Call a static method of class from another class width '$this'

Viewed 1136

I've got some problem. I want to call static method of class from another class. Class name and method are created dynamically.

It's not really hard to do like:

$class = 'className';
$method = 'method';

$data = $class::$method();

BUT, i want to to do it like this

class abc {
    static public function action() {
        //some code
    }
}

class xyz {
    protected $method = 'action';
    protected $class = 'abc';

    public function test(){
        $data = $this->class::$this->method();
    }
}

And it doesn't work if i don't assign $this->class to a $class variable, and $this->method to a $method variable. What's the problem?

2 Answers
Related