@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function extract($command) |
| 18 | 18 | { |
| 19 | - if ( ! is_object($command)) { |
|
| 19 | + if (!is_object($command)) { |
|
| 20 | 20 | throw new \InvalidArgumentException('Command must be an object'); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $handlerObject = $this->app[$handlerClassName]; |
| 37 | 37 | |
| 38 | - if ( ! is_object($handlerObject)) { |
|
| 38 | + if (!is_object($handlerObject)) { |
|
| 39 | 39 | throw new \InvalidArgumentException(sprintf( |
| 40 | 40 | 'Class %s is not registered in container', |
| 41 | 41 | $handlerClassName |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function addHandler($commandClassName, $handlerClassName) |
| 53 | 53 | { |
| 54 | - if ( ! class_exists($handlerClassName)) { |
|
| 54 | + if (!class_exists($handlerClassName)) { |
|
| 55 | 55 | throw new \InvalidArgumentException(sprintf( |
| 56 | 56 | 'Handler class %s not found', |
| 57 | 57 | $handlerClassName |
@@ -51,15 +51,15 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // register default locator if haven't defined yet |
| 54 | - if ( ! $app->offsetExists('tactician.locator')) { |
|
| 55 | - $app['tactician.locator'] = function () use ($app) { |
|
| 54 | + if (!$app->offsetExists('tactician.locator')) { |
|
| 55 | + $app['tactician.locator'] = function() use ($app) { |
|
| 56 | 56 | return new SilexLocator($app); |
| 57 | 57 | }; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // register default command extractor if haven't defined yet |
| 61 | - if ( ! $app->offsetExists('tactician.command_extractor')) { |
|
| 62 | - $app['tactician.command_extractor'] = function () { |
|
| 61 | + if (!$app->offsetExists('tactician.command_extractor')) { |
|
| 62 | + $app['tactician.command_extractor'] = function() { |
|
| 63 | 63 | return new SilexCommandExtractor(); |
| 64 | 64 | }; |
| 65 | 65 | } |
@@ -69,17 +69,17 @@ discard block |
||
| 69 | 69 | $app['tactician.inflector'] = $this->resolveStringBaseMethodInflector($app['tactician.inflector']); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $app['tactician.command_bus'] = function () use ($app) { |
|
| 72 | + $app['tactician.command_bus'] = function() use ($app) { |
|
| 73 | 73 | // type checking, make sure all command bus component are valid |
| 74 | - if ( ! $app['tactician.command_extractor'] instanceof CommandNameExtractor) { |
|
| 74 | + if (!$app['tactician.command_extractor'] instanceof CommandNameExtractor) { |
|
| 75 | 75 | throw new \InvalidArgumentException(sprintf('Tactician command extractor must implement %s', CommandNameExtractor::class)); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if ( ! $app['tactician.locator'] instanceof HandlerLocator) { |
|
| 78 | + if (!$app['tactician.locator'] instanceof HandlerLocator) { |
|
| 79 | 79 | throw new \InvaludArgumentException(sprintf('tactician locator must implement %s', HandlerLocator::class)); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if ( ! $app['tactician.inflector'] instanceof MethodNameInflector) { |
|
| 82 | + if (!$app['tactician.inflector'] instanceof MethodNameInflector) { |
|
| 83 | 83 | throw new \InvalidArgumentException(sprintf( |
| 84 | 84 | 'Tactician inflector must implement %s', |
| 85 | 85 | MethodNameInflector::class |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | // combine middleware toggether |
| 96 | 96 | $middleware = $app['tactician.middleware']; |
| 97 | - array_walk($middleware, function (&$value) { |
|
| 97 | + array_walk($middleware, function(&$value) { |
|
| 98 | 98 | $value = $this->resolveMiddleware($value); |
| 99 | 99 | }); |
| 100 | 100 | array_push($middleware, $handler_middleware); |
@@ -111,27 +111,27 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | switch ($string) { |
| 113 | 113 | case 'class_name': |
| 114 | - $inflector = function () { |
|
| 114 | + $inflector = function() { |
|
| 115 | 115 | return new HandleClassNameInflector(); |
| 116 | 116 | }; |
| 117 | 117 | break; |
| 118 | 118 | case 'class_name_without_suffix': |
| 119 | - $inflector = function () { |
|
| 119 | + $inflector = function() { |
|
| 120 | 120 | return new HandleClassNameWithoutSuffixInflector(); |
| 121 | 121 | }; |
| 122 | 122 | break; |
| 123 | 123 | case 'handle': |
| 124 | - $inflector = function () { |
|
| 124 | + $inflector = function() { |
|
| 125 | 125 | return new HandleInflector(); |
| 126 | 126 | }; |
| 127 | 127 | break; |
| 128 | 128 | case 'invoke': |
| 129 | - $inflector = function () { |
|
| 129 | + $inflector = function() { |
|
| 130 | 130 | return new InvokeInflector(); |
| 131 | 131 | }; |
| 132 | 132 | break; |
| 133 | 133 | default: |
| 134 | - $inflector = function () { |
|
| 134 | + $inflector = function() { |
|
| 135 | 135 | return new HandleClassNameInflector(); |
| 136 | 136 | }; |
| 137 | 137 | break; |