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 Anax\Events; |
||
4 | |||
5 | /** |
||
6 | * Model for Events. |
||
7 | * |
||
8 | */ |
||
9 | class Event extends \Anax\Events\CDatabaseModel { |
||
10 | |||
11 | public function getSource() |
||
12 | { |
||
13 | return strtolower(implode('', array_slice(explode('\\', get_class($this)), -1))); |
||
14 | } |
||
15 | |||
16 | public function getProperties() |
||
17 | { |
||
18 | $properties = get_object_vars($this); |
||
19 | unset($properties['di']); |
||
20 | unset($properties['db']); |
||
21 | |||
22 | return $properties; |
||
23 | } |
||
24 | |||
25 | public function setProperties($properties) |
||
26 | { |
||
27 | // Update object with incoming values, if any |
||
28 | if (!empty($properties)) { |
||
29 | foreach ($properties as $key => $val) { |
||
30 | $this->$key = $val; |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 | |||
35 | public function findAllOfMonth($month, $year) |
||
36 | { |
||
37 | $start_date = "showdate >= '".$year ."-".$month ."-01'"; |
||
38 | $end_date = "showdate <= '".$year ."-".$month ."-31'"; |
||
39 | |||
40 | $this->db->select() |
||
0 ignored issues
–
show
|
|||
41 | ->from($this->getSource()) |
||
42 | ->where($start_date) |
||
43 | ->andWhere($end_date) |
||
44 | ->execute(); |
||
45 | |||
46 | return $this->db->fetchAll($this); |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
47 | } |
||
48 | |||
49 | public function findEventsOfDay($date){ |
||
50 | |||
51 | $currentDate = "'". $date ."'" ; |
||
52 | $this->db->select() |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
53 | ->from($this->getSource()) |
||
54 | ->where('showdate = '.$currentDate) |
||
55 | ->execute(); |
||
56 | |||
57 | return $this->db->fetchAll($this); |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
58 | } |
||
59 | |||
60 | /** |
||
61 | * |
||
62 | * @return array with eventcount per day. |
||
63 | */ |
||
64 | public function getEventCountPerDayOfMonth($month,$year = '2016'){ |
||
65 | $eventsPerDayForMonth = []; |
||
66 | |||
67 | for($i = 1;$i < 32;$i++){ |
||
68 | $day = sprintf('%02s', $i); |
||
69 | $date = "'".$year ."-".$month ."-".$day."'"; |
||
70 | $count = $this->getEventCount($date); |
||
71 | $eventsPerDayForMonth[$i] = $count; |
||
72 | } |
||
73 | |||
74 | return $eventsPerDayForMonth; |
||
75 | } |
||
76 | public function getEventCount($date){ |
||
77 | $this->db->select() |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
78 | ->from($this->getSource()) |
||
79 | ->where('showdate = '.$date) |
||
80 | ->execute(); |
||
81 | $count = $this->db->fetchAll($this); |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
82 | |||
83 | return $result = count($count); |
||
0 ignored issues
–
show
$result is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
84 | |||
85 | } |
||
86 | |||
87 | public function save($values = []) |
||
88 | { |
||
89 | $this->setProperties($values); |
||
90 | $values = $this->getProperties(); |
||
91 | |||
92 | if (isset($values['id'])) { |
||
93 | return $this->update($values); |
||
94 | } else { |
||
95 | return $this->create($values); |
||
96 | } |
||
97 | } |
||
98 | |||
99 | public function create($values) |
||
100 | { |
||
101 | $keys = array_keys($values); |
||
102 | $values = array_values($values); |
||
103 | |||
104 | $this->db->insert( |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
105 | $this->getSource(), |
||
106 | $keys |
||
107 | ); |
||
108 | |||
109 | $res = $this->db->execute($values); |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
110 | |||
111 | $this->id = $this->db->lastInsertId(); |
||
0 ignored issues
–
show
The property
id does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
112 | |||
113 | return $res; |
||
114 | } |
||
115 | |||
116 | public function update($values) |
||
117 | { |
||
118 | $keys = array_keys($values); |
||
119 | $values = array_values($values); |
||
120 | |||
121 | unset($keys['id']); |
||
122 | $values[] = $this->id; |
||
123 | |||
124 | |||
125 | $this->db->update( |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
126 | $this->getSource(), |
||
127 | $keys, |
||
128 | "id = ?" |
||
129 | ); |
||
130 | |||
131 | return $this->db->execute($values); |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
132 | } |
||
133 | |||
134 | public function find($id) |
||
135 | { |
||
136 | $this->db->select() |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
137 | ->from($this->getSource()) |
||
138 | ->where("id = ?"); |
||
139 | |||
140 | $this->db->execute([$id]); |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
141 | return $this->db->fetchInto($this); |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
142 | } |
||
143 | |||
144 | public function delete($id) |
||
145 | { |
||
146 | |||
147 | $this->db->delete( |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
148 | $this->getSource(), |
||
149 | 'id = ?' |
||
150 | ); |
||
151 | |||
152 | return $this->db->execute([$id]); |
||
0 ignored issues
–
show
The property
db does not exist on object<Anax\Events\Event> . 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. ![]() |
|||
153 | } |
||
154 | |||
155 | |||
156 | } |
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.