Completed
Pull Request — develop (#1)
by René
03:39
created
src/Wambo/Core/Module/ModuleMapper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
      */
15 15
     public static function create($data) : Module
16 16
     {
17
-        if(!array_key_exists('namespace', $data) || !array_key_exists('name', $data)){
17
+        if (!array_key_exists('namespace', $data) || !array_key_exists('name', $data)) {
18 18
             throw new InvalidArgumentException('can not create Module. Not all nessesary data provided');
19 19
         }
20 20
 
Please login to merge, or discard this patch.
src/Wambo/Core/Module/ModuleRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         $modules = array();
39 39
 
40 40
         $modulesData = $this->storage->read();
41
-        foreach($modulesData as $moduleData)
41
+        foreach ($modulesData as $moduleData)
42 42
         {
43 43
             $modules[] = $this->mapper->getModule($moduleData);
44 44
         }
Please login to merge, or discard this patch.
src/Wambo/Core/Config.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,18 +37,18 @@  discard block
 block discarded – undo
37 37
      */
38 38
     private function loadModules($scope)
39 39
     {
40
-        $modules_json_filename = $this->getConfigDir() . '/' . $scope . '.json';
41
-        if ( !file_exists($modules_json_filename) ) {
40
+        $modules_json_filename = $this->getConfigDir().'/'.$scope.'.json';
41
+        if (!file_exists($modules_json_filename)) {
42 42
             throw new Exception('modules file not found');
43 43
         }
44
-        if ( !is_readable($modules_json_filename ) ) {
44
+        if (!is_readable($modules_json_filename)) {
45 45
             throw new Exception('modules file is not readable');
46 46
         }
47 47
         $modules_json = file_get_contents($modules_json_filename);
48 48
         $modules = json_decode($modules_json, true);
49 49
         // throw an Exception if something went wrong on json_decode
50 50
         if (json_last_error() !== JSON_ERROR_NONE) {
51
-            $msg = 'JSON decode Error: ' . json_last_error_msg();
51
+            $msg = 'JSON decode Error: '.json_last_error_msg();
52 52
             throw new Exception($msg);
53 53
         }
54 54
         $this->modules = array_merge($this->modules, $modules);
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
      */
63 63
     private function getConfigDir()
64 64
     {
65
-        $config_folder = WAMBO_ROOT_DIR . $this->config_folder_path;
66
-        if ( !file_exists($config_folder)){
65
+        $config_folder = WAMBO_ROOT_DIR.$this->config_folder_path;
66
+        if (!file_exists($config_folder)) {
67 67
             throw new Exception('config folder was not found');
68 68
         }
69
-        if ( !is_readable($config_folder) ){
69
+        if (!is_readable($config_folder)) {
70 70
             throw new Exception('config folder was not readable');
71 71
         }
72 72
         return $config_folder;
Please login to merge, or discard this patch.
src/Wambo/Core/App.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
24 24
      */
25 25
     private function loadModules()
26 26
     {
27
-        foreach($this->config->getModules() as $module){
28
-            $module_class = $module['namespace'] . '\\' . $module['name'];
27
+        foreach ($this->config->getModules() as $module) {
28
+            $module_class = $module['namespace'].'\\'.$module['name'];
29 29
             new $module_class($this);
30 30
         }
31 31
     }
Please login to merge, or discard this patch.
src/Wambo/Core/Storage/JSONDecoder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
     public function getData(string $json)
14 14
     {
15 15
         $data = json_decode($json, true);
16
-        if($error = json_last_error() !== JSON_ERROR_NONE){
17
-            throw new RuntimeException( json_last_error_msg() );
16
+        if ($error = json_last_error() !== JSON_ERROR_NONE) {
17
+            throw new RuntimeException(json_last_error_msg());
18 18
         }
19 19
 
20 20
         return $data;
Please login to merge, or discard this patch.
tests/Wambo/Core/Module/ModuleTest.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace Wambo\Core\Module;
4 4
 
5 5
 use PHPUnit\Framework\TestCase;
6
-use Symfony\Component\Config\Definition\Exception\Exception;
7 6
 use Wambo\Core\Module\Exception\InvalidArgumentException;
8 7
 
9 8
 /**
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -59,20 +59,20 @@
 block discarded – undo
59 59
      */
60 60
     public function testConstructorValidation($namespace, $name, $expectedExceptionMsg)
61 61
     {
62
-        new Module($namespace,$name);
62
+        new Module($namespace, $name);
63 63
     }
64 64
 
65 65
     public function constructorDataProvider()
66 66
     {
67 67
         return [
68
-            ['', 'MyClass', 'namespace can not be empty'],          // empty namespace
69
-            ['My Namespace', 'MyClass', 'illigal namespace'],       // space in namespace
70
-            ["My\tNamespace", 'MyClass', 'illigal namespace'],      // tab in namespace
68
+            ['', 'MyClass', 'namespace can not be empty'], // empty namespace
69
+            ['My Namespace', 'MyClass', 'illigal namespace'], // space in namespace
70
+            ["My\tNamespace", 'MyClass', 'illigal namespace'], // tab in namespace
71 71
 
72
-            ['My\Namespace', '', 'name can not be empty'],          // empty name
73
-            ['My\Namespace', 'My Class', 'illigal name'],           // space in name
74
-            ['My\Namespace', "My\tClass", 'illigal name'],          // tab in name
75
-            ['My\Namespace ', 'MyClass', 'name can not be empty'],  // space name
72
+            ['My\Namespace', '', 'name can not be empty'], // empty name
73
+            ['My\Namespace', 'My Class', 'illigal name'], // space in name
74
+            ['My\Namespace', "My\tClass", 'illigal name'], // tab in name
75
+            ['My\Namespace ', 'MyClass', 'name can not be empty'], // space name
76 76
         ];
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
src/Wambo/Core/Module/Module.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,12 +69,12 @@
 block discarded – undo
69 69
     private function validate(string $attr, string $attrName)
70 70
     {
71 71
         // empty
72
-        if(strlen($attr) === 0){
72
+        if (strlen($attr) === 0) {
73 73
             throw new InvalidArgumentException(sprintf('%s can not be empty', $attrName));
74 74
         }
75 75
 
76 76
         // whitespaces
77
-        if(preg_match('/\s/', $attr)){
77
+        if (preg_match('/\s/', $attr)) {
78 78
             throw new InvalidArgumentException(sprintf('illigal %s', $attrName));
79 79
         }
80 80
     }
Please login to merge, or discard this patch.