Default action to handle OPTIONS requests.

@return ezcMvcResult
357014
public function doHttpOptions()
    {
        $methods = implode( ', ', $this->supported_http_methods );
        $result = new ezpRestMvcResult;
        $result->status = new ezpRestStatusResponse(
            ezpHttpResponseCodes::OK,
            'Allowed methods are: ' . $methods,
            array( 'Allow' => $methods )
        );
        return $result;
    }
745901
protected function action()
    {
        if ($this->argument('action') != null) {
            return $this->argument('action');
        }
        if (strtolower($this->option('type')) != 'regular') {
            return $this->argument('link') . 'Controller';
        }
        return $this->argument('link');
    }
1160302
public function onDispatch(MvcEvent $e)
    {
        $request = $e->getRequest();
        if (!$request instanceof HttpRequest) {
            throw new RuntimeException('CRUD controller from CmsCommon can only handle HTTP requests');
        }

        $action = $this->params()->fromRoute('action', 'not-found');
        $method = static::getMethodFromAction($action);

        if (!method_exists($this, $method)) {
            $method = 'notFoundAction';
        }

        $object = null;
        if ($action === static::ACTION_READ ||
            $action === static::ACTION_UPDATE ||
            $action === static::ACTION_DELETE
        ) {
            $options = $this->getOptions();
            $id = $this->params()->fromRoute($options->getIdentifierKey());

            if (null === $id) {
                $this->flashMessenger()->addWarningMessage(sprintf(
                    $this->translate('An identifier must be provided to %s an object'),
                    $this->translate($action)
                ));

                return $this->redirectToBaseRoute();
            }

            if (!($object = $this->getDomainService()->getMapper()->find($id))) {
                $this->flashMessenger()->addWarningMessage($this->translate('An object cannot be found'));
                return $this->redirectToBaseRoute();
            }
        }

        $data = $this->getData($object);

        // Return early if getData method returned a response
        if ($data instanceof ResponseInterface) {
            $actionResponse = $data;
        } else {
            switch ($action) {
                case static::ACTION_READ:
                case static::ACTION_DELETE:
                    $actionResponse = $this->$method($data, $object);
                    break;
                case static::ACTION_UPDATE:
                    $actionResponse = $this->$method($data, $object);
                    break;
                default:
                    $actionResponse = $this->$method($data);
            }
        }

        $e->setResult($actionResponse);
    }
884619
public function searchAction()
    {
        $optionsProvider = $this->getOptionsProvider();
        $pane = $this->params()->fromRoute('pane');
        if (! $pane || ! $optionsProvider->hasIdentifier($pane)) {
            $pane = 'first';
        }

        $options = $optionsProvider->getOptions($pane, 'search');

        $search = $optionsProvider->getSearchProxy($pane);
        $form = $this->getSearchForm();
        $form->setAttribute(
            'action',
            $this->url()->fromRoute(
                'sc-admin/content-search',
                ['pane' => $pane]
            )
        );
        $form->bind($search);
        if ($this->getRequest()->isPost()) {
            $post = $this->params()->fromPost();
            if (array_key_exists('clean', $post)) {
                $search->clean();
            } else {
                $form->setData($post);
            }
            if ($form->isValid()) {
                $options->setSearchOptions(
                    $form->getData(ContentSearchForm::VALUES_AS_ARRAY)
                );
                $optionsProvider->save($options->getName());
            }
        }
        $list = $this->getContentListProvider()->getList($pane);

        return new ViewModel([
            'options' => $options,
            'list' => $list,
            'pane' => $pane,
            'form' => $form,
        ]);
    }
931504
public function get_return_action() {
        global $PAGE;

        // Web services don't set a URL, we should avoid debugging when ussing the url object.
        if (!WS_SERVER) {
            $params = $PAGE->url->params();
        }

        if (!empty($params['action'])) {
            return $params['action'];
        }
        return '';
    }
715905
public function handleRequest()
    {
        // test if user has selected an idp or idp can be deremine automatically somehow.
        $this->start();

        // no choice possible. Show discovery service page
        $idpList = $this->getIdPList();
        if (isset($this->originalsp['disco.addInstitutionApp'])
            && $this->originalsp['disco.addInstitutionApp'] === true
        ) {
            $idpList = $this->filterAddInstitutionList($idpList);
        } else {
            $idpList = $this->filterList($idpList);
        }
        $preferredIdP = $this->getRecommendedIdP();
        $preferredIdP = array_key_exists($preferredIdP, $idpList)
            ? $preferredIdP : null;

        if (sizeof($idpList) === 1) {
            $idp = array_keys($idpList)[0];
            $url = Disco::buildContinueUrl(
                $this->spEntityId,
                $this->returnURL,
                $this->returnIdParam,
                $idp
            );
            Logger::info('perun.Disco: Only one Idp left. Redirecting automatically. IdP: '
                . $idp);
            HTTP::redirectTrustedURL($url);
        }

        $t = new DiscoTemplate($this->config);
        $t->data['originalsp'] = $this->originalsp;
        $t->data['idplist'] = $this->idplistStructured($idpList);
        $t->data['preferredidp'] = $preferredIdP;
        $t->data['entityID'] = $this->spEntityId;
        $t->data['return'] = $this->returnURL;
        $t->data['returnIDParam'] = $this->returnIdParam;
        $t->data['AuthnContextClassRef'] = $this->authnContextClassRef;
        $t->show();
    }
