@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $urlArray = explode('/', $url); |
| 41 | 41 | |
| 42 | - $urlArray[0] = $newShortLanguage; |
|
| 42 | + $urlArray[ 0 ] = $newShortLanguage; |
|
| 43 | 43 | |
| 44 | - return '/' . implode('/', $urlArray); |
|
| 44 | + return '/'.implode('/', $urlArray); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -73,19 +73,19 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public static function detectClientShortLanguage() |
| 75 | 75 | { |
| 76 | - if (!isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) || empty($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { |
|
| 76 | + if (!isset($_SERVER[ "HTTP_ACCEPT_LANGUAGE" ]) || empty($_SERVER[ "HTTP_ACCEPT_LANGUAGE" ])) { |
|
| 77 | 77 | return null; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | preg_match_all('/([a-z]{1,8}(?:-[a-z]{1,8})?)(?:;q=([0-9.]+))?/', |
| 81 | - strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"]), |
|
| 81 | + strtolower($_SERVER[ "HTTP_ACCEPT_LANGUAGE" ]), |
|
| 82 | 82 | $matches |
| 83 | 83 | ); |
| 84 | 84 | |
| 85 | - $langs = array_combine($matches[1], $matches[2]); |
|
| 85 | + $langs = array_combine($matches[ 1 ], $matches[ 2 ]); |
|
| 86 | 86 | |
| 87 | 87 | foreach ($langs as $n => $v) { |
| 88 | - $langs[$n] = $v ? $v : 1; // If no q, then set q = 1 |
|
| 88 | + $langs[ $n ] = $v ? $v : 1; // If no q, then set q = 1 |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | arsort($langs); // Sort descending q |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | $fields = array('HTTP_CLIENT_IP', 'HTTP_X_REAL_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR'); |
| 104 | 104 | |
| 105 | 105 | $ip = "0.0.0.0"; |
| 106 | - foreach($fields as $k) |
|
| 106 | + foreach ($fields as $k) |
|
| 107 | 107 | { |
| 108 | - if(!empty($_SERVER[$k]) && ip2long($_SERVER[$k]) != false) |
|
| 108 | + if (!empty($_SERVER[ $k ]) && ip2long($_SERVER[ $k ]) != false) |
|
| 109 | 109 | { |
| 110 | - $ip = $_SERVER[$k]; |
|
| 110 | + $ip = $_SERVER[ $k ]; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | private static function setUserStatus(TableSchema $settingsTableSchema, $settings, IdentityInterface $user): void |
| 64 | 64 | { |
| 65 | 65 | if (in_array('initUserStatus', $settingsTableSchema->columnNames)) { |
| 66 | - $user->status = is_array($settings) && null !== $settings['initUserStatus'] ? |
|
| 67 | - $settings['initUserStatus'] : self::INIT_USER_STATUS; |
|
| 66 | + $user->status = is_array($settings) && null !== $settings[ 'initUserStatus' ] ? |
|
| 67 | + $settings[ 'initUserStatus' ] : self::INIT_USER_STATUS; |
|
| 68 | 68 | $user->save(); |
| 69 | 69 | } else { |
| 70 | 70 | Yii::error('Field "initUserStatus" does not exists in "settings" table to set initial user status.'); |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | ]); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if (!is_array($settings) || null === $settings['initUserRole']) { |
|
| 96 | + if (!is_array($settings) || null === $settings[ 'initUserRole' ]) { |
|
| 97 | 97 | $initUserRole = self::INIT_USER_ROLE; |
| 98 | 98 | Yii::error('Can not get field value of "initUserRole" from "settings" table to set initial user role.'); |
| 99 | 99 | } else { |
| 100 | - $initUserRole = $settings['initUserRole']; |
|
| 100 | + $initUserRole = $settings[ 'initUserRole' ]; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $authManager->assign( |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | 'rules' => [ |
| 28 | 28 | [ |
| 29 | 29 | 'allow' => true, |
| 30 | - 'actions' => ['view'], |
|
| 31 | - 'roles' => ['?', '@'], |
|
| 30 | + 'actions' => [ 'view' ], |
|
| 31 | + 'roles' => [ '?', '@' ], |
|
| 32 | 32 | ], |
| 33 | 33 | ], |
| 34 | 34 | ], |
| 35 | 35 | 'verbs' => [ |
| 36 | 36 | 'class' => VerbFilter::class, |
| 37 | 37 | 'actions' => [ |
| 38 | - 'view' => ['get'], |
|
| 38 | + 'view' => [ 'get' ], |
|
| 39 | 39 | ], |
| 40 | 40 | ], |
| 41 | 41 | ]); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $pagination = new Pagination([ |
| 72 | 72 | 'totalCount' => $productsQuery->count(), |
| 73 | - 'defaultPageSize' => Yii::$app->params['defaultPageSize'] |
|
| 73 | + 'defaultPageSize' => Yii::$app->params[ 'defaultPageSize' ] |
|
| 74 | 74 | ]); |
| 75 | 75 | |
| 76 | 76 | return $this->render('view', [ |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | public function verbs() |
| 59 | 59 | { |
| 60 | 60 | return [ |
| 61 | - 'send' => ['POST'] |
|
| 61 | + 'send' => [ 'POST' ] |
|
| 62 | 62 | ]; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $feedback->setScenario(Feedback::SCENARIO_FEEDBACK); |
| 103 | 103 | $feedback->setAttributes($request->post(), false); |
| 104 | 104 | |
| 105 | - if ($feedback->contact(Yii::$app->params['adminEmail'])) { |
|
| 105 | + if ($feedback->contact(Yii::$app->params[ 'adminEmail' ])) { |
|
| 106 | 106 | |
| 107 | 107 | return $this->getSuccessResponse(Yii::t('feedback', 'You have successfully sent your message.')); |
| 108 | 108 | } else { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function init() |
| 36 | 36 | { |
| 37 | - $this->recaptchaDriver = new ReCaptcha(Yii::$app->params['captcha']['secret_key']); |
|
| 37 | + $this->recaptchaDriver = new ReCaptcha(Yii::$app->params[ 'captcha' ][ 'secret_key' ]); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function verbs() |
| 72 | 72 | { |
| 73 | 73 | return [ |
| 74 | - 'validate' => ['POST'] |
|
| 74 | + 'validate' => [ 'POST' ] |
|
| 75 | 75 | ]; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -25,15 +25,15 @@ |
||
| 25 | 25 | 'rules' => [ |
| 26 | 26 | [ |
| 27 | 27 | 'allow' => true, |
| 28 | - 'actions' => ['view'], |
|
| 29 | - 'roles' => ['?', '@'], |
|
| 28 | + 'actions' => [ 'view' ], |
|
| 29 | + 'roles' => [ '?', '@' ], |
|
| 30 | 30 | ], |
| 31 | 31 | ], |
| 32 | 32 | ], |
| 33 | 33 | 'verbs' => [ |
| 34 | 34 | 'class' => VerbFilter::class, |
| 35 | 35 | 'actions' => [ |
| 36 | - 'view' => ['get'], |
|
| 36 | + 'view' => [ 'get' ], |
|
| 37 | 37 | ], |
| 38 | 38 | ], |
| 39 | 39 | ]); |
@@ -24,15 +24,15 @@ |
||
| 24 | 24 | 'rules' => [ |
| 25 | 25 | [ |
| 26 | 26 | 'allow' => true, |
| 27 | - 'actions' => ['index'], |
|
| 28 | - 'roles' => ['?', '@'], |
|
| 27 | + 'actions' => [ 'index' ], |
|
| 28 | + 'roles' => [ '?', '@' ], |
|
| 29 | 29 | ], |
| 30 | 30 | ], |
| 31 | 31 | ], |
| 32 | 32 | 'verbs' => [ |
| 33 | 33 | 'class' => VerbFilter::class, |
| 34 | 34 | 'actions' => [ |
| 35 | - 'index' => ['get'], |
|
| 35 | + 'index' => [ 'get' ], |
|
| 36 | 36 | ], |
| 37 | 37 | ] |
| 38 | 38 | ]); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | public function afterAction($action, $result) |
| 28 | 28 | { |
| 29 | 29 | if ($action->id == 'view') { |
| 30 | - $modelId = $action->controller->actionParams['id']; |
|
| 30 | + $modelId = $action->controller->actionParams[ 'id' ]; |
|
| 31 | 31 | Feedback::fixReadStatus((int)$modelId); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $home = Home::findOne($homeId); |
| 41 | 41 | |
| 42 | 42 | if (null === $home) { |
| 43 | - throw new NotFoundHttpException('Record with id ' . $homeId . ' does not exist'); |
|
| 43 | + throw new NotFoundHttpException('Record with id '.$homeId.' does not exist'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $home->default = 1; |