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...
13
{
14
/**
15
* @var null|string
16
*/
17
private $prefix;
18
19
/**
20
* XmlAttribute constructor.
21
*
22
* @param string $name
23
* @param string|null $value
24
* @param string|null $prefix
25
*/
26
public function __construct(string $name, string $value = null, string $prefix = null)
27
{
28
parent::__construct($name, $value);
29
30
if ($prefix !== null) {
31
$this->setPrefix($prefix);
32
}
33
}
34
35
/**
36
* @return string
37
*/
38
final public function getPrefix(): string
39
{
40
return $this->prefix;
41
}
42
43
/**
44
* @param string $prefix
45
*/
46
final public function setPrefix(string $prefix)
47
{
48
$prefix = trim($prefix);
49
if (strlen($prefix) !== 0) {
50
$this->prefix = $prefix;
51
}
52
}
53
54
/**
55
* @return bool
56
*/
57
final public function hasPrefix(): bool
58
{
59
return $this->prefix !== null;
60
}
61
62
/**
63
* @param VisitorInterface $hydrator
64
*/
65
public function accept(VisitorInterface $hydrator)
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.