Issues (7)

src/Behaviors/OnEmptyQueueResumeException.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * Created by solly [30.10.17 22:22]
4
 */
5
6
namespace insolita\cqueue\Behaviors;
7
8
use Exception;
9
use insolita\cqueue\Contracts\DelayingInterface;
10
use insolita\cqueue\Contracts\EmptyQueueBehaviorInterface;
11
use insolita\cqueue\Contracts\QueueInterface;
12
13
class OnEmptyQueueResumeException implements EmptyQueueBehaviorInterface
14
{
15
    
16
    /**
17
     * @param QueueInterface|\insolita\cqueue\Contracts\DelayingInterface $queue
18
     *
19
     * @return void
20
     * @throws \Exception
21
     */
22
    public function resolve($queue)
23
    {
24
        if ($queue instanceof DelayingInterface) {
25
            $queue->resumeAllDelayed();
26
        }
27
        if ($queue->countQueued() === 0) {
0 ignored issues
show
The method countQueued() does not exist on insolita\cqueue\Contracts\DelayingInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to insolita\cqueue\Contracts\DelayingInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
        if ($queue->/** @scrutinizer ignore-call */ countQueued() === 0) {
Loading history...
28
            throw new Exception('Queue ' . $queue->getName() . ' is empty');
0 ignored issues
show
The method getName() does not exist on insolita\cqueue\Contracts\DelayingInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to insolita\cqueue\Contracts\DelayingInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
            throw new Exception('Queue ' . $queue->/** @scrutinizer ignore-call */ getName() . ' is empty');
Loading history...
29
        }
30
    }
31
}
32