@@ -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'] . |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function readUser($id): User |
| 72 | 72 | { |
| 73 | - if( ! isset($this->userDataStore[$id]) ){ |
|
| 73 | + if ( ! isset($this->userDataStore[$id])) { |
|
| 74 | 74 | throw new InvalidArgumentException(); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | public function readGroup($id): Group |
| 102 | 102 | { |
| 103 | - if( ! isset($this->groupDataStore[$id]) ){ |
|
| 103 | + if ( ! isset($this->groupDataStore[$id])) { |
|
| 104 | 104 | throw new InvalidArgumentException(); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | public function readRole($id): Role |
| 131 | 131 | { |
| 132 | - if( ! isset($this->roleDataStore[$id]) ){ |
|
| 132 | + if ( ! isset($this->roleDataStore[$id])) { |
|
| 133 | 133 | throw new InvalidArgumentException(); |
| 134 | 134 | } |
| 135 | 135 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | public function readModule($id): Module |
| 160 | 160 | { |
| 161 | - if( ! isset($this->moduleDataStore[$id]) ){ |
|
| 161 | + if ( ! isset($this->moduleDataStore[$id])) { |
|
| 162 | 162 | throw new InvalidArgumentException(); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | 'available' => $available |
| 252 | 252 | ]; |
| 253 | 253 | |
| 254 | - foreach($from as $xKey => $xs) |
|
| 255 | - foreach($xs as $yKey => $pair) |
|
| 256 | - if( $yKey === $entityY->getId() ) { |
|
| 254 | + foreach ($from as $xKey => $xs) |
|
| 255 | + foreach ($xs as $yKey => $pair) |
|
| 256 | + if ($yKey === $entityY->getId()) { |
|
| 257 | 257 | $r[$who][$xKey] = $pair[0]; |
| 258 | 258 | unset($r['available'][$xKey]); |
| 259 | 259 | } |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | 'available' => $available |
| 269 | 269 | ]; |
| 270 | 270 | |
| 271 | - foreach($from as $xKey => $xs) |
|
| 272 | - foreach($xs as $yKey => $pair) |
|
| 271 | + foreach ($from as $xKey => $xs) |
|
| 272 | + foreach ($xs as $yKey => $pair) |
|
| 273 | 273 | if ($xKey === $entityX->getId()) { |
| 274 | 274 | $r[$who][$yKey] = $pair[1]; |
| 275 | 275 | unset($r['available'][$yKey]); |
@@ -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 | |
@@ -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; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | 23 | $this->bus->addHandler('ProyectoTAU\TAU\Module\Administration\Group\Application\getUsersFromGroup\GetUsersFromGroupCommand', |
| 24 | - 'ProyectoTAU\TAU\Module\Administration\Group\Application\getUsersFromGroup\GetUsersFromGroupCommandHandler'); |
|
| 24 | + 'ProyectoTAU\TAU\Module\Administration\Group\Application\getUsersFromGroup\GetUsersFromGroupCommandHandler'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function getUsersFromGroup($groupId): array { |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | $this->bus = app('Joselfonseca\LaravelTactician\CommandBusInterface'); |
| 17 | 17 | |
| 18 | 18 | app()->bind('ProyectoTAU\TAU\Module\Administration\Group\Domain\GroupRepository', |
| 19 | - function () use ($group){ |
|
| 19 | + function() use ($group){ |
|
| 20 | 20 | return $group; |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | 23 | $this->bus->addHandler('ProyectoTAU\TAU\Module\Administration\Group\Application\delete\DeleteGroupCommand', |
| 24 | - 'ProyectoTAU\TAU\Module\Administration\Group\Application\delete\DeleteGroupCommandHandler'); |
|
| 24 | + 'ProyectoTAU\TAU\Module\Administration\Group\Application\delete\DeleteGroupCommandHandler'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function delete($id) |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | { |
| 13 | 13 | private $bus; |
| 14 | 14 | |
| 15 | - public function __construct(GroupRepository $group){ |
|
| 15 | + public function __construct(GroupRepository $group) { |
|
| 16 | 16 | $this->bus = app('Joselfonseca\LaravelTactician\CommandBusInterface'); |
| 17 | 17 | |
| 18 | 18 | app()->bind('ProyectoTAU\TAU\Module\Administration\Group\Domain\GroupRepository', |
| 19 | - function () use ($group){ |
|
| 19 | + function() use ($group){ |
|
| 20 | 20 | return $group; |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | 23 | $this->bus->addHandler('ProyectoTAU\TAU\Module\Administration\Group\Application\update\UpdateGroupCommand', |
| 24 | - 'ProyectoTAU\TAU\Module\Administration\Group\Application\update\UpdateGroupCommandHandler'); |
|
| 24 | + 'ProyectoTAU\TAU\Module\Administration\Group\Application\update\UpdateGroupCommandHandler'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function update($id, $name, $desc) |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | { |
| 13 | 13 | private $bus; |
| 14 | 14 | |
| 15 | - public function __construct(GroupRepository $group){ |
|
| 15 | + public function __construct(GroupRepository $group) { |
|
| 16 | 16 | $this->bus = app('Joselfonseca\LaravelTactician\CommandBusInterface'); |
| 17 | 17 | |
| 18 | 18 | app()->bind('ProyectoTAU\TAU\Module\Administration\Group\Domain\GroupRepository', |
| 19 | - function () use ($group){ |
|
| 19 | + function() use ($group){ |
|
| 20 | 20 | return $group; |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | 23 | $this->bus->addHandler('ProyectoTAU\TAU\Module\Administration\Group\Application\create\CreateGroupCommand', |
| 24 | - 'ProyectoTAU\TAU\Module\Administration\Group\Application\create\CreateGroupCommandHandler'); |
|
| 24 | + 'ProyectoTAU\TAU\Module\Administration\Group\Application\create\CreateGroupCommandHandler'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function create($id, $name, $desc) |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | { |
| 13 | 13 | private $bus; |
| 14 | 14 | |
| 15 | - public function __construct(GroupRepository $group){ |
|
| 15 | + public function __construct(GroupRepository $group) { |
|
| 16 | 16 | $this->bus = app('Joselfonseca\LaravelTactician\CommandBusInterface'); |
| 17 | 17 | |
| 18 | 18 | app()->bind('ProyectoTAU\TAU\Module\Administration\Group\Domain\GroupRepository', |
| 19 | - function () use ($group){ |
|
| 19 | + function() use ($group){ |
|
| 20 | 20 | return $group; |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | }); |
| 28 | 28 | |
| 29 | 29 | $this->bus->addHandler('ProyectoTAU\TAU\Module\Administration\Group\Application\addRoleToGroup\AddRoleToGroupCommand', |
| 30 | - 'ProyectoTAU\TAU\Module\Administration\Group\Application\addRoleToGroup\AddRoleToGroupCommandHandler'); |
|
| 30 | + 'ProyectoTAU\TAU\Module\Administration\Group\Application\addRoleToGroup\AddRoleToGroupCommandHandler'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function addRoleToGroup($roleId, $groupId) |
@@ -17,12 +17,12 @@ |
||
| 17 | 17 | $this->bus = app('Joselfonseca\LaravelTactician\CommandBusInterface'); |
| 18 | 18 | |
| 19 | 19 | app()->bind('ProyectoTAU\TAU\Module\Administration\Role\Domain\RoleRepository', |
| 20 | - function () use ($role){ |
|
| 20 | + function() use ($role){ |
|
| 21 | 21 | return $role; |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | 24 | app()->bind('ProyectoTAU\TAU\Module\Administration\Group\Domain\GroupRepository', |
| 25 | - function () use ($group){ |
|
| 25 | + function() use ($group){ |
|
| 26 | 26 | return $group; |
| 27 | 27 | }); |
| 28 | 28 | |