1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ProyectoTAU\TAU\Common; |
4
|
|
|
|
5
|
|
|
use phpDocumentor\Reflection\Types\True_; |
|
|
|
|
6
|
|
|
|
7
|
|
|
trait SettersBag |
8
|
|
|
{ |
9
|
|
|
private $setters = []; |
10
|
|
|
|
11
|
31 |
|
protected function setSettersBag($attributes) |
12
|
|
|
{ |
13
|
31 |
|
foreach ($attributes as $value) { |
14
|
31 |
|
$v = ucwords(strtolower($value)); |
15
|
31 |
|
$this->setters[] = 'set' . $v; |
16
|
31 |
|
$this->setters[] = 'get' . $v; |
17
|
|
|
} |
18
|
31 |
|
} |
19
|
|
|
|
20
|
39 |
|
protected function isSetterAllowed($name): bool |
21
|
|
|
{ |
22
|
39 |
|
return in_array($name, $this->setters, true); |
23
|
|
|
} |
24
|
|
|
|
25
|
39 |
|
public function __call($name, $arguments) |
26
|
|
|
{ |
27
|
39 |
|
if( ! $this->isSetterAllowed($name) ) { |
28
|
|
|
$trace = debug_backtrace(); |
29
|
|
|
trigger_error( |
30
|
|
|
'Disallowed getter/setter ' . $name . |
31
|
|
|
' in ' . $trace[0]['file'] . |
32
|
|
|
' on line ' . $trace[0]['line'], |
33
|
|
|
E_USER_NOTICE); |
34
|
|
|
return null; |
35
|
|
|
} |
36
|
|
|
|
37
|
39 |
|
$attribute = strtolower(substr($name, 3)); |
38
|
39 |
|
if($this->isSetter($name)){ |
39
|
31 |
|
$this->$attribute = $arguments[0]; |
40
|
36 |
|
} elseif( $this->isGetter($name) ) { |
41
|
36 |
|
return $this->$attribute; |
42
|
|
|
} else { |
43
|
|
|
$name(...$arguments); |
44
|
|
|
} |
45
|
31 |
|
} |
46
|
|
|
|
47
|
19 |
|
public function equals($o): bool |
48
|
|
|
{ |
49
|
19 |
|
foreach ($this->setters as $getter){ |
50
|
19 |
|
if( $this->isGetter($getter) ) |
51
|
|
|
{ |
52
|
19 |
|
if( $this->$getter() != $o->$getter() ) |
53
|
|
|
return false; |
54
|
|
|
} |
55
|
|
|
} |
56
|
19 |
|
return true; |
57
|
|
|
} |
58
|
|
|
|
59
|
39 |
|
private function isSetter($name): bool |
60
|
|
|
{ |
61
|
39 |
|
return substr($name, 0, 3) === 'set'; |
62
|
|
|
} |
63
|
|
|
|
64
|
36 |
|
private function isGetter($name): bool |
65
|
|
|
{ |
66
|
36 |
|
return substr($name, 0, 3) === 'get'; |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths