Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
I think you need to use not an array but an object. Then everything will fly)
/**
* @property string $key;
* @property string $foreign_key;
* @property string $repository;
*/
class Helper {
private $data;
public function __construct($data) {
$this->data = $data;
}
public function __set($name, $value) {
$this->data[$name] = $value;
}
public function __get($name) {
return isset($this->data[$name]) ? $this->data[$name] : null;
}
}
$test = new Helper(array(
'key'=>12,
'foreign_key'=>'id',
'repository'=>'',
));
echo $test->key;
$test->key = '23';
echo $test->key;
class C1 {
public $name;
}
class C2 {
public $age;
}
class Helper {
/**
* @var C1|C2
*/
public static $app;
}
Helper::$app->age
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question