Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#614)
by Stepan
26:42 queued 23:09
created

CompileCacheWarmer::warmUp()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3.0175

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 13
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 1
crap 3.0175
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\CacheWarmer;
6
7
use Overblog\GraphQLBundle\Generator\TypeGenerator;
8
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
9
10
class CompileCacheWarmer implements CacheWarmerInterface
11
{
12
    private $typeGenerator;
13
14
    private $compiled;
15
16
    /**
17
     * CompileCacheWarmer constructor.
18
     *
19
     * @param TypeGenerator $typeGenerator
20
     * @param bool          $compiled
21
     */
22 36
    public function __construct(TypeGenerator $typeGenerator, $compiled = true)
23
    {
24 36
        $this->typeGenerator = $typeGenerator;
25 36
        $this->compiled = $compiled;
26 36
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 36
    public function isOptional()
32
    {
33 36
        return !$this->compiled;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 35
    public function warmUp($cacheDir): void
40
    {
41 35
        if (!$this->compiled) {
42
            return;
43
        }
44
45
        // use warm up cache dir if type generator cache dir not already explicitly declare
46 35
        $baseCacheDir = $this->typeGenerator->getBaseCacheDir();
47 35
        if (null === $this->typeGenerator->getCacheDir(false)) {
48 35
            $this->typeGenerator->setBaseCacheDir($cacheDir);
49
        }
50 35
        $this->typeGenerator->compile(TypeGenerator::MODE_WRITE | TypeGenerator::MODE_OVERRIDE);
51 32
        $this->typeGenerator->setBaseCacheDir($baseCacheDir);
52 32
    }
53
}
54