These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace gossi\swagger; |
||
3 | |||
4 | use gossi\swagger\parts\ExtensionPart; |
||
5 | use phootwork\collection\CollectionUtils; |
||
6 | use phootwork\lang\Arrayable; |
||
7 | |||
8 | class Contact extends AbstractModel implements Arrayable { |
||
9 | |||
10 | use ExtensionPart; |
||
11 | |||
12 | /** @var string */ |
||
13 | private $name; |
||
14 | |||
15 | /** @var string */ |
||
16 | private $url; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $email; |
||
20 | |||
21 | 9 | public function __construct($contents = []) { |
|
22 | 9 | $this->parse($contents); |
|
23 | 9 | } |
|
24 | |||
25 | 9 | private function parse($contents = []) { |
|
26 | 9 | $data = CollectionUtils::toMap($contents); |
|
27 | |||
28 | 9 | $this->name = $data->get('name'); |
|
0 ignored issues
–
show
|
|||
29 | 9 | $this->url = $data->get('url'); |
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues.
Loading history...
|
|||
30 | 9 | $this->email = $data->get('email'); |
|
31 | |||
32 | // extensions |
||
33 | 9 | $this->parseExtensions($data); |
|
34 | 9 | } |
|
35 | |||
36 | 6 | public function toArray() { |
|
37 | 6 | return $this->export('name', 'url', 'email'); |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * |
||
42 | * @return string |
||
43 | */ |
||
44 | 1 | public function getName() { |
|
45 | 1 | return $this->name; |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * |
||
50 | * @param string $name |
||
51 | * @return $this |
||
52 | */ |
||
53 | 1 | public function setName($name) { |
|
54 | 1 | $this->name = $name; |
|
55 | 1 | return $this; |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | 1 | public function getUrl() { |
|
63 | 1 | return $this->url; |
|
64 | } |
||
65 | |||
66 | /** |
||
67 | * |
||
68 | * @param string $url |
||
69 | * @return $this |
||
70 | */ |
||
71 | 1 | public function setUrl($url) { |
|
72 | 1 | $this->url = $url; |
|
73 | 1 | return $this; |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 1 | public function getEmail() { |
|
81 | 1 | return $this->email; |
|
82 | } |
||
83 | |||
84 | /** |
||
85 | * |
||
86 | * @param string $email |
||
87 | * @return $this |
||
88 | */ |
||
89 | 1 | public function setEmail($email) { |
|
90 | 1 | $this->email = $email; |
|
91 | 1 | return $this; |
|
92 | } |
||
93 | |||
94 | } |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.