Completed
Push — master ( baf44b...2e8cc4 )
by Kevin
05:16 queued 02:33
created
lib/Cli/Command/ApiPing.php 2 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -5,13 +5,9 @@
 block discarded – undo
5 5
 use Guzzle\Http\Client;
6 6
 use Magium\Cli\Command\Test\TestSkeleton;
7 7
 use Magium\InvalidConfigurationException;
8
-use Magium\NotFoundException;
9 8
 use Magium\Util\Api\ApiConfiguration;
10 9
 use Symfony\Component\Console\Command\Command;
11
-use Symfony\Component\Console\Input\ArrayInput;
12
-use Symfony\Component\Console\Input\InputArgument;
13 10
 use Symfony\Component\Console\Input\InputInterface;
14
-use Symfony\Component\Console\Input\InputOption;
15 11
 use Symfony\Component\Console\Output\OutputInterface;
16 12
 
17 13
 class ApiPing extends Command
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
         $api = $test->get('Magium\Util\Api\ApiConfiguration');
32 32
         /* @var $api ApiConfiguration */
33 33
         if (!$api instanceof ApiConfiguration) {
34
-            throw new InvalidConfigurationException('Did not receive an instance of ApiConfiguration; received ' . get_class($api));
34
+            throw new InvalidConfigurationException('Did not receive an instance of ApiConfiguration; received '.get_class($api));
35 35
         }
36 36
         $api->setEnabled(true); // Gotta force this for this test
37 37
 
38 38
         $output->writeln('Sending un-authenticated payload...');
39
-        $client = new Client('http://' . $api->getApiHostname(). '/api/ping');
39
+        $client = new Client('http://'.$api->getApiHostname().'/api/ping');
40 40
         $request = $client->get();
41 41
         $response = $request->send();
42 42
         $output->writeln(
43 43
             'Checking for 200 status message... '
44
-            . ($response->getStatusCode() == '200'?'OK':'Failed')
44
+            . ($response->getStatusCode() == '200' ? 'OK' : 'Failed')
45 45
         );
46 46
         $output->writeln(
47 47
             'Checking for application/json content type... '
48
-            . (stripos($response->getContentType(), 'application/json') !== false?'OK':'Failed')
48
+            . (stripos($response->getContentType(), 'application/json') !== false ? 'OK' : 'Failed')
49 49
         );
50 50
         $content = json_decode($response->getBody(), true);
51 51
         $output->writeln(
52 52
             'Checking for successful response... '
53
-            . (is_array($content) && isset($content['status']) && $content['status'] === 'success'?'OK':'Failed')
53
+            . (is_array($content) && isset($content['status']) && $content['status'] === 'success' ? 'OK' : 'Failed')
54 54
         );
55 55
 
56 56
         $output->writeln('');
@@ -62,16 +62,16 @@  discard block
 block discarded – undo
62 62
 
63 63
         $output->writeln(
64 64
             'Checking for 200 status message... '
65
-            . ($response->getStatusCode() == '200'?'OK':'Failed')
65
+            . ($response->getStatusCode() == '200' ? 'OK' : 'Failed')
66 66
         );
67 67
         $output->writeln(
68 68
             'Checking for application/json content type... '
69
-            . (stripos($response->getContentType(), 'application/json') !== false?'OK':'Failed')
69
+            . (stripos($response->getContentType(), 'application/json') !== false ? 'OK' : 'Failed')
70 70
         );
71 71
         $content = $request->getPayload($response);
72 72
         $output->writeln(
73 73
             'Checking for successful response... '
74
-            . (is_array($content) && isset($content['status']) && $content['status'] === 'success'?'OK':'Failed')
74
+            . (is_array($content) && isset($content['status']) && $content['status'] === 'success' ? 'OK' : 'Failed')
75 75
         );
76 76
 
77 77
 
@@ -82,20 +82,20 @@  discard block
 block discarded – undo
82 82
         $response = $request->push('/api/echo-authed', ['message' => 'hello world']);
83 83
         $output->writeln(
84 84
             'Checking for 200 status message... '
85
-            . ($response->getStatusCode() == '200'?'OK':'Failed')
85
+            . ($response->getStatusCode() == '200' ? 'OK' : 'Failed')
86 86
         );
87 87
         $output->writeln(
88 88
             'Checking for application/json content type... '
89
-            . (stripos($response->getContentType(), 'application/json') !== false?'OK':'Failed')
89
+            . (stripos($response->getContentType(), 'application/json') !== false ? 'OK' : 'Failed')
90 90
         );
91 91
         $content = $request->getPayload($response);
92 92
         $output->writeln(
93 93
             'Checking for successful response... '
94
-            . (is_array($content) && isset($content['status']) && $content['status'] === 'success'?'OK':'Failed')
94
+            . (is_array($content) && isset($content['status']) && $content['status'] === 'success' ? 'OK' : 'Failed')
95 95
         );
