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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 42
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A setArtifacts() 0 5 1
A getArtifact() 0 8 2
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
}