@@ -105,7 +105,7 @@ |
||
105 | 105 | /** |
106 | 106 | * @param string $eventType |
107 | 107 | * @param int $since |
108 | - * @return Generator|Job[] |
|
108 | + * @return Generator |
|
109 | 109 | */ |
110 | 110 | public function getEventsByTypeGenerator(string $eventType = null, int $since = 0) : Generator |
111 | 111 | { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function addEvent(AbstractEvent $event, int $timestamp = 0) : Job |
61 | 61 | { |
62 | - $jobId = $this->generateUniqueId('jobid:' . $event->getEventName()); |
|
62 | + $jobId = $this->generateUniqueId('jobid:'.$event->getEventName()); |
|
63 | 63 | $jobId = sprintf('%s:%s', $event->getEventName(), $jobId); |
64 | 64 | |
65 | 65 | $job = new Job($event, $jobId, $timestamp); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $pipeline = $this->getRedis()->pipeline(['fire-and-forget' => true]); |
81 | 81 | if (empty($job->timestamp)) { |
82 | 82 | // immediate execution in background |
83 | - $pipeline->lpush(self::QUEUE_IMMEDIATE, $job->jobId . '#' . $serialized); |
|
83 | + $pipeline->lpush(self::QUEUE_IMMEDIATE, $job->jobId.'#'.$serialized); |
|
84 | 84 | } else { |
85 | 85 | // delayed execution |
86 | 86 | $pipeline->hset(self::META_DATA, $job->jobId, $serialized); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $keys = []; |
122 | 122 | foreach ($resultRaw as $jobId => $timestamp) { |
123 | - if (empty($eventType) || strpos($jobId, $eventType . ':') === 0) { |
|
123 | + if (empty($eventType) || strpos($jobId, $eventType.':') === 0) { |
|
124 | 124 | $keys[$jobId] = $timestamp; |
125 | 125 | } |
126 | 126 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $immediate = $this->getRedis()->lrange(self::QUEUE_IMMEDIATE, 0, 100); |
178 | 178 | foreach ($immediate as $rawJob) { |
179 | 179 | list($jobId, $rawJob) = explode('#', $rawJob, 2); |
180 | - if (empty($eventType) || strpos($jobId, $eventType . ':') === 0) { |
|
180 | + if (empty($eventType) || strpos($jobId, $eventType.':') === 0) { |
|
181 | 181 | /** @var Job $job */ |
182 | 182 | $job = unserialize(base64_decode($rawJob)); |
183 | 183 | yield $job->jobId => $job; |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function __construct(string $type, Job $job) |
28 | 28 | { |
29 | 29 | parent::__construct($type); |
30 | - $this->job = $job; |
|
30 | + $this->job = $job; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | use BrainExe\Core\Core; |
4 | 4 | |
5 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
5 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
6 | 6 | |
7 | -define('ROOT', realpath(__DIR__ . '/..') . '/'); |
|
7 | +define('ROOT', realpath(__DIR__.'/..').'/'); |
|
8 | 8 | |
9 | 9 | return (new Core())->boot(); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public function boot() : Container |
18 | 18 | { |
19 | - $fileName = ROOT . 'cache/dic.php'; |
|
19 | + $fileName = ROOT.'cache/dic.php'; |
|
20 | 20 | /** @var Container $dic */ |
21 | 21 | if (!is_file($fileName)) { |
22 | 22 | $rebuild = new Rebuild(); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $this->builders = $builders; |
43 | 43 | $this->reader = new IndexedReader(new AnnotationReader()); |
44 | 44 | |
45 | - AnnotationRegistry::registerLoader(function ($class) { |
|
45 | + AnnotationRegistry::registerLoader(function($class) { |
|
46 | 46 | return class_exists($class); |
47 | 47 | }); |
48 | 48 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | { |
24 | 24 | $locator = new FileLocator([ |
25 | 25 | ROOT, |
26 | - ROOT . 'app/', |
|
26 | + ROOT.'app/', |
|
27 | 27 | ]); |
28 | 28 | |
29 | 29 | $xmlLoader = new XmlFileLoader($container, $locator); |
@@ -59,8 +59,8 @@ |
||
59 | 59 | $event = new ClearCacheEvent(); |
60 | 60 | $this->dispatcher->dispatchEvent($event); |
61 | 61 | |
62 | - @mkdir(ROOT . 'logs', 0744); |
|
63 | - @mkdir(ROOT . 'cache', 0744); |
|
62 | + @mkdir(ROOT.'logs', 0744); |
|
63 | + @mkdir(ROOT.'cache', 0744); |
|
64 | 64 | |
65 | 65 | $output->writeln('<info>done</info>'); |
66 | 66 | } |
@@ -143,7 +143,7 @@ |
||
143 | 143 | * @param Throwable $exception |
144 | 144 | * @return Response|null |
145 | 145 | */ |
146 | - protected function applyExceptionMiddleware(Request $request, Throwable $exception) : ?Response |
|
146 | + protected function applyExceptionMiddleware(Request $request, Throwable $exception) : ? Response |
|
147 | 147 | { |
148 | 148 | foreach ($this->middlewares as $middleware) { |
149 | 149 | $response = $middleware->processException($request, $exception); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | $redis = $this->getRedis(); |
26 | 26 | |
27 | - return (bool)$redis->set(self::PREFIX . $name, '1', 'EX', $lockTime, 'NX'); |
|
27 | + return (bool)$redis->set(self::PREFIX.$name, '1', 'EX', $lockTime, 'NX'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -32,6 +32,6 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function unlock(string $name) |
34 | 34 | { |
35 | - $this->getRedis()->del(self::PREFIX . $name); |
|
35 | + $this->getRedis()->del(self::PREFIX.$name); |
|
36 | 36 | } |
37 | 37 | } |