@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $resource_dir = 'resource/'; |
8 | 8 | $resource_file = 'UseCaseXsFromYCommandHandler.tpl'; |
9 | 9 | |
10 | -if( $argc != 4){ |
|
10 | +if ($argc != 4) { |
|
11 | 11 | echo "Usage:\n"; |
12 | 12 | echo "php tools/makeUseCaseXsFromYCommandHandler.php UseCase EntityX EntityY\n"; |
13 | 13 | exit(1); |
@@ -24,26 +24,26 @@ discard block |
||
24 | 24 | |
25 | 25 | $template = file_get_contents($resource_dir . $resource_file); |
26 | 26 | |
27 | -if( DEBUG ){echo 'Template';echo $template;} |
|
27 | +if (DEBUG) {echo 'Template'; echo $template; } |
|
28 | 28 | |
29 | 29 | $next = str_replace('%usecase%', $usecase, $template); |
30 | 30 | $next = str_replace('%Usecase%', $UseCase, $next); |
31 | 31 | |
32 | -if( DEBUG ){echo 'next';echo $next;} |
|
32 | +if (DEBUG) {echo 'next'; echo $next; } |
|
33 | 33 | |
34 | 34 | $next = str_replace('%entityX%', $entityX, $next); |
35 | 35 | $next = str_replace('%EntityX%', $EntityX, $next); |
36 | 36 | |
37 | -if( DEBUG ){echo 'next';echo $next;} |
|
37 | +if (DEBUG) {echo 'next'; echo $next; } |
|
38 | 38 | |
39 | 39 | $next = str_replace('%entityY%', $entityY, $next); |
40 | 40 | $next = str_replace('%EntityY%', $EntityY, $next); |
41 | 41 | |
42 | -/*if( DEBUG ){echo 'next';*/echo $next;//} |
|
42 | +/*if( DEBUG ){echo 'next';*/echo $next; //} |
|
43 | 43 | |
44 | 44 | $destination = 'src' . namespace2dir($next) . '/' . $UseCase . $EntityX . 'sFrom' . $EntityY . 'CommandHandler.php'; |
45 | 45 | |
46 | -if( ($count = file_force_contents($destination, $next)) === false ){ |
|
46 | +if (($count = file_force_contents($destination, $next)) === false) { |
|
47 | 47 | echo 'file_put_contents returned false'; |
48 | 48 | } else { |
49 | 49 | echo $destination . ': ' . $count . ' bytes written'; |
@@ -251,10 +251,11 @@ discard block |
||
251 | 251 | 'available' => $available |
252 | 252 | ]; |
253 | 253 | |
254 | - foreach($from as $xKey => $xs) |
|
255 | - foreach($xs as $yKey => $pair) |
|
254 | + foreach($from as $xKey => $xs) { |
|
255 | + foreach($xs as $yKey => $pair) |
|
256 | 256 | if( $yKey === $entityY->getId() ) { |
257 | 257 | $r[$who][$xKey] = $pair[0]; |
258 | + } |
|
258 | 259 | unset($r['available'][$xKey]); |
259 | 260 | } |
260 | 261 | |
@@ -268,10 +269,11 @@ discard block |
||
268 | 269 | 'available' => $available |
269 | 270 | ]; |
270 | 271 | |
271 | - foreach($from as $xKey => $xs) |
|
272 | - foreach($xs as $yKey => $pair) |
|
272 | + foreach($from as $xKey => $xs) { |
|
273 | + foreach($xs as $yKey => $pair) |
|
273 | 274 | if ($xKey === $entityX->getId()) { |
274 | 275 | $r[$who][$yKey] = $pair[1]; |
276 | + } |
|
275 | 277 | unset($r['available'][$yKey]); |
276 | 278 | } |
277 | 279 |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | 'available' => $available |
288 | 288 | ]; |
289 | 289 | |
290 | - foreach($from as $xKey => $xs) |
|
291 | - foreach($xs as $yKey => $pair) |
|
292 | - if( $yKey === $entityY->getId() ) { |
|
290 | + foreach ($from as $xKey => $xs) |
|
291 | + foreach ($xs as $yKey => $pair) |
|
292 | + if ($yKey === $entityY->getId()) { |
|
293 | 293 | $r[$who][$xKey] = $pair[0]; |
294 | 294 | unset($r['available'][$xKey]); |
295 | 295 | } |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | 'available' => $available |
305 | 305 | ]; |
306 | 306 | |
307 | - foreach($from as $xKey => $xs) |
|
308 | - foreach($xs as $yKey => $pair) |
|
307 | + foreach ($from as $xKey => $xs) |
|
308 | + foreach ($xs as $yKey => $pair) |
|
309 | 309 | if ($xKey === $entityX->getId()) { |
310 | 310 | $r[$who][$yKey] = $pair[1]; |
311 | 311 | unset($r['available'][$yKey]); |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | private function failIfNotExists($entity, $id) |
318 | 318 | { |
319 | 319 | $datastore = strtolower($entity) . 'DataStore'; |
320 | - if( ! isset($this->$datastore[$id]) ){ |
|
321 | - throw new InvalidArgumentException(ucfirst($entity)." with id = {$id} not found"); |
|
320 | + if ( ! isset($this->$datastore[$id])) { |
|
321 | + throw new InvalidArgumentException(ucfirst($entity) . " with id = {$id} not found"); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | use GroupUseCases; |
22 | 22 | |
23 | - public function __construct($id, $name, $desc) |
|
24 | - { |
|
23 | + public function __construct($id, $name, $desc) |
|
24 | + { |
|
25 | 25 | $this->setPropertiesBag(['id', 'name', 'desc']); |
26 | 26 | $this->setSettersBag($this->getPropertiesBag()); |
27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->setDesc($desc); |
31 | 31 | |
32 | 32 | // TODO: Raise CreateGroupDomainEvent($this) |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | 35 | public function __toString() |
36 | 36 | { |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | use RoleUseCases; |
22 | 22 | |
23 | - public function __construct($id, $name, $desc) |
|
24 | - { |
|
23 | + public function __construct($id, $name, $desc) |
|
24 | + { |
|
25 | 25 | $this->setPropertiesBag(['id', 'name', 'desc']); |
26 | 26 | $this->setSettersBag($this->getPropertiesBag()); |
27 | 27 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | $this->setName($name); |
30 | 30 | $this->setDesc($desc); |
31 | 31 | |
32 | - // TODO: Raise CreateRoleDomainEvent($this) |
|
33 | - } |
|
32 | + // TODO: Raise CreateRoleDomainEvent($this) |
|
33 | + } |
|
34 | 34 | |
35 | 35 | public function __toString() |
36 | 36 | { |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | use ModuleUseCases; |
22 | 22 | |
23 | - public function __construct($id, $name, $desc) |
|
24 | - { |
|
23 | + public function __construct($id, $name, $desc) |
|
24 | + { |
|
25 | 25 | $this->setPropertiesBag(['id', 'name', 'desc']); |
26 | 26 | $this->setSettersBag($this->getPropertiesBag()); |
27 | 27 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | $this->setName($name); |
30 | 30 | $this->setDesc($desc); |
31 | 31 | |
32 | - // TODO: Raise CreateModuleDomainEvent($this) |
|
33 | - } |
|
32 | + // TODO: Raise CreateModuleDomainEvent($this) |
|
33 | + } |
|
34 | 34 | |
35 | 35 | public function __toString() |
36 | 36 | { |
@@ -16,7 +16,7 @@ |
||
16 | 16 | public function execute(object $command, callable $next) |
17 | 17 | { |
18 | 18 | $commandName = \get_class($command); |
19 | - $commandHandler = $commandName.$this->handler; |
|
19 | + $commandHandler = $commandName . $this->handler; |
|
20 | 20 | return // TODO: remove return from Coomands. It's for Queries only!!! |
21 | 21 | app()->get($commandHandler)->handle($command); |
22 | 22 | } |
@@ -75,10 +75,10 @@ |
||
75 | 75 | |
76 | 76 | public function equals($o): bool |
77 | 77 | { |
78 | - return $this->getid() == $o->getid() |
|
79 | - && $this->getName() == $o->getName() |
|
80 | - && $this->getSurname() == $o->getSurname() |
|
81 | - && $this->getLogin() == $o->getLogin(); |
|
78 | + return $this->getid() == $o->getid() |
|
79 | + && $this->getName() == $o->getName() |
|
80 | + && $this->getSurname() == $o->getSurname() |
|
81 | + && $this->getLogin() == $o->getLogin(); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | public function __toString() |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | if ( ! array_key_exists($key, $actual)) { |
12 | 12 | $message = "Keys: Expected ($key) not found in Actual"; |
13 | 13 | return false; |
14 | - } elseif ( ! $this->AssertsArrayIsASubsetOf($expected[$key], $actual[$key], $message)){ |
|
14 | + } elseif ( ! $this->AssertsArrayIsASubsetOf($expected[$key], $actual[$key], $message)) { |
|
15 | 15 | $message .= " with key ($key)"; |
16 | 16 | return false; |
17 | 17 | } |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | { |
28 | 28 | if (is_array($expected) && is_array($actual)) { |
29 | 29 | foreach ($actual as $key => $value) { |
30 | - if (!array_key_exists($key, $expected)) { |
|
30 | + if ( ! array_key_exists($key, $expected)) { |
|
31 | 31 | $message = "Keys: Actual ($key) unexpected"; |
32 | 32 | return false; |
33 | - } elseif (!$this->AssertsReverseArrayIsASubsetOf($actual[$key], $expected[$key], $message)) { |
|
33 | + } elseif ( ! $this->AssertsReverseArrayIsASubsetOf($actual[$key], $expected[$key], $message)) { |
|
34 | 34 | $message .= " in key ($key)"; |
35 | 35 | return false; |
36 | 36 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | if (gettype($expected) != gettype($actual)) { |
48 | 48 | $message = "Mismatched Types: Expected (gettype($expected)) != Actual (gettype($actual))"; |
49 | 49 | return false; |
50 | - } elseif (gettype($expected) == 'object' ) { |
|
51 | - if( ! $expected->equals($actual) ) { |
|
50 | + } elseif (gettype($expected) == 'object') { |
|
51 | + if ( ! $expected->equals($actual)) { |
|
52 | 52 | $message = "Objects: Expected ($expected) != Actual ($actual)"; |
53 | 53 | return false; |
54 | 54 | } |
@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | trait PropertiesBag |
6 | 6 | { |
7 | 7 | private $attributes = []; |
8 | - private $data = []; |
|
8 | + private $data = []; |
|
9 | 9 | |
10 | - protected function setPropertiesBag($attributes) |
|
10 | + protected function setPropertiesBag($attributes) |
|
11 | 11 | { |
12 | 12 | $this->attributes = $attributes; |
13 | 13 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | return array_key_exists($name, $this->data); |
42 | 42 | } |
43 | 43 | |
44 | - public function __set($name, $value) |
|
44 | + public function __set($name, $value) |
|
45 | 45 | { |
46 | 46 | if( ! $this->isPropertyAllowed($name) ) { |
47 | 47 | $trace = debug_backtrace(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $this->data[$name] = $value; |
57 | 57 | } |
58 | 58 | |
59 | - public function __get($name) |
|
59 | + public function __get($name) |
|
60 | 60 | { |
61 | 61 | if( ! $this->isPropertyAllowed($name) ) { |
62 | 62 | $trace = debug_backtrace(); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return $this->data[$name]; |
82 | 82 | } |
83 | 83 | |
84 | - public function __isset($name) |
|
84 | + public function __isset($name) |
|
85 | 85 | { |
86 | 86 | if( ! $this->isPropertyAllowed($name) ) { |
87 | 87 | $trace = debug_backtrace(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function __set($name, $value) |
45 | 45 | { |
46 | - if( ! $this->isPropertyAllowed($name) ) { |
|
46 | + if ( ! $this->isPropertyAllowed($name)) { |
|
47 | 47 | $trace = debug_backtrace(); |
48 | 48 | trigger_error( |
49 | 49 | 'Disallowed property ' . $name . |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function __get($name) |
60 | 60 | { |
61 | - if( ! $this->isPropertyAllowed($name) ) { |
|
61 | + if ( ! $this->isPropertyAllowed($name)) { |
|
62 | 62 | $trace = debug_backtrace(); |
63 | 63 | trigger_error( |
64 | 64 | 'Disallowed property ' . $name . |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return null; |
69 | 69 | } |
70 | 70 | |
71 | - if( ! $this->isDefined($name)) { |
|
71 | + if ( ! $this->isDefined($name)) { |
|
72 | 72 | $trace = debug_backtrace(); |
73 | 73 | trigger_error( |
74 | 74 | 'Undefined property ' . $name . |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | public function __isset($name) |
85 | 85 | { |
86 | - if( ! $this->isPropertyAllowed($name) ) { |
|
86 | + if ( ! $this->isPropertyAllowed($name)) { |
|
87 | 87 | $trace = debug_backtrace(); |
88 | 88 | trigger_error( |
89 | 89 | 'Disallowed property ' . $name . |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return null; |
94 | 94 | } |
95 | 95 | |
96 | - if( ! $this->isDefined($name)) { |
|
96 | + if ( ! $this->isDefined($name)) { |
|
97 | 97 | $trace = debug_backtrace(); |
98 | 98 | trigger_error( |
99 | 99 | 'Undefined property ' . $name . |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | public function __unset($name) |
110 | 110 | { |
111 | - if( ! $this->isPropertyAllowed($name) ) { |
|
111 | + if ( ! $this->isPropertyAllowed($name)) { |
|
112 | 112 | $trace = debug_backtrace(); |
113 | 113 | trigger_error( |
114 | 114 | 'Disallowed property ' . $name . |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | return null; |
119 | 119 | } |
120 | 120 | |
121 | - if( ! $this->isDefined($name)) { |
|
121 | + if ( ! $this->isDefined($name)) { |
|
122 | 122 | $trace = debug_backtrace(); |
123 | 123 | trigger_error( |
124 | 124 | 'Undefined property ' . $name . |