Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/vendor/yiisoft/yii2/base/ |
Upload File : |
<?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ namespace yii\base; use Yii; /** * Action is the base class for all controller action classes. * * Action provides a way to reuse action method code. An action method in an Action * class can be used in multiple controllers or in different projects. * * Derived classes must implement a method named `run()`. This method * will be invoked by the controller when the action is requested. * The `run()` method can have parameters which will be filled up * with user input values automatically according to their names. * For example, if the `run()` method is declared as follows: * * ```php * public function run($id, $type = 'book') { ... } * ``` * * And the parameters provided for the action are: `['id' => 1]`. * Then the `run()` method will be invoked as `run(1)` automatically. * * For more details and usage information on Action, see the [guide article on actions](guide:structure-controllers). * * @property-read string $uniqueId The unique ID of this action among the whole application. * * @author Qiang Xue <qiang.xue@gmail.com> * @since 2.0 */ class Action extends Component { /** * @var string ID of the action */ public $id; /** * @var Controller|\yii\web\Controller|\yii\console\Controller the controller that owns this action */ public $controller; /** * Constructor. * * @param string $id the ID of this action * @param Controller $controller the controller that owns this action * @param array $config name-value pairs that will be used to initialize the object properties */ public function __construct($id, $controller, $config = []) { $this->id = $id; $this->controller = $controller; parent::__construct($config); } /** * Returns the unique ID of this action among the whole application. * * @return string the unique ID of this action among the whole application. */ public function getUniqueId() { return $this->controller->getUniqueId() . '/' . $this->id; } /** * Runs this action with the specified parameters. * This method is mainly invoked by the controller. * * @param array $params the parameters to be bound to the action's run() method. * @return mixed the result of the action * @throws InvalidConfigException if the action class does not have a run() method */ public function runWithParams($params) { if (!method_exists($this, 'run')) { throw new InvalidConfigException(get_class($this) . ' must define a "run()" method.'); } $args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this) . '::run(), invoked by ' . get_class($this->controller), __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } if ($this->beforeRun()) { $result = call_user_func_array([$this, 'run'], $args); $this->afterRun(); return $result; } return null; } /** * This method is called right before `run()` is executed. * You may override this method to do preparation work for the action run. * If the method returns false, it will cancel the action. * * @return bool whether to run the action. */ protected function beforeRun() { return true; } /** * This method is called right after `run()` is executed. * You may override this method to do post-processing work for the action run. */ protected function afterRun() { } }