Passed
Push — develop ( 33983c...cd4207 )
by Paul
03:13
created
src/Config/ConfigManager.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -141,6 +141,7 @@  discard block
 block discarded – undo
141 141
 	}
142 142
 
143 143
 	/**
144
+	 * @param integer $timestamp
144 145
 	 * @return array
145 146
 	 */
146 147
 	public function setTimestamp( array $config, $timestamp = null )
@@ -198,6 +199,7 @@  discard block
 block discarded – undo
198 199
 	}
199 200
 
200 201
 	/**
202
+	 * @param string $value
201 203
 	 * @return mixed
202 204
 	 */
203 205
 	protected function parseYaml( $value )
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 	{
47 47
 		$yamlFile = $this->getYamlFile();
48 48
 		$yaml = $this->normalize(
49
-			$this->parseYaml( file_get_contents( $yamlFile ))
49
+			$this->parseYaml( file_get_contents( $yamlFile ) )
50 50
 		);
51
-		if( !$yaml['disable_config'] ) {
51
+		if( !$yaml[ 'disable_config' ] ) {
52 52
 			$config = $this->normalizeArray(
53
-				array_filter( (array) get_option( Config::id(), [] ))
53
+				array_filter( (array) get_option( Config::id(), [ ] ) )
54 54
 			);
55 55
 		}
56 56
 		return empty( $config )
57
-			? $this->setTimestamp( $yaml, filemtime( $yamlFile ))
57
+			? $this->setTimestamp( $yaml, filemtime( $yamlFile ) )
58 58
 			: $this->normalize( $config );
59 59
 	}
60 60
 
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 	public function compile()
65 65
 	{
66 66
 		$configFile = $this->getCompileDestination();
67
-		if( $this->shouldCompile( $configFile )) {
67
+		if( $this->shouldCompile( $configFile ) ) {
68 68
 			file_put_contents( $configFile, sprintf( '<?php // DO NOT MODIFY THIS FILE DIRECTLY!%sreturn (object) %s;',
69 69
 				PHP_EOL,
70
-				$this->parseRawStrings( var_export( $this->setTimestamp( $this->options ), true ))
71
-			));
70
+				$this->parseRawStrings( var_export( $this->setTimestamp( $this->options ), true ) )
71
+			) );
72 72
 		}
73 73
 		return include $configFile;
74 74
 	}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	public function convertArrayToYaml( array $array )
80 80
 	{
81 81
 		return !empty( $array )
82
-			? trim( $this->parseRawStrings( $this->dumpYaml( $array )))
82
+			? trim( $this->parseRawStrings( $this->dumpYaml( $array ) ) )
83 83
 			: '';
84 84
 	}
85 85
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 			trailingslashit( trailingslashit( $theme->theme_root ) . $theme->template ),
107 107
 			trailingslashit( WP_CONTENT_DIR ),
108 108
 			trailingslashit( ABSPATH ),
109
-			trailingslashit( dirname( ABSPATH )),
110
-			trailingslashit( dirname( dirname( ABSPATH ))),
111
-		]);
109
+			trailingslashit( dirname( ABSPATH ) ),
110
+			trailingslashit( dirname( dirname( ABSPATH ) ) ),
111
+		] );
112 112
 		foreach( (array) $configLocations as $location ) {
113
-			if( !file_exists( $location . $configYaml ))continue;
113
+			if( !file_exists( $location . $configYaml ) )continue;
114 114
 			return $location . $configYaml;
115 115
 		}
116 116
 		return $this->app->path( 'defaults.yml' );
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	public function setTimestamp( array $config, $timestamp = null )
147 147
 	{
148 148
 		$timestamp || $timestamp = time();
149
-		$config['updated'] = $timestamp;
149
+		$config[ 'updated' ] = $timestamp;
150 150
 		return $config;
151 151
 	}
152 152
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			return Yaml::dump( $array, 13, 2 );
168 168
 		}
169 169
 		catch( DumpException $e ) {
170
-			error_log( print_r( $e->getMessage(), 1 ));
170
+			error_log( print_r( $e->getMessage(), 1 ) );
171 171
 		}
172 172
 	}
173 173
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	{
179 179
 		return wp_parse_args(
180 180
 			$config,
181
-			$this->parseYaml( file_get_contents( $this->app->path( 'defaults.yml' )))
181
+			$this->parseYaml( file_get_contents( $this->app->path( 'defaults.yml' ) ) )
182 182
 		);
183 183
 	}
184 184
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		$pattern = '/(\')((' . implode( '|', $strings ) . ')\(?.+\))(\')/';
193 193
 		return stripslashes(
194 194
 			preg_replace_callback( $pattern, function( $matches ) {
195
-				return str_replace( "''", "'", $matches[2] );
195
+				return str_replace( "''", "'", $matches[ 2 ] );
196 196
 			}, $configString )
197 197
 		);
198 198
 	}
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 		}
208 208
 		catch( ParseException $e ) {
209 209
 			// http://api.symfony.com/3.2/Symfony/Component/Yaml/Exception/ParseException.html
210
-			error_log( print_r( sprintf( 'Unable to parse the YAML string: %s', $e->getMessage() ), 1 ));
211
-			error_log( print_r( $e->getParsedFile(), 1 ));
212
-			error_log( print_r( $e->getParsedLine(), 1 ));
213
-			error_log( print_r( $e->getSnippet(), 1 ));
210
+			error_log( print_r( sprintf( 'Unable to parse the YAML string: %s', $e->getMessage() ), 1 ) );
211
+			error_log( print_r( $e->getParsedFile(), 1 ) );
212
+			error_log( print_r( $e->getParsedLine(), 1 ) );
213
+			error_log( print_r( $e->getSnippet(), 1 ) );
214 214
 		}
215 215
 	}
216 216
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	protected function shouldCompile( $configFile )
222 222
 	{
223
-		if( !file_exists( $configFile )) {
223
+		if( !file_exists( $configFile ) ) {
224 224
 			return true;
225 225
 		}
226 226
 		$config = include $configFile;
Please login to merge, or discard this patch.