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.

NameTrait::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @link https://github.com/old-town/old-town-workflow
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\Loader\Traits;
7
8
use DOMElement;
9
use OldTown\Workflow\Loader\XmlUtil;
10
11
/**
12
 * Class ConditionDescriptor
13
 *
14
 * @package OldTown\Workflow\Loader
15
 */
16 View Code Duplication
trait NameTrait
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...
17
{
18
    /**
19
     * @var string
20
     */
21
   protected $name;
22
23
24
    /**
25
     * Возвращает имя
26
     *
27
     * @return string
28
     */
29 50
    public function getName()
30
    {
31 50
        return $this->name;
32
    }
33
34
    /**
35
     * Устанавливает имя
36
     *
37
     * @param $name
38
     *
39
     * @return $this
40
     */
41 1
    public function setName($name)
42
    {
43 1
        $this->name = $name;
44
45 1
        return $this;
46
    }
47
48
    /**
49
     * Парсит элемент и извлекает из имя
50
     *
51
     * @param DOMElement $element
52
     * @param bool       $flagRequired
53
     */
54 107
    protected function parseName(DOMElement $element, $flagRequired = false)
55
    {
56 107
        if ($flagRequired || (!$flagRequired && $element->hasAttribute('name'))) {
57 101
            $this->name = XmlUtil::getRequiredAttributeValue($element, 'name');
58 101
        }
59 107
    }
60
}
61