1 | <?php |
||
32 | class AuditEntry extends ActiveRecord |
||
33 | { |
||
34 | /** |
||
35 | * @var bool |
||
36 | */ |
||
37 | protected $autoSerialize = false; |
||
38 | |||
39 | /** |
||
40 | * @inheritdoc |
||
41 | */ |
||
42 | 195 | public static function tableName() |
|
46 | |||
47 | /** |
||
48 | * @param bool $initialise |
||
49 | * @return static |
||
50 | */ |
||
51 | 117 | public static function create($initialise = true) |
|
59 | |||
60 | /** |
||
61 | * Returns all linked AuditError instances |
||
62 | * (Called `linkedErrors()` to avoid confusion with the `getErrors()` method) |
||
63 | * @return ActiveQuery |
||
64 | */ |
||
65 | 9 | public function getLinkedErrors() |
|
69 | |||
70 | /** |
||
71 | * Returns all linked AuditTrail instances |
||
72 | * @return ActiveQuery |
||
73 | */ |
||
74 | 9 | public function getTrails() |
|
78 | |||
79 | /** |
||
80 | * Returns all linked AuditMail instances |
||
81 | * @return ActiveQuery |
||
82 | */ |
||
83 | 9 | public function getMails() |
|
87 | |||
88 | /** |
||
89 | * Returns all linked AuditJavascript instances |
||
90 | * @return ActiveQuery |
||
91 | */ |
||
92 | 9 | public function getJavascripts() |
|
96 | |||
97 | /** |
||
98 | * Returns all linked data records |
||
99 | * @return ActiveQuery |
||
100 | */ |
||
101 | 3 | public function getData() |
|
105 | |||
106 | /** |
||
107 | * Writes a number of associated data records in one go. |
||
108 | * @param $batchData |
||
109 | * @param bool $compact |
||
110 | * @throws \yii\db\Exception |
||
111 | */ |
||
112 | 45 | public function addBatchData($batchData, $compact = true) |
|
129 | |||
130 | /** |
||
131 | * @param $type |
||
132 | * @param $data |
||
133 | * @param bool|true $compact |
||
134 | * @throws \yii\db\Exception |
||
135 | */ |
||
136 | 6 | public function addData($type, $data, $compact = true) |
|
147 | |||
148 | /** |
||
149 | * Records the current application state into the instance. |
||
150 | */ |
||
151 | 117 | public function record() |
|
168 | |||
169 | /** |
||
170 | * @return bool |
||
171 | */ |
||
172 | 75 | public function finalize() |
|
173 | { |
||
174 | 75 | $app = Yii::$app; |
|
175 | 75 | $request = $app->request; |
|
176 | |||
177 | 75 | if (!$this->user_id && $request instanceof \yii\web\Request) { |
|
178 | 75 | $this->user_id = Audit::getInstance()->getUserId(); |
|
179 | 75 | } |
|
180 | |||
181 | 75 | $this->duration = microtime(true) - YII_BEGIN_TIME; |
|
182 | 75 | $this->memory_max = memory_get_peak_usage(); |
|
183 | 75 | return $this->save(false, ['duration', 'memory_max', 'user_id']); |
|
184 | } |
||
185 | |||
186 | /** |
||
187 | * @return array |
||
188 | */ |
||
189 | 15 | public function attributeLabels() |
|
201 | |||
202 | /** |
||
203 | * @return bool |
||
204 | */ |
||
205 | public function hasRelatedData() |
||
206 | { |
||
207 | if ($this->getLinkedErrors()->count()) { |
||
208 | return true; |
||
209 | } |
||
210 | if ($this->getJavascripts()->count()) { |
||
211 | return true; |
||
212 | } |
||
213 | if ($this->getMails()->count()) { |
||
214 | return true; |
||
215 | } |
||
216 | if ($this->getTrails()->count()) { |
||
217 | return true; |
||
218 | } |
||
219 | return false; |
||
220 | } |
||
221 | |||
222 | /** |
||
223 | * @return string |
||
224 | */ |
||
225 | public function getUserIP() |
||
232 | |||
233 | /** |
||
234 | * @param AuditEntry $auditEntry |
||
|
|||
235 | * @return bool|string |
||
236 | */ |
||
237 | public static function getRequestUrl() |
||
247 | |||
248 | } |
||
249 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.