@@ -67,7 +67,7 @@ |
||
67 | 67 | |
68 | 68 | if ($this->needSync) { |
69 | 69 | if ($var->needSync) { |
70 | - @file_get_contents($this->syncHost . 'set/' . $varName . '?value=' . $value); |
|
70 | + @file_get_contents($this->syncHost.'set/'.$varName.'?value='.$value); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 |
@@ -13,15 +13,15 @@ discard block |
||
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 |
||
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(); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | /** @var Action $action */ |
74 | 74 | foreach ($actions as $action) { |
75 | - if ($action->getArguments()=='{"state":"on"}') { |
|
75 | + if ($action->getArguments() == '{"state":"on"}') { |
|
76 | 76 | $resultAction = $action; |
77 | 77 | break; |
78 | 78 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $changeSet = ['state'=>'off']; |
83 | 83 | /** @var Action $action */ |
84 | 84 | foreach ($actions as $action) { |
85 | - if ($action->getArguments()=='{"state":"off"}') { |
|
85 | + if ($action->getArguments() == '{"state":"off"}') { |
|
86 | 86 | $resultAction = $action; |
87 | 87 | break; |
88 | 88 | } |
@@ -90,41 +90,41 @@ discard block |
||
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - if ($request->get('cmd')==0) { |
|
93 | + if ($request->get('cmd') == 0) { |
|
94 | 94 | // turn off, only by pi |
95 | 95 | |
96 | 96 | $changeSet = ['state'=>'off']; |
97 | 97 | /** @var Action $action */ |
98 | 98 | foreach ($actions as $action) { |
99 | - if ($action->getArguments()=='{"state":"off"}') { |
|
99 | + if ($action->getArguments() == '{"state":"off"}') { |
|
100 | 100 | $resultAction = $action; |
101 | 101 | break; |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - if ($request->get('cmd')==6) { |
|
106 | + if ($request->get('cmd') == 6) { |
|
107 | 107 | // turn off, only by pi |
108 | 108 | |
109 | - $percent = round((($request->get('d0') - 34)/123) * 100); |
|
109 | + $percent = round((($request->get('d0') - 34)/123)*100); |
|
110 | 110 | |
111 | - $changeSet = ['state'=>'on','percent'=>$percent]; |
|
111 | + $changeSet = ['state'=>'on', 'percent'=>$percent]; |
|
112 | 112 | /** @var Action $action */ |
113 | 113 | foreach ($actions as $action) { |
114 | - if ($action->getArguments()=='{"state":"on"}') { |
|
114 | + if ($action->getArguments() == '{"state":"on"}') { |
|
115 | 115 | $resultAction = $action; |
116 | 116 | break; |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - if ($request->get('cmd')==2) { |
|
121 | + if ($request->get('cmd') == 2) { |
|
122 | 122 | // turn on, only by pi |
123 | 123 | |
124 | 124 | $changeSet = ['state'=>'on']; |
125 | 125 | /** @var Action $action */ |
126 | 126 | foreach ($actions as $action) { |
127 | - if ($action->getArguments()=='{"state":"on"}') { |
|
127 | + if ($action->getArguments() == '{"state":"on"}') { |
|
128 | 128 | $resultAction = $action; |
129 | 129 | break; |
130 | 130 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | if (($changeSet['state'] == 'on') && !isset($changeSet['percent'])) { |
139 | - $changeSet['percent'] = 100; // ? I don't really know if they restore their states |
|
139 | + $changeSet['percent'] = 100; // ? I don't really know if they restore their states |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | if (!$resultAction) { |
@@ -17,8 +17,8 @@ |
||
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()-> |
@@ -34,6 +34,9 @@ |
||
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); |
@@ -47,10 +47,10 @@ discard block |
||
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 |
||
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 |
||
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(); |
@@ -9,7 +9,7 @@ discard block |
||
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 |
||
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'); |
@@ -33,7 +33,7 @@ |
||
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-> |
@@ -13,7 +13,7 @@ |
||
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; |