This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace EveryPolitician\EveryPoliticianPopolo\Objects; |
||
4 | |||
5 | use \DateTime; |
||
6 | |||
7 | class Membership extends PopoloObject |
||
8 | { |
||
9 | protected $properties = [ |
||
10 | 'role', |
||
11 | 'personId', |
||
12 | 'person', |
||
13 | 'organizationId', |
||
14 | 'organization', |
||
15 | 'areaId', |
||
16 | 'area', |
||
17 | 'legislativePeriodId', |
||
18 | 'legislativePeriod', |
||
19 | 'onBehalfOfId', |
||
20 | 'onBehalfOf', |
||
21 | 'postId', |
||
22 | 'post', |
||
23 | 'startDate', |
||
24 | 'endDate', |
||
25 | 'current', |
||
26 | ]; |
||
27 | |||
28 | /** |
||
29 | * String representation of {@link Membership} |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | 3 | public function __toString() |
|
34 | { |
||
35 | 3 | return "<Membership: '".$this->personId."' at '".$this->organizationId."'>"; |
|
0 ignored issues
–
show
The property
organizationId does not exist on object<EveryPolitician\E...olo\Objects\Membership> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
36 | } |
||
37 | |||
38 | 3 | protected function getRole() |
|
39 | { |
||
40 | 3 | return $this->arrGet($this->data, 'role'); |
|
41 | } |
||
42 | |||
43 | 12 | protected function getPersonId() |
|
44 | { |
||
45 | 12 | return $this->arrGet($this->data, 'person_id'); |
|
46 | } |
||
47 | |||
48 | 3 | protected function getPerson() |
|
49 | { |
||
50 | 3 | return $this->allPopolo->persons->lookupFromKey[$this->personId]; |
|
0 ignored issues
–
show
The property
personId does not exist on object<EveryPolitician\E...olo\Objects\Membership> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
51 | } |
||
52 | |||
53 | 9 | protected function getOrganizationId() |
|
54 | { |
||
55 | 9 | return $this->arrGet($this->data, 'organization_id'); |
|
56 | } |
||
57 | |||
58 | 3 | protected function getOrganization() |
|
59 | { |
||
60 | 3 | return $this->allPopolo->organizations->lookupFromKey[$this->organizationId]; |
|
0 ignored issues
–
show
The property
organizationId does not exist on object<EveryPolitician\E...olo\Objects\Membership> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
61 | } |
||
62 | |||
63 | 6 | protected function getAreaId() |
|
64 | { |
||
65 | 6 | return $this->arrGet($this->data, 'area_id'); |
|
66 | } |
||
67 | |||
68 | 3 | protected function getArea() |
|
69 | { |
||
70 | 3 | return $this->allPopolo->areas->lookupFromKey[$this->areaId]; |
|
0 ignored issues
–
show
The property
areaId does not exist on object<EveryPolitician\E...olo\Objects\Membership> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
71 | } |
||
72 | |||
73 | 6 | protected function getLegislativePeriodId() |
|
74 | { |
||
75 | 6 | return $this->arrGet($this->data, 'legislative_period_id'); |
|
76 | } |
||
77 | |||
78 | 3 | protected function getLegislativePeriod() |
|
79 | { |
||
80 | 3 | return $this->allPopolo->events->lookupFromKey[$this->legislativePeriodId]; |
|
0 ignored issues
–
show
The property
legislativePeriodId does not exist on object<EveryPolitician\E...olo\Objects\Membership> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
81 | } |
||
82 | |||
83 | 6 | protected function getOnBehalfOfId() |
|
84 | { |
||
85 | 6 | return $this->arrGet($this->data, 'on_behalf_of_id'); |
|
86 | } |
||
87 | |||
88 | 3 | protected function getOnBehalfOf() |
|
89 | { |
||
90 | 3 | return $this->allPopolo->organizations->lookupFromKey[$this->onBehalfOfId]; |
|
0 ignored issues
–
show
The property
onBehalfOfId does not exist on object<EveryPolitician\E...olo\Objects\Membership> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
91 | } |
||
92 | |||
93 | 6 | protected function getPostId() |
|
94 | { |
||
95 | 6 | return $this->arrGet($this->data, 'post_id'); |
|
96 | } |
||
97 | |||
98 | 3 | protected function getPost() |
|
99 | { |
||
100 | 3 | return $this->allPopolo->posts->lookupFromKey[$this->postId]; |
|
0 ignored issues
–
show
The property
postId does not exist on object<EveryPolitician\E...olo\Objects\Membership> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
101 | } |
||
102 | |||
103 | 12 | protected function getStartDate() |
|
104 | { |
||
105 | // TODO: Mark uses his magical ApproxDate.PAST here |
||
106 | 12 | return $this->getDate('start_date'); |
|
107 | } |
||
108 | |||
109 | 6 | protected function getEndDate() |
|
110 | { |
||
111 | // TODO: Mark uses his magical ApproxDate.FUTURE here |
||
112 | 6 | return $this->getDate('end_date'); |
|
113 | } |
||
114 | |||
115 | 54 | protected function getKeyForHash() |
|
116 | { |
||
117 | 54 | $sortedData = $this->data; |
|
118 | 54 | ksort($sortedData); |
|
119 | 54 | return json_encode($sortedData); |
|
120 | } |
||
121 | |||
122 | protected function getCurrent() |
||
123 | { |
||
124 | return $this->currentAt(new DateTime); |
||
125 | } |
||
126 | |||
127 | 9 | public function currentAt($when) |
|
128 | { |
||
129 | 9 | return ($when >= $this->startDate && $when <= $this->endDate); |
|
0 ignored issues
–
show
The property
startDate does not exist on object<EveryPolitician\E...olo\Objects\Membership> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
endDate does not exist on object<EveryPolitician\E...olo\Objects\Membership> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
130 | } |
||
131 | |||
132 | 9 | View Code Duplication | public function equals($other) |
0 ignored issues
–
show
This method 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. ![]() |
|||
133 | { |
||
134 | 9 | if (is_object($other) && get_class($other) == get_class($this)) { |
|
135 | 6 | return $this->data == $other->data; |
|
136 | } |
||
137 | // TODO: Throw a custom exception here |
||
138 | 3 | throw new \BadMethodCallException; |
|
139 | } |
||
140 | } |
||
141 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.