Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/core/mail/transport/MailgunTransport.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
 	 */
138 138
 	protected function getTo(Swift_Mime_SimpleMessage $message)
139 139
 	{
140
-		return collect($this->allContacts($message))->map(function ($display, $address) {
140
+		return collect($this->allContacts($message))->map(function($display, $address) {
141 141
 			return $display ? $display." <{$address}>" : $address;
142 142
 		})->values()->implode(',');
143 143
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,8 +56,9 @@
 block discarded – undo
56 56
 	 */
57 57
 	public function getClient()
58 58
 	{
59
-		if ($this->_client === null)
60
-			$this->_client = new Client();
59
+		if ($this->_client === null) {
60
+					$this->_client = new Client();
61
+		}
61 62
 		return $this->_client;
62 63
 	}
63 64
 
Please login to merge, or discard this patch.
neon/core/themes/ni/Assets.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 //		'theme.css',
21 21
 		'https://fonts.googleapis.com/css?family=Nunito+Sans:200,200i,300,300i,400,400i,600,600i,700,700i,800,900',
22 22
 	];
23
-	public $sourcePath = __DIR__ . '/assets';
23
+	public $sourcePath = __DIR__.'/assets';
24 24
 	public $depends = [
25 25
 //		'\neon\core\assets\CoreAsset',
26 26
 //		'\yii\bootstrap\BootstrapAsset',
@@ -29,6 +29,6 @@  discard block
 block discarded – undo
29 29
 	public function init()
30 30
 	{
31 31
 		$info = neon()->assetManager->publish($this->sourcePath, $this->publishOptions);
32
-		neon()->view->registerJs('var NEON_THEME_URL = "' . $info[1] . '";', View::POS_HEAD, 'neonThemeData');
32
+		neon()->view->registerJs('var NEON_THEME_URL = "'.$info[1].'";', View::POS_HEAD, 'neonThemeData');
33 33
 	}
34 34
 }
Please login to merge, or discard this patch.
neon/core/Env.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	 * @param  string  $file  - the path to the config file
57 57
 	 * @throws \Exception - if the environment variable value is an array
58 58
 	 */
59
-	public static function setEnvironmentFromFile($file, $overwrite=false)
59
+	public static function setEnvironmentFromFile($file, $overwrite = false)
60 60
 	{
61 61
 		if (file_exists($file)) {
62 62
 			// we need to load in the locally set environment ini file
63 63
 			$iniSettings = parse_ini_file($file, false, INI_SCANNER_TYPED);
64
-			foreach($iniSettings as $name => $value) {
64
+			foreach ($iniSettings as $name => $value) {
65 65
 				Env::setEnvironmentVariable($name, $value, $overwrite);
66 66
 			}
67 67
 		}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param  bool  $overwrite  Whether to force overwriting the environment variable if it already exists defaults to false
76 76
 	 * @throws \Exception - if the environment variable value is an array
77 77
 	 */
78
-	public static function setEnvironmentVariable($key, $value, $overwrite=false)
78
+	public static function setEnvironmentVariable($key, $value, $overwrite = false)
79 79
 	{
80 80
 		if (is_array($value)) {
81 81
 			throw new \Exception('Environment variables do not support nesting. The variable "'.print_r($key, true).'" is poop.');
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 			throw new \Exception('DIR_ROOT constant must be defined as the path to the root of your neon application');
110 110
 		}
111 111
 
112
-		defined('DIR_CONFIG') || define('DIR_CONFIG', DIR_ROOT . '/config');
113
-		defined('DIR_VAR') || define('DIR_VAR', DIR_ROOT . '/var');
114
-		defined('DIR_SYSTEM') || define('DIR_SYSTEM', DIR_ROOT . '/system');
115
-		defined('DIR_PUBLIC') || define('DIR_PUBLIC', DIR_ROOT . '/public');
112
+		defined('DIR_CONFIG') || define('DIR_CONFIG', DIR_ROOT.'/config');
113
+		defined('DIR_VAR') || define('DIR_VAR', DIR_ROOT.'/var');
114
+		defined('DIR_SYSTEM') || define('DIR_SYSTEM', DIR_ROOT.'/system');
115
+		defined('DIR_PUBLIC') || define('DIR_PUBLIC', DIR_ROOT.'/public');
116 116
 
117 117
 		Env::environment();
118 118
 		if (!class_exists('Neon'))
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string $name
160 160
 	 * @param boolean $saveToEnvFile
161 161
 	 */
162
-	private static function createEnvironmentVariable($name, $saveToEnvFile=true)
162
+	private static function createEnvironmentVariable($name, $saveToEnvFile = true)
163 163
 	{
164 164
 		$value = Hash::uuid64().Hash::uuid64().Hash::uuid64().Hash::uuid64();
165 165
 		if ($saveToEnvFile && file_exists(DIR_CONFIG.'/env.ini'))
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public static function getNeonSecret()
36 36
 	{
37
-		if (empty(env('NEON_SECRET')))
38
-			Env::createEnvironmentVariable('NEON_SECRET');
37
+		if (empty(env('NEON_SECRET'))) {
38
+					Env::createEnvironmentVariable('NEON_SECRET');
39
+		}
39 40
 		return env('NEON_SECRET');
40 41
 	}
41 42
 
@@ -45,8 +46,9 @@  discard block
 block discarded – undo
45 46
 	 */
46 47
 	public static function getNeonEncryptionKey()
47 48
 	{
48
-		if (empty(env('NEON_ENCRYPTION_KEY')))
49
-			Env::createEnvironmentVariable('NEON_ENCRYPTION_KEY');
49
+		if (empty(env('NEON_ENCRYPTION_KEY'))) {
50
+					Env::createEnvironmentVariable('NEON_ENCRYPTION_KEY');
51
+		}
50 52
 		return env('NEON_ENCRYPTION_KEY');
51 53
 	}
52 54
 
@@ -115,8 +117,9 @@  discard block
 block discarded – undo
115 117
 		defined('DIR_PUBLIC') || define('DIR_PUBLIC', DIR_ROOT . '/public');
116 118
 
117 119
 		Env::environment();
118
-		if (!class_exists('Neon'))
119
-			require DIR_NEON.'/core/Yii.php';
120
+		if (!class_exists('Neon')) {
121
+					require DIR_NEON.'/core/Yii.php';
122
+		}
120 123
 
121 124
 		\Neon::setAlias('neon', DIR_NEON);
122 125
 		\Neon::setAlias('root', DIR_ROOT);
@@ -162,8 +165,9 @@  discard block
 block discarded – undo
162 165
 	private static function createEnvironmentVariable($name, $saveToEnvFile=true)
163 166
 	{
164 167
 		$value = Hash::uuid64().Hash::uuid64().Hash::uuid64().Hash::uuid64();
165
-		if ($saveToEnvFile && file_exists(DIR_CONFIG.'/env.ini'))
166
-			file_put_contents(DIR_CONFIG.'/env.ini', PHP_EOL."$name = '$value'", FILE_APPEND | LOCK_EX);
168
+		if ($saveToEnvFile && file_exists(DIR_CONFIG.'/env.ini')) {
169
+					file_put_contents(DIR_CONFIG.'/env.ini', PHP_EOL."$name = '$value'", FILE_APPEND | LOCK_EX);
170
+		}
167 171
 		static::setEnvironmentVariable($name, $value, true);
168 172
 	}
169 173
 
Please login to merge, or discard this patch.
neon/core/migrations/m141106_185632_log_init.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -17,71 +17,71 @@
 block discarded – undo
17 17
  */
18 18
 class m141106_185632_log_init extends Migration
19 19
 {
20
-    /**
21
-     * @var DbTarget[] Targets to create log table for
22
-     */
23
-    private $dbTargets = [];
20
+	/**
21
+	 * @var DbTarget[] Targets to create log table for
22
+	 */
23
+	private $dbTargets = [];
24 24
 
25
-    /**
26
-     * @throws InvalidConfigException
27
-     * @return DbTarget[]
28
-     */
29
-    protected function getDbTargets()
30
-    {
31
-        if ($this->dbTargets === []) {
32
-            $log = Yii::$app->getLog();
25
+	/**
26
+	 * @throws InvalidConfigException
27
+	 * @return DbTarget[]
28
+	 */
29
+	protected function getDbTargets()
30
+	{
31
+		if ($this->dbTargets === []) {
32
+			$log = Yii::$app->getLog();
33 33
 
34
-            $usedTargets = [];
35
-            foreach ($log->targets as $target) {
36
-                if ($target instanceof DbTarget) {
37
-                    $currentTarget = [
38
-                        $target->db,
39
-                        $target->logTable,
40
-                    ];
41
-                    if (!in_array($currentTarget, $usedTargets, true)) {
42
-                        // do not create same table twice
43
-                        $usedTargets[] = $currentTarget;
44
-                        $this->dbTargets[] = $target;
45
-                    }
46
-                }
47
-            }
48
-        }
34
+			$usedTargets = [];
35
+			foreach ($log->targets as $target) {
36
+				if ($target instanceof DbTarget) {
37
+					$currentTarget = [
38
+						$target->db,
39
+						$target->logTable,
40
+					];
41
+					if (!in_array($currentTarget, $usedTargets, true)) {
42
+						// do not create same table twice
43
+						$usedTargets[] = $currentTarget;
44
+						$this->dbTargets[] = $target;
45
+					}
46
+				}
47
+			}
48
+		}
49 49
 
50
-        return $this->dbTargets;
51
-    }
50
+		return $this->dbTargets;
51
+	}
52 52
 
53
-    public function up()
54
-    {
55
-        foreach ($this->getDbTargets() as $target) {
56
-            $this->db = $target->db;
53
+	public function up()
54
+	{
55
+		foreach ($this->getDbTargets() as $target) {
56
+			$this->db = $target->db;
57 57
 
58
-            $tableOptions = null;
59
-            if ($this->db->driverName === 'mysql') {
60
-                // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
61
-                $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
62
-            }
58
+			$tableOptions = null;
59
+			if ($this->db->driverName === 'mysql') {
60
+				// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
61
+				$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
62
+			}
63 63
 
64
-            $this->createTable($target->logTable, [
65
-                'id' => $this->bigPrimaryKey(),
66
-                'level' => $this->integer(),
67
-                'category' => $this->string(),
68
-                'log_time' => $this->double(),
69
-                'prefix' => $this->text(),
70
-                'message' => $this->text(),
71
-            ], $tableOptions);
64
+			$this->createTable($target->logTable, [
65
+				'id' => $this->bigPrimaryKey(),
66
+				'level' => $this->integer(),
67
+				'category' => $this->string(),
68
+				'log_time' => $this->double(),
69
+				'prefix' => $this->text(),
70
+				'message' => $this->text(),
71
+			], $tableOptions);
72 72
 
73
-            $this->createIndex('idx_log_level', $target->logTable, 'level');
74
-            $this->createIndex('idx_log_category', $target->logTable, 'category');
75
-            $this->createIndex('idx_log_time', $target->logTable, 'log_time');
76
-        }
77
-    }
73
+			$this->createIndex('idx_log_level', $target->logTable, 'level');
74
+			$this->createIndex('idx_log_category', $target->logTable, 'category');
75
+			$this->createIndex('idx_log_time', $target->logTable, 'log_time');
76
+		}
77
+	}
78 78
 
79
-    public function down()
80
-    {
81
-        foreach ($this->getDbTargets() as $target) {
82
-            $this->db = $target->db;
79
+	public function down()
80
+	{
81
+		foreach ($this->getDbTargets() as $target) {
82
+			$this->db = $target->db;
83 83
 
84
-            $this->dropTable($target->logTable);
85
-        }
86
-    }
84
+			$this->dropTable($target->logTable);
85
+		}
86
+	}
87 87
 }
Please login to merge, or discard this patch.
neon/core/helpers.php 2 patches
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,10 +32,11 @@  discard block
 block discarded – undo
32 32
 	{
33 33
 		echo dp_string(...$dump);
34 34
 		$backtrace = backtrace_line_by_function('dp');
35
-		if (neon()->debug)
36
-			echo $backtrace;
37
-		else
38
-			\Neon::error($backtrace);
35
+		if (neon()->debug) {
36
+					echo $backtrace;
37
+		} else {
38
+					\Neon::error($backtrace);
39
+		}
39 40
 	}
40 41
 }
41 42
 
@@ -86,8 +87,9 @@  discard block
 block discarded – undo
86 87
 			$str .= "<pre>$debug</pre>";
87 88
 		}
88 89
 
89
-		if (neon()->debug)
90
-			return $str;
90
+		if (neon()->debug) {
91
+					return $str;
92
+		}
91 93
 		\Neon::error($str);
92 94
 		return '';
93 95
 	}
@@ -125,8 +127,9 @@  discard block
 block discarded – undo
125 127
 	function debug_message(...$dump)
126 128
 	{
127 129
 		// security feature to ensure debug is not displayed unless in debug mode
128
-		if (!neon()->debug)
129
-			return '';
130
+		if (!neon()->debug) {
131
+					return '';
132
+		}
130 133
 		return dp_string(...$dump);
131 134
 	}
132 135
 }
@@ -190,8 +193,9 @@  discard block
 block discarded – undo
190 193
 	 */
191 194
 	function url($url = '', $absolute = false)
192 195
 	{
193
-		if ($url === null)
194
-			return '';
196
+		if ($url === null) {
197
+					return '';
198
+		}
195 199
 		$url = is_string($url) ? "/$url" : $url;
196 200
 		return Url::toRoute($url, $absolute);
197 201
 	}
@@ -248,8 +252,9 @@  discard block
 block discarded – undo
248 252
 	 */
249 253
 	function truthy($value)
250 254
 	{
251
-		if ($value && strtolower($value) !== "false")
252
-			return true;
255
+		if ($value && strtolower($value) !== "false") {
256
+					return true;
257
+		}
253 258
 		return false;
254 259
 	}
255 260
 }
@@ -455,8 +460,9 @@  discard block
 block discarded – undo
455 460
 	function faker()
456 461
 	{
457 462
 		static $faker = null;
458
-		if ($faker === null)
459
-			$faker = \Faker\Factory::create();
463
+		if ($faker === null) {
464
+					$faker = \Faker\Factory::create();
465
+		}
460 466
 		return $faker;
461 467
 	}
462 468
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 use \Carbon\Carbon;
18 18
 use neon\core\helpers\Url;
19 19
 
20
-if (! function_exists('dp')) {
20
+if (!function_exists('dp')) {
21 21
 	/**
22 22
 	 * Debug function. Prints all passed in arguments to the screen.
23 23
 	 * arguments containing objects or arrays are output using print_r
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	}
40 40
 }
41 41
 
42
-if (! function_exists('backtrace_line_by_function')) {
42
+if (!function_exists('backtrace_line_by_function')) {
43 43
 	/**
44 44
 	 * Tries to get the line and file that called the specified functions
45 45
 	 * - will return the earliest match in execution order that it found.
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 	{
52 52
 		$bt = debug_backtrace();
53 53
 		$lineInfo = '';
54
-		foreach($bt as $trace) {
54
+		foreach ($bt as $trace) {
55 55
 			if (isset($trace['function']) && $trace['function'] === $functionToShow) {
56
-				$lineInfo = '==> [' . (isset($trace['file']) ? $trace['file'] : ' unknown file '). ':' . (isset($trace['line']) ? $trace['line'] : ' unknown line ' ) . ']';
56
+				$lineInfo = '==> ['.(isset($trace['file']) ? $trace['file'] : ' unknown file ').':'.(isset($trace['line']) ? $trace['line'] : ' unknown line ').']';
57 57
 				break;
58 58
 			}
59 59
 		}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	}
62 62
 }
63 63
 
64
-if (! function_exists('dp_string')) {
64
+if (!function_exists('dp_string')) {
65 65
 	/**
66 66
 	 * This generates a nice debug string and returns it. It will only
67 67
 	 * print to the screen if you are in debug mode. Otherwise it prints
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 }
95 95
 
96
-if (! function_exists('dd')) {
96
+if (!function_exists('dd')) {
97 97
 	/**
98 98
 	 * This is the same as the dp (debug print) function but exits after
99 99
 	 * **Note:** If not in debug will print to log error and not exit
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 }
115 115
 
116
-if (! function_exists('debug_message')) {
116
+if (!function_exists('debug_message')) {
117 117
 	/**
118 118
 	 * This is the same as the dp_string (debug print) function however it returns the string
119 119
 	 * The main difference is that it will only output a message if neon is in debug mode
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 }
133 133
 
134 134
 
135
-if (! function_exists('neon')) {
135
+if (!function_exists('neon')) {
136 136
 	/**
137 137
 	 * Shortcut method to ```\Neon::$app```
138 138
 	 * @param string $name
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 }
146 146
 
147
-if (! function_exists('setting')) {
147
+if (!function_exists('setting')) {
148 148
 	/**
149 149
 	 * Get a setting value
150 150
 	 *
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
 	 * the setting has been set in the current session
156 156
 	 * @return string
157 157
 	 */
158
-	function setting($app, $name, $default=null, $refresh=false)
158
+	function setting($app, $name, $default = null, $refresh = false)
159 159
 	{
160 160
 		return neon()->getSettingsManager()->get($app, $name, $default, $refresh);
161 161
 	}
162 162
 }
163 163
 
164
-if (! function_exists('set_setting')) {
164
+if (!function_exists('set_setting')) {
165 165
 	/**
166 166
 	 * @param string $app the app responsible for this setting
167 167
 	 * @param string $name the setting name
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	}
175 175
 }
176 176
 
177
-if (! function_exists('url')) {
177
+if (!function_exists('url')) {
178 178
 	/**
179 179
 	 * Alias of \neon\core\helpers\Url::to
180 180
 	 * @see \neon\core\helpers\Url::to()
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	}
198 198
 }
199 199
 
200
-if (! function_exists('url_base')) {
200
+if (!function_exists('url_base')) {
201 201
 	/**
202 202
 	 * Returns the base URL of the current request.
203 203
 	 * @param boolean|string $scheme the URI scheme to use in the returned base URL:
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	}
214 214
 }
215 215
 
216
-if (! function_exists('to_bytes')) {
216
+if (!function_exists('to_bytes')) {
217 217
 	/**
218 218
 	 * Returns the number of bytes as integer from a strings like `128K` | `128M` | `2G` | `1T` | `1P`
219 219
 	 *
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	}
226 226
 }
227 227
 
228
-if (! function_exists('format_bytes')) {
228
+if (!function_exists('format_bytes')) {
229 229
 	/**
230 230
 	 * Output a formatted size like '128M' from bytes.
231 231
 	 *
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	}
239 239
 }
240 240
 
241
-if (! function_exists('truthy')) {
241
+if (!function_exists('truthy')) {
242 242
 	/**
243 243
 	 * Php if statement handles truthy and falsey string conversions by default e.g. evaluating a '0' string to false
244 244
 	 * however a string of 'false' is evaluated as true. This function resolves that difference. This should be used
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	}
255 255
 }
256 256
 
257
-if (! function_exists('env')) {
257
+if (!function_exists('env')) {
258 258
 	/**
259 259
 	 * Gets the value of an environment variable.
260 260
 	 * Interprets 'true', 'false', 'empty' and 'null' strings appropriately
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	}
290 290
 }
291 291
 
292
-if (! function_exists('neon_secret')) {
292
+if (!function_exists('neon_secret')) {
293 293
 	/**
294 294
 	 * Gets the value of NEON_SECRET creating it if missing
295 295
 	 * @return string
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	}
300 300
 }
301 301
 
302
-if (! function_exists('neon_encryption_key')) {
302
+if (!function_exists('neon_encryption_key')) {
303 303
 	/**
304 304
 	 * Gets the value of NEON_SECRET creating it if missing
305 305
 	 * @return string
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	}
310 310
 }
311 311
 
312
-if (! function_exists('value')) {
312
+if (!function_exists('value')) {
313 313
 	/**
314 314
 	 * Return the value of the given value.
315 315
 	 * If the $value is a Closure, it will first be executed then its result returned
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	}
324 324
 }
325 325
 
326
-if (! function_exists('collect')) {
326
+if (!function_exists('collect')) {
327 327
 	/**
328 328
 	 * Create a collection from the given value.
329 329
 	 *
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	}
337 337
 }
338 338
 
339
-if (! function_exists('now')) {
339
+if (!function_exists('now')) {
340 340
 	/**
341 341
 	 * Create a new Carbon instance for the current time.
342 342
 	 *
@@ -349,27 +349,27 @@  discard block
 block discarded – undo
349 349
 	}
350 350
 }
351 351
 
352
-if (! function_exists('profile_begin')) {
352
+if (!function_exists('profile_begin')) {
353 353
 	/**
354 354
 	 * @param string $name
355 355
 	 */
356
-	function profile_begin($name, $category='neon')
356
+	function profile_begin($name, $category = 'neon')
357 357
 	{
358 358
 		\Neon::beginProfile($name, $category);
359 359
 	}
360 360
 }
361 361
 
362
-if (! function_exists('profile_end')) {
362
+if (!function_exists('profile_end')) {
363 363
 	/**
364 364
 	 * @param string $name
365 365
 	 */
366
-	function profile_end($name=null, $category='neon')
366
+	function profile_end($name = null, $category = 'neon')
367 367
 	{
368 368
 		\Neon::endProfile($name, $category);
369 369
 	}
370 370
 }
371 371
 
372
-if (! function_exists('encrypt')) {
372
+if (!function_exists('encrypt')) {
373 373
 	/**
374 374
 	 * @param string $data
375 375
 	 * @return string - encrypted data
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	}
381 381
 }
382 382
 
383
-if (! function_exists('decrypt')) {
383
+if (!function_exists('decrypt')) {
384 384
 	/**
385 385
 	 * @param string $data
386 386
 	 * @return string - encrypted data
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	}
392 392
 }
393 393
 
394
-if (! function_exists('get_alias')) {
394
+if (!function_exists('get_alias')) {
395 395
 	/**
396 396
 	 * @param string $path
397 397
 	 * @return string - resolved path
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	}
403 403
 }
404 404
 
405
-if (! function_exists('on_url')) {
405
+if (!function_exists('on_url')) {
406 406
 	/**
407 407
 	 * This function is useful for checking if links should be active,
408 408
 	 *
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		return \neon\core\helpers\Url::isUrl(...$urls);
423 423
 	}
424 424
 }
425
-if (! function_exists('_t')) {
425
+if (!function_exists('_t')) {
426 426
 	/**
427 427
 	 * Translates a message to the target language
428 428
 	 * This function is a wrapper to the \Neon::t method
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
 	 * @param string $category  if provided will save the text to that category. Defaults to 'neon'
443 443
 	 * @return string the translated message.
444 444
 	 */
445
-	function _t($text, $params=[], $category='neon')
445
+	function _t($text, $params = [], $category = 'neon')
446 446
 	{
447 447
 		return \Neon::t($category, $text, $params);
448 448
 	}
449 449
 }
450
-if (! function_exists('faker')) {
450
+if (!function_exists('faker')) {
451 451
 	/**
452 452
 	 * Generate a faker object
453 453
 	 * @return \Faker\Generator;
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		return $faker;
461 461
 	}
462 462
 }
463
-if (! function_exists('user_is')) {
463
+if (!function_exists('user_is')) {
464 464
 	/**
465 465
 	 * @return boolean whether the user is/has a particular role
466 466
 	 */
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	}
471 471
 }
472 472
 
473
-if (! function_exists('user_can')) {
473
+if (!function_exists('user_can')) {
474 474
 	/**
475 475
 	 * Whether the user can perform a permission
476 476
 	 * @param $permission
@@ -481,18 +481,18 @@  discard block
 block discarded – undo
481 481
 		return neon()->user->can($permission);
482 482
 	}
483 483
 }
484
-if (! function_exists('uuid')) {
484
+if (!function_exists('uuid')) {
485 485
 	/**
486 486
 	 * Generate a universally unique id
487 487
 	 * @param string $separator - default '-'
488 488
 	 * @return bool
489 489
 	 */
490
-	function uuid($separator='-')
490
+	function uuid($separator = '-')
491 491
 	{
492 492
 		return \neon\core\helpers\Hash::uuid($separator);
493 493
 	}
494 494
 }
495
-if (! function_exists('uuid64')) {
495
+if (!function_exists('uuid64')) {
496 496
 	/**
497 497
 	 * Generate a universally unique id in base64
498 498
 	 * @return bool
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 		return \neon\core\helpers\Hash::uuid64();
503 503
 	}
504 504
 }
505
-if (! function_exists('id')) {
505
+if (!function_exists('id')) {
506 506
 	/**
507 507
 	 * Generate a html friendly UUID64
508 508
 	 * @return string
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 		return \neon\core\helpers\Hash::id();
513 513
 	}
514 514
 }
515
-if (! function_exists('is_route')) {
515
+if (!function_exists('is_route')) {
516 516
 	/**
517 517
 	 * Test whether the current application is on a particular route
518 518
 	 * This is url rewrite safe! However you must reference the module/controller/action and not the url directly
@@ -523,12 +523,12 @@  discard block
 block discarded – undo
523 523
 	 * @param array $params
524 524
 	 * @return boolean - whether on the route
525 525
 	 */
526
-	function is_route($pattern, $params=[])
526
+	function is_route($pattern, $params = [])
527 527
 	{
528 528
 		return neon()->request->isRoute($pattern, $params);
529 529
 	}
530 530
 }
531
-if (! function_exists('abort')) {
531
+if (!function_exists('abort')) {
532 532
 	/**
533 533
 	 * Throw a HttpException with the given data.
534 534
 	 *
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	}
545 545
 }
546 546
 
547
-if (! function_exists('abort_if')) {
547
+if (!function_exists('abort_if')) {
548 548
 	/**
549 549
 	 * Throw a HttpException with the given data if the given condition is true.
550 550
 	 *
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 		}
563 563
 	}
564 564
 }
565
-if (! function_exists('request')) {
565
+if (!function_exists('request')) {
566 566
 	/**
567 567
 	 * Get an instance of the current request or an input item from the request.
568 568
 	 *
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 		return is_null($value) ? value($default) : $value;
582 582
 	}
583 583
 }
584
-if (! function_exists('object_get')) {
584
+if (!function_exists('object_get')) {
585 585
 	/**
586 586
 	 * Get an item from an object using "dot" notation.
587 587
 	 *
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		}
598 598
 
599 599
 		foreach (explode('.', $key) as $segment) {
600
-			if (! is_object($object) || ! isset($object->{$segment})) {
600
+			if (!is_object($object) || !isset($object->{$segment})) {
601 601
 				return value($default);
602 602
 			}
603 603
 
Please login to merge, or discard this patch.
neon/core/helpers/Hash.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 	 * @param  string  $separator the section separator for the uuid - normally '-'
27 27
 	 * @return string
28 28
 	 */
29
-	public static function uuid($separator='-')
29
+	public static function uuid($separator = '-')
30 30
 	{
31
-		$sha = sha1(uniqid('', true).rand(1000000,9999999));
32
-		return substr($sha,0,8).$separator.substr($sha,9,4).$separator.'3'.substr($sha,15,3).$separator.'8'.substr($sha,19,3).$separator.substr($sha,22,12);
31
+		$sha = sha1(uniqid('', true).rand(1000000, 9999999));
32
+		return substr($sha, 0, 8).$separator.substr($sha, 9, 4).$separator.'3'.substr($sha, 15, 3).$separator.'8'.substr($sha, 19, 3).$separator.substr($sha, 22, 12);
33 33
 	}
34 34
 
35 35
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @param string encoding - characters used for the encoding
38 38
 	 * @return string
39 39
 	 */
40
-	public static function uuid64($encoding='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-')
40
+	public static function uuid64($encoding = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-')
41 41
 	{
42 42
 		$uuid = self::uuid(''); // create a uuid without any '-' in it
43 43
 		return self::uuid2uuid64($uuid, $encoding);
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	 * @param string encoding - characters used for the encoding
60 60
 	 * @return string
61 61
 	 */
62
-	public static function uuid2uuid64($uuid, $encoding='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-')
62
+	public static function uuid2uuid64($uuid, $encoding = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-')
63 63
 	{
64
-		if (strlen($uuid)==22)
64
+		if (strlen($uuid) == 22)
65 65
 			return $uuid;
66 66
 
67 67
 		// remove any hyphens
68
-		$uuid = str_replace('-','',$uuid);
68
+		$uuid = str_replace('-', '', $uuid);
69 69
 
70 70
 		$uuid .= '0'; // 33 hexadecimal characters = 22 64-cimal chars.
71 71
 		// to convert from base-16 to base-64 (not Base64)
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		while ($position < 33) {
76 76
 			$snip = substr($uuid, $position, 3);
77 77
 			$number = hexdec($snip);
78
-			$uuid64 .= $encoding[(integer)floor($number/64)].$encoding[(integer)($number%64)];
78
+			$uuid64 .= $encoding[(integer) floor($number / 64)].$encoding[(integer) ($number % 64)];
79 79
 			$position += 3;
80 80
 		}
81 81
 		return $uuid64;
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 	 * @return string token
97 97
 	 * @throws \ReflectionException
98 98
 	 */
99
-	public static function setObjectToToken($object, $duration=86400)
99
+	public static function setObjectToToken($object, $duration = 86400)
100 100
 	{
101 101
 		// get public properties of child class
102 102
 		$data = \Neon::getObjectVars($object);
103 103
 		$data['class'] = get_class($object);
104 104
 		if (method_exists($object, 'toArray'))
105 105
 			$data = array_merge($data, $object->toArray(['objectToken']));
106
-		$token = sha1(serialize($data) . env('NEON_SECRET'));
106
+		$token = sha1(serialize($data).env('NEON_SECRET'));
107 107
 		neon()->cache->set($token, $data, $duration); // 24 hour
108 108
 		return neon()->security->maskToken($token);
109 109
 	}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @throws BadRequestHttpException
117 117
 	 * @throws NotFoundHttpException
118 118
 	 */
119
-	public static function getObjectFromToken($token, $expectClass=null)
119
+	public static function getObjectFromToken($token, $expectClass = null)
120 120
 	{
121 121
 		$data = neon()->cache->get(neon()->security->unmaskToken($token));
122 122
 		if ($data === null)
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public static function uuid2uuid64($uuid, $encoding='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-')
63 63
 	{
64
-		if (strlen($uuid)==22)
65
-			return $uuid;
64
+		if (strlen($uuid)==22) {
65
+					return $uuid;
66
+		}
66 67
 
67 68
 		// remove any hyphens
68 69
 		$uuid = str_replace('-','',$uuid);
@@ -101,8 +102,9 @@  discard block
 block discarded – undo
101 102
 		// get public properties of child class
102 103
 		$data = \Neon::getObjectVars($object);
103 104
 		$data['class'] = get_class($object);
104
-		if (method_exists($object, 'toArray'))
105
-			$data = array_merge($data, $object->toArray(['objectToken']));
105
+		if (method_exists($object, 'toArray')) {
106
+					$data = array_merge($data, $object->toArray(['objectToken']));
107
+		}
106 108
 		$token = sha1(serialize($data) . env('NEON_SECRET'));
107 109
 		neon()->cache->set($token, $data, $duration); // 24 hour
108 110
 		return neon()->security->maskToken($token);
@@ -119,17 +121,20 @@  discard block
 block discarded – undo
119 121
 	public static function getObjectFromToken($token, $expectClass=null)
120 122
 	{
121 123
 		$data = neon()->cache->get(neon()->security->unmaskToken($token));
122
-		if ($data === null)
123
-			throw new NotFoundHttpException('Does not exist or has timed out');
124
+		if ($data === null) {
125
+					throw new NotFoundHttpException('Does not exist or has timed out');
126
+		}
124 127
 
125
-		if (!isset($data['class']) || !class_exists($data['class']))
126
-			throw new BadRequestHttpException('Not a valid class');
128
+		if (!isset($data['class']) || !class_exists($data['class'])) {
129
+					throw new BadRequestHttpException('Not a valid class');
130
+		}
127 131
 
128 132
 		// instantiate the class
129 133
 		$class = Arr::remove($data, 'class');
130 134
 		$object = new $class($data);
131
-		if ($expectClass !== null && !$object instanceof $expectClass)
132
-			throw new BadRequestHttpException('Not a valid class');
135
+		if ($expectClass !== null && !$object instanceof $expectClass) {
136
+					throw new BadRequestHttpException('Not a valid class');
137
+		}
133 138
 
134 139
 		return $object;
135 140
 	}
Please login to merge, or discard this patch.
neon/core/controllers/ErrorController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 		// If we have requested json we should return the error as json
34 34
 		$acceptsJson = array_key_exists('application/json', neon()->request->getAcceptableContentTypes());
35
-		if (neon()->request->getIsAjax() || $acceptsJson ) {
35
+		if (neon()->request->getIsAjax() || $acceptsJson) {
36 36
 			return $data;
37 37
 		}
38 38
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			return $this->render($errorPage, $data);
58 58
 		}
59 59
 		// Look up specific framework view file e.g `core/view/error_404.php`
60
-		$viewForError = 'error_' . $data['status'];
60
+		$viewForError = 'error_'.$data['status'];
61 61
 		if ($this->findView($viewForError)) {
62 62
 			return $this->render($viewForError, $data);
63 63
 		}
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function getCustomErrorPage($errorCode)
74 74
 	{
75
-		$themeFileOld = neon('cms')->getThemeAlias() . "/error_$errorCode.tpl";
76
-		$themeFile = neon('cms')->getThemeAlias() . "/pages/errors/$errorCode.tpl";
75
+		$themeFileOld = neon('cms')->getThemeAlias()."/error_$errorCode.tpl";
76
+		$themeFile = neon('cms')->getThemeAlias()."/pages/errors/$errorCode.tpl";
77 77
 		if ($this->findView($themeFile)) {
78 78
 			return $themeFile;
79 79
 		}
Please login to merge, or discard this patch.
neon/core/BaseApp.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			$class = \get_class($this);
67 67
 			if (($pos = strrpos($class, '\\')) !== false) {
68 68
 				$controllers = neon()->isConsoleApp() ? 'console' : 'controllers';
69
-				$this->controllerNamespace = substr($class, 0, $pos) . '\\' . $controllers;
69
+				$this->controllerNamespace = substr($class, 0, $pos).'\\'.$controllers;
70 70
 			}
71 71
 		}
72 72
 		parent::init();
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param boolean $refresh - default false
147 147
 	 * @return type
148 148
 	 */
149
-	public function getSetting($name, $default=null, $refresh=false)
149
+	public function getSetting($name, $default = null, $refresh = false)
150 150
 	{
151 151
 		$settingManager = neon()->settingsManager;
152 152
 		return $settingManager->get($this->id, $name, $default, $refresh);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	/**
187 187
 	 * @inheritdoc
188 188
 	 */
189
-	public function uninstall(){}
189
+	public function uninstall() {}
190 190
 
191 191
 	/**
192 192
 	 * Get the alias key to this module (App)
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	public function getClassAlias()
198 198
 	{
199
-		return '@' . rtrim(str_replace(['\\', 'App'], ['/', ''], get_called_class()), "/");
199
+		return '@'.rtrim(str_replace(['\\', 'App'], ['/', ''], get_called_class()), "/");
200 200
 	}
201 201
 
202 202
 	/**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function getAssetsPath()
235 235
 	{
236
-		return $this->getPath() . '/assets';
236
+		return $this->getPath().'/assets';
237 237
 	}
238 238
 
239 239
 	/**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function getDocsPath()
243 243
 	{
244
-		return $this->getPath() . '/docs';
244
+		return $this->getPath().'/docs';
245 245
 	}
246 246
 
247 247
 	/**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	public function getDataMapProviders()
268 268
 	{
269 269
 		$availableMaps = [];
270
-		foreach(neon()->getAllApps() as $name => $config) {
270
+		foreach (neon()->getAllApps() as $name => $config) {
271 271
 			$app = neon($name);
272 272
 			if ($app instanceof IDataMapProvider) {
273 273
 				$maps = $app->getDataMapTypes();
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		if ($provider === null) {
294 294
 			throw new \Exception("The map provider '$name' specified can not be found.");
295 295
 		}
296
-		if (! $provider instanceof IDataMapProvider) {
296
+		if (!$provider instanceof IDataMapProvider) {
297 297
 			throw new \Exception("The Provider '$name' must implement the 'neon\\core\\interfaces\\IDataMapProvider' interface.");
298 298
 		}
299 299
 		return $provider;
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
 	 * @param string $instanceOf - a string defining a class or interface that the ckasses must implement or be
340 340
 	 * @return array
341 341
 	 */
342
-	public function getClasses($subPath='', $instanceOf=false)
342
+	public function getClasses($subPath = '', $instanceOf = false)
343 343
 	{
344 344
 		$path = $this->getPath().Str::start($subPath, '/');
345 345
 		$classes = [];
346 346
 		if (!file_exists($path)) return [];
347
-		foreach(\neon\core\helpers\File::findFiles("$path", ['only' => ['*.php']]) as $file) {
347
+		foreach (\neon\core\helpers\File::findFiles("$path", ['only' => ['*.php']]) as $file) {
348 348
 			$class = $this->getClassFromFile($file);
349 349
 			// the class is not valid then skip
350 350
 			if (!$class) continue;
Please login to merge, or discard this patch.
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,8 +107,9 @@  discard block
 block discarded – undo
107 107
 	public function getMenu()
108 108
 	{
109 109
 		// if the menu has been overridden
110
-		if ($this->_menu !== null)
111
-			return $this->_menu;
110
+		if ($this->_menu !== null) {
111
+					return $this->_menu;
112
+		}
112 113
 		return $this->getDefaultMenu();
113 114
 	}
114 115
 
@@ -343,13 +344,19 @@  discard block
 block discarded – undo
343 344
 	{
344 345
 		$path = $this->getPath().Str::start($subPath, '/');
345 346
 		$classes = [];
346
-		if (!file_exists($path)) return [];
347
+		if (!file_exists($path)) {
348
+			return [];
349
+		}
347 350
 		foreach(\neon\core\helpers\File::findFiles("$path", ['only' => ['*.php']]) as $file) {
348 351
 			$class = $this->getClassFromFile($file);
349 352
 			// the class is not valid then skip
350
-			if (!$class) continue;
353
+			if (!$class) {
354
+				continue;
355
+			}
351 356
 			// if we want to check the instance of the class and the $class is NOT an $instanceOf the class then skip
352
-			if ($instanceOf && !is_a($class, $instanceOf, true)) continue;
357
+			if ($instanceOf && !is_a($class, $instanceOf, true)) {
358
+				continue;
359
+			}
353 360
 			$classes[] = $class;
354 361
 		}
355 362
 		return $classes;
@@ -365,9 +372,12 @@  discard block
 block discarded – undo
365 372
 	{
366 373
 		$alias = $this->getClassAlias();
367 374
 		$fileName = basename($file);
368
-		if (in_array($fileName, ['Yii.php', 'Neon.php'])) return false;
369
-		if (!ctype_upper($fileName[0]))
375
+		if (in_array($fileName, ['Yii.php', 'Neon.php'])) {
370 376
 			return false;
377
+		}
378
+		if (!ctype_upper($fileName[0])) {
379
+					return false;
380
+		}
371 381
 		$class = str_replace([$this->getPath(), '/', '@', '.php'], ['', '\\', '\\', ''], $alias.$file);
372 382
 		return $class;
373 383
 	}
Please login to merge, or discard this patch.
neon/core/view/SmartyRenderer.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,12 +25,14 @@
 block discarded – undo
25 25
 		// set up the theme directories
26 26
 		foreach ($themeHierarchy as $theme) {
27 27
 			if (isset($theme['templates'])) {
28
-				foreach ($theme['templates'] as $tplDir)
29
-					$this->smarty->addTemplateDir($tplDir);
28
+				foreach ($theme['templates'] as $tplDir) {
29
+									$this->smarty->addTemplateDir($tplDir);
30
+				}
30 31
 			}
31 32
 			if (isset($theme['plugins'])) {
32
-				foreach ($theme['plugins'] as $pluginDir)
33
-					$this->smarty->addPluginsDir($pluginDir);
33
+				foreach ($theme['plugins'] as $pluginDir) {
34
+									$this->smarty->addPluginsDir($pluginDir);
35
+				}
34 36
 			}
35 37
 		}
36 38
 	}
Please login to merge, or discard this patch.