Completed
Push — master ( 3a87d5...4e429b )
by Kirill
04:26
created
src/AppBundle/Action/Executor/Movement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@
 block discarded – undo
17 17
         $variable = false;
18 18
 
19 19
         foreach ($params as $param) {
20
-            list($p,$v) = explode(':', $param);
21
-            if ($p=='variable') {
20
+            list($p, $v) = explode(':', $param);
21
+            if ($p == 'variable') {
22 22
                 $variable = $this->
23 23
                                 getDoctrine()->
24 24
                                 getManager()->
Please login to merge, or discard this patch.
src/AppBundle/Action/Service.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -34,6 +34,9 @@
 block discarded – undo
34 34
         return $this->execute($action, $source, $changeSet, true);
35 35
     }
36 36
 
37
+    /**
38
+     * @param string $source
39
+     */
37 40
     public function executeReal(Action $action, $source, $arguments)
38 41
     {
39 42
         return $this->execute($action, $source, $arguments, false);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
         if (!$virtual) {
48 48
             list($executor, $method) = explode(':', $action->getExecutor());
49 49
 
50
-            $executor = 'AppBundle\Action\Executor\\' . ucfirst($executor);
50
+            $executor = 'AppBundle\Action\Executor\\'.ucfirst($executor);
51 51
 
52 52
             if (!class_exists($executor)) {
53
-                throw new \Exception('Unknown executor: ' . $executor);
53
+                throw new \Exception('Unknown executor: '.$executor);
54 54
             }
55 55
 
56 56
             /** @var ExecutorInterface $executor */
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             }
64 64
 
65 65
             if (!method_exists($executor, $method)) {
66
-                throw new \Exception('Unknown executor method: ' . $action->getExecutor().'()');
66
+                throw new \Exception('Unknown executor method: '.$action->getExecutor().'()');
67 67
             }
68 68
 
69 69
             $executor->setParameters($changeSet);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             } catch (\Exception $exception) {
74 74
                 $result = $exception->getMessage();
75 75
             }
76
-            $changeSet['result']=$result;
76
+            $changeSet['result'] = $result;
77 77
         }
78 78
 
79 79
         $state = new ActionHistory();
Please login to merge, or discard this patch.
src/AppBundle/Action/Executor/Saytext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 {
10 10
     public function say(Action $action)
11 11
     {
12
-        $args =  json_decode($action->getArguments(), true);
12
+        $args = json_decode($action->getArguments(), true);
13 13
 
14 14
         if (isset($this->parameters['text'])) {
15 15
             $text = $this->parameters['text'];
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
                 urlencode($text)."&tl=De_de");
37 37
             file_put_contents($file, $res);
38 38
 
39
-            $result= 'Saved in cache';
39
+            $result = 'Saved in cache';
40 40
         }
41 41
 
42 42
         $res = exec('which mplayer');
Please login to merge, or discard this patch.
src/AppBundle/Command/RunCronsCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
                 continue;
34 34
             }
35 35
 
36
-            if (time()-$args['last'] >= $args['every']) {
36
+            if (time() - $args['last'] >= $args['every']) {
37 37
                 $output->writeln('Running '.$cronAction->getExecutor().' for "'.
38 38
                     $cronAction->getDevice()->getName().'" device');
39 39
                 $this->
Please login to merge, or discard this patch.
src/AppBundle/Action/Executor/Noolite.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
         $deviceParams = $device->getParams();
14 14
         $ch = 0;
15 15
         foreach ($deviceParams as $deviceParam) {
16
-            list($param,$value) = explode(':', $deviceParam);
16
+            list($param, $value) = explode(':', $deviceParam);
17 17
             if ($param == 'channel') {
18 18
                 $ch = $value;
19 19
                 break;
Please login to merge, or discard this patch.
src/AppBundle/Controller/NooliteController.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 
14 14
     private $channelMap = [
15 15
 
16
-        1 => ['name'=>'noolite.main','source'=>'human'],
17
-        2 => ['name'=>'noolite.kitchen','source'=>'human'],
18
-        3 => ['name'=>'noolite.diningroom','source'=>'human'],
19
-        4 => ['name'=>'noolite.main','source'=>'pi'],
20
-        5 => ['name'=>'noolite.toilet','source'=>'pi'],
21
-        6 => ['name'=>'noolite.diningroom','source'=>'pi'],
22
-        7 => ['name'=>'noolite.kitchen','source'=>'pi'],
23
-        9 => ['name'=>'noolite.toilet','source'=>'human,upper'],
24
-        10 => ['name'=>'noolite.toilet','source'=>'human,lower'],
16
+        1 => ['name'=>'noolite.main', 'source'=>'human'],
17
+        2 => ['name'=>'noolite.kitchen', 'source'=>'human'],
18
+        3 => ['name'=>'noolite.diningroom', 'source'=>'human'],
19
+        4 => ['name'=>'noolite.main', 'source'=>'pi'],
20
+        5 => ['name'=>'noolite.toilet', 'source'=>'pi'],
21
+        6 => ['name'=>'noolite.diningroom', 'source'=>'pi'],
22
+        7 => ['name'=>'noolite.kitchen', 'source'=>'pi'],
23
+        9 => ['name'=>'noolite.toilet', 'source'=>'human,upper'],
24
+        10 => ['name'=>'noolite.toilet', 'source'=>'human,lower'],
25 25
     ];
26 26
 
27 27
     /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             $changeSet = [];
61 61
 
62 62
 
63
-            if ($request->get('cmd')==4) {
63
+            if ($request->get('cmd') == 4) {
64 64
                 // reverse state, only by human
65 65
 
66 66
                 $oldState = $device->getState();
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                     /** @var Action $action */
74 74
                     foreach ($actions as $action) {
75 75
                         $args = json_decode($action->getArguments(), true);
76
-                        if (isset($args['state']) && ($args['state']=='on')) {
76
+                        if (isset($args['state']) && ($args['state'] == 'on')) {
77 77
                             $resultAction = $action;
78 78
                             break;
79 79
                         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                     /** @var Action $action */
85 85
                     foreach ($actions as $action) {
86 86
                         $args = json_decode($action->getArguments(), true);
87
-                        if (isset($args['state']) && ($args['state']=='off')) {
87
+                        if (isset($args['state']) && ($args['state'] == 'off')) {
88 88
                             $resultAction = $action;
89 89
                             break;
90 90
                         }
@@ -92,44 +92,44 @@  discard block
 block discarded – undo
92 92
                 }
93 93
             }
94 94
 
95
-            if ($request->get('cmd')==0) {
95
+            if ($request->get('cmd') == 0) {
96 96
                 // turn off, only by pi
97 97
 
98 98
                 $changeSet = ['state'=>'off'];
99 99
                 /** @var Action $action */
100 100
                 foreach ($actions as $action) {
101 101
                     $args = json_decode($action->getArguments(), true);
102
-                    if (isset($args['state']) && ($args['state']=='off')) {
102
+                    if (isset($args['state']) && ($args['state'] == 'off')) {
103 103
                         $resultAction = $action;
104 104
                         break;
105 105
                     }
106 106
                 }
107 107
             }
108 108
 
109
-            if ($request->get('cmd')==6) {
109
+            if ($request->get('cmd') == 6) {
110 110
                 // turn off, only by pi
111 111
 
112
-                $percent = round((($request->get('d0') - 34)/123) * 100);
112
+                $percent = round((($request->get('d0') - 34)/123)*100);
113 113
 
114
-                $changeSet = ['state'=>'on','percent'=>$percent];
114
+                $changeSet = ['state'=>'on', 'percent'=>$percent];
115 115
                 /** @var Action $action */
116 116
                 foreach ($actions as $action) {
117 117
                     $args = json_decode($action->getArguments(), true);
118
-                    if (isset($args['state']) && ($args['state']=='on')) {
118
+                    if (isset($args['state']) && ($args['state'] == 'on')) {
119 119
                         $resultAction = $action;
120 120
                         break;
121 121
                     }
122 122
                 }
123 123
             }
124 124
 
125
-            if ($request->get('cmd')==2) {
125
+            if ($request->get('cmd') == 2) {
126 126
                 // turn on, only by pi
127 127
 
128 128
                 $changeSet = ['state'=>'on'];
129 129
                 /** @var Action $action */
130 130
                 foreach ($actions as $action) {
131 131
                     $args = json_decode($action->getArguments(), true);
132
-                    if (isset($args['state']) && ($args['state']=='on')) {
132
+                    if (isset($args['state']) && ($args['state'] == 'on')) {
133 133
                         $resultAction = $action;
134 134
                         break;
135 135
                     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             }
142 142
 
143 143
             if (($changeSet['state'] == 'on') && !isset($changeSet['percent'])) {
144
-                $changeSet['percent'] = 100;  // ? I don't really know if they restore their states
144
+                $changeSet['percent'] = 100; // ? I don't really know if they restore their states
145 145
             }
146 146
 
147 147
             if (!$resultAction) {
Please login to merge, or discard this patch.
src/AppBundle/Variable/Service.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         if ($this->needSync) {
72 72
             if ($var->needSync) {
73
-                @file_get_contents($this->syncHost . 'set/' . $varName . '?value=' . $value);
73
+                @file_get_contents($this->syncHost.'set/'.$varName.'?value='.$value);
74 74
             }
75 75
         }
76 76
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
         foreach ($hooks as $varHook) {
100 100
             list($executor, $method) = explode(':', $varHook->getExecutor());
101 101
 
102
-            $executor = 'AppBundle\Action\Executor\\' . ucfirst($executor);
102
+            $executor = 'AppBundle\Action\Executor\\'.ucfirst($executor);
103 103
 
104 104
             if (!class_exists($executor)) {
105
-                throw new \Exception('Unknown executor: ' . $executor);
105
+                throw new \Exception('Unknown executor: '.$executor);
106 106
             }
107 107
 
108 108
             /** @var ExecutorInterface $executor */
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 
113 113
             if (!method_exists($executor, $method)) {
114
-                throw new \Exception('Unknown executor method: ' . $varHook->getExecutor().'()');
114
+                throw new \Exception('Unknown executor method: '.$varHook->getExecutor().'()');
115 115
             }
116 116
 
117 117
             $executor->setParameters(json_decode($varHook->getArguments(), true));
Please login to merge, or discard this patch.