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

daycry / jobs / 19498141349

19 Nov 2025 10:30AM UTC coverage: 62.5% (+0.7%) from 61.815%
19498141349

push

github

daycry
- Fixes

4 of 4 new or added lines in 4 files covered. (100.0%)

41 existing lines in 9 files now uncovered.

1145 of 1832 relevant lines covered (62.5%)

4.69 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 DateTime;
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
use Daycry\Jobs\Libraries\RandomIdGenerator;
22

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

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

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

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

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

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

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

70
    protected function getSerializer(): PayloadSerializerInterface
71
    {
72
        if (! $this->serializer) {
9✔
73
            $this->serializer = new JsonPayloadSerializer();
9✔
74
        }
75
        return $this->serializer;
9✔
76
    }
77
}
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