Passed
Push — develop ( 44d21a...7d51f9 )
by Neill
34:25 queued 18:25
created
neon/settings/interfaces/ISettingsManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @param boolean $refresh whther to refresh the cache before fetching this setting defaults to false
25 25
 	 * @return string
26 26
 	 */
27
-	public function get($app, $key, $default=null, $refresh=false);
27
+	public function get($app, $key, $default = null, $refresh = false);
28 28
 
29 29
 	/**
30 30
 	 * Set a setting value
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param boolean $refresh if true forces reftech fo the the settings
45 45
 	 * @return array in the format @see self::$_settings
46 46
 	 */
47
-	public function getSettings($refresh=false);
47
+	public function getSettings($refresh = false);
48 48
 
49 49
 	/**
50 50
 	 * Load the settings from the database and cache for the session
@@ -52,6 +52,6 @@  discard block
 block discarded – undo
52 52
 	 * @param boolean $refresh if true forces refresh values from the database
53 53
 	 * @return array in the format @see self::$_settings
54 54
 	 */
55
-	public function getAll($refresh=false);
55
+	public function getAll($refresh = false);
56 56
 
57 57
 }
Please login to merge, or discard this patch.
neon/settings/controllers/IndexController.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@
 block discarded – undo
15 15
 	{
16 16
 		$form = new \neon\settings\forms\AppSettings('setting');
17 17
 		$form->registerScripts($this->getView());
18
-		if (neon()->request->isAjax)
19
-			return $form->ajaxValidation();
18
+		if (neon()->request->isAjax) {
19
+					return $form->ajaxValidation();
20
+		}
20 21
 		$form->process();
21 22
 		return $this->render('index', [
22 23
 			'form' => $form,
Please login to merge, or discard this patch.
neon/settings/forms/AppSettings.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
 	public function loadFields()
82 82
 	{
83 83
 		$settings = neon()->settings->getAppSettings();
84
-		foreach($settings as $app => $config) {
84
+		foreach ($settings as $app => $config) {
85 85
 			if (is_array($config)) {
86 86
 				$this->addSubForm($app)->setFields($config)->setLabel(neon($app)->name);
87 87
 			}
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 	/**
36 36
 	 *
37 37
 	 */
38
-    public function process()
39
-    {
40
-	    if ($this->shouldProcess()) {
41
-		    $this->load();
42
-		    $this->validate();
43
-		    if ($this->hasError()) {
44
-			    neon()->session->setFlash('error', 'The form has errors.');
45
-		    } else {
46
-			    $this->saveToSettings();
47
-			    neon()->session->setFlash('success', 'Settings have been successfully saved.');
38
+	public function process()
39
+	{
40
+		if ($this->shouldProcess()) {
41
+			$this->load();
42
+			$this->validate();
43
+			if ($this->hasError()) {
44
+				neon()->session->setFlash('error', 'The form has errors.');
45
+			} else {
46
+				$this->saveToSettings();
47
+				neon()->session->setFlash('success', 'Settings have been successfully saved.');
48 48
 			}
49 49
 		} else {
50 50
 			$this->loadFieldValuesFromSettings();
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			foreach ($appSettings as $key => $value) {
67 67
 				// if the fields value is valid then save it
68 68
 				if ($appForm->getField($key)->validate()) {
69
-				    $saved = $this->getSettingsManager()->set($appKey, $key, $value);
69
+					$saved = $this->getSettingsManager()->set($appKey, $key, $value);
70 70
 				}
71 71
 			}   
72 72
 		}
Please login to merge, or discard this patch.
settings/migrations/m181127_165817_settings_update_settings_to_json.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@
 block discarded – undo
15 15
 		$success = true;
16 16
 		foreach ($settings as $setting) {
17 17
 			try {
18
-				if ($setting->value != null)
19
-					$setting->value = $this->_decode($setting->value);
18
+				if ($setting->value != null) {
19
+									$setting->value = $this->_decode($setting->value);
20
+				}
20 21
 			} catch (\Exception $e) {
21 22
 				dp("Error while decoding setting from json: {$setting->app} {$setting->key} {$setting->value}. Error is ".$e->getMessage());
22 23
 				dp('Trying to save it back as Json');
Please login to merge, or discard this patch.
neon/settings/App.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@
 block discarded – undo
22 22
 
23 23
 	/**
24 24
 	 * Get all registered settings for each neon app
25
-     * ??? This should be in the settings manager ???
26
-     *
25
+	 * ??? This should be in the settings manager ???
26
+	 *
27 27
 	 * @return array
28 28
 	 */
29 29
 	public function getAppSettings()
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function getAppSettings()
30 30
 	{
31 31
 		$ret = [];
32
-		foreach(neon()->getActiveApps() as $key => $app) {
32
+		foreach (neon()->getActiveApps() as $key => $app) {
33 33
 			if (!empty($app->getSettings())) {
34 34
 				$ret[$key] = $app->getSettings();
35 35
 			}
@@ -185,16 +185,16 @@  discard block
 block discarded – undo
185 185
 
186 186
 	private function _itemLineDatetime($dateFormat, $exampleDate)
187 187
 	{
188
-		return neon()->formatter->asDatetime($exampleDate, $dateFormat) . "  -  $dateFormat";
188
+		return neon()->formatter->asDatetime($exampleDate, $dateFormat)."  -  $dateFormat";
189 189
 	}
190 190
 
191 191
 	private function _itemLine($dateFormat, $exampleDate)
192 192
 	{
193
-		return neon()->formatter->asDate($exampleDate, $dateFormat) . "  -  $dateFormat";
193
+		return neon()->formatter->asDate($exampleDate, $dateFormat)."  -  $dateFormat";
194 194
 	}
195 195
 
196 196
 	private function _itemLineTime($dateFormat, $exampleDate)
197 197
 	{
198
-		return neon()->formatter->asTime($exampleDate, $dateFormat) . "  -  $dateFormat";
198
+		return neon()->formatter->asTime($exampleDate, $dateFormat)."  -  $dateFormat";
199 199
 	}
200 200
 }
Please login to merge, or discard this patch.
neon/install/forms/InstallDatabase.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 class InstallDatabase extends \yii\base\Model
8 8
 {
9
-	public $name='';
9
+	public $name = '';
10 10
 	public $username;
11 11
 	public $password;
12 12
 	public $host = 'localhost';
@@ -54,21 +54,21 @@  discard block
 block discarded – undo
54 54
 		} else {
55 55
 			if ($result == InstallHelper::ERROR_DB_UNKNOWN_DATABASE) {
56 56
 				// Attempt to create the database (if asked to do so)
57
-				if ($this->create_database == 1 ) {
58
-					if (! $this->createDatabase($exception)) {
57
+				if ($this->create_database == 1) {
58
+					if (!$this->createDatabase($exception)) {
59 59
 						$this->error_message = 'cant_create_database';
60
-						$this->addError('name', 'Failed to create database "' . $this->name . '" Database error: ' . $exception);
60
+						$this->addError('name', 'Failed to create database "'.$this->name.'" Database error: '.$exception);
61 61
 					}
62
-				}  else {
62
+				} else {
63 63
 					// This is useful information - but not an error therefore in
64
-					if (! $this->isAjaxValidating) {
64
+					if (!$this->isAjaxValidating) {
65 65
 						$this->error_message = 'unknown_database';
66
-						$this->addError('name', 'Unknown database name "' . $this->name . '"');
66
+						$this->addError('name', 'Unknown database name "'.$this->name.'"');
67 67
 					}
68 68
 				}
69 69
 			} else if ($result == InstallHelper::ERROR_DB_UNKNOWN_HOST) {
70 70
 				$this->error_message = 'unknown_host';
71
-				$this->addError('host', 'Unknown host name "' . $this->host . '"');
71
+				$this->addError('host', 'Unknown host name "'.$this->host.'"');
72 72
 			} else if ($result == InstallHelper::ERROR_DB_ACCESS_DENIED) {
73 73
 				$this->error_message = 'access_denied';
74 74
 				$this->addError('username', 'The username either does not exist or does not work with the given password');
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 			$config['dsn'] = 'mysql:host='.$this->host.';';
93 93
 			$connection = new \neon\core\db\Connection($config);
94 94
 			try {
95
-				$connection->createCommand('CREATE DATABASE ' . $this->name)->execute();
95
+				$connection->createCommand('CREATE DATABASE '.$this->name)->execute();
96 96
 			} catch (\yii\db\Exception $e) {
97 97
 				// could not create the database
98 98
 				$exception = $e->getMessage();
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 						$this->error_message = 'cant_create_database';
60 60
 						$this->addError('name', 'Failed to create database "' . $this->name . '" Database error: ' . $exception);
61 61
 					}
62
-				}  else {
62
+				} else {
63 63
 					// This is useful information - but not an error therefore in
64 64
 					if (! $this->isAjaxValidating) {
65 65
 						$this->error_message = 'unknown_database';
Please login to merge, or discard this patch.
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.