Jyxo\Rpc\Server::registerFunc PHP Method

registerFunc() public method

Registers given function.
public registerFunc ( string $func ) : self
$func string Function name
return self
    public function registerFunc(string $func) : self
    {
        if (!function_exists($func)) {
            throw new \InvalidArgumentException(sprintf('Function %s does not exist.', $func));
        }
        $this->register($func);
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Tests registering a non-existent function.
  */
 public function testRegisterNonExistingFunction()
 {
     $this->setExpectedException('\\InvalidArgumentException');
     $this->rpc->registerFunc('dummy');
 }
All Usage Examples Of Jyxo\Rpc\Server::registerFunc