999304
public function indexesAction()
    {
        return $this->viewHandler->handle(
            View::create(
                array_map(
                    function($indexName) {
                        $indexConfiguration = $this->indexConfigurationProvider->getIndexConfiguration($indexName);

                        return $indexConfiguration ?: new IndexConfiguration($indexName);
                    },
                    $this->getAllowedIndexes()
                )
            )
        );
    }
1193053
public function getAction() : ?string 
    {
        if ( ! $this->hasAction()) {
            $this->setAction($this->getDefaultAction());
        }
        return $this->action;
    }
1348350
protected function defaults(): self
    {
        $this->option('-h, --help', 'Show help')->on([$this, 'showHelp']);
        $this->option('-V, --version', 'Show version')->on([$this, 'showVersion']);
        $this->option('-v, --verbosity', 'Verbosity level', null, 0)->on(function () {
            $this->set('verbosity', ($this->verbosity ?? 0) + 1);

            return false;
        });

        // @codeCoverageIgnoreStart
        $this->onExit(function ($exitCode = 0) {
            exit($exitCode);
        });
        // @codeCoverageIgnoreEnd

        return $this;
    }
660949
public function init()
    {
        if (!$this->opts->action) {
            return $this->addError("Parameter 'action' is required.");
        } else {
            $actionName = strtolower($this->opts->action) . 'Action';
            if (!method_exists($this, $actionName)) {
                return $this->addError(sprintf("Action '$actionName' doesn't exists in '%s' cli script.", get_class($this)));
            }

            $this->action = $actionName;
        }

        $this->initialized = true;
        return $this;
    }
1162215
public function optionsAction(Request $request)
    {
        $response = $this->response;
        $response->setStatusCode(Response::HTTP_NO_CONTENT);
        $request->attributes->set('corsMethods', 'GET, OPTIONS');

        return $response;
    }
759207
protected function defaultHandler()
    {
        if ($this->runExtensions(self::BEFORE_DEFAULT, $this->result)) {
            $status  = $this->result->getStatus();
            $handler = $this->getHandler($status);
            if ($handler) {
                $handler($this->result);
            } else {
                echo Message::get(Message::DEBUG_NEED_HANDLER, $status);
            }
            $this->runExtensions(self::AFTER_DEFAULT, $this->result);
        }
        return false;
    }
1253926
public function handleRequest()
    {
        try {
            $this->response = parent::handleRequest();
        } catch (HttpException $ex) {
            $this->config->set('page_title', 'Error');

            $view = new View('exception');
            $view->exception = $ex;

            $this->response->setResponseCode($ex->getErrorCode());
            $this->response->setContent($view->render());
        } catch (\Exception $ex) {
            $this->config->set('page_title', 'Error');

            $view = new View('exception');
            $view->exception = $ex;

            $this->response->setResponseCode(500);
            $this->response->setContent($view->render());
        }

        if ($this->response->hasLayout() && $this->controller->layout) {
            $this->setLayoutVariables($this->controller->layout);

            $this->controller->layout->content  = $this->response->getContent();
            $this->response->setContent($this->controller->layout->render());
        }

        return $this->response;
    }
298236
protected function defaultCurlOptions()
    {
        $result = parent::defaultCurlOptions();
        $result[CURLOPT_NOSIGNAL] = 1;
        if ($this->speed == self::SPEED_LONG || $this->big) {
            $result[CURLOPT_CONNECTTIMEOUT_MS] = 60000;
            $result[CURLOPT_TIMEOUT_MS] = 60000;
            $this->big = false;
        } else {
            $result[CURLOPT_CONNECTTIMEOUT_MS] = 500;
            $result[CURLOPT_TIMEOUT_MS] = 500;
        }
        return $result;
    }
141220
public function execute()
    {
        $this->_setOptions();

        $response = $this->_execute();
        $this->_saveStatusCode();

        $curlErrorNumber = $this->_getErrorNumber();

        $this->_close();

        if ($curlErrorNumber) {
            /**
             * @var \OxidEsales\Eshop\Core\Exception\StandardException $exception
             */
            $exception = oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class);
            $lang = \OxidEsales\Eshop\Core\Registry::getLang();
            $exception->setMessage(sprintf($lang->translateString('EXCEPTION_CURL_ERROR', $lang->getTplLanguage()), $curlErrorNumber));
            throw $exception;
        }

        return $response;
    }
646600
protected function invokeStandardOptions() {
        return $this
            ->addOption('c', 'config', self::OPTION_NOT_REQUIRED)
            ->addOption('h', 'help', self::NO_VALUE)
            ->addOption(null, 'no-colors', self::NO_VALUE)
            ->addOption('q', 'quiet', self::NO_VALUE)
            ->addOption('v', 'verbose', self::NO_VALUE)
            ->addOption(null, 'version', self::NO_VALUE)
            ->addOption('s', 'setting', self::OPTION_NOT_REQUIRED);
    }
3204
public function getRequestHandler()
    {
        if (!isset($this->requestHandler)) {
            $requestHandler = new \Zend\Http\Client();
            $requestHandler->setOptions(array(
                'timeout'=> 60
            ));
            $this->setRequestHandler($requestHandler);
        }

        return $this->requestHandler;
    }