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 | /* |
||
4 | * This file is part of Jitamin. |
||
5 | * |
||
6 | * Copyright (C) Jitamin Team |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Jitamin\Model; |
||
13 | |||
14 | use Jitamin\Foundation\Database\Model; |
||
15 | |||
16 | /** |
||
17 | * Column Model. |
||
18 | */ |
||
19 | class ColumnModel extends Model |
||
20 | { |
||
21 | /** |
||
22 | * SQL table name. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | const TABLE = 'columns'; |
||
27 | |||
28 | /** |
||
29 | * Get a column by the id. |
||
30 | * |
||
31 | * @param int $column_id Column id |
||
32 | * |
||
33 | * @return array |
||
34 | */ |
||
35 | public function getById($column_id) |
||
36 | { |
||
37 | return $this->db->table(self::TABLE)->eq('id', $column_id)->findOne(); |
||
0 ignored issues
–
show
|
|||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Get projectId by the columnId. |
||
42 | * |
||
43 | * @param int $column_id Column id |
||
44 | * |
||
45 | * @return int |
||
46 | */ |
||
47 | public function getProjectId($column_id) |
||
48 | { |
||
49 | return $this->db->table(self::TABLE)->eq('id', $column_id)->findOneColumn('project_id'); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Get the first column id for a given project. |
||
54 | * |
||
55 | * @param int $project_id Project id |
||
56 | * |
||
57 | * @return int |
||
58 | */ |
||
59 | public function getFirstColumnId($project_id) |
||
60 | { |
||
61 | return $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->findOneColumn('id'); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
62 | } |
||
63 | |||
64 | /** |
||
65 | * Get the last column id for a given project. |
||
66 | * |
||
67 | * @param int $project_id Project id |
||
68 | * |
||
69 | * @return int |
||
70 | */ |
||
71 | public function getLastColumnId($project_id) |
||
72 | { |
||
73 | return $this->db->table(self::TABLE)->eq('project_id', $project_id)->desc('position')->findOneColumn('id'); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Get the position of the last column for a given project. |
||
78 | * |
||
79 | * @param int $project_id Project id |
||
80 | * |
||
81 | * @return int |
||
82 | */ |
||
83 | public function getLastColumnPosition($project_id) |
||
84 | { |
||
85 | return (int) $this->db |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
86 | ->table(self::TABLE) |
||
87 | ->eq('project_id', $project_id) |
||
88 | ->desc('position') |
||
89 | ->findOneColumn('position'); |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * Get a column id by the name. |
||
94 | * |
||
95 | * @param int $project_id |
||
96 | * @param string $title |
||
97 | * |
||
98 | * @return int |
||
99 | */ |
||
100 | public function getColumnIdByTitle($project_id, $title) |
||
101 | { |
||
102 | return (int) $this->db->table(self::TABLE)->eq('project_id', $project_id)->eq('title', $title)->findOneColumn('id'); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
103 | } |
||
104 | |||
105 | /** |
||
106 | * Get a column title by the id. |
||
107 | * |
||
108 | * @param int $column_id |
||
109 | * |
||
110 | * @return int |
||
111 | */ |
||
112 | public function getColumnTitleById($column_id) |
||
113 | { |
||
114 | return $this->db->table(self::TABLE)->eq('id', $column_id)->findOneColumn('title'); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
115 | } |
||
116 | |||
117 | /** |
||
118 | * Get all columns sorted by position for a given project. |
||
119 | * |
||
120 | * @param int $project_id Project id |
||
121 | * |
||
122 | * @return array |
||
123 | */ |
||
124 | public function getAll($project_id) |
||
125 | { |
||
126 | return $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->findAll(); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
127 | } |
||
128 | |||
129 | /** |
||
130 | * Get the list of columns sorted by position [ column_id => title ]. |
||
131 | * |
||
132 | * @param int $project_id Project id |
||
133 | * @param bool $prepend Prepend a default value |
||
134 | * |
||
135 | * @return array |
||
136 | */ |
||
137 | public function getList($project_id, $prepend = false) |
||
138 | { |
||
139 | $listing = $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->asc('position')->getAll('id', 'title'); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
140 | |||
141 | return $prepend ? [-1 => t('All columns')] + $listing : $listing; |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * Add a new column to the board. |
||
146 | * |
||
147 | * @param int $project_id Project id |
||
148 | * @param string $title Column title |
||
149 | * @param int $task_limit Task limit |
||
150 | * @param string $description Column description |
||
151 | * @param int $hide_in_dashboard |
||
152 | * |
||
153 | * @return bool|int |
||
154 | */ |
||
155 | public function create($project_id, $title, $task_limit = 0, $description = '', $hide_in_dashboard = 0) |
||
156 | { |
||
157 | $values = [ |
||
158 | 'project_id' => $project_id, |
||
159 | 'title' => $title, |
||
160 | 'task_limit' => intval($task_limit), |
||
161 | 'position' => $this->getLastColumnPosition($project_id) + 1, |
||
162 | 'hide_in_dashboard' => $hide_in_dashboard, |
||
163 | 'description' => $description, |
||
164 | ]; |
||
165 | |||
166 | return $this->db->table(self::TABLE)->persist($values); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
167 | } |
||
168 | |||
169 | /** |
||
170 | * Update a column. |
||
171 | * |
||
172 | * @param int $column_id Column id |
||
173 | * @param string $title Column title |
||
174 | * @param int $task_limit Task limit |
||
175 | * @param string $description Optional description |
||
176 | * @param int $hide_in_dashboard |
||
177 | * |
||
178 | * @return bool |
||
179 | */ |
||
180 | public function update($column_id, $title, $task_limit = 0, $description = '', $hide_in_dashboard = 0) |
||
181 | { |
||
182 | return $this->db->table(self::TABLE)->eq('id', $column_id)->update([ |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
183 | 'title' => $title, |
||
184 | 'task_limit' => intval($task_limit), |
||
185 | 'hide_in_dashboard' => $hide_in_dashboard, |
||
186 | 'description' => $description, |
||
187 | ]); |
||
188 | } |
||
189 | |||
190 | /** |
||
191 | * Remove a column and all tasks associated to this column. |
||
192 | * |
||
193 | * @param int $column_id Column id |
||
194 | * |
||
195 | * @return bool |
||
196 | */ |
||
197 | public function remove($column_id) |
||
198 | { |
||
199 | return $this->db->table(self::TABLE)->eq('id', $column_id)->remove(); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
200 | } |
||
201 | |||
202 | /** |
||
203 | * Change column position. |
||
204 | * |
||
205 | * @param int $project_id |
||
206 | * @param int $column_id |
||
207 | * @param int $position |
||
208 | * |
||
209 | * @return bool |
||
210 | */ |
||
211 | View Code Duplication | public function changePosition($project_id, $column_id, $position) |
|
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. ![]() |
|||
212 | { |
||
213 | if ($position < 1 || $position > $this->db->table(self::TABLE)->eq('project_id', $project_id)->count()) { |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
214 | return false; |
||
215 | } |
||
216 | |||
217 | $column_ids = $this->db->table(self::TABLE)->eq('project_id', $project_id)->neq('id', $column_id)->asc('position')->findAllByColumn('id'); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
218 | $offset = 1; |
||
219 | $results = []; |
||
220 | |||
221 | foreach ($column_ids as $current_column_id) { |
||
222 | if ($offset == $position) { |
||
223 | $offset++; |
||
224 | } |
||
225 | |||
226 | $results[] = $this->db->table(self::TABLE)->eq('id', $current_column_id)->update(['position' => $offset]); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
227 | $offset++; |
||
228 | } |
||
229 | |||
230 | $results[] = $this->db->table(self::TABLE)->eq('id', $column_id)->update(['position' => $position]); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\ColumnModel> . 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. ![]() |
|||
231 | |||
232 | return !in_array(false, $results, true); |
||
233 | } |
||
234 | } |
||
235 |
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.