Passed
Pull Request — master (#14)
by
unknown
08:37
created
src/functions.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     // Working from the first key, descend into the array until nothing is found
13 13
     return array_reduce(
14 14
         explode('.', $dotPath),
15
-        function ($config, $key) use ($default) {
15
+        function($config, $key) use ($default) {
16 16
             return isset($config[$key]) ? $config[$key] : $default;
17 17
         },
18 18
         $config
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     // Work backward from the last key, wrapping each key in an array
28 28
     $replace = array_reduce(
29 29
         array_reverse(explode('.', $dotPath)),
30
-        function ($value, $key) {
30
+        function($value, $key) {
31 31
             return [$key => $value];
32 32
         },
33 33
         $value
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
  * alternative to var_export that exports an array to short array syntax
42 42
  * copyright disclaimer: orignally written by stemar: [https://gist.github.com/stemar/bb7c5cd2614b21b624bf57608f995ac0]
43 43
  */
44
-function varexport($expression, $return=FALSE) {
44
+function varexport($expression, $return = FALSE) {
45 45
     $export = var_export($expression, TRUE);
46 46
     $export = preg_replace("/^([ ]*)(.*)/m", '$1$1$2', $export);
47 47
     $array = preg_split("/\r\n|\n|\r/", $export);
48 48
     $array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array);
49 49
     $export = join(PHP_EOL, array_filter(["["] + $array));
50
-    if ((bool)$return) return $export; else echo $export;
50
+    if ((bool) $return) return $export; else echo $export;
51 51
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,5 +47,9 @@
 block discarded – undo
47 47
     $array = preg_split("/\r\n|\n|\r/", $export);
48 48
     $array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array);
49 49
     $export = join(PHP_EOL, array_filter(["["] + $array));
50
-    if ((bool)$return) return $export; else echo $export;
51
-}
50
+    if ((bool)$return) {
51
+        return $export;
52
+    } else {
53
+        echo $export;
54
+    }
55
+    }
Please login to merge, or discard this patch.
src/Decorator/VariableDecorator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
         if (is_array($value)) {
48 48
             return array_map(
49
-                function ($value) {
49
+                function($value) {
50 50
                     return $this->replaceVariables($value);
51 51
                 },
52 52
                 $value
Please login to merge, or discard this patch.
src/ConfigCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     private function reducer(string $dotPath): callable
27 27
     {
28
-        return static function ($currentValue, ConfigInterface $config) use ($dotPath) {
28
+        return static function($currentValue, ConfigInterface $config) use ($dotPath) {
29 29
             $found = $config->get($dotPath, null);
30 30
 
31 31
             if ($found === null) {
Please login to merge, or discard this patch.
src/Loader/PhpLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@
 block discarded – undo
23 23
     public function unload(string $path, array $data)
24 24
     {
25 25
 
26
-        if ( is_file("{$path}.php") && !copy("{$path}.php", "{$path}.backup.php") ) {
26
+        if (is_file("{$path}.php") && !copy("{$path}.php", "{$path}.backup.php")) {
27 27
             throw LoaderException::backupFail(static::class);
28 28
         }
29 29
         $filename = basename($path);
30 30
         
31
-        file_put_contents("{$path}.php" , "<?php " . PHP_EOL . " return " . \Northwoods\Config\varexport($data[$filename], true) . ';' . PHP_EOL);
31
+        file_put_contents("{$path}.php", "<?php ".PHP_EOL." return ".\Northwoods\Config\varexport($data[$filename], true).';'.PHP_EOL);
32 32
     }
33 33
 }
Please login to merge, or discard this patch.
tests/FactoryTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function testDirectory()
20 20
     {
21 21
         $config = ConfigFactory::make([
22
-            'directory' => __DIR__ . '/../examples',
22
+            'directory' => __DIR__.'/../examples',
23 23
         ]);
24 24
 
25 25
         // it implements the configuration interfaces
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         // in order to make the test run smoothly i will change the filename
48 48
         $config->set('customSafe.dynamic.key', 'value', true);
49 49
         $config = ConfigFactory::make([
50
-            'directory' => __DIR__ . '/../examples',
50
+            'directory' => __DIR__.'/../examples',
51 51
         ]);
52 52
         $this->assertSame('value', $config->get('customSafe.dynamic.key'));
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function testEnvironment()
57 57
     {
58 58
         $config = ConfigFactory::make([
59
-            'directory' => __DIR__ . '/../examples',
59
+            'directory' => __DIR__.'/../examples',
60 60
             'environment' => 'dev',
61 61
         ]);
62 62
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
         // new environments can be created
78 78
         $config = ConfigFactory::make([
79
-            'directory' => __DIR__ . '/../examples',
79
+            'directory' => __DIR__.'/../examples',
80 80
             'environment' => 'prod',
81 81
         ]);
82 82
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     public function testYamlDirectory()
99 99
     {
100 100
         $config = ConfigFactory::make([
101
-            'directory' => __DIR__ . '/../examples',
101
+            'directory' => __DIR__.'/../examples',
102 102
             'environment' => 'dev',
103 103
             'type' => 'yaml',
104 104
         ]);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         // new environments can be created
122 122
         $config = ConfigFactory::make([
123
-            'directory' => __DIR__ . '/../examples',
123
+            'directory' => __DIR__.'/../examples',
124 124
             'environment' => 'prod',
125 125
             'type' => 'yaml',
126 126
         ]);
Please login to merge, or discard this patch.