I'm developing a Illuminate\Console\Command. To be run via cli using php artisan. This Command class is using other classes. I appreciate the Command->info(), Command->error(), methods... How can I use them in dependencies?
Until now I'm passing to other classes $this as parameter
e.g.
class MyClass extends Command {
....
$g = new MyOtherClass($this, $param...);
$g->find();
....
}
class MyOtherClass {
$command;
....
public function __construct($command){
$this->command=$command;
}
public function find(){
if($error)
$this->command->error($error);
}
....
}
I wished methods could be accessed statically like: Command::error("some error");
But maybe this is not the intended use?