1 | <?php |
||||
2 | /** |
||||
3 | * FlexiPeeHP - Document Default Address support |
||||
4 | * |
||||
5 | * @author Vítězslav Dvořák <[email protected]> |
||||
6 | * @copyright (C) 2018 Spoje.Net |
||||
7 | */ |
||||
8 | |||||
9 | namespace FlexiPeeHP; |
||||
10 | |||||
11 | /** |
||||
12 | * Add for Objects use with "firma" data column |
||||
13 | * @author Vítězslav Dvořák <[email protected]> |
||||
14 | */ |
||||
15 | trait Stitky |
||||
16 | { |
||||
17 | |||||
18 | /** |
||||
19 | * Get all labels for current record |
||||
20 | * |
||||
21 | * @return array |
||||
22 | */ |
||||
23 | public function getLabels() |
||||
24 | { |
||||
25 | return Stitek::listToArray($this->getDataValue('stitky')); |
||||
26 | } |
||||
27 | |||||
28 | /** |
||||
29 | * Set one of availble Labels for current record |
||||
30 | * |
||||
31 | * @param string $label |
||||
32 | * |
||||
33 | * @return boolean Operation success |
||||
34 | */ |
||||
35 | public function setLabel($label) |
||||
36 | { |
||||
37 | $this->insertToFlexiBee(['id' => $this->getRecordID(), 'stitky' => $label]); |
||||
38 | return $this->lastResultCode == 201; |
||||
39 | } |
||||
40 | |||||
41 | /** |
||||
42 | * UnSet Label for Current Object record |
||||
43 | * |
||||
44 | * @param string|array $label(s) To Remove |
||||
45 | * |
||||
46 | * @return boolean success result ? |
||||
47 | */ |
||||
48 | public function unsetLabel($labelsToRemove) |
||||
49 | { |
||||
50 | $this->insertToFlexiBee(['id' => $this->getMyKey(), 'stitky@removeAll' => 'true', |
||||
51 | 'stitky' => array_diff_key(self::getLabels($this), |
||||
0 ignored issues
–
show
The method
FlexiPeeHP\Stitky::getLabels() is not static, but was called statically.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
52 | Stitek::listToArray($labelsToRemove))]); |
||||
53 | return $this->lastResponseCode == 201; |
||||
54 | } |
||||
55 | |||||
56 | /** |
||||
57 | * UnSet all Labels for Current Object record |
||||
58 | * |
||||
59 | * @return boolean success result ? |
||||
60 | */ |
||||
61 | public function unsetLabels() |
||||
62 | { |
||||
63 | $this->insertToFlexiBee(['id' => $this->getMyKey(), 'stitky@removeAll' => 'true']); |
||||
64 | return $this->lastResponseCode == 201; |
||||
65 | } |
||||
66 | } |
||||
67 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.