From 4fbe84cd74a73b85e125935dc08b86b13993ce7d Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sat, 9 Sep 2023 06:57:00 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/ActionForward.php | 68 ++++++++++++++++++++--------------------- src/_app_not_found.php | 15 +++++---- src/_process_worker.php | 54 ++++++++++++++++---------------- 3 files changed, 68 insertions(+), 69 deletions(-) diff --git a/src/ActionForward.php b/src/ActionForward.php index 45262e3..85edffa 100644 --- a/src/ActionForward.php +++ b/src/ActionForward.php @@ -364,12 +364,12 @@ public function get($k = null, $default = null) public function setClientRedirect($type) { switch ($type) { - case 'href': - case 'replace': - $this->_isClientRedirect = $type; - break; - default: - $this->_isClientRedirect = false; + case 'href': + case 'replace': + $this->_isClientRedirect = $type; + break; + default: + $this->_isClientRedirect = false; } return $this->_isClientRedirect; @@ -464,36 +464,36 @@ private function _processView() public function go() { switch ($this->getType()) { - case 'redirect': - $this->_processHeader(); - $path = $this->getPath(true); - if (!empty($this->_isClientRedirect)) { - $this['clientRedirectTo'] = $path; - $this['clientRedirectType'] = $this->_isClientRedirect; - } - callPlugin( - option('get', _ROUTER), - 'go', - [ - $path, - $this->_isClientRedirect, - ] - ); - case self::VIEW: - return $this->_processView(); - case 'action': - default: - if (exists(_RUN_APP, 'plugin')) { - $run = plug(_RUN_APP); - $keepForward = $run[_FORWARD]; - if (is_null($keepForward)) { - $keepForward = new HashMap(); - $run[_FORWARD] = $keepForward; + case 'redirect': + $this->_processHeader(); + $path = $this->getPath(true); + if (!empty($this->_isClientRedirect)) { + $this['clientRedirectTo'] = $path; + $this['clientRedirectType'] = $this->_isClientRedirect; + } + callPlugin( + option('get', _ROUTER), + 'go', + [ + $path, + $this->_isClientRedirect, + ] + ); + case self::VIEW: + return $this->_processView(); + case 'action': + default: + if (exists(_RUN_APP, 'plugin')) { + $run = plug(_RUN_APP); + $keepForward = $run[_FORWARD]; + if (is_null($keepForward)) { + $keepForward = new HashMap(); + $run[_FORWARD] = $keepForward; + } + $keepForward[[]] = $this->get(); } - $keepForward[[]] = $this->get(); - } - return $this; + return $this; } } } diff --git a/src/_app_not_found.php b/src/_app_not_found.php index 083828c..4c5f34c 100644 --- a/src/_app_not_found.php +++ b/src/_app_not_found.php @@ -33,7 +33,7 @@ * @link https://packagist.org/packages/pmvc/pmvc */ // @codingStandardsIgnoreStart -${_INIT_CONFIG}[_CLASS] = __NAMESPACE__ . '\app_not_found'; +${_INIT_CONFIG}[_CLASS] = __NAMESPACE__.'\app_not_found'; class app_not_found // @codingStandardsIgnoreEnd { public $caller; @@ -59,21 +59,20 @@ public function __invoke($parents, $indexFile, $folders) $path = $caller->getAppFile($parents, $indexFile); if (!$path) { throw new DomainException( - 'Default app setting is not correct. [' . - $caller[_DEFAULT_APP] . + 'Default app setting is not correct. ['. + $caller[_DEFAULT_APP]. ']' ); } else { trigger_error( json_encode([ - 'Error' => - 'No app found with routers, ' . + 'Error' => 'No app found with routers, '. 'Please check following debug message.', 'Debug' => [ 'Parent' => $parents, - 'App' => $caller[_REAL_APP], - 'Index' => $indexFile, - 'Alias' => $alias ?: '', + 'App' => $caller[_REAL_APP], + 'Index' => $indexFile, + 'Alias' => $alias ?: '', ], ]), E_USER_WARNING diff --git a/src/_process_worker.php b/src/_process_worker.php index cc9c150..e7207fc 100644 --- a/src/_process_worker.php +++ b/src/_process_worker.php @@ -79,38 +79,38 @@ public function __invoke() } }; switch ($taskAttr->type) { - case sup\TYPE_DAEMON: - $workerGroup = $taskAttr->group; - $inputConcurrency = get($form, $workerGroup); - $concurrency = !empty($inputConcurrency) && - is_numeric($inputConcurrency) && - $inputConcurrency > 1 - ? $form[$workerGroup] - : 1; - for ($i = 0; $i < $concurrency; $i++) { + case sup\TYPE_DAEMON: + $workerGroup = $taskAttr->group; + $inputConcurrency = get($form, $workerGroup); + $concurrency = !empty($inputConcurrency) && + is_numeric($inputConcurrency) && + $inputConcurrency > 1 + ? $form[$workerGroup] + : 1; + for ($i = 0; $i < $concurrency; $i++) { + new Parallel( + $wrap, + [ + sup\TYPE => sup\TYPE_DAEMON, + sup\INTERVAL => $taskAttr->interval, + ] + ); + } + break; + case sup\TYPE_SCRIPT: new Parallel( $wrap, [ - sup\TYPE => sup\TYPE_DAEMON, - sup\INTERVAL => $taskAttr->interval, + sup\TYPE => sup\TYPE_SCRIPT, + sup\NAME => $action->name, ] ); - } - break; - case sup\TYPE_SCRIPT: - new Parallel( - $wrap, - [ - sup\TYPE => sup\TYPE_SCRIPT, - sup\NAME => $action->name, - ] - ); - break; - default: - trigger_error( - 'Wrong worker type ['.$taskAttr->type.']' - ); - break; + break; + default: + trigger_error( + 'Wrong worker type ['.$taskAttr->type.']' + ); + break; } } }