/** * Add a class to the list of accessible classes externally. * If a {@link self::setServiceValidator() service validator} is defined, this will be executed before the class * should be added. * * @param string $class * @return \Greplab\Jsonrpcsmd\Smd */ public function addClass($class) { $reflectedclass = Smd\Service::read($this, $class); if ($reflectedclass !== false) { $this->services[] = $reflectedclass; } return $this; }
/** * Add Service * * @param Zend\Json\Server\Smd\Service|array $service * @return void */ public function addService($service) { if ($service instanceof Smd\Service) { $name = $service->getName(); } elseif (is_array($service)) { $service = new Smd\Service($service); $name = $service->getName(); } else { throw new Exception('Invalid service passed to addService()'); } if (array_key_exists($name, $this->_services)) { throw new Exception('Attempt to register a service already registered detected'); } $this->_services[$name] = $service; return $this; }