public function invoke($functionName, array $arguments = array()) { if (self::isLanguageConstruct($functionName) || function_exists($functionName) === true && is_callable($functionName) === false) { throw new exceptions\logic\invalidArgument('Function \'' . $functionName . '()\' is not invokable by an adapter'); } $call = sizeof($this->addCall($functionName, $arguments)->getCallsEqualTo(new adapter\call($functionName))); try { return $this->callIsOverloaded($functionName, $call) === false ? parent::invoke($functionName, $arguments) : $this->{$functionName}->invoke($arguments, $call); } catch (exceptions\logic\invalidArgument $exception) { throw new exceptions\logic('There is no return value defined for \'' . $functionName . '() at call ' . $call); } }
public function testInvoke() { $this->given($adapter = new testedClass())->then->string($adapter->invoke('md5', array($hash = uniqid())))->isEqualTo(md5($hash)); }