public function invoke($serviceName, $methodName, $arguments) { if (LOGGING) { Log::log(LoggingConstants::INFO, "ServiceName = {$serviceName}, " . "methodName = {$methodName}, count(arguments) = " . count($arguments)); } $class = TypeLoader::loadType($serviceName); $object = $this->resolveObject($class); $method = MethodLookup::findMethod($class, $methodName); $startInvoke = microtime(true); $result = Invocation::invoke($object, $method, $arguments); $invokeTime = microtime(true) - $startInvoke; // $this->addMonitoredClass($class, $serviceName, $methodName, $invokeTime, $arguments, $result); return new Value($result); }
public function answer(Invocation $invocation) { $method = $invocation->getMethod(); $type = $method == null ? null : $method->getReturnType(); if ($type == null) { return null; } switch ($type) { case 'string': return ''; case 'int': case 'number': case 'integer': return 0; case 'float': case 'double': return 0.1; case 'array': return array(); default: return null; } }
public static function subtract(Invocation $inv) { list($x, $y) = $inv->getArguments(); return $x - $y; }