GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( bb3b68...0079b6 )
by Ludovic
11s
created

CircuitBreakerAwareTrait::setCircuitBreaker()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php declare(strict_types = 1);
2
3
namespace CircuitBreakerBundle\Traits;
4
5
use CircuitBreakerBundle\Service\CircuitBreakerService;
6
use CircuitBreakerBundle\Event\CircuitBreakerEvent;
7
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
8
9
trait CircuitBreakerAwareTrait
10
{
11
    /**
12
     * @var CircuitBreakerService
13
     */
14
    private $circuitBreaker;
15
16
    /**
17
     * @var EventDispatcherInterface
18
     */
19
    private $eventDispatcher;
20
21
    /**
22
     * Set the circuit breaker service
23
     *
24
     * @param CircuitBreakerService $circuitBreaker
25
     */
26 1
    public function setCircuitBreaker(CircuitBreakerService $circuitBreaker)
27
    {
28 1
        $this->circuitBreaker = $circuitBreaker;
29 1
    }
30
31
    /**
32
     * @param EventDispatcherInterface $eventDispatcher
33
     */
34 3
    public function setEventDispatcher(EventDispatcherInterface $eventDispatcher)
35
    {
36 3
        $this->eventDispatcher = $eventDispatcher;
37 3
    }
38
39
40
    /**
41
     * Send an event to notify the circuit breaker that a given service is down
42
     *
43
     * @param string $serviceName The service which is down
44
     */
45 1
    public function notifyServiceIsDown(string $serviceName)
46
    {
47 1
        $this->eventDispatcher->dispatch(
48 1
            'circuit.breaker',
49 1
            new CircuitBreakerEvent($serviceName, CircuitBreakerService::STATUS_DOWN)
50
        );
51 1
    }
52
53
    /**
54
     * Send an event to notify the circuit breaker that a given service is up
55
     *
56
     * @param string $serviceName The service which is up
57
     */
58 1
    public function notifyServiceIsUp(string $serviceName)
59
    {
60 1
        $this->eventDispatcher->dispatch(
61 1
            'circuit.breaker',
62 1
            new CircuitBreakerEvent($serviceName, CircuitBreakerService::STATUS_UP)
63
        );
64 1
    }
65
}
66