96 96
         $output->writeln(
97 97
             'Checking for matching echo message... '
98
-            . (is_array($content) && isset($content['message']) && $content['message'] === 'hello world'?'OK':'Failed')
98
+            . (is_array($content) && isset($content['message']) && $content['message'] === 'hello world' ? 'OK' : 'Failed')
99 99
         );
100 100
     }
101 101
     
Please login to merge, or discard this patch.
lib/Util/Configuration/ClassConfigurationReader.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
             }
54 54
         }
55 55
 
56
-        if (!is_dir($configurationDir)) return;
56
+        if (!is_dir($configurationDir)) {
57
+            return;
58
+        }
57 59
 
58 60
         $configurationFile = get_class($config) . '.php';
59 61
         $configurationFile = $configurationDir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $configurationFile);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
             $isVendor = array_pop($testParts) == 'vendor';
45 45
 
46 46
             if ($isVendor) {
47
-                $path = realpath(__DIR__ . '/../../../../..'); // Get out of the Magium directories
47
+                $path = realpath(__DIR__.'/../../../../..'); // Get out of the Magium directories
48 48
             } else {
49
-                $path = realpath(__DIR__ . '/../../..');
49
+                $path = realpath(__DIR__.'/../../..');
50 50
             }
51 51
 
52 52
             $count = 0;
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         $classes = array_reverse($classes);
86 86
 
87 87
         foreach ($classes as $class) {
88
-            $configurationFile = $class . '.php';
89
-            $configurationFile = $configurationDir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $configurationFile);
88
+            $configurationFile = $class.'.php';
89
+            $configurationFile = $configurationDir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $configurationFile);
90 90
 
