• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daycry / jobs / 24850441053

23 Apr 2026 05:54PM UTC coverage: 52.404% (-1.5%) from 53.938%
24850441053

push

github

daycry
Fixes

104 of 219 new or added lines in 42 files covered. (47.49%)

14 existing lines in 9 files now uncovered.

1210 of 2309 relevant lines covered (52.4%)

4.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/Queues/BaseQueue.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of Daycry Queues.
7
 *
8
 * (c) Daycry <daycry9@proton.me>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace Daycry\Jobs\Queues;
15

16
use Daycry\Jobs\Generators\UuidGenerator;
17
use Daycry\Jobs\Interfaces\IdGeneratorInterface;
18
use Daycry\Jobs\Interfaces\PayloadSerializerInterface;
19
use Daycry\Jobs\Libraries\DelayResult;
20
use Daycry\Jobs\Libraries\JsonPayloadSerializer;
21

22
abstract class BaseQueue
23
{
24
    private ?DelayResult $delayResult               = null;
25
    private ?IdGeneratorInterface $idGenerator      = null;
26
    private ?PayloadSerializerInterface $serializer = null;
27

28
    /**
29
     * Calcula delay desde schedule y retorna DelayResult.
30
     */
31
    protected function calculateDelay(object $data): DelayResult
32
    {
33
        $schedule          = $data->schedule ?? null;
12✔
34
        $this->delayResult = DelayResult::fromSchedule($schedule);
12✔
35

36
        return $this->delayResult;
12✔
37
    }
38

39
    protected function getDelayResult(): DelayResult
40
    {
NEW
41
        return $this->delayResult ?? new DelayResult(0);
×
42
    }
43

44
    public function setIdGenerator(IdGeneratorInterface $generator): self
45
    {
46
        $this->idGenerator = $generator;
×
47

48
        return $this;
×
49
    }
50

51
    protected function getIdGenerator(): IdGeneratorInterface
52
    {
53
        if (!$this->idGenerator instanceof IdGeneratorInterface) {
12✔
54
            // Posible clase personalizada desde config en fases futuras
55
            $this->idGenerator = new UuidGenerator();
12✔
56
        }
57

58
        return $this->idGenerator;
12✔
59
    }
60

61
    protected function generateId(?string $prefix = null, int $bytes = 8): string
62
    {
63
        return $this->getIdGenerator()->generate($bytes, $prefix);
12✔
64
    }
65

66
    public function setSerializer(PayloadSerializerInterface $serializer): self
67
    {
68
        $this->serializer = $serializer;
×
69

70
        return $this;
×
71
    }
72

73
    protected function getSerializer(): PayloadSerializerInterface
74
    {
75
        if (!$this->serializer instanceof PayloadSerializerInterface) {
7✔
76
            $this->serializer = new JsonPayloadSerializer();
7✔
77
        }
78

79
        return $this->serializer;
7✔
80
    }
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc