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')); |
||||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||||
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->getRecordIdent(), 'stitky' => $label]); |
||||||||
0 ignored issues
–
show
It seems like
insertToFlexiBee() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() It seems like
getRecordIdent() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||||
38 | return $this->lastResponseCode == 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->getRecordIdent(), 'stitky@removeAll' => 'true', |
||||||||
51 | 'stitky' => array_diff_key($this->getLabels($this), |
||||||||
0 ignored issues
–
show
The call to
FlexiPeeHP\Stitky::getLabels() has too many arguments starting with $this .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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. ![]() |
|||||||||
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->getRecordIdent(), 'stitky@removeAll' => 'true']); |
||||||||
64 | return $this->lastResponseCode == 201; |
||||||||
65 | } |
||||||||
66 | } |
||||||||
67 |