91 91
             if (file_exists($configurationFile)) {
92 92
                 include $configurationFile;
Please login to merge, or discard this patch.
lib/Cli/CommandLoader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     )
20 20
     {
21 21
         if (!is_dir($configDir)) {
22
-            throw new NotFoundException('Configuration dir not found: ' . $configDir);
22
+            throw new NotFoundException('Configuration dir not found: '.$configDir);
23 23
         }
24 24
         $this->config = $configDir;
25 25
 
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function load()
30 30
     {
31
-        self::addCommandDir('Magium\Cli\Command', __DIR__ . '/Command');
31
+        self::addCommandDir('Magium\Cli\Command', __DIR__.'/Command');
32 32
 
33 33
         foreach (self::$dirs as $namespace => $dir) {
34
-            $files = glob($dir . '/*.php');
34
+            $files = glob($dir.'/*.php');
35 35
 
36 36
             foreach ($files as $file) {
37 37
                 $class = substr(basename($file), 0, -4);
38
-                $className = $namespace . '\\' . $class;
38
+                $className = $namespace.'\\'.$class;
39 39
                 if (class_exists($className)) {
40 40
                     $reflection = new \ReflectionClass($className);
41 41
                     if (!$reflection->isInstantiable()) {
Please login to merge, or discard this patch.
lib/Cli/Command/SetElementValue.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 
35 35
     protected function execute(InputInterface $input, OutputInterface $output)
36 36
     {
37
-        if (!file_exists($this->path . '/magium.json')) {
37
+        if (!file_exists($this->path.'/magium.json')) {
38 38
             throw new NotFoundException('Configuration file not found.  Please execute magium:init.');
39 39
         }
40 40
         $reader = new \Zend\Config\Reader\Json();
41
-        $config = new Config($reader->fromFile($this->path . '/magium.json'), true);
41
+        $config = new Config($reader->fromFile($this->path.'/magium.json'), true);
42 42
 
43 43
         $class = $input->getArgument('class');
44 44
         $property = $input->getArgument('property');
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             $config->magium = [];
52 52
         }
53 53
         if (!class_exists($class)) {
54
-            throw new NotFoundException('Could not find class: ' . $class . '.  You might need to escape blackslashes (\\\\)');
54
+            throw new NotFoundException('Could not find class: '.$class.'.  You might need to escape blackslashes (\\\\)');
55 55
         }
56 56
         $class = strtolower($class);
57 57
         $s = $config->magium;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $s[$class]->$property = $value;
63 63
 
64 64
         $writer = new Json();
65
-        $writer->toFile($this->path . '/magium.json', $config);
65
+        $writer->toFile($this->path.'/magium.json', $config);
66 66
         $output->writeln(sprintf('Wrote value %s for "%s:%s" to %s/magium.json', $value, $class, $property, $this->path));
67 67
     }
68 68
 
Please login to merge, or discard this patch.
lib/Cli/Command/GetElementValue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $collector = new DefaultPropertyCollector();
38 38
         $class = $input->getArgument('class');
39 39
         if (!class_exists($class)) {
40
-            throw new NotFoundException('Could not find the class: ' . $class);
40
+            throw new NotFoundException('Could not find the class: '.$class);
41 41
         }
42 42
         if (!is_subclass_of($class, 'Magium\AbstractConfigurableElement')) {
43 43
             throw new \InvalidArgumentException('Class must be a sub-class of Magium\AbstractConfigurableElement');
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
         foreach ($print as $property) {
59 59
             $output->writeln('');
60 60
             $output->writeln($property->getName());
61
-            $output->writeln("\tDefault Value: " . $property->getDefaultValue());
61
+            $output->writeln("\tDefault Value: ".$property->getDefaultValue());
62 62
             if ($property->getDescription()) {
63
-                $output->writeln("\t" . $property->getDescription());
63
+                $output->writeln("\t".$property->getDescription());
64 64
             }
65 65
         }
66 66
     }
Please login to merge, or discard this patch.
lib/Cli/Command/AbstractApiEnablement.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
     protected function configure()
22 22
     {
23
-        $this->setName('api:' . $this->getApiName());
23
+        $this->setName('api:'.$this->getApiName());
24 24
         $this->setDescription($this->getApiDescription());
25 25
     }
26 26
 
Please login to merge, or discard this patch.
lib/Cli/Command/Init.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,22 +32,22 @@
 block discarded – undo
32 32
     {
33 33
         $path = $this->path;
34 34
         if ($path && $path[0] != '/' && $path[1] != ':') {
35
-            $path = getcwd() . '/' . $path;
35
+            $path = getcwd().'/'.$path;
36 36
         }
37 37
         $calcPath = $path;
38 38
         $path = realpath($path);
39 39
         if ($path === false) {
40
-            throw new NotFoundException('Path not found: ' . $calcPath);
40
+            throw new NotFoundException('Path not found: '.$calcPath);
41 41
         }
42 42
         if (!is_writable($path)) {
43
-            throw new NotAccessibleException('Could not write to path: ' . $calcPath);
43
+            throw new NotAccessibleException('Could not write to path: '.$calcPath);
44 44
         }
45
-        $fullPath = $path . '/magium.json';
45
+        $fullPath = $path.'/magium.json';
46 46
         if (file_exists($fullPath)) {
47
-            throw new ExistsException('The file exists already.  Will not overwrite: ' . $fullPath);
47
+            throw new ExistsException('The file exists already.  Will not overwrite: '.$fullPath);
48 48
         }
49 49
         file_put_contents($fullPath, '{}');
50
-        $output->writeln('Created empty JSON configuration file: ' . realpath($fullPath));
50
+        $output->writeln('Created empty JSON configuration file: '.realpath($fullPath));
51 51
 
52 52
     }
53 53
 
Please login to merge, or discard this patch.
lib/Cli/Command/ListElements.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     public static function addDirectory($dir, $namespace)
18 18
     {
19 19
         if ($dir != realpath($dir)) {
20
-            throw new InvalidConfigurationException('Path not found.  Please ensure that you pass the realpath() in: ' . $dir);
20
+            throw new InvalidConfigurationException('Path not found.  Please ensure that you pass the realpath() in: '.$dir);
21 21
         }
22 22
         self::$dirs[$dir] = $namespace;
23 23
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             'Set if you want the namespace output escaped (useful for copy and paste)'
76 76
         );
77 77
 
78
-        self::addDirectory(realpath(__DIR__ . '/../..'), 'Magium');
78
+        self::addDirectory(realpath(__DIR__.'/../..'), 'Magium');
79 79
     }
80 80
 
81 81
     protected function execute(InputInterface $input, OutputInterface $output)
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
         sort($paths);
100 100
         $filter = $input->getArgument('filter');
101
-        if (count($paths) > 0 ) {
101
+        if (count($paths) > 0) {
102 102
             $output->writeln('Classes found: ');
103 103
             $escape = $input->getOption('escape');
104 104
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     $path = str_replace('\\', '\\\\', $path);
108 108
                 }
109 109
                 if ($filter && stripos($path, $filter) !== false) {
110
-                    $output->writeln("\t" . $path);
110
+                    $output->writeln("\t".$path);
111 111
                 }
112 112
             }
113 113
         } else {
Please login to merge, or discard this patch.
lib/Cli/Command/SetSetting.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 
34 34
     protected function execute(InputInterface $input, OutputInterface $output)
35 35
     {
36
-        if (!file_exists($this->path . '/magium.json')) {
36
+        if (!file_exists($this->path.'/magium.json')) {
37 37
             throw new NotFoundException('Configuration file not found.  Please execute magium:init.');
38 38
         }
39 39
         $reader = new \Zend\Config\Reader\Json();
40
-        $config = new Config($reader->fromFile($this->path . '/magium.json'), true);
40
+        $config = new Config($reader->fromFile($this->path.'/magium.json'), true);
41 41
 
42 42
         $name = $input->getArgument('name');
43 43
         $value = $input->getArgument('value');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $config->config->$name = $value;
53 53
 
54 54
         $writer = new Json();
55
-        $writer->toFile($this->path . '/magium.json', $config);
55
+        $writer->toFile($this->path.'/magium.json', $config);
56 56
         $output->writeln(sprintf('Wrote value for "%s" to %s/magium.json', $name, $this->path));
57 57
     }
58 58
 
Please login to merge, or discard this patch.