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.

getGeneratedMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
namespace MageTest\PhpSpec\MagentoExtension\CodeGenerator\Generator;
4
5
use PhpSpec\CodeGenerator\Generator\PromptingGenerator;
6
use PhpSpec\CodeGenerator\Generator\Generator as GeneratorInterface;
7
use PhpSpec\Locator\Resource as ResourceInterface;
8
9
class ControllerSpecificationGenerator extends PromptingGenerator implements GeneratorInterface
10
{
11
    /**
12
     * @param ResourceInterface $resource
13
     * @param string $generation
14
     * @param array $data
15
     * @return bool
16
     */
17
    public function supports(ResourceInterface $resource, $generation, array $data)
18
    {
19
        return 'controller_specification' === $generation;
20
    }
21
22
    public function getPriority()
23
    {
24
        return 0;
25
    }
26
27
    /**
28
     * @param ResourceInterface $resource
29
     *
30
     * @return string
31
     */
32
    protected function getFilePath(ResourceInterface $resource)
33
    {
34
        return $resource->getSpecFilename();
35
    }
36
37
    /**
38
     * @param ResourceInterface $resource
39
     * @param string $filepath
40
     *
41
     * @return string
42
     */
43
    protected function renderTemplate(ResourceInterface $resource, $filepath)
44
    {
45
        $values = array(
46
            '%filepath%'  => $filepath,
47
            '%name%'      => $resource->getSpecName(),
48
            '%namespace%' => $resource->getSpecNamespace(),
49
            '%subject%'   => $resource->getSrcClassname()
50
        );
51
52
        if (!$content = $this->getTemplateRenderer()->render('controller_specification', $values)) {
53
            $content = $this->getTemplateRenderer()->renderString(
54
                file_get_contents(__DIR__ . '/templates/controller_spec.template'), $values
55
            );
56
        }
57
58
        return $content;
59
    }
60
61
    /**
62
     * @param ResourceInterface $resource
63
     * @param string $filepath
64
     *
65
     * @return string
66
     */
67
    protected function getGeneratedMessage(ResourceInterface $resource, $filepath)
68
    {
69
        sprintf(
70
            "<info>ControllerSpecification for <value>%s</value> created in <value>'%s'</value>.</info>\n",
71
            $resource->getSrcClassname(),
72
            $filepath
73
        );
74
    }
75
}
76