Passed
Push — master ( f1720a...d37884 )
by Marcel
07:58
created

SetPhpBinarySubscriber::setPhpBinary()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace App\EventSubscriber;
4
5
use Symfony\Component\Console\ConsoleEvents;
6
use Symfony\Component\Console\Event\ConsoleCommandEvent;
7
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
8
use Symfony\Component\HttpKernel\Event\RequestEvent;
9
use Symfony\Component\HttpKernel\KernelEvents;
10
11
class SetPhpBinarySubscriber implements EventSubscriberInterface {
12
13
    private function setPhpBinary(): void {
14
        $binary = $_ENV['PHP_BINARY'];
15
16
        if($binary !== null && $binary !== false) {
17
            putenv('PHP_BINARY=' . $binary);
18
        }
19
    }
20
21
    public function onCommand(ConsoleCommandEvent $commandEvent): void {
0 ignored issues
show
Unused Code introduced by
The parameter $commandEvent is not used and could be removed. ( Ignorable by Annotation )

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

21
    public function onCommand(/** @scrutinizer ignore-unused */ ConsoleCommandEvent $commandEvent): void {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
        $this->setPhpBinary();
23
    }
24
25
    public function onKernelRequest(RequestEvent $requestEvent): void {
0 ignored issues
show
Unused Code introduced by
The parameter $requestEvent is not used and could be removed. ( Ignorable by Annotation )

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

25
    public function onKernelRequest(/** @scrutinizer ignore-unused */ RequestEvent $requestEvent): void {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
        $this->setPhpBinary();
27
    }
28
29
    /**
30
     * @inheritDoc
31
     */
32
    public static function getSubscribedEvents() {
33
        return [
34
            KernelEvents::REQUEST => 'onKernelRequest',
35
            ConsoleEvents::COMMAND => 'onCommand'
36
        ];
37
    }
38
}