Example:
Class A {
public function __construct() {
$this->b_Instance = new B();
}
public caller() {
$this->b_Instance->call_me($param1,$param2,$param3);
}
}
Class B {
public function __construct() {
//lots of variables here
}
public function call_me($param1,$param2,$param3) {
...
//do something with param1, but nothing with param2 and 3. just pass it.
$this->do_something($param2,$param3);
}
private function do_something($param2,$param3) {
...
//do something with param2 and 3
}
//lots of other functions here
}
Normally I'd add it to the constructor of B as a class variable, however the constructor is already populated with lots of variables, and the parameters passed by A->caller() is only used by B->call_me and B->do_something anyway.
What is the elegant way of preventing this extra-passing of parameters from B->call_me to B->do_something? Or is this even a problem and I just have OCD?
Additional: Notice that B->call_me does nothing with param2 and 3, but only passes it to B->do_something which is a private function.