@@ -39,36 +39,36 @@ discard block |
||
| 39 | 39 | ]; |
| 40 | 40 | |
| 41 | 41 | foreach ($functions as $function) { |
| 42 | - $this->register($function, function () use ($function) { |
|
| 42 | + $this->register($function, function() use ($function) { |
|
| 43 | 43 | $parameters = func_get_args(); |
| 44 | 44 | |
| 45 | 45 | return sprintf('%s(%s)', $function, implode(', ', $parameters)); |
| 46 | - }, function () use ($function) { |
|
| 46 | + }, function() use ($function) { |
|
| 47 | 47 | $parameters = array_slice(func_get_args(), 1); |
| 48 | 48 | return call_user_func_array($function, $parameters); |
| 49 | 49 | }); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $this->register('setProperty', function ($property, $value) { |
|
| 52 | + $this->register('setProperty', function($property, $value) { |
|
| 53 | 53 | return sprintf('($entity->payload[%s] = %s)', $property, $value); |
| 54 | - }, function ($parameters, $property, $value) { |
|
| 54 | + }, function($parameters, $property, $value) { |
|
| 55 | 55 | /** @var Entity $entity */ |
| 56 | 56 | $entity = $parameters['entity']; |
| 57 | 57 | $entity->payload[$property] = $value; |
| 58 | 58 | }); |
| 59 | 59 | |
| 60 | - $this->register('getProperty', function ($property) { |
|
| 60 | + $this->register('getProperty', function($property) { |
|
| 61 | 61 | return sprintf('$entity->payload[%s]', $property); |
| 62 | - }, function ($parameters, $property) { |
|
| 62 | + }, function($parameters, $property) { |
|
| 63 | 63 | /** @var Entity $entity */ |
| 64 | 64 | $entity = $parameters['entity']; |
| 65 | 65 | |
| 66 | 66 | return $entity->payload[$property]; |
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | - $this->register('isTiming', function ($timingId) { |
|
| 69 | + $this->register('isTiming', function($timingId) { |
|
| 70 | 70 | return sprintf('($eventName == \'%s\' && $event->timingId === %s)', TimingEvent::TIMING_EVENT, $timingId); |
| 71 | - }, function ($parameters, $eventId) { |
|
| 71 | + }, function($parameters, $eventId) { |
|
| 72 | 72 | if ($parameters['eventName'] !== TimingEvent::TIMING_EVENT) { |
| 73 | 73 | return false; |
| 74 | 74 | } |
@@ -76,32 +76,32 @@ discard block |
||
| 76 | 76 | return $parameters['event']->timingId === $eventId; |
| 77 | 77 | }); |
| 78 | 78 | |
| 79 | - $this->register('isEvent', function ($eventId) { |
|
| 79 | + $this->register('isEvent', function($eventId) { |
|
| 80 | 80 | return sprintf('($eventName == \'%s\')', $eventId); |
| 81 | - }, function ($parameters, $eventId) { |
|
| 81 | + }, function($parameters, $eventId) { |
|
| 82 | 82 | return $parameters['eventName'] === $eventId; |
| 83 | 83 | }); |
| 84 | 84 | |
| 85 | - $this->register('pushViaWebsocket', function () { |
|
| 85 | + $this->register('pushViaWebsocket', function() { |
|
| 86 | 86 | throw new Exception('pushViaWebsocket() not implemented'); |
| 87 | - }, function ($parameters) { |
|
| 87 | + }, function($parameters) { |
|
| 88 | 88 | $this->getDispatcher()->dispatchAsWebsocketEvent($parameters['event']); |
| 89 | 89 | }); |
| 90 | 90 | |
| 91 | - $this->register('exec', function () { |
|
| 91 | + $this->register('exec', function() { |
|
| 92 | 92 | throw new Exception('exec() not implemented'); |
| 93 | - }, function ($parameters, $string) { |
|
| 93 | + }, function($parameters, $string) { |
|
| 94 | 94 | unset($parameters); |
| 95 | 95 | $inputEvent = new InputControlEvent($string); |
| 96 | 96 | |
| 97 | 97 | $this->getDispatcher()->dispatchInBackground($inputEvent); |
| 98 | 98 | }); |
| 99 | 99 | |
| 100 | - $this->register('event', function () { |
|
| 100 | + $this->register('event', function() { |
|
| 101 | 101 | throw new Exception('event() not implemented'); |
| 102 | - }, function (array $parameters, $type, ...$eventArguments) { |
|
| 102 | + }, function(array $parameters, $type, ...$eventArguments) { |
|
| 103 | 103 | unset($parameters); |
| 104 | - $events = (include ROOT.'/cache/events.php'); // TODO extract |
|
| 104 | + $events = (include ROOT . '/cache/events.php'); // TODO extract |
|
| 105 | 105 | |
| 106 | 106 | $reflection = new ReflectionClass($events[$type]['class']); |
| 107 | 107 | /** @var AbstractEvent $event */ |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | $this->dispatchEvent($event); |
| 111 | 111 | }); |
| 112 | 112 | |
| 113 | - $this->register('log', function () { |
|
| 113 | + $this->register('log', function() { |
|
| 114 | 114 | throw new Exception('log() not implemented'); |
| 115 | - }, function (array $parameters, $level, $message, $context = null) { |
|
| 115 | + }, function(array $parameters, $level, $message, $context = null) { |
|
| 116 | 116 | unset($parameters); |
| 117 | 117 | $this->log($level, $message, ['channel' => $context]); |
| 118 | 118 | }); |
| 119 | 119 | |
| 120 | - $this->register('increaseCounter', function () { |
|
| 120 | + $this->register('increaseCounter', function() { |
|
| 121 | 121 | throw new Exception('log() not implemented'); |
| 122 | - }, function (array $parameters) { |
|
| 122 | + }, function(array $parameters) { |
|
| 123 | 123 | /** @var Entity $entity */ |
| 124 | 124 | $entity = $parameters['entity']; |
| 125 | 125 | if (empty($entity->payload['counter'])) { |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | 131 | |
| 132 | - $this->register('executeExpression', function () { |
|
| 132 | + $this->register('executeExpression', function() { |
|
| 133 | 133 | throw new Exception('executeExpression() not implemented'); |
| 134 | - }, function (array $parameters, $expressionId) { |
|
| 134 | + }, function(array $parameters, $expressionId) { |
|
| 135 | 135 | // TODO throw some event |
| 136 | 136 | }); |
| 137 | 137 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function getAll() |
| 64 | 64 | { |
| 65 | 65 | return array_map( |
| 66 | - function ($string) { |
|
| 66 | + function($string) { |
|
| 67 | 67 | return unserialize($string); |
| 68 | 68 | }, |
| 69 | 69 | $this->getRedis()->hgetall(self::REDIS_KEY) |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function getEntities(array $entityIds) |
| 78 | 78 | { |
| 79 | 79 | return array_map( |
| 80 | - function ($string) { |
|
| 80 | + function($string) { |
|
| 81 | 81 | return unserialize($string); |
| 82 | 82 | }, |
| 83 | 83 | $this->getRedis()->hmget(self::REDIS_KEY, $entityIds) |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | protected function configure() |
| 39 | 39 | { |
| 40 | 40 | $this->setName('expression:list') |
| 41 | - ->setDescription('List all available expression functions'); |
|
| 41 | + ->setDescription('List all available expression functions'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |