@@ -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'; |
@@ -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 | $trace = debug_backtrace(); |
47 | 47 | if( ! $this->isPropertyAllowed($name) ) { |
@@ -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 | $trace = debug_backtrace(); |
62 | 62 | if( ! $this->isPropertyAllowed($name) ) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | return $this->data[$name]; |
81 | 81 | } |
82 | 82 | |
83 | - public function __isset($name) |
|
83 | + public function __isset($name) |
|
84 | 84 | { |
85 | 85 | $trace = debug_backtrace(); |
86 | 86 | if( ! $this->isPropertyAllowed($name) ) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function __set($name, $value) |
45 | 45 | { |
46 | 46 | $trace = debug_backtrace(); |
47 | - if( ! $this->isPropertyAllowed($name) ) { |
|
47 | + if ( ! $this->isPropertyAllowed($name)) { |
|
48 | 48 | trigger_error( |
49 | 49 | 'Disallowed property ' . $name . |
50 | 50 | ' in ' . $trace[0]['file'] . |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function __get($name) |
60 | 60 | { |
61 | 61 | $trace = debug_backtrace(); |
62 | - if( ! $this->isPropertyAllowed($name) ) { |
|
62 | + if ( ! $this->isPropertyAllowed($name)) { |
|
63 | 63 | trigger_error( |
64 | 64 | 'Disallowed property ' . $name . |
65 | 65 | ' in ' . $trace[0]['file'] . |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return null; |
69 | 69 | } |
70 | 70 | |
71 | - if( ! $this->defined($name)) { |
|
71 | + if ( ! $this->defined($name)) { |
|
72 | 72 | trigger_error( |
73 | 73 | 'Undefined property ' . $name . |
74 | 74 | ' in ' . $trace[0]['file'] . |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function __isset($name) |
84 | 84 | { |
85 | 85 | $trace = debug_backtrace(); |
86 | - if( ! $this->isPropertyAllowed($name) ) { |
|
86 | + if ( ! $this->isPropertyAllowed($name)) { |
|
87 | 87 | trigger_error( |
88 | 88 | 'Disallowed property ' . $name . |
89 | 89 | ' in ' . $trace[0]['file'] . |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | return null; |
93 | 93 | } |
94 | 94 | |
95 | - if( ! $this->defined($name)) { |
|
95 | + if ( ! $this->defined($name)) { |
|
96 | 96 | trigger_error( |
97 | 97 | 'Undefined property ' . $name . |
98 | 98 | ' in ' . $trace[0]['file'] . |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function __unset($name) |
108 | 108 | { |
109 | 109 | $trace = debug_backtrace(); |
110 | - if( ! $this->isPropertyAllowed($name) ) { |
|
110 | + if ( ! $this->isPropertyAllowed($name)) { |
|
111 | 111 | trigger_error( |
112 | 112 | 'Disallowed property ' . $name . |
113 | 113 | ' in ' . $trace[0]['file'] . |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | return null; |
117 | 117 | } |
118 | 118 | |
119 | - if( ! $this->defined($name)) { |
|
119 | + if ( ! $this->defined($name)) { |
|
120 | 120 | trigger_error( |
121 | 121 | 'Undefined property ' . $name . |
122 | 122 | ' in ' . $trace[0]['file'] . |
@@ -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 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function __call($name, $arguments) |
24 | 24 | { |
25 | 25 | $trace = debug_backtrace(); |
26 | - if( ! $this->isSetterAllowed($name) ) { |
|
26 | + if ( ! $this->isSetterAllowed($name)) { |
|
27 | 27 | trigger_error( |
28 | 28 | 'Disallowed getter/setter ' . $name . |
29 | 29 | ' in ' . $trace[0]['file'] . |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | //echo "Llamando al método de objeto '$name' " . implode(', ', $arguments). "\n"; |
36 | 36 | |
37 | 37 | $attribute = strtolower(substr($name, 3)); |
38 | - if( substr($name, 0, 1) === 's' ){ |
|
38 | + if (substr($name, 0, 1) === 's') { |
|
39 | 39 | $this->$attribute = $arguments[0]; |
40 | 40 | } else { |
41 | 41 | return $this->$attribute; |
@@ -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 | } |