public function add($name, $method)
{
$func = $this->{$name};
if(!isset($func))
{
$this->{$name} = $method;
}
return true;
}
$context->add("getUser", function () use ($vk) {
return $vk->api->request("users.get", [])[0]["first_name"];
});
Fatal error: Call to a member function add() on null in