Completed
Pull Request — develop (#1)
by René
16:59
created
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.
src/Wambo/Core/Module/Module.php 2 patches
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.
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,6 @@
 block discarded – undo
33 33
 
34 34
     /**
35 35
      * Module constructor.
36
-     * @param string $namespace
37 36
      * @param string $name
38 37
      */
39 38
     public function __construct(string $name, string $version, string $class)
Please login to merge, or discard this patch.
src/Wambo/Core/Module/ModuleRepository.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
         try{
46 46
             $modulesData = $this->storage->read();
47
-        }catch(FileNotFoundException $e){
47
+        } catch(FileNotFoundException $e){
48 48
             return [];
49 49
         }
50 50
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $modules = array();
44 44
 
45
-        try{
45
+        try {
46 46
             $modulesData = $this->storage->read();
47
-        }catch(FileNotFoundException $e){
47
+        } catch (FileNotFoundException $e) {
48 48
             return [];
49 49
         }
50 50
 
51
-        foreach($modulesData as $moduleData)
51
+        foreach ($modulesData as $moduleData)
52 52
         {
53 53
             $modules[] = $this->mapper->getModule($moduleData);
54 54
         }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function add(Module $module)
62 62
     {
63
-        if($this->has($module)){
63
+        if ($this->has($module)) {
64 64
             return;
65 65
         }
66 66
         
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
     public function has(Module $origModule) : bool
79 79
     {
80 80
         $allModules = $this->getAll();
81
-        foreach($allModules as $module){
82
-            if($origModule->equals($module)){
81
+        foreach ($allModules as $module) {
82
+            if ($origModule->equals($module)) {
83 83
                 return true;
84 84
             }
85 85
         }
Please login to merge, or discard this patch.
src/Wambo/Core/Module/JSONModuleStorage.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@
 block discarded – undo
22 22
 
23 23
     public function read() : array
24 24
     {
25
-        try{
25
+        try {
26 26
             $json = $this->filesystem->read($this->filename);
27 27
         }
28
-        catch(FileNotFoundException $e)
28
+        catch (FileNotFoundException $e)
29 29
         {
30 30
             $json = "{}";
31 31
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@
 block discarded – undo
24 24
     {
25 25
         try{
26 26
             $json = $this->filesystem->read($this->filename);
27
-        }
28
-        catch(FileNotFoundException $e)
27
+        } catch(FileNotFoundException $e)
29 28
         {
30 29
             $json = "{}";
31 30
         }
Please login to merge, or discard this patch.
tests/Wambo/Core/DITest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
     {
18 18
         $container = new Container();
19 19
 
20
-        $container['filesystem_adapter'] = function($c){ return new MemoryAdapter(); };
21
-        $container['filesystem'] = function($c){ return new Filesystem($c['filesystem_adapter']); };
20
+        $container['filesystem_adapter'] = function($c) { return new MemoryAdapter(); };
21
+        $container['filesystem'] = function($c) { return new Filesystem($c['filesystem_adapter']); };
22 22
 
23
-        $container['module_repository'] = function($c){
23
+        $container['module_repository'] = function($c) {
24 24
             $storage = new JSONModuleStorage($c['filesystem'], 'modules.json');
25 25
             $mapper = new ModuleMapper();
26 26
             return new ModuleRepository($storage, $mapper);
Please login to merge, or discard this patch.
src/Wambo/Core/Module/ModuleMapper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
     public function getModule($data) : Module
14 14
     {
15 15
         // ToDo: may static is better?
16
-        if(!array_key_exists('name', $data) ||
16
+        if (!array_key_exists('name', $data) ||
17 17
             !array_key_exists('version', $data) ||
18 18
             !array_key_exists('class', $data)
19
-        ){
19
+        ) {
20 20
             throw new InvalidArgumentException('can not create Module. Not all nessesary data provided');
21 21
         }
22 22
 
Please login to merge, or discard this patch.
src/Wambo/Core/App.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
         $repo = $this->getContainer()->get('module_repository');
30 30
 
31 31
         /** @var Module $module */
32
-        foreach($repo->getAll() as $module){
32
+        foreach ($repo->getAll() as $module) {
33 33
             $moduleClass = $module->getClass();
34 34
             new $moduleClass($this);
35 35
         }
Please login to merge, or discard this patch.