| @@ -49,7 +49,7 @@ | ||
| 49 | 49 | |
| 50 | 50 | /** | 
| 51 | 51 | * @param int $userId | 
| 52 | - * @return array[]|Generator | |
| 52 | + * @return Generator | |
| 53 | 53 | */ | 
| 54 | 54 | public function getTokensForUser($userId) | 
| 55 | 55 |      { | 
| @@ -103,7 +103,7 @@ | ||
| 103 | 103 | /** | 
| 104 | 104 | * @param string $eventType | 
| 105 | 105 | * @param integer $since | 
| 106 | - * @return Generator|Job[] | |
| 106 | + * @return Generator | |
| 107 | 107 | */ | 
| 108 | 108 | public function getEventsByTypeGenerator($eventType = null, $since = 0) | 
| 109 | 109 |      { | 
| @@ -61,7 +61,7 @@ discard block | ||
| 61 | 61 | */ | 
| 62 | 62 | public function addEvent(AbstractEvent $event, int $timestamp = 0) | 
| 63 | 63 |      { | 
| 64 | -        $jobId = $this->generateUniqueId('jobid:' . $event->getEventName()); | |
| 64 | +        $jobId = $this->generateUniqueId('jobid:'.$event->getEventName()); | |
| 65 | 65 |          $jobId = sprintf('%s:%s', $event->getEventName(), $jobId); | 
| 66 | 66 | |
| 67 | 67 | $job = new Job($event, $jobId, $timestamp); | 
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 | $pipeline = $this->getRedis()->pipeline(['fire-and-forget' => true]); | 
| 80 | 80 |          if (empty($job->timestamp)) { | 
| 81 | 81 | // immediate execution in background | 
| 82 | - $pipeline->lpush(self::QUEUE_IMMEDIATE, $job->jobId . '#' . $serialized); | |
| 82 | + $pipeline->lpush(self::QUEUE_IMMEDIATE, $job->jobId.'#'.$serialized); | |
| 83 | 83 |          } else { | 
| 84 | 84 | // delayed execution | 
| 85 | 85 | $pipeline->hset(self::META_DATA, $job->jobId, $serialized); | 
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 | |
| 120 | 120 | $keys = []; | 
| 121 | 121 |          foreach ($resultRaw as $jobId => $timestamp) { | 
| 122 | -            if (empty($eventType) || strpos($jobId, $eventType . ":") === 0) { | |
| 122 | +            if (empty($eventType) || strpos($jobId, $eventType.":") === 0) { | |
| 123 | 123 | $keys[$jobId] = $timestamp; | 
| 124 | 124 | } | 
| 125 | 125 | } | 
| @@ -176,7 +176,7 @@ discard block | ||
| 176 | 176 | $immediate = $this->getRedis()->lrange(self::QUEUE_IMMEDIATE, 0, 100); | 
| 177 | 177 |          foreach ($immediate as $rawJob) { | 
| 178 | 178 |              list($jobId, $rawJob) = explode('#', $rawJob, 2); | 
| 179 | -            if (empty($eventType) || strpos($jobId, $eventType . ":") === 0) { | |
| 179 | +            if (empty($eventType) || strpos($jobId, $eventType.":") === 0) { | |
| 180 | 180 | /** @var Job $job */ | 
| 181 | 181 | $job = unserialize(base64_decode($rawJob)); | 
| 182 | 182 | yield $job->jobId => $job; | 
| @@ -25,6 +25,6 @@ | ||
| 25 | 25 | public function __construct($type, Job $job) | 
| 26 | 26 |      { | 
| 27 | 27 | parent::__construct($type); | 
| 28 | - $this->job = $job; | |
| 28 | + $this->job = $job; | |
| 29 | 29 | } | 
| 30 | 30 | } | 
| @@ -2,9 +2,9 @@ | ||
| 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 | $core = new Core(); | 
| 10 | 10 | return $core->boot(); | 
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | use BrainExe\Core\Application\AppKernel; | 
| 6 | 6 | |
| 7 | 7 | /** @var Container $dic */ | 
| 8 | -$dic = include __DIR__ . '/../src/bootstrap.php'; | |
| 8 | +$dic = include __DIR__.'/../src/bootstrap.php'; | |
| 9 | 9 | |
| 10 | 10 | $request = Request::createFromGlobals(); | 
| 11 | 11 | |
| @@ -22,7 +22,7 @@ | ||
| 22 | 22 | $context = new RequestContext(); | 
| 23 | 23 | $context->fromRequest($request); | 
| 24 | 24 | |
| 25 | - include_once ROOT . 'cache/router_matcher.php'; | |
| 25 | + include_once ROOT.'cache/router_matcher.php'; | |
| 26 | 26 | |
| 27 | 27 | $matcher = new ProjectUrlMatcher($context); | 
| 28 | 28 | |
| @@ -35,7 +35,7 @@ discard block | ||
| 35 | 35 | */ | 
| 36 | 36 | public function read($sessionId) | 
| 37 | 37 |      { | 
| 38 | -        if ($data = $this->client->get(self::KEY . $sessionId)) { | |
| 38 | +        if ($data = $this->client->get(self::KEY.$sessionId)) { | |
| 39 | 39 | return $data; | 
| 40 | 40 | } | 
| 41 | 41 | |
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 | */ | 
| 47 | 47 | public function write($sessionId, $sessionData) | 
| 48 | 48 |      { | 
| 49 | - $this->client->setex(self::KEY . $sessionId, $this->ttl, $sessionData); | |
| 49 | + $this->client->setex(self::KEY.$sessionId, $this->ttl, $sessionData); | |
| 50 | 50 | |
| 51 | 51 | return true; | 
| 52 | 52 | } | 
| @@ -56,7 +56,7 @@ discard block | ||
| 56 | 56 | */ | 
| 57 | 57 | public function destroy($sessionId) | 
| 58 | 58 |      { | 
| 59 | - $this->client->del(self::KEY . $sessionId); | |
| 59 | + $this->client->del(self::KEY.$sessionId); | |
| 60 | 60 | |
| 61 | 61 | return true; | 
| 62 | 62 | } | 
| @@ -24,7 +24,7 @@ discard block | ||
| 24 | 24 |      { | 
| 25 | 25 | $redis = $this->getRedis(); | 
| 26 | 26 | |
| 27 | - return $redis->set(self::PREFIX . $name, '1', 'EX', $lockTime, 'NX'); | |
| 27 | + return $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 | } | 
| @@ -33,7 +33,7 @@ | ||
| 33 | 33 | */ | 
| 34 | 34 | public function generateRandomId($length = self::ID_LENGTH) : string | 
| 35 | 35 |      { | 
| 36 | - $randomId = md5(microtime() . mt_rand()) . mt_rand(); | |
| 36 | + $randomId = md5(microtime().mt_rand()).mt_rand(); | |
| 37 | 37 | |
| 38 | 38 | return substr(base_convert($randomId, 10, 36), 0, $length); | 
| 39 | 39 | } |