Completed
Pull Request — master (#3)
by Guilh
02:22
created
src/Schema.php 1 patch
Braces   +17 added lines, -34 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 use phootwork\lang\Arrayable;
15 15
 use phootwork\collection\Map;
16 16
 
17
-class Schema extends AbstractModel implements Arrayable
18
-{
17
+class Schema extends AbstractModel implements Arrayable {
19 18
     use RefPart;
20 19
     use TypePart;
21 20
     use DescriptionPart;
@@ -49,13 +48,11 @@  discard block
 block discarded – undo
49 48
     /** @var Schema */
50 49
     private $additionalProperties;
51 50
 
52
-    public function __construct($contents = null)
53
-    {
51
+    public function __construct($contents = null) {
54 52
         $this->parse($contents === null ? new Map() : $contents);
55 53
     }
56 54
 
57
-    private function parse($contents = [])
58
-    {
55
+    private function parse($contents = []) {
59 56
         $data = CollectionUtils::toMap($contents);
60 57
 
61 58
         $this->title = $data->get('title');
@@ -84,8 +81,7 @@  discard block
 block discarded – undo
84 81
         $this->parseExtensions($data);
85 82
     }
86 83
 
87
-    public function toArray()
88
-    {
84
+    public function toArray() {
89 85
         return $this->export('title', 'discriminator', 'description', 'readOnly', 'example',
90 86
                 'externalDocs', $this->getTypeExportFields(), 'items', 'required',
91 87
                 'properties', 'additionalProperties', 'allOf');
@@ -94,8 +90,7 @@  discard block
 block discarded – undo
94 90
     /**
95 91
      * @return bool|array
96 92
      */
97
-    public function getRequired()
98
-    {
93
+    public function getRequired() {
99 94
         return $this->required;
100 95
     }
101 96
 
@@ -104,8 +99,7 @@  discard block
 block discarded – undo
104 99
      *
105 100
      * @return $this
106 101
      */
107
-    public function setRequired($required)
108
-    {
102
+    public function setRequired($required) {
109 103
         $this->required = $required;
110 104
 
111 105
         return $this;
@@ -114,16 +108,14 @@  discard block
 block discarded – undo
114 108
     /**
115 109
      * @return string
116 110
      */
117
-    public function getDiscriminator()
118
-    {
111
+    public function getDiscriminator() {
119 112
         return $this->discriminator;
120 113
     }
121 114
 
122 115
     /**
123 116
      * @param string $discriminator
124 117
      */
125
-    public function setDiscriminator($discriminator)
126
-    {
118
+    public function setDiscriminator($discriminator) {
127 119
         $this->discriminator = $discriminator;
128 120
 
129 121
         return $this;
@@ -132,16 +124,14 @@  discard block
 block discarded – undo
132 124
     /**
133 125
      * @return bool
134 126
      */
135
-    public function isReadOnly()
136
-    {
127
+    public function isReadOnly() {
137 128
         return $this->readOnly;
138 129
     }
139 130
 
140 131
     /**
141 132
      * @param bool $readOnly
142 133
      */
143
-    public function setReadOnly($readOnly)
144
-    {
134
+    public function setReadOnly($readOnly) {
145 135
         $this->readOnly = $readOnly;
146 136
 
147 137
         return $this;
@@ -150,16 +140,14 @@  discard block
 block discarded – undo
150 140
     /**
151 141
      * @return string
152 142
      */
153
-    public function getExample()
154
-    {
143
+    public function getExample() {
155 144
         return $this->example;
156 145
     }
157 146
 
158 147
     /**
159 148
      * @param string $example
160 149
      */
161
-    public function setExample($example)
162
-    {
150
+    public function setExample($example) {
163 151
         $this->example = $example;
164 152
 
165 153
         return $this;
@@ -168,8 +156,7 @@  discard block
 block discarded – undo
168 156
     /**
169 157
      * @return string
170 158
      */
171
-    public function getTitle()
172
-    {
159
+    public function getTitle() {
173 160
         return $this->title;
174 161
     }
175 162
 
@@ -178,8 +165,7 @@  discard block
 block discarded – undo
178 165
      *
179 166
      * @return $this
180 167
      */
181
-    public function setTitle($title)
182
-    {
168
+    public function setTitle($title) {
183 169
         $this->title = $title;
184 170
 
185 171
         return $this;
@@ -188,24 +174,21 @@  discard block
 block discarded – undo
188 174
     /**
189 175
      * @return Definitions
190 176
      */
191
-    public function getProperties()
192
-    {
177
+    public function getProperties() {
193 178
         return $this->properties;
194 179
     }
195 180
 
196 181
     /**
197 182
      * @return ArrayList
198 183
      */
199
-    public function getAllOf()
200
-    {
184
+    public function getAllOf() {
201 185
         return $this->allOf;
202 186
     }
203 187
 
204 188
     /**
205 189
      * @return Schema
206 190
      */
207
-    public function getAdditionalProperties()
208
-    {
191
+    public function getAdditionalProperties() {
209 192
         if ($this->additionalProperties === null) {
210 193
             $this->additionalProperties = new self();
211 194
         }
Please login to merge, or discard this patch.
src/Tag.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@  discard block
 block discarded – undo
8 8
 use gossi\swagger\parts\ExternalDocsPart;
9 9
 use gossi\swagger\parts\DescriptionPart;
10 10
 
11
-class Tag extends AbstractModel implements Arrayable
12
-{
11
+class Tag extends AbstractModel implements Arrayable {
13 12
     use DescriptionPart;
14 13
     use ExternalDocsPart;
15 14
     use ExtensionPart;
@@ -19,13 +18,11 @@  discard block
 block discarded – undo
19 18
 
20 19
     private $isObject = true;
21 20
 
22
-    public function __construct($contents = [])
23
-    {
21
+    public function __construct($contents = []) {
24 22
         $this->parse($contents);
25 23
     }
26 24
 
27
-    private function parse($contents = [])
28
-    {
25
+    private function parse($contents = []) {
29 26
         if (is_string($contents)) {
30 27
             $this->isObject = false;
31 28
             $this->name = $contents;
@@ -42,34 +39,29 @@  discard block
 block discarded – undo
42 39
         }
43 40
     }
44 41
 
45
-    public function toArray()
46
-    {
42
+    public function toArray() {
47 43
         return $this->export('name', 'description', 'externalDocs');
48 44
     }
49 45
 
50
-    public function isObject()
51
-    {
46
+    public function isObject() {
52 47
         return $this->isObject;
53 48
     }
54 49
 
55
-    public function setObject($object)
56
-    {
50
+    public function setObject($object) {
57 51
         $this->isObject = $object;
58 52
     }
59 53
 
60 54
     /**
61 55
      * @return string
62 56
      */
63
-    public function getName()
64
-    {
57
+    public function getName() {
65 58
         return $this->name;
66 59
     }
67 60
 
68 61
     /**
69 62
      * @param string $name
70 63
      */
71
-    public function setName($name)
72
-    {
64
+    public function setName($name) {
73 65
         $this->name = $name;
74 66
 
75 67
         return $this;
Please login to merge, or discard this patch.
src/Swagger.php 1 patch
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
 use gossi\swagger\collections\Paths;
20 20
 use gossi\swagger\collections\Definitions;
21 21
 
22
-class Swagger extends AbstractModel implements Arrayable
23
-{
22
+class Swagger extends AbstractModel implements Arrayable {
24 23
     use SchemesPart;
25 24
     use ConsumesPart;
26 25
     use ProducesPart;
@@ -78,8 +77,7 @@  discard block
 block discarded – undo
78 77
      *
79 78
      * @return static
80 79
      */
81
-    public static function fromFile($filename)
82
-    {
80
+    public static function fromFile($filename) {
83 81
         $file = new File($filename);
84 82
 
85 83
         if (!$file->exists()) {
@@ -91,13 +89,11 @@  discard block
 block discarded – undo
91 89
         return new static($json);
92 90
     }
93 91
 
94
-    public function __construct($contents = [])
95
-    {
92
+    public function __construct($contents = []) {
96 93
         $this->parse($contents);
97 94
     }
98 95
 
99
-    private function parse($contents)
100
-    {
96
+    private function parse($contents) {
101 97
         $data = CollectionUtils::toMap($contents);
102 98
 
103 99
         $this->swagger = $data->get('version', $this->swagger);
@@ -124,8 +120,7 @@  discard block
 block discarded – undo
124 120
         $this->parseExtensions($data);
125 121
     }
126 122
 
127
-    public function toArray()
128
-    {
123
+    public function toArray() {
129 124
         return $this->export('swagger', 'info', 'host', 'basePath', 'schemes', 'consumes', 'produces',
130 125
             'paths', 'definitions', 'parameters', 'responses', 'tags', 'externalDocs'
131 126
         );
@@ -134,8 +129,7 @@  discard block
 block discarded – undo
134 129
     /**
135 130
      * @return string
136 131
      */
137
-    public function getVersion()
138
-    {
132
+    public function getVersion() {
139 133
         return $this->swagger;
140 134
     }
141 135
 
@@ -144,8 +138,7 @@  discard block
 block discarded – undo
144 138
      *
145 139
      * @return $this
146 140
      */
147
-    public function setVersion($version)
148
-    {
141
+    public function setVersion($version) {
149 142
         $this->swagger = $version;
150 143
 
151 144
         return $this;
@@ -154,16 +147,14 @@  discard block
 block discarded – undo
154 147
     /**
155 148
      * @return Info
156 149
      */
157
-    public function getInfo()
158
-    {
150
+    public function getInfo() {
159 151
         return $this->info;
160 152
     }
161 153
 
162 154
     /**
163 155
      * @return string
164 156
      */
165
-    public function getHost()
166
-    {
157
+    public function getHost() {
167 158
         return $this->host;
168 159
     }
169 160
 
@@ -172,8 +163,7 @@  discard block
 block discarded – undo
172 163
      *
173 164
      * @return $this
174 165
      */
175
-    public function setHost($host)
176
-    {
166
+    public function setHost($host) {
177 167
         $this->host = $host;
178 168
 
179 169
         return $this;
@@ -182,8 +172,7 @@  discard block
 block discarded – undo
182 172
     /**
183 173
      * @return string
184 174
      */
185
-    public function getBasePath()
186
-    {
175
+    public function getBasePath() {
187 176
         return $this->basePath;
188 177
     }
189 178
 
@@ -192,8 +181,7 @@  discard block
 block discarded – undo
192 181
      *
193 182
      * @return $this
194 183
      */
195
-    public function setBasePath($basePath)
196
-    {
184
+    public function setBasePath($basePath) {
197 185
         $this->basePath = $basePath;
198 186
 
199 187
         return $this;
@@ -202,24 +190,21 @@  discard block
 block discarded – undo
202 190
     /**
203 191
      * @return Paths
204 192
      */
205
-    public function getPaths()
206
-    {
193
+    public function getPaths() {
207 194
         return $this->paths;
208 195
     }
209 196
 
210 197
     /**
211 198
      * @return Map
212 199
      */
213
-    public function getDefinitions()
214
-    {
200
+    public function getDefinitions() {
215 201
         return $this->definitions;
216 202
     }
217 203
 
218 204
     /**
219 205
      * @return Map
220 206
      */
221
-    public function getSecurityDefinitions()
222
-    {
207
+    public function getSecurityDefinitions() {
223 208
         return $this->securityDefinitions;
224 209
     }
225 210
 
Please login to merge, or discard this patch.
src/License.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,21 +7,18 @@  discard block
 block discarded – undo
7 7
 use phootwork\lang\Arrayable;
8 8
 use gossi\swagger\parts\UrlPart;
9 9
 
10
-class License extends AbstractModel implements Arrayable
11
-{
10
+class License extends AbstractModel implements Arrayable {
12 11
     use UrlPart;
13 12
     use ExtensionPart;
14 13
 
15 14
     /** @var string */
16 15
     private $name;
17 16
 
18
-    public function __construct($contents = [])
19
-    {
17
+    public function __construct($contents = []) {
20 18
         $this->parse($contents);
21 19
     }
22 20
 
23
-    private function parse($contents = [])
24
-    {
21
+    private function parse($contents = []) {
25 22
         $data = CollectionUtils::toMap($contents);
26 23
 
27 24
         $this->name = $data->get('name');
@@ -31,16 +28,14 @@  discard block
 block discarded – undo
31 28
         $this->parseExtensions($data);
32 29
     }
33 30
 
34
-    public function toArray()
35
-    {
31
+    public function toArray() {
36 32
         return $this->export('name', 'url');
37 33
     }
38 34
 
39 35
     /**
40 36
      * @return string
41 37
      */
42
-    public function getName()
43
-    {
38
+    public function getName() {
44 39
         return $this->name;
45 40
     }
46 41
 
@@ -49,8 +44,7 @@  discard block
 block discarded – undo
49 44
      *
50 45
      * @return $this
51 46
      */
52
-    public function setName($name)
53
-    {
47
+    public function setName($name) {
54 48
         $this->name = $name;
55 49
 
56 50
         return $this;
Please login to merge, or discard this patch.
src/AbstractModel.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,10 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace gossi\swagger;
4 4
 
5
-abstract class AbstractModel
6
-{
7
-    protected function export()
8
-    {
5
+abstract class AbstractModel {
6
+    protected function export() {
9 7
         $cols = func_get_args();
10 8
 
11 9
         // add cols
Please login to merge, or discard this patch.
src/Items.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,20 +9,17 @@  discard block
 block discarded – undo
9 9
 use phootwork\lang\Arrayable;
10 10
 use gossi\swagger\parts\RefPart;
11 11
 
12
-class Items extends AbstractModel implements Arrayable
13
-{
12
+class Items extends AbstractModel implements Arrayable {
14 13
     use RefPart;
15 14
     use TypePart;
16 15
     use ItemsPart;
17 16
     use ExtensionPart;
18 17
 
19
-    public function __construct($contents = [])
20
-    {
18
+    public function __construct($contents = []) {
21 19
         $this->parse($contents);
22 20
     }
23 21
 
24
-    private function parse($contents = [])
25
-    {
22
+    private function parse($contents = []) {
26 23
         $data = CollectionUtils::toMap($contents);
27 24
 
28 25
         // parts
@@ -32,8 +29,7 @@  discard block
 block discarded – undo
32 29
         $this->parseExtensions($data);
33 30
     }
34 31
 
35
-    public function toArray()
36
-    {
32
+    public function toArray() {
37 33
         return $this->export($this->getTypeExportFields(), 'items');
38 34
     }
39 35
 }
Please login to merge, or discard this patch.
src/Path.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
 use phootwork\collection\Map;
8 8
 use phootwork\lang\Arrayable;
9 9
 
10
-class Path extends AbstractModel implements Arrayable
11
-{
10
+class Path extends AbstractModel implements Arrayable {
12 11
     use ExtensionPart;
13 12
 
14 13
     private $operations;
@@ -16,15 +15,13 @@  discard block
 block discarded – undo
16 15
     /** @var string */
17 16
     private $path;
18 17
 
19
-    public function __construct($path, $contents = [])
20
-    {
18
+    public function __construct($path, $contents = []) {
21 19
         $this->path = $path;
22 20
         $this->operations = new Map();
23 21
         $this->parse($contents);
24 22
     }
25 23
 
26
-    private function parse($contents)
27
-    {
24
+    private function parse($contents) {
28 25
         $data = CollectionUtils::toMap($contents);
29 26
 
30 27
         foreach (Swagger::$METHODS as $method) {
@@ -37,8 +34,7 @@  discard block
 block discarded – undo
37 34
         $this->parseExtensions($data);
38 35
     }
39 36
 
40
-    public function toArray()
41
-    {
37
+    public function toArray() {
42 38
         return array_merge($this->operations->toArray(), $this->getExtensions()->toArray());
43 39
     }
44 40
 
@@ -47,8 +43,7 @@  discard block
 block discarded – undo
47 43
      * 
48 44
      * @return string
49 45
      */
50
-    public function getPath()
51
-    {
46
+    public function getPath() {
52 47
         return $this->path;
53 48
     }
54 49
 
@@ -59,8 +54,7 @@  discard block
 block discarded – undo
59 54
      *
60 55
      * @return Operation
61 56
      */
62
-    public function getOperation($method)
63
-    {
57
+    public function getOperation($method) {
64 58
         if (!$this->operations->has($method)) {
65 59
             $this->operations->set($method, new Operation());
66 60
         }
@@ -73,8 +67,7 @@  discard block
 block discarded – undo
73 67
      *
74 68
      * @return bool
75 69
      */
76
-    public function hasOperation($method)
77
-    {
70
+    public function hasOperation($method) {
78 71
         return $this->operations->has($method);
79 72
     }
80 73
 
@@ -83,8 +76,7 @@  discard block
 block discarded – undo
83 76
      * 
84 77
      * @param string $method
85 78
      */
86
-    public function removeOperation($method)
87
-    {
79
+    public function removeOperation($method) {
88 80
         $this->operations->remove($method);
89 81
     }
90 82
 }
Please login to merge, or discard this patch.
src/Parameter.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
 use gossi\swagger\parts\RefPart;
13 13
 use phootwork\lang\Arrayable;
14 14
 
15
-class Parameter extends AbstractModel implements Arrayable
16
-{
15
+class Parameter extends AbstractModel implements Arrayable {
17 16
     use RefPart;
18 17
     use DescriptionPart;
19 18
     use SchemaPart;
@@ -31,13 +30,11 @@  discard block
 block discarded – undo
31 30
     /** @var bool */
32 31
     private $allowEmptyValue = false;
33 32
 
34
-    public function __construct($contents = [])
35
-    {
33
+    public function __construct($contents = []) {
36 34
         $this->parse($contents);
37 35
     }
38 36
 
39
-    private function parse($contents = [])
40
-    {
37
+    private function parse($contents = []) {
41 38
         $data = CollectionUtils::toMap($contents);
42 39
 
43 40
         $this->name = $data->get('name');
@@ -54,8 +51,7 @@  discard block
 block discarded – undo
54 51
         $this->parseExtensions($data);
55 52
     }
56 53
 
57
-    public function toArray()
58
-    {
54
+    public function toArray() {
59 55
         return $this->export('name', 'in', 'allowEmptyValue', 'required', 'description', 'schema',
60 56
                 $this->getTypeExportFields(), 'items');
61 57
     }
@@ -63,16 +59,14 @@  discard block
 block discarded – undo
63 59
     /**
64 60
      * @return string
65 61
      */
66
-    public function getName()
67
-    {
62
+    public function getName() {
68 63
         return $this->name;
69 64
     }
70 65
 
71 66
     /**
72 67
      * @param string $name
73 68
      */
74
-    public function setName($name)
75
-    {
69
+    public function setName($name) {
76 70
         $this->name = $name;
77 71
 
78 72
         return $this;
@@ -81,16 +75,14 @@  discard block
 block discarded – undo
81 75
     /**
82 76
      * @return string
83 77
      */
84
-    public function getIn()
85
-    {
78
+    public function getIn() {
86 79
         return $this->in;
87 80
     }
88 81
 
89 82
     /**
90 83
      * @param string $in
91 84
      */
92
-    public function setIn($in)
93
-    {
85
+    public function setIn($in) {
94 86
         $this->in = $in;
95 87
 
96 88
         return $this;
@@ -99,8 +91,7 @@  discard block
 block discarded – undo
99 91
     /**
100 92
      * @return bool
101 93
      */
102
-    public function getAllowEmptyValue()
103
-    {
94
+    public function getAllowEmptyValue() {
104 95
         return $this->allowEmptyValue;
105 96
     }
106 97
 
@@ -111,8 +102,7 @@  discard block
 block discarded – undo
111 102
      * 
112 103
      * @param bool $allowEmptyValue
113 104
      */
114
-    public function setAllowEmptyValue($allowEmptyValue)
115
-    {
105
+    public function setAllowEmptyValue($allowEmptyValue) {
116 106
         $this->allowEmptyValue = $allowEmptyValue;
117 107
 
118 108
         return $this;
Please login to merge, or discard this patch.
src/Operation.php 1 patch
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
 use phootwork\collection\CollectionUtils;
13 13
 use phootwork\lang\Arrayable;
14 14
 
15
-class Operation extends AbstractModel implements Arrayable
16
-{
15
+class Operation extends AbstractModel implements Arrayable {
17 16
     use ConsumesPart;
18 17
     use ProducesPart;
19 18
     use TagsPart;
@@ -34,13 +33,11 @@  discard block
 block discarded – undo
34 33
     /** @var bool */
35 34
     private $deprecated = false;
36 35
 
37
-    public function __construct($contents = [])
38
-    {
36
+    public function __construct($contents = []) {
39 37
         $this->parse($contents);
40 38
     }
41 39
 
42
-    private function parse($contents = [])
43
-    {
40
+    private function parse($contents = []) {
44 41
         $data = CollectionUtils::toMap($contents);
45 42
 
46 43
         $this->summary = $data->get('summary');
@@ -58,8 +55,7 @@  discard block
 block discarded – undo
58 55
         $this->parseExtensions($data);
59 56
     }
60 57
 
61
-    public function toArray()
62
-    {
58
+    public function toArray() {
63 59
         return $this->export('summary', 'description', 'operationId', 'deprecated',
64 60
                 'consumes', 'produces', 'parameters', 'responses', 'tags', 'externalDocs');
65 61
     }
@@ -67,8 +63,7 @@  discard block
 block discarded – undo
67 63
     /**
68 64
      * @return the string
69 65
      */
70
-    public function getSummary()
71
-    {
66
+    public function getSummary() {
72 67
         return $this->summary;
73 68
     }
74 69
 
@@ -77,8 +72,7 @@  discard block
 block discarded – undo
77 72
      *
78 73
      * @return $this
79 74
      */
80
-    public function setSummary($summary)
81
-    {
75
+    public function setSummary($summary) {
82 76
         $this->summary = $summary;
83 77
 
84 78
         return $this;
@@ -87,16 +81,14 @@  discard block
 block discarded – undo
87 81
     /**
88 82
      * @return string
89 83
      */
90
-    public function getDescription()
91
-    {
84
+    public function getDescription() {
92 85
         return $this->description;
93 86
     }
94 87
 
95 88
     /**
96 89
      * @param string $description
97 90
      */
98
-    public function setDescription($description)
99
-    {
91
+    public function setDescription($description) {
100 92
         $this->description = $description;
101 93
 
102 94
         return $this;
@@ -105,8 +97,7 @@  discard block
 block discarded – undo
105 97
     /**
106 98
      * @return string
107 99
      */
108
-    public function getOperationId()
109
-    {
100
+    public function getOperationId() {
110 101
         return $this->operationId;
111 102
     }
112 103
 
@@ -115,8 +106,7 @@  discard block
 block discarded – undo
115 106
      *
116 107
      * @return $this
117 108
      */
118
-    public function setOperationId($operationId)
119
-    {
109
+    public function setOperationId($operationId) {
120 110
         $this->operationId = $operationId;
121 111
 
122 112
         return $this;
@@ -125,8 +115,7 @@  discard block
 block discarded – undo
125 115
     /**
126 116
      * @return bool
127 117
      */
128
-    public function getDeprecated()
129
-    {
118
+    public function getDeprecated() {
130 119
         return $this->deprecated;
131 120
     }
132 121
 
@@ -135,8 +124,7 @@  discard block
 block discarded – undo
135 124
      *
136 125
      * @return $this
137 126
      */
138
-    public function setDeprecated($deprecated)
139
-    {
127
+    public function setDeprecated($deprecated) {
140 128
         $this->deprecated = $deprecated;
141 129
 
142 130
         return $this;
Please login to merge, or discard this patch.