Completed
Push — master ( e5b923...79443c )
by Adam
04:06
created
Bootstrap.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@
 block discarded – undo
151 151
 	protected function autowire(IBuild $build, Container $container)
152 152
 	{
153 153
 		foreach ($this->getAutowiredProperties($build) as $property => $service) {
154
-			if(!$container->hasService($service)){
154
+			if (!$container->hasService($service)) {
155 155
 				throw new Exception("Cannot found service '$service' to inject into " . get_class($build) . "::$property.");
156 156
 			}
157 157
 			$build->$property = $container->getService($service);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 			$container = require_once $bootstrapFile;
55 55
 			if ($container === 1 || $container === TRUE) { // 1 = success, TRUE = already required
56 56
 				$container = NULL;
57
-			}elseif (!($container instanceof Container)) {
57
+			} elseif (!($container instanceof Container)) {
58 58
 				$this->log("Returned value from bootstrap.php must be instance of 'Genesis\\Container\\Container' or nothing (NULL).", 'red');
59 59
 				exit(255);
60 60
 			}
Please login to merge, or discard this patch.
config/ContainerFactory.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -89,34 +89,34 @@  discard block
 block discarded – undo
89 89
 
90 90
 		// BC break check
91 91
 		$mainSections = ['includes', 'class', 'parameters', 'services'];
92
-		foreach($config as $key => $val){
93
-			if(!in_array($key, $mainSections)) {
92
+		foreach ($config as $key => $val) {
93
+			if (!in_array($key, $mainSections)) {
94 94
 				throw new NotSupportedException("Since version 2.0 are supported main only these sections: " . implode(", ", $mainSections) . ". Section '$key' found. Move your variables into parameters section.");
95 95
 			}
96 96
 		}
97 97
 
98 98
 		$container = new Container();
99 99
 		$container->setClass($config['class']);
100
-		if(isset($config['parameters'])){
100
+		if (isset($config['parameters'])) {
101 101
 			$container->setParameters($config['parameters']);
102 102
 		}
103
-		if(isset($config['services'])){
104
-			foreach($config['services'] as $name => $config){
105
-				if(!is_array($config)){
103
+		if (isset($config['services'])) {
104
+			foreach ($config['services'] as $name => $config) {
105
+				if (!is_array($config)) {
106 106
 					$container->addService($name, $config); // is directly service object from merged container
107 107
 					continue;
108 108
 				}
109 109
 				$class = $config['class'];
110 110
 				$arguments = [];
111
-				if($config['class'] instanceof \Nette\Neon\Entity){
111
+				if ($config['class'] instanceof \Nette\Neon\Entity) {
112 112
 					$class = $config['class']->value;
113 113
 					$arguments = $config['class']->attributes;
114 114
 				}
115 115
 				$reflectionClass = new \ReflectionClass($class);
116 116
 				$service = $reflectionClass->newInstanceArgs($arguments);
117
-				if(isset($config['setup'])){
118
-					foreach($config['setup'] as $neonEntity){
119
-						if(!method_exists($service, $neonEntity->value)){
117
+				if (isset($config['setup'])) {
118
+					foreach ($config['setup'] as $neonEntity) {
119
+						if (!method_exists($service, $neonEntity->value)) {
120 120
 							throw new ContainerFactoryException("Class $class does not have method $neonEntity->value().");
121 121
 						}
122 122
 						call_user_func_array(array($service, $neonEntity->value), $neonEntity->attributes);
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
 	{
178 178
 		$config = $this->resolveUnmergables($config);
179 179
 		foreach ($config as $key => $value) {
180
-			if($value instanceof \Nette\Neon\Entity){
180
+			if ($value instanceof \Nette\Neon\Entity) {
181 181
 				$value->value = $this->parseValue($value->value, $allConfig);
182
-				foreach($value->attributes as $k => $v){
183
-					if(is_array($v)){
182
+				foreach ($value->attributes as $k => $v) {
183
+					if (is_array($v)) {
184 184
 						$value->attributes[$k] = $this->parseValues($v, $allConfig, array_merge($keysPath, [$key]));
185
-					} else{
185
+					} else {
186 186
 						$value->attributes[$k] = $this->parseValue($v, $allConfig);
187 187
 					}
188 188
 				}
189 189
 			} elseif (is_array($value)) {
190 190
 				$value = $this->parseValues($value, $allConfig, array_merge($keysPath, [$key]));
191
-			} elseif(!is_object($value)) {
191
+			} elseif (!is_object($value)) {
192 192
 				$value = $this->parseValue($value, $allConfig);
193 193
 			}
194 194
 
@@ -215,14 +215,14 @@  discard block
 block discarded – undo
215 215
 		if (preg_match_all('#%([^%]+)%#', $value, $matches)) {
216 216
 			foreach ($matches[1] as $match) {
217 217
 				$parameter = $config['parameters'];
218
-				foreach(explode(".", $match) as $m){
218
+				foreach (explode(".", $match) as $m) {
219 219
 					if (!array_key_exists($m, $parameter)) {
220 220
 						throw new ContainerFactoryException("Cannot find variable '$match', part '$m'.");
221 221
 					}
222 222
 					$parameter = $parameter[$m];
223 223
 				}
224
-				if(is_array($parameter)){
225
-					if("%$match%" !== $value){ // if is variable value an array, must not be part of a string
224
+				if (is_array($parameter)) {
225
+					if ("%$match%" !== $value) { // if is variable value an array, must not be part of a string
226 226
 						throw new ContainerFactoryException("Array value cannot be part of a string.");
227 227
 					}
228 228
 					return $parameter;
Please login to merge, or discard this patch.
commands/Help.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 	 */
52 52
 	public function setSectionTasks($section, array $tasks)
53 53
 	{
54
-		if(!isset($this->sections[$section])){
54
+		if (!isset($this->sections[$section])) {
55 55
 			throw new InvalidArgumentException("Section '$section' not found.");
56 56
 		}
57 57
 		$this->sections[$section]['tasks'] = $tasks;
Please login to merge, or discard this patch.
commands/filesystem/Filesystem.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -130,17 +130,17 @@
 block discarded – undo
130 130
 				$this->log("Directory '$directory' cleaned.");
131 131
 			}
132 132
 		}
133
-		if(count($this->filesToCopy) > 0) {
133
+		if (count($this->filesToCopy) > 0) {
134 134
 			$this->log(Cli::getColoredString('Copying files', 'light_blue'));
135 135
 			$command = new File();
136 136
 			foreach ($this->filesToCopy as $destination => $options) {
137
-				if(is_file($destination)){
138
-					if($options['onDuplicate'] == self::ERROR){
137
+				if (is_file($destination)) {
138
+					if ($options['onDuplicate'] == self::ERROR) {
139 139
 						$this->error("File '$destination' already exists.");
140
-					}elseif($options['onDuplicate'] == self::SKIP){
140
+					}elseif ($options['onDuplicate'] == self::SKIP) {
141 141
 						$this->log("File '$destination' already exists, skipping ...");
142 142
 						continue;
143
-					}elseif($options['onDuplicate'] == self::REWRITE){
143
+					}elseif ($options['onDuplicate'] == self::REWRITE) {
144 144
 						$command->delete($destination);
145 145
 					}
146 146
 				}
Please login to merge, or discard this patch.