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 ( d777dd...f9710a )
by Iakov
02:39
created

AbstractStep::setArtifacts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Kami\Component\RequestProcessor\Step;
4
5
use Kami\Component\RequestProcessor\ArtifactCollection;
6
use Kami\Component\RequestProcessor\ProcessingException;
7
8
/**
9
 * Class AbstractStep
10
 *
11
 * @package Kami\ApiCoreBundle\RequestProcessor\Step
12
 */
13
abstract class AbstractStep implements StepInterface
14
{
15
16
    /**
17
     * @var ArtifactCollection
18
     */
19
    protected $artifacts;
20
21
    /**
22
     * @return string
23
     */
24 1
    public function getName() : string
25
    {
26 1
        return get_class($this);
27
    }
28
29
    /**
30
     * @param ArtifactCollection $artifacts
31
     *
32
     * @return StepInterface
33
     */
34 3
    public function setArtifacts(ArtifactCollection $artifacts): StepInterface
35
    {
36 3
        $this->artifacts = $artifacts;
37
38 3
        return $this;
39
    }
40
41
    /**
42
     * @param $name
43
     * @return mixed
44
     *
45
     * @throws ProcessingException
46
     */
47 2
    protected function getArtifact($name)
48
    {
49 2
        $artifact = $this->artifacts->get($name);
50 2
        if(!$artifact) {
51 1
            throw new ProcessingException(sprintf('You don\'t have "%s" artifact yet.', $name));
52
        }
53
54 1
        return $artifact->getValue();
55
    }
56
}