Prado\Web\Services\TJsonService::run PHP Метод

run() публичный Метод

This method is invoked by application automatically.
public run ( )
    public function run()
    {
        $id = $this->getRequest()->getServiceParameter();
        if (isset($this->_services[$id])) {
            $serviceConfig = $this->_services[$id];
            if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) {
                if (isset($serviceConfig['class'])) {
                    $service = Prado::createComponent($serviceConfig['class']);
                    if ($service instanceof TJsonResponse) {
                        $properties = isset($serviceConfig['properties']) ? $serviceConfig['properties'] : array();
                        $this->createJsonResponse($service, $properties, $serviceConfig);
                    } else {
                        throw new TConfigurationException('jsonservice_response_type_invalid', $id);
                    }
                } else {
                    throw new TConfigurationException('jsonservice_class_required', $id);
                }
            } else {
                $properties = $serviceConfig->getAttributes();
                if (($class = $properties->remove('class')) !== null) {
                    $service = Prado::createComponent($class);
                    if ($service instanceof TJsonResponse) {
                        $this->createJsonResponse($service, $properties, $serviceConfig);
                    } else {
                        throw new TConfigurationException('jsonservice_response_type_invalid', $id);
                    }
                } else {
                    throw new TConfigurationException('jsonservice_class_required', $id);
                }
            }
        } else {
            throw new THttpException(404, 'jsonservice_provider_unknown', $id);
        }
    }