@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ['class'=>'email'], |
32 | 32 | ['class'=>'required'] |
33 | 33 | ], |
34 | - 'placeholder' => 'e.g. robot@' . strtolower(setting('core', 'site_name', neon()->name)) . '.com' |
|
34 | + 'placeholder' => 'e.g. robot@'.strtolower(setting('core', 'site_name', neon()->name)).'.com' |
|
35 | 35 | ], |
36 | 36 | 'fromEmailName' => [ |
37 | 37 | 'name' => 'fromEmailName', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'name' => 'sslOnly', |
44 | 44 | 'class' => '\neon\core\form\fields\SwitchButton', |
45 | 45 | 'label' => 'Force SSL (https) everywhere', |
46 | - 'hint' => 'The application will redirect all requests to secure https requests. ' . |
|
46 | + 'hint' => 'The application will redirect all requests to secure https requests. '. |
|
47 | 47 | (neon()->isDevMode() ? 'Note: You are currently in dev mode so the redirects to https will not happen' : '') |
48 | 48 | ], |
49 | 49 | ]; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | (for example, plural in |
72 | 72 | <a href=\"http://www.yiiframework.com/doc-2.0/yii-i18n-formatter.html#asRelativeTime%28%29-detail\"> |
73 | 73 | Formatter::asRelativeTime()</a>) in the <code>yii\i18n\Formatter</code> class. Your current ICU version is ' . |
74 | - (defined('INTL_ICU_VERSION') ? INTL_ICU_VERSION : '(ICU is missing)') . '.' |
|
74 | + (defined('INTL_ICU_VERSION') ? INTL_ICU_VERSION : '(ICU is missing)').'.' |
|
75 | 75 | ], |
76 | 76 | [ |
77 | 77 | 'name' => 'ICU Data version', |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | (for example, plural in |
83 | 83 | <a href=\"http://www.yiiframework.com/doc-2.0/yii-i18n-formatter.html#asRelativeTime%28%29-detail\"> |
84 | 84 | Formatter::asRelativeTime()</a>) in the <code>yii\i18n\Formatter</code> class. Your current ICU Data version is ' . |
85 | - (defined('INTL_ICU_DATA_VERSION') ? INTL_ICU_DATA_VERSION : '(ICU Data is missing)') . '.' |
|
85 | + (defined('INTL_ICU_DATA_VERSION') ? INTL_ICU_DATA_VERSION : '(ICU Data is missing)').'.' |
|
86 | 86 | ], |
87 | 87 | [ |
88 | 88 | 'name' => 'Fileinfo extension', |
@@ -335,7 +335,7 @@ |
||
335 | 335 | * Check the system requirements |
336 | 336 | * Returns an array of tests that detect if the system meats the requirements for Neon |
337 | 337 | * |
338 | - * @return array of requirement tests: |
|
338 | + * @return array of requirement tests: |
|
339 | 339 | * for e.g: |
340 | 340 | * |
341 | 341 | * ```php |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public static function getLocalConfigFile() |
23 | 23 | { |
24 | - return \Neon::getALias(DIR_CONFIG . '/env.ini'); |
|
24 | + return \Neon::getALias(DIR_CONFIG.'/env.ini'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | 0 => 'Ready Check', // (a requirements check stage) |
44 | 44 | 1 => 'Configure', // condition=>self::hasLocalConfigFile // create config file |
45 | - 2 => 'Database Install',// condition=>self::tablesExist // install tables |
|
45 | + 2 => 'Database Install', // condition=>self::tablesExist // install tables |
|
46 | 46 | 3 => 'Account', // condition=>self::hasUserAccount // install user admin account |
47 | 47 | 4 => 'Log In' // (just a "well done, all done", link to log in page) |
48 | 48 | ]; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | try { |
113 | 113 | \Neon::$app->db->open(); |
114 | 114 | return true; |
115 | - } catch(\Exception $e) { |
|
115 | + } catch (\Exception $e) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | } |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | public static function getAllMigrations() |
226 | 226 | { |
227 | 227 | $migrations = ['core' => [], 'apps' => []]; |
228 | - foreach(neon()->getCoreApps() as $appName => $config) { |
|
228 | + foreach (neon()->getCoreApps() as $appName => $config) { |
|
229 | 229 | $app = neon()->getApp($appName); |
230 | 230 | if ($app) { |
231 | 231 | $ms = $app->getNewMigrations(); |
232 | 232 | $migrations['core'][$appName] = $ms; |
233 | 233 | } |
234 | 234 | } |
235 | - foreach(neon()->getApps() as $appName => $config) { |
|
235 | + foreach (neon()->getApps() as $appName => $config) { |
|
236 | 236 | $app = neon()->getApp($appName); |
237 | 237 | if ($app) { |
238 | 238 | $ms = $app->getNewMigrations(); |
@@ -397,11 +397,11 @@ discard block |
||
397 | 397 | * @return boolean |
398 | 398 | * @throws \yii\db\Exception |
399 | 399 | */ |
400 | - private static function checkForUserAccounts($super=false) |
|
400 | + private static function checkForUserAccounts($super = false) |
|
401 | 401 | { |
402 | 402 | $userTable = \neon\user\models\User::tableName(); |
403 | 403 | try { |
404 | - $query = 'SELECT `id` from ' . $userTable; |
|
404 | + $query = 'SELECT `id` from '.$userTable; |
|
405 | 405 | if ($super) |
406 | 406 | $query .= " WHERE `super`=1"; |
407 | 407 | $result = neon()->db->createCommand($query)->queryOne(); |
@@ -377,14 +377,11 @@ discard block |
||
377 | 377 | $msg = $e->getMessage(); |
378 | 378 | if (preg_match('/\bUnknown database\b/i', $msg)) { |
379 | 379 | return static::ERROR_DB_UNKNOWN_DATABASE; |
380 | - } |
|
381 | - else if (preg_match('/\bUnknown .* server host\b/i', $msg)) { |
|
380 | + } else if (preg_match('/\bUnknown .* server host\b/i', $msg)) { |
|
382 | 381 | return static::ERROR_DB_UNKNOWN_HOST; |
383 | - } |
|
384 | - else if (preg_match('/\bAccess denied for user\b/i', $msg)) { |
|
382 | + } else if (preg_match('/\bAccess denied for user\b/i', $msg)) { |
|
385 | 383 | return static::ERROR_DB_ACCESS_DENIED; |
386 | - } |
|
387 | - else { |
|
384 | + } else { |
|
388 | 385 | return static::ERROR_DB; |
389 | 386 | } |
390 | 387 | } |
@@ -402,8 +399,9 @@ discard block |
||
402 | 399 | $userTable = \neon\user\models\User::tableName(); |
403 | 400 | try { |
404 | 401 | $query = 'SELECT `id` from ' . $userTable; |
405 | - if ($super) |
|
406 | - $query .= " WHERE `super`=1"; |
|
402 | + if ($super) { |
|
403 | + $query .= " WHERE `super`=1"; |
|
404 | + } |
|
407 | 405 | $result = neon()->db->createCommand($query)->queryOne(); |
408 | 406 | } catch (\yii\db\Exception $e) { |
409 | 407 | // if this has thrown an exception because the user table does not exist. |
@@ -35,7 +35,7 @@ |
||
35 | 35 | if ($model->load(\Yii::$app->request->post()) && $model->validate()) { |
36 | 36 | $success = $model->createUser($user); |
37 | 37 | if ($success === false) { |
38 | - throw new \Exception('Unable to create and save a valid user ' . print_r($user->getErrors(), true)); |
|
38 | + throw new \Exception('Unable to create and save a valid user '.print_r($user->getErrors(), true)); |
|
39 | 39 | } else { |
40 | 40 | return $this->redirect(['/install/account/complete']); |
41 | 41 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public function actionMigrations() |
48 | 48 | { |
49 | - ob_start(); |
|
49 | + ob_start(); |
|
50 | 50 | $migrator = new \neon\core\db\Migrator(); |
51 | 51 | $migrator->runAllMigrations(); |
52 | 52 | $migrations = ob_get_clean(); |
@@ -106,10 +106,10 @@ |
||
106 | 106 | // show message saying no config file found |
107 | 107 | // and provide a button to go back to the config step /install/config |
108 | 108 | $errorResponse = $this->render('/install/_error.tpl', [ |
109 | - 'message' => 'Could not find the database <strong>' . env('DB_NAME') . '</strong>', |
|
109 | + 'message' => 'Could not find the database <strong>'.env('DB_NAME').'</strong>', |
|
110 | 110 | 'buttons' => [ |
111 | 111 | [ |
112 | - 'label' => 'Try to Create & Install Database <strong>' . env('DB_NAME') . '</strong>', |
|
112 | + 'label' => 'Try to Create & Install Database <strong>'.env('DB_NAME').'</strong>', |
|
113 | 113 | 'url' => Url::toRoute(['/install/database/create-database']), |
114 | 114 | 'iconClass' => 'fa fa-plus', |
115 | 115 | 'type' => 'primary', |
@@ -26,10 +26,12 @@ discard block |
||
26 | 26 | { |
27 | 27 | neon()->view->params['step'] = 2; |
28 | 28 | |
29 | - if ($this->hasLocalConfigError($errorResponse)) |
|
30 | - return $errorResponse; |
|
31 | - if ($this->hasDatabaseError($errorResponse)) |
|
32 | - return $errorResponse; |
|
29 | + if ($this->hasLocalConfigError($errorResponse)) { |
|
30 | + return $errorResponse; |
|
31 | + } |
|
32 | + if ($this->hasDatabaseError($errorResponse)) { |
|
33 | + return $errorResponse; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | // check if tables have already been installed: |
35 | 37 | if (InstallHelper::coreInstalled()) { |
@@ -123,8 +125,7 @@ discard block |
||
123 | 125 | ] |
124 | 126 | ]); |
125 | 127 | return true; |
126 | - } |
|
127 | - else if ($error !== 0) { |
|
128 | + } else if ($error !== 0) { |
|
128 | 129 | // show message saying no config file found |
129 | 130 | // and provide a button to go back to the config step /install/config |
130 | 131 | $errorResponse = $this->render('/install/_error.tpl', [ |
@@ -53,7 +53,7 @@ |
||
53 | 53 | InstallHelper::createConfigFile($installer); |
54 | 54 | return $this->render('_created'); |
55 | 55 | } |
56 | - return $this->render('_show', [ 'config' => InstallHelper::createConfigFileContents($installer) ]); |
|
56 | + return $this->render('_show', ['config' => InstallHelper::createConfigFileContents($installer)]); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | return $this->render('index', ['model'=>$installer]); |
@@ -43,8 +43,9 @@ |
||
43 | 43 | */ |
44 | 44 | public function createUser(&$user) |
45 | 45 | { |
46 | - if (!$this->validate()) |
|
47 | - return false; |
|
46 | + if (!$this->validate()) { |
|
47 | + return false; |
|
48 | + } |
|
48 | 49 | $user = new User(); |
49 | 50 | $user->username = $this->username; |
50 | 51 | $user->email = $this->email; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param \neon\core\helpers\Iterator $iterator Iterate over the results. |
64 | 64 | * @return array the change log data |
65 | 65 | */ |
66 | - public function listChangeLog($fromDate=null, Iterator $iterator=null); |
|
66 | + public function listChangeLog($fromDate = null, Iterator $iterator = null); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * List an object's change log, if the object's class has been set up to store changes |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return If the object's class is set to have a change log, this will return the |
74 | 74 | * change log for this object. Otherwise it will return a blank array. |
75 | 75 | */ |
76 | - public function listObjectChangeLog($uuid, $fromDate=null, Iterator $iterator=null); |
|
76 | + public function listObjectChangeLog($uuid, $fromDate = null, Iterator $iterator = null); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * List the history of an object, if the object's class has been set up to store changes. |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return If the object's class is set to have a change log, this will return the |
85 | 85 | * history for this object. Otherwise it will return a blank array. |
86 | 86 | */ |
87 | - public function listObjectHistory($uuid, $fromDate=null, Iterator $iterator=null); |
|
87 | + public function listObjectHistory($uuid, $fromDate = null, Iterator $iterator = null); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Clear change log to a certain date and optionally for particular class types |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * then the $classList is the set of log items to be preserved and all |
99 | 99 | * others are cleared. |
100 | 100 | */ |
101 | - public function clearChangeLog($toDate, $classList=[], $clearClassList=true); |
|
101 | + public function clearChangeLog($toDate, $classList = [], $clearClassList = true); |
|
102 | 102 | |
103 | 103 | /** |
104 | 104 | * Clear an object's change log |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * This can be empty, if the item was deleted or destroyed for example. |
125 | 125 | * @return string the uuid of the created log entry |
126 | 126 | */ |
127 | - public function addLogEntry($objectUuid, $class, $changeKey, $before=[], $after=[]); |
|
127 | + public function addLogEntry($objectUuid, $class, $changeKey, $before = [], $after = []); |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Get the log entry |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param array $associateObjectUuids any associated objects that are related to the principal one. |
164 | 164 | * @return string the uuid of the created log entry |
165 | 165 | */ |
166 | - public function addGeneralComment($module, $classType, $comment, $objectUuid=null, array $associateObjectUuids=[]); |
|
166 | + public function addGeneralComment($module, $classType, $comment, $objectUuid = null, array $associateObjectUuids = []); |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Get an object's value at a particular log point. |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * 'count_current', 'count_deleted', ['deleted']] - deleted is set if you've |
49 | 49 | * set $includeDeleted to true |
50 | 50 | */ |
51 | - public function listClasses($module, &$total, $includeDeleted=false, $start=0, $length=100, $orderBy='label'); |
|
51 | + public function listClasses($module, &$total, $includeDeleted = false, $start = 0, $length = 100, $orderBy = 'label'); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Count all classes |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param boolean $includeDeleted default false |
58 | 58 | * @return integer |
59 | 59 | */ |
60 | - public function countClasses($module=null, $includeDeleted=false); |
|
60 | + public function countClasses($module = null, $includeDeleted = false); |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * create a new class |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * class_type, label, description, module, deleted, count_total, |
97 | 97 | * count_deleted, members |
98 | 98 | */ |
99 | - public function getClass($classType, $includeMembers=false); |
|
99 | + public function getClass($classType, $includeMembers = false); |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Edit a class |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * where deleted is given if $includeDeleted is true and keyBy is @see $keyBy |
157 | 157 | * Empty array is returned if there are no results |
158 | 158 | */ |
159 | - public function listMembers($classType, $includeDeleted=false, $keyBy='member_ref'); |
|
159 | + public function listMembers($classType, $includeDeleted = false, $keyBy = 'member_ref'); |
|
160 | 160 | |
161 | 161 | /** |
162 | 162 | * Create a new member for a class |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @throw InvalidArgumentException if the member already exists or the class doesn't |
183 | 183 | * @throw RunTimeException if the member could not be added |
184 | 184 | */ |
185 | - public function addMember($classType, &$memberRef, $dataTypeRef, $label, $description, $additional=null); |
|
185 | + public function addMember($classType, &$memberRef, $dataTypeRef, $label, $description, $additional = null); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Get the details of a member |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * id, class_type, member_ref, data_type_ref, label, description, |
195 | 195 | * choices, link_class, deleted] |
196 | 196 | */ |
197 | - public function getMember($classType, $memberRef, $fields=[]); |
|
197 | + public function getMember($classType, $memberRef, $fields = []); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Edit a member's details |