#!/usr/bin/env php <?php /** * Part of sms-phpstorm-config-installer project. * * @copyright Copyright (C) 2011 - 2015 SMS Taiwan, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ // Force strict mode error_reporting(32767); $app = new Application(); $app->execute(); /** * The Application class. */ class Application { /** * Property calledScript. * * @var string */ protected $calledScript; /** * Property args. * * @var array */ protected $args = array(); /** * Property options.
/** * Executes controllers action and returns response * * @param string $controllerName Controller name * @param string $actionName Action name * @return Response * @throws ApplicationException if error situation occurs */ public function execute($controllerInstance, $actionName, $isBlock = false) { if ($this->isDevMode() && $isBlock && !empty($_REQUEST['noblock'])) { return null; } if (!$isBlock) { $this->logStat('Before executing controller action'); } else { $this->logStat('Before executing block: ' . $actionName); } if ($response = $this->processInitPlugins($controllerInstance, 'before-' . $actionName)) { if (!$response instanceof RawResponse || $response->getContent()) { $this->processResponse($response); return $response; } } if (!$isBlock) { $originalResponse = parent::execute($controllerInstance, $actionName); $this->logStat('Execute controller action'); } else { $originalResponse = $controllerInstance->executeBlock($actionName); $this->logStat('Executed block: ' . $actionName); if (!$originalResponse) { return null; } } $response = $this->processActionPlugins($controllerInstance, $originalResponse, $actionName); if ($response !== $originalResponse) { $this->processResponse($response); } if (!$isBlock) { $this->logStat('Finish executing controller action (plugins, etc.)'); } else { $this->logStat('Finished executing block plugins: ' . $actionName); } return $response; }