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.

BlockGenerator::getFilePath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * MageSpec
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the MIT License, that is bundled with this
8
 * package in the file LICENSE.
9
 * It is also available through the world-wide-web at this URL:
10
 *
11
 * http://opensource.org/licenses/MIT
12
 *
13
 * If you did not receive a copy of the license and are unable to obtain it
14
 * through the world-wide-web, please send an email
15
 * to <[email protected]> so we can send you a copy immediately.
16
 *
17
 * @category   MageTest
18
 * @package    PhpSpec_MagentoExtension
19
 *
20
 * @copyright  Copyright (c) 2012-2013 MageTest team and contributors.
21
 */
22
namespace MageTest\PhpSpec\MagentoExtension\CodeGenerator\Generator;
23
24
use MageTest\PhpSpec\MagentoExtension\Locator\Magento\BlockResource;
25
use PhpSpec\CodeGenerator\Generator\Generator as GeneratorInterface;
26
use PhpSpec\Locator\Resource as ResourceInterface;
27
28
/**
29
 * BlockGenerator
30
 *
31
 * @category   MageTest
32
 * @package    PhpSpec_MagentoExtension
33
 *
34
 * @author     MageTest team (https://github.com/MageTest/MageSpec/contributors)
35
 */
36 View Code Duplication
class BlockGenerator extends MagentoObjectGenerator implements GeneratorInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
{
38
    /**
39
     * @param ResourceInterface $resource
40
     * @param string $generation
41
     * @param array $data
42
     * @return bool
43
     */
44
    public function supports(ResourceInterface $resource, $generation, array $data)
45
    {
46
        return 'class' === $generation && $resource instanceof BlockResource;
47
    }
48
49
    /**
50
     * @return int
51
     */
52
    public function getPriority()
53
    {
54
        return 30;
55
    }
56
57
    /**
58
     * @param ResourceInterface $resource
59
     *
60
     * @return string
61
     */
62
    protected function getFilePath(ResourceInterface $resource)
63
    {
64
        return $resource->getSrcFilename();
65
    }
66
67
    /**
68
     * @param ResourceInterface $resource
69
     * @param string $filepath
70
     *
71
     * @return string
72
     */
73
    protected function getGeneratedMessage(ResourceInterface $resource, $filepath)
74
    {
75
        return sprintf(
76
            "<info>Magento block <value>%s</value> created in <value>'%s'</value>.</info>\n",
77
            $resource->getSrcClassname(),
78
            $filepath
79
        );
80
    }
81
82
    /**
83
     * @return string
84
     */
85
    protected function getParentClass()
86
    {
87
        return 'Mage_Core_Block_Abstract';
88
    }
89
90
    /**
91
     * @return string
92
     */
93
    protected function getTemplateName()
94
    {
95
        return 'mage_block';
96
    }
97
}
98