Answer the question
In order to leave comments, you need to log in
How to write possible methods in __call()?
Hello. I want to make a wrapper for a class. It turns out something like this:
class WebCategory{
private $cat;
public function __construct(Category $cat){
$this->cat = $cat;
}
public function __call($name, $arguments){
return $this->cat->$name($arguments);
}
}
Answer the question
In order to leave comments, you need to log in
/**
* Class WebCategory
*
* @mixin Category
*/
class WebCategory
{
private $cat;
public function __construct(Category $cat)
{
$this->cat = $cat;
}
public function __call($name, $arguments)
{
return $this->cat->$name($arguments);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question