1 | <?php |
||
68 | class Issue extends ModelAbstract |
||
69 | { |
||
70 | use IssueRelations, |
||
71 | IssueScopes, |
||
72 | LoggedUser; |
||
73 | |||
74 | /** |
||
75 | * Issue status: Open. |
||
76 | * |
||
77 | * @var int |
||
78 | */ |
||
79 | const STATUS_OPEN = 1; |
||
80 | |||
81 | /** |
||
82 | * Issue status: Closed. |
||
83 | * |
||
84 | * @var int |
||
85 | */ |
||
86 | const STATUS_CLOSED = 0; |
||
87 | |||
88 | /** |
||
89 | * Timestamp enabled. |
||
90 | * |
||
91 | * @var bool |
||
92 | */ |
||
93 | public $timestamps = true; |
||
94 | |||
95 | /** |
||
96 | * Name of database table. |
||
97 | * |
||
98 | * @var string |
||
99 | */ |
||
100 | protected $table = 'projects_issues'; |
||
101 | |||
102 | /** |
||
103 | * List of allowed columns to be used in $this->fill(). |
||
104 | * |
||
105 | * @var array |
||
106 | */ |
||
107 | protected $fillable = ['created_by', 'project_id', 'title', 'body', 'assigned_to', 'time_quote', 'lock_quote']; |
||
108 | |||
109 | /** |
||
110 | * Set attributes default value. |
||
111 | * |
||
112 | * @var array |
||
113 | */ |
||
114 | protected $attributes = [ |
||
115 | 'status' => self::STATUS_OPEN, |
||
116 | ]; |
||
117 | |||
118 | /** |
||
119 | * @param User|null $user |
||
120 | * |
||
121 | * @return \Tinyissue\Repository\Project\Issue\Updater |
||
122 | */ |
||
123 | public function updater(User $user = null) |
||
127 | |||
128 | /** |
||
129 | * Generate a URL for the active project. |
||
130 | * |
||
131 | * @param string $url |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | public function to($url = '') |
||
139 | |||
140 | /** |
||
141 | * Convert time quote from an array into seconds. |
||
142 | * |
||
143 | * @param array $value |
||
144 | */ |
||
145 | public function setTimeQuoteAttribute($value) |
||
155 | |||
156 | /** |
||
157 | * Returns the color of tag status. |
||
158 | * |
||
159 | * @return string |
||
160 | */ |
||
161 | public function getTypeColorAttribute() |
||
173 | |||
174 | /** |
||
175 | * Whether or not the issue is new. |
||
176 | * |
||
177 | * @return bool |
||
178 | */ |
||
179 | public function isNew() |
||
187 | |||
188 | /** |
||
189 | * Whether or not the issue is open or closed. |
||
190 | * |
||
191 | * @return bool |
||
192 | */ |
||
193 | public function isOpen() |
||
197 | |||
198 | /** |
||
199 | * Check if the issue contains a tag with option to set the issue as readonly to current user. |
||
200 | * |
||
201 | * @param Model\User $user |
||
202 | * |
||
203 | * @return bool |
||
204 | */ |
||
205 | public function hasReadOnlyTag(Model\User $user) |
||
211 | |||
212 | /** |
||
213 | * Whether or not the issue quote is locked by manager. |
||
214 | * |
||
215 | * @return bool |
||
216 | */ |
||
217 | public function isQuoteLocked() |
||
221 | |||
222 | /** |
||
223 | * Whether or not a user is the creator of the issue. |
||
224 | * |
||
225 | * @param Model\User $user |
||
226 | * |
||
227 | * @return bool |
||
228 | */ |
||
229 | public function isCreatedBy(Model\User $user) |
||
233 | } |
||
234 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.