Completed
Push — master ( a6cc58...1b8eb5 )
by Martijn
26s
created
SwaggerGen/Swagger/SecurityScheme.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -16,132 +16,132 @@
 block discarded – undo
16 16
 class SecurityScheme extends AbstractObject
17 17
 {
18 18
 
19
-    /**
20
-     * 'basic', 'apikey' or 'oauth2'
21
-     * @var string
22
-     */
23
-    private $type;
24
-
25
-    /**
26
-     * @var string
27
-     */
28
-    private $description;
29
-    private $name;
30
-    private $in;
31
-    private $flow;
32
-    private $authorizationUrl;
33
-    private $tokenUrl;
34
-
35
-    /**
36
-     * Map of scope-name => description
37
-     * @var []
38
-     */
39
-    private $scopes = array();
40
-
41
-    /**
42
-     * Create a new SecurityScheme object
43
-     * @param AbstractObject $parent
44
-     * @param string $type
45
-     * @param string $data
46
-     * @throws Exception
47
-     */
48
-    public function __construct(AbstractObject $parent, $type, $data = null)
49
-    {
50
-        parent::__construct($parent);
51
-
52
-        if (!in_array(strtolower($type), array('basic', 'apikey', 'oauth2'))) {
53
-            throw new Exception("Security scheme type must be either 'basic', 'apiKey' or 'oauth2', not '{$type}'");
54
-        }
55
-        $this->type = strtolower($type);
56
-
57
-        switch ($this->type) {
58
-            case 'basic':
59
-                $this->description = $data;
60
-                break;
61
-
62
-            case 'apikey':
63
-                $this->name = self::wordShift($data);
64
-
65
-                $in = strtolower(self::wordShift($data));
66
-                if (!in_array($in, array('query', 'header'))) {
67
-                    throw new Exception("ApiKey in must be either 'query' or 'header', not '{$in}'");
68
-                }
69
-                $this->in = $in;
70
-
71
-                $this->description = $data;
72
-                break;
73
-
74
-            case 'oauth2':
75
-                $flow = strtolower(self::wordShift($data));
76
-                if (!in_array($flow, array('implicit', 'password', 'application', 'accesscode'))) {
77
-                    throw new Exception("OAuth2 flow must be either 'implicit', 'password', 'application' or 'accesscode', not '{$flow}'");
78
-                }
79
-                $this->flow = $flow;
80
-
81
-                if (in_array($flow, array('implicit', 'accesscode'))) {
82
-                    $authUrl = self::wordShift($data);
83
-                    if (!filter_var($authUrl, FILTER_VALIDATE_URL)) {
84
-                        throw new Exception("OAuth2 authorization URL invalid: '{$authUrl}'");
85
-                    }
86
-                    $this->authorizationUrl = $authUrl;
87
-                }
88
-
89
-                if (in_array($flow, array('password', 'application', 'accesscode'))) {
90
-                    $tokenUrl = self::wordShift($data);
91
-                    if (!filter_var($tokenUrl, FILTER_VALIDATE_URL)) {
92
-                        throw new Exception("OAuth2 token URL invalid: '{$tokenUrl}'");
93
-                    }
94
-                    $this->tokenUrl = $tokenUrl;
95
-                }
96
-
97
-                $this->description = $data;
98
-                break;
99
-        }
100
-    }
101
-
102
-    /**
103
-     * @param string $command
104
-     * @param string $data
105
-     * @return AbstractObject|boolean
106
-     * @throws Exception
107
-     */
108
-    public function handleCommand($command, $data = null)
109
-    {
110
-        switch (strtolower($command)) {
111
-            case 'description':
112
-                $this->description = $data;
113
-                return $this;
114
-
115
-            case 'scope':
116
-                if ($this->type !== 'oauth2') {
117
-                    throw new Exception("Cannot set scope on type '{$this->type}'");
118
-                }
119
-
120
-                $name = self::wordShift($data);
121
-                $this->scopes[$name] = $data;
122
-                return $this;
123
-        }
124
-
125
-        return parent::handleCommand($command, $data);
126
-    }
127
-
128
-    public function toArray(): array
129
-    {
130
-        return self::arrayFilterNull(array_merge(array(
131
-            'type' => $this->type === 'apikey' ? 'apiKey' : $this->type,
132
-            'description' => empty($this->description) ? null : $this->description,
133
-            'name' => $this->name,
134
-            'in' => $this->in,
135
-            'flow' => $this->flow === 'accesscode' ? 'accessCode' : $this->flow,
136
-            'authorizationUrl' => $this->authorizationUrl,
137
-            'tokenUrl' => $this->tokenUrl,
138
-            'scopes' => $this->scopes,
139
-        ), parent::toArray()));
140
-    }
141
-
142
-    public function __toString()
143
-    {
144
-        return __CLASS__ . ' ' . $this->type;
145
-    }
19
+	/**
20
+	 * 'basic', 'apikey' or 'oauth2'
21
+	 * @var string
22
+	 */
23
+	private $type;
24
+
25
+	/**
26
+	 * @var string
27
+	 */
28
+	private $description;
29
+	private $name;
30
+	private $in;
31
+	private $flow;
32
+	private $authorizationUrl;
33
+	private $tokenUrl;
34
+
35
+	/**
36
+	 * Map of scope-name => description
37
+	 * @var []
38
+	 */
39
+	private $scopes = array();
40
+
41
+	/**
42
+	 * Create a new SecurityScheme object
43
+	 * @param AbstractObject $parent
44
+	 * @param string $type
45
+	 * @param string $data
46
+	 * @throws Exception
47
+	 */
48
+	public function __construct(AbstractObject $parent, $type, $data = null)
49
+	{
50
+		parent::__construct($parent);
51
+
52
+		if (!in_array(strtolower($type), array('basic', 'apikey', 'oauth2'))) {
53
+			throw new Exception("Security scheme type must be either 'basic', 'apiKey' or 'oauth2', not '{$type}'");
54
+		}
55
+		$this->type = strtolower($type);
56
+
57
+		switch ($this->type) {
58
+			case 'basic':
59
+				$this->description = $data;
60
+				break;
61
+
62
+			case 'apikey':
63
+				$this->name = self::wordShift($data);
64
+
65
+				$in = strtolower(self::wordShift($data));
66
+				if (!in_array($in, array('query', 'header'))) {
67
+					throw new Exception("ApiKey in must be either 'query' or 'header', not '{$in}'");
68
+				}
69
+				$this->in = $in;
70
+
71
+				$this->description = $data;
72
+				break;
73
+
74
+			case 'oauth2':
75
+				$flow = strtolower(self::wordShift($data));
76
+				if (!in_array($flow, array('implicit', 'password', 'application', 'accesscode'))) {
77
+					throw new Exception("OAuth2 flow must be either 'implicit', 'password', 'application' or 'accesscode', not '{$flow}'");
78
+				}
79
+				$this->flow = $flow;
80
+
81
+				if (in_array($flow, array('implicit', 'accesscode'))) {
82
+					$authUrl = self::wordShift($data);
83
+					if (!filter_var($authUrl, FILTER_VALIDATE_URL)) {
84
+						throw new Exception("OAuth2 authorization URL invalid: '{$authUrl}'");
85
+					}
86
+					$this->authorizationUrl = $authUrl;
87
+				}
88
+
89
+				if (in_array($flow, array('password', 'application', 'accesscode'))) {
90
+					$tokenUrl = self::wordShift($data);
91
+					if (!filter_var($tokenUrl, FILTER_VALIDATE_URL)) {
92
+						throw new Exception("OAuth2 token URL invalid: '{$tokenUrl}'");
93
+					}
94
+					$this->tokenUrl = $tokenUrl;
95
+				}
96
+
97
+				$this->description = $data;
98
+				break;
99
+		}
100
+	}
101
+
102
+	/**
103
+	 * @param string $command
104
+	 * @param string $data
105
+	 * @return AbstractObject|boolean
106
+	 * @throws Exception
107
+	 */
108
+	public function handleCommand($command, $data = null)
109
+	{
110
+		switch (strtolower($command)) {
111
+			case 'description':
112
+				$this->description = $data;
113
+				return $this;
114
+
115
+			case 'scope':
116
+				if ($this->type !== 'oauth2') {
117
+					throw new Exception("Cannot set scope on type '{$this->type}'");
118
+				}
119
+
120
+				$name = self::wordShift($data);
121
+				$this->scopes[$name] = $data;
122
+				return $this;
123
+		}
124
+
125
+		return parent::handleCommand($command, $data);
126
+	}
127
+
128
+	public function toArray(): array
129
+	{
130
+		return self::arrayFilterNull(array_merge(array(
131
+			'type' => $this->type === 'apikey' ? 'apiKey' : $this->type,
132
+			'description' => empty($this->description) ? null : $this->description,
133
+			'name' => $this->name,
134
+			'in' => $this->in,
135
+			'flow' => $this->flow === 'accesscode' ? 'accessCode' : $this->flow,
136
+			'authorizationUrl' => $this->authorizationUrl,
137
+			'tokenUrl' => $this->tokenUrl,
138
+			'scopes' => $this->scopes,
139
+		), parent::toArray()));
140
+	}
141
+
142
+	public function __toString()
143
+	{
144
+		return __CLASS__ . ' ' . $this->type;
145
+	}
146 146
 
147 147
 }
Please login to merge, or discard this patch.
SwaggerGen/Swagger/Response.php 2 patches
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -16,177 +16,177 @@
 block discarded – undo
16 16
 class Response extends AbstractObject
17 17
 {
18 18
 
19
-    const OK = 200;
20
-    const CREATED = 201;
21
-    const ACCEPTED = 202;
22
-    const NON_AUTHORITATIVE_INFORMATION = 203;
23
-    const NO_CONTENT = 204;
24
-    const RESET_CONTENT = 205;
25
-    const PARTIAL_CONTENT = 206;
26
-    const BAD_REQUEST = 400;
27
-    const UNAUTHORIZED = 401;
28
-    const PAYMENT_REQUIRED = 402;
29
-    const FORBIDDEN = 403;
30
-    const NOT_FOUND = 404;
31
-    const METHOD_NOT_ALLOWED = 405;
32
-    const NOT_ACCEPTABLE = 406;
33
-    const PROXY_AUTHENTICATION_REQUIRED = 407;
34
-    const REQUEST_TIMEOUT = 408;
35
-    const CONFLICT = 409;
36
-    const GONE = 410;
37
-    const LENGTH_REQUIRED = 411;
38
-    const PRECONDITION_FAILED = 412;
39
-    const REQUEST_ENTITY_TOO_LARGE = 413;
40
-    const REQUEST_URI_TOO_LONG = 414;
41
-    const UNSUPPORTED_MEDIA_TYPE = 415;
42
-    const REQUESTED_RANGE_NOT_SATISFIABLE = 416;
43
-    const EXPECTATION_FAILED = 417;
44
-    const UNPROCESSABLE_ENTITY = 422;
45
-    const TOO_MANY_REQUESTS = 429;
46
-    const INTERNAL_SERVER_ERROR = 500;
47
-    const NOT_IMPLEMENTED = 501; // When method is supported for none of the resources
48
-
49
-    protected static $httpCodes = array(
50
-        self::OK => 'OK',
51
-        self::CREATED => 'Created',
52
-        self::ACCEPTED => 'Accepted',
53
-        self::NON_AUTHORITATIVE_INFORMATION => 'Non-Authoritative Information',
54
-        self::NO_CONTENT => 'No Content',
55
-        self::RESET_CONTENT => 'Reset Content',
56
-        self::PARTIAL_CONTENT => 'Partial Content',
57
-        self::BAD_REQUEST => 'Bad Request',
58
-        self::UNAUTHORIZED => 'Unauthorized',
59
-        self::PAYMENT_REQUIRED => 'Payment Required',
60
-        self::FORBIDDEN => 'Forbidden',
61
-        self::NOT_FOUND => 'Not Found',
62
-        self::METHOD_NOT_ALLOWED => 'Method Not Allowed',
63
-        self::NOT_ACCEPTABLE => 'Not Acceptable',
64
-        self::PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required',
65
-        self::REQUEST_TIMEOUT => 'Request Timeout',
66
-        self::CONFLICT => 'Conflict',
67
-        self::GONE => 'Gone',
68
-        self::LENGTH_REQUIRED => 'Length Required',
69
-        self::PRECONDITION_FAILED => 'Precondition Failed',
70
-        self::REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large',
71
-        self::REQUEST_URI_TOO_LONG => 'Request-URI Too Long',
72
-        self::UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type',
73
-        self::REQUESTED_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable',
74
-        self::EXPECTATION_FAILED => 'Expectation Failed',
75
-        self::UNPROCESSABLE_ENTITY => 'Unprocessable Entity',
76
-        self::TOO_MANY_REQUESTS => 'Too Many Requests',
77
-        self::INTERNAL_SERVER_ERROR => 'Internal Server Error',
78
-        self::NOT_IMPLEMENTED => 'Not Implemented',
79
-    );
80
-    private $description = '';
81
-    private $schema;
82
-
83
-    /**
84
-     * @var Header[]
85
-     */
86
-    private $Headers = array();
87
-
88
-    /**
89
-     * JSON examples
90
-     * @var array
91
-     */
92
-    private $examples = array();
93
-
94
-    public static function getCode($search)
95
-    {
96
-        static $lookup = null;
97
-
98
-        if (is_numeric($search)) {
99
-            return (int)$search;
100
-        }
101
-
102
-        // build static lookup table
103
-        if (!$lookup) {
104
-            $lookup = array();
105
-            foreach (self::$httpCodes as $code => $text) {
106
-                $lookup[preg_replace('/[^a-z]+/', '', strtolower($text))] = $code;
107
-            }
108
-        }
109
-
110
-        $search = preg_replace('/[^a-z]+/', '', strtolower($search));
111
-        return $lookup[$search] ?? null;
112
-    }
113
-
114
-    /**
115
-     * @throws Exception
116
-     */
117
-    public function __construct(AbstractObject $parent, $code, $definition = null, $description = null)
118
-    {
119
-        parent::__construct($parent);
120
-
121
-        if ($definition) {
122
-            $this->schema = new Schema($this, $definition);
123
-        }
124
-
125
-        if (!empty($description)) {
126
-            $this->description = $description;
127
-        } elseif (isset(self::$httpCodes[$code])) {
128
-            $this->description = self::$httpCodes[$code];
129
-        }
130
-    }
131
-
132
-    /**
133
-     * @param string $command
134
-     * @param string $data
135
-     * @return AbstractObject|boolean
136
-     * @throws Exception
137
-     * @throws Exception
138
-     * @throws Exception
139
-     * @throws Exception
140
-     * @throws Exception
141
-     */
142
-    public function handleCommand($command, $data = null)
143
-    {
144
-        switch (strtolower($command)) {
145
-            case 'header':
146
-                $type = self::wordShift($data);
147
-                if (empty($type)) {
148
-                    throw new Exception('Missing type for header');
149
-                }
150
-                $name = self::wordShift($data);
151
-                if (empty($name)) {
152
-                    throw new Exception('Missing name for header type \'' . $type . '\'');
153
-                }
154
-                $Header = new Header($this, $type, $data);
155
-                $this->Headers[$name] = $Header;
156
-                return $Header;
157
-
158
-            case 'example':
159
-                $name = self::wordShift($data);
160
-                if (empty($name)) {
161
-                    throw new Exception('Missing name for example');
162
-                }
163
-                if ($data === '') {
164
-                    throw new Exception('Missing content for example `' . $name . '`');
165
-                }
166
-                $json = preg_replace_callback('/([^{}:]+)/', static function ($match) {
167
-                    json_decode($match[1]);
168
-                    return json_last_error() === JSON_ERROR_NONE ? $match[1] : json_encode($match[1]);
169
-                }, trim($data));
170
-                $this->examples[$name] = json_decode($json, true);
171
-                return $this;
172
-        }
173
-
174
-        return parent::handleCommand($command, $data);
175
-    }
176
-
177
-    public function toArray(): array
178
-    {
179
-        return self::arrayFilterNull(array_merge(array(
180
-            'description' => $this->description,
181
-            'schema' => $this->schema ? $this->schema->toArray() : null,
182
-            'headers' => self::objectsToArray($this->Headers),
183
-            'examples' => $this->examples,
184
-        ), parent::toArray()));
185
-    }
186
-
187
-    public function __toString()
188
-    {
189
-        return __CLASS__;
190
-    }
19
+	const OK = 200;
20
+	const CREATED = 201;
21
+	const ACCEPTED = 202;
22
+	const NON_AUTHORITATIVE_INFORMATION = 203;
23
+	const NO_CONTENT = 204;
24
+	const RESET_CONTENT = 205;
25
+	const PARTIAL_CONTENT = 206;
26
+	const BAD_REQUEST = 400;
27
+	const UNAUTHORIZED = 401;
28
+	const PAYMENT_REQUIRED = 402;
29
+	const FORBIDDEN = 403;
30
+	const NOT_FOUND = 404;
31
+	const METHOD_NOT_ALLOWED = 405;
32
+	const NOT_ACCEPTABLE = 406;
33
+	const PROXY_AUTHENTICATION_REQUIRED = 407;
34
+	const REQUEST_TIMEOUT = 408;
35
+	const CONFLICT = 409;
36
+	const GONE = 410;
37
+	const LENGTH_REQUIRED = 411;
38
+	const PRECONDITION_FAILED = 412;
39
+	const REQUEST_ENTITY_TOO_LARGE = 413;
40
+	const REQUEST_URI_TOO_LONG = 414;
41
+	const UNSUPPORTED_MEDIA_TYPE = 415;
42
+	const REQUESTED_RANGE_NOT_SATISFIABLE = 416;
43
+	const EXPECTATION_FAILED = 417;
44
+	const UNPROCESSABLE_ENTITY = 422;
45
+	const TOO_MANY_REQUESTS = 429;
46
+	const INTERNAL_SERVER_ERROR = 500;
47
+	const NOT_IMPLEMENTED = 501; // When method is supported for none of the resources
48
+
49
+	protected static $httpCodes = array(
50
+		self::OK => 'OK',
51
+		self::CREATED => 'Created',
52
+		self::ACCEPTED => 'Accepted',
53
+		self::NON_AUTHORITATIVE_INFORMATION => 'Non-Authoritative Information',
54
+		self::NO_CONTENT => 'No Content',
55
+		self::RESET_CONTENT => 'Reset Content',
56
+		self::PARTIAL_CONTENT => 'Partial Content',
57
+		self::BAD_REQUEST => 'Bad Request',
58
+		self::UNAUTHORIZED => 'Unauthorized',
59
+		self::PAYMENT_REQUIRED => 'Payment Required',
60
+		self::FORBIDDEN => 'Forbidden',
61
+		self::NOT_FOUND => 'Not Found',
62
+		self::METHOD_NOT_ALLOWED => 'Method Not Allowed',
63
+		self::NOT_ACCEPTABLE => 'Not Acceptable',
64
+		self::PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required',
65
+		self::REQUEST_TIMEOUT => 'Request Timeout',
66
+		self::CONFLICT => 'Conflict',
67
+		self::GONE => 'Gone',
68
+		self::LENGTH_REQUIRED => 'Length Required',
69
+		self::PRECONDITION_FAILED => 'Precondition Failed',
70
+		self::REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large',
71
+		self::REQUEST_URI_TOO_LONG => 'Request-URI Too Long',
72
+		self::UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type',
73
+		self::REQUESTED_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable',
74
+		self::EXPECTATION_FAILED => 'Expectation Failed',
75
+		self::UNPROCESSABLE_ENTITY => 'Unprocessable Entity',
76
+		self::TOO_MANY_REQUESTS => 'Too Many Requests',
77
+		self::INTERNAL_SERVER_ERROR => 'Internal Server Error',
78
+		self::NOT_IMPLEMENTED => 'Not Implemented',
79
+	);
80
+	private $description = '';
81
+	private $schema;
82
+
83
+	/**
84
+	 * @var Header[]
85
+	 */
86
+	private $Headers = array();
87
+
88
+	/**
89
+	 * JSON examples
90
+	 * @var array
91
+	 */
92
+	private $examples = array();
93
+
94
+	public static function getCode($search)
95
+	{
96
+		static $lookup = null;
97
+
98
+		if (is_numeric($search)) {
99
+			return (int)$search;
100
+		}
101
+
102
+		// build static lookup table
103
+		if (!$lookup) {
104
+			$lookup = array();
105
+			foreach (self::$httpCodes as $code => $text) {
106
+				$lookup[preg_replace('/[^a-z]+/', '', strtolower($text))] = $code;
107
+			}
108
+		}
109
+
110
+		$search = preg_replace('/[^a-z]+/', '', strtolower($search));
111
+		return $lookup[$search] ?? null;
112
+	}
113
+
114
+	/**
115
+	 * @throws Exception
116
+	 */
117
+	public function __construct(AbstractObject $parent, $code, $definition = null, $description = null)
118
+	{
119
+		parent::__construct($parent);
120
+
121
+		if ($definition) {
122
+			$this->schema = new Schema($this, $definition);
123
+		}
124
+
125
+		if (!empty($description)) {
126
+			$this->description = $description;
127
+		} elseif (isset(self::$httpCodes[$code])) {
128
+			$this->description = self::$httpCodes[$code];
129
+		}
130
+	}
131
+
132
+	/**
133
+	 * @param string $command
134
+	 * @param string $data
135
+	 * @return AbstractObject|boolean
136
+	 * @throws Exception
137
+	 * @throws Exception
138
+	 * @throws Exception
139
+	 * @throws Exception
140
+	 * @throws Exception
141
+	 */
142
+	public function handleCommand($command, $data = null)
143
+	{
144
+		switch (strtolower($command)) {
145
+			case 'header':
146
+				$type = self::wordShift($data);
147
+				if (empty($type)) {
148
+					throw new Exception('Missing type for header');
149
+				}
150
+				$name = self::wordShift($data);
151
+				if (empty($name)) {
152
+					throw new Exception('Missing name for header type \'' . $type . '\'');
153
+				}
154
+				$Header = new Header($this, $type, $data);
155
+				$this->Headers[$name] = $Header;
156
+				return $Header;
157
+
158
+			case 'example':
159
+				$name = self::wordShift($data);
160
+				if (empty($name)) {
161
+					throw new Exception('Missing name for example');
162
+				}
163
+				if ($data === '') {
164
+					throw new Exception('Missing content for example `' . $name . '`');
165
+				}
166
+				$json = preg_replace_callback('/([^{}:]+)/', static function ($match) {
167
+					json_decode($match[1]);
168
+					return json_last_error() === JSON_ERROR_NONE ? $match[1] : json_encode($match[1]);
169
+				}, trim($data));
170
+				$this->examples[$name] = json_decode($json, true);
171
+				return $this;
172
+		}
173
+
174
+		return parent::handleCommand($command, $data);
175
+	}
176
+
177
+	public function toArray(): array
178
+	{
179
+		return self::arrayFilterNull(array_merge(array(
180
+			'description' => $this->description,
181
+			'schema' => $this->schema ? $this->schema->toArray() : null,
182
+			'headers' => self::objectsToArray($this->Headers),
183
+			'examples' => $this->examples,
184
+		), parent::toArray()));
185
+	}
186
+
187
+	public function __toString()
188
+	{
189
+		return __CLASS__;
190
+	}
191 191
 
192 192
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         static $lookup = null;
97 97
 
98 98
         if (is_numeric($search)) {
99
-            return (int)$search;
99
+            return (int) $search;
100 100
         }
101 101
 
102 102
         // build static lookup table
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                 if ($data === '') {
164 164
                     throw new Exception('Missing content for example `' . $name . '`');
165 165
                 }
166
-                $json = preg_replace_callback('/([^{}:]+)/', static function ($match) {
166
+                $json = preg_replace_callback('/([^{}:]+)/', static function($match) {
167 167
                     json_decode($match[1]);
168 168
                     return json_last_error() === JSON_ERROR_NONE ? $match[1] : json_encode($match[1]);
169 169
                 }, trim($data));
Please login to merge, or discard this patch.
SwaggerGen/Swagger/Header.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -15,50 +15,50 @@
 block discarded – undo
15 15
 class Header extends AbstractObject
16 16
 {
17 17
 
18
-    private $type;
19
-    private $description;
18
+	private $type;
19
+	private $description;
20 20
 
21
-    /**
22
-     * @throws Exception
23
-     */
24
-    public function __construct(AbstractObject $parent, $type, $description = null)
25
-    {
26
-        parent::__construct($parent);
21
+	/**
22
+	 * @throws Exception
23
+	 */
24
+	public function __construct(AbstractObject $parent, $type, $description = null)
25
+	{
26
+		parent::__construct($parent);
27 27
 
28
-        $this->type = strtolower($type);
29
-        if (!in_array($this->type, array('string', 'number', 'integer', 'boolean', 'array'))) {
30
-            throw new Exception('Header type not valid: \'' . $type . '\'');
31
-        }
28
+		$this->type = strtolower($type);
29
+		if (!in_array($this->type, array('string', 'number', 'integer', 'boolean', 'array'))) {
30
+			throw new Exception('Header type not valid: \'' . $type . '\'');
31
+		}
32 32
 
33
-        $this->description = $description;
34
-    }
33
+		$this->description = $description;
34
+	}
35 35
 
36
-    /**
37
-     * @param string $command
38
-     * @param string $data
39
-     * @return AbstractObject|boolean
40
-     */
41
-    public function handleCommand($command, $data = null)
42
-    {
43
-        if (strtolower($command) === 'description') {
44
-            $this->description = $data;
45
-            return $this;
46
-        }
36
+	/**
37
+	 * @param string $command
38
+	 * @param string $data
39
+	 * @return AbstractObject|boolean
40
+	 */
41
+	public function handleCommand($command, $data = null)
42
+	{
43
+		if (strtolower($command) === 'description') {
44
+			$this->description = $data;
45
+			return $this;
46
+		}
47 47
 
48
-        return parent::handleCommand($command, $data);
49
-    }
48
+		return parent::handleCommand($command, $data);
49
+	}
50 50
 
51
-    public function toArray(): array
52
-    {
53
-        return self::arrayFilterNull(array_merge(array(
54
-            'type' => $this->type,
55
-            'description' => empty($this->description) ? null : $this->description,
56
-        ), parent::toArray()));
57
-    }
51
+	public function toArray(): array
52
+	{
53
+		return self::arrayFilterNull(array_merge(array(
54
+			'type' => $this->type,
55
+			'description' => empty($this->description) ? null : $this->description,
56
+		), parent::toArray()));
57
+	}
58 58
 
59
-    public function __toString()
60
-    {
61
-        return __CLASS__ . ' ' . $this->type;
62
-    }
59
+	public function __toString()
60
+	{
61
+		return __CLASS__ . ' ' . $this->type;
62
+	}
63 63
 
64 64
 }
Please login to merge, or discard this patch.
SwaggerGen/Swagger/Path.php 2 patches
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -16,102 +16,102 @@
 block discarded – undo
16 16
 class Path extends AbstractObject
17 17
 {
18 18
 
19
-    private static $methods = array(
20
-        'get',
21
-        'put',
22
-        'post',
23
-        'delete',
24
-        'options',
25
-        'head',
26
-        'patch',
27
-    );
28
-
29
-    /**
30
-     * @var Operation[] $operation
31
-     */
32
-    private $operations = array();
33
-
34
-    /**
35
-     * @var Tag|null $tag ;
36
-     */
37
-    private $tag;
38
-
39
-    public function __construct(AbstractObject $parent, Tag $Tag = null)
40
-    {
41
-        parent::__construct($parent);
42
-        $this->tag = $Tag;
43
-    }
44
-
45
-    /**
46
-     * @param string $command
47
-     * @param string $data
48
-     * @return AbstractObject|boolean
49
-     * @throws Exception
50
-     */
51
-    public function handleCommand($command, $data = null)
52
-    {
53
-        switch (strtolower($command)) {
54
-            case 'method': // alias
55
-            case 'operation':
56
-                $method = strtolower(self::wordShift($data));
57
-
58
-                if (!in_array($method, self::$methods)) {
59
-                    throw new Exception('Unrecognized operation method \'' . $method . '\'');
60
-                }
61
-
62
-                if (isset($this->operations[$method])) {
63
-                    $Operation = $this->operations[$method];
64
-                } else {
65
-                    $summary = $data;
66
-                    $Operation = new Operation($this, $summary, $this->tag);
67
-                    $this->operations[$method] = $Operation;
68
-                }
69
-
70
-                return $Operation;
71
-
72
-            case 'description':
73
-                if ($this->tag) {
74
-                    return $this->tag->handleCommand($command, $data);
75
-                }
76
-                break;
77
-        }
78
-
79
-        return parent::handleCommand($command, $data);
80
-    }
81
-
82
-    public function toArray(): array
83
-    {
84
-        $methods = self::$methods;
85
-        uksort($this->operations, static function ($a, $b) use ($methods) {
86
-            return array_search($a, $methods) - array_search($b, $methods);
87
-        });
88
-
89
-        return self::arrayFilterNull(array_merge(
90
-            self::objectsToArray($this->operations)
91
-            , parent::toArray()));
92
-    }
93
-
94
-    public function __toString()
95
-    {
96
-        end($this->operations);
97
-        return __CLASS__ . ' ' . key($this->operations);
98
-    }
99
-
100
-    /**
101
-     * Check if an operation with the given id is registered to this Path.
102
-     *
103
-     * @param string $operationId
104
-     * @return boolean
105
-     */
106
-    public function hasOperationId($operationId)
107
-    {
108
-        foreach ($this->operations as $operation) {
109
-            if ($operation->getId() === $operationId) {
110
-                return true;
111
-            }
112
-        }
113
-
114
-        return false;
115
-    }
19
+	private static $methods = array(
20
+		'get',
21
+		'put',
22
+		'post',
23
+		'delete',
24
+		'options',
25
+		'head',
26
+		'patch',
27
+	);
28
+
29
+	/**
30
+	 * @var Operation[] $operation
31
+	 */
32
+	private $operations = array();
33
+
34
+	/**
35
+	 * @var Tag|null $tag ;
36
+	 */
37
+	private $tag;
38
+
39
+	public function __construct(AbstractObject $parent, Tag $Tag = null)
40
+	{
41
+		parent::__construct($parent);
42
+		$this->tag = $Tag;
43
+	}
44
+
45
+	/**
46
+	 * @param string $command
47
+	 * @param string $data
48
+	 * @return AbstractObject|boolean
49
+	 * @throws Exception
50
+	 */
51
+	public function handleCommand($command, $data = null)
52
+	{
53
+		switch (strtolower($command)) {
54
+			case 'method': // alias
55
+			case 'operation':
56
+				$method = strtolower(self::wordShift($data));
57
+
58
+				if (!in_array($method, self::$methods)) {
59
+					throw new Exception('Unrecognized operation method \'' . $method . '\'');
60
+				}
61
+
62
+				if (isset($this->operations[$method])) {
63
+					$Operation = $this->operations[$method];
64
+				} else {
65
+					$summary = $data;
66
+					$Operation = new Operation($this, $summary, $this->tag);
67
+					$this->operations[$method] = $Operation;
68
+				}
69
+
70
+				return $Operation;
71
+
72
+			case 'description':
73
+				if ($this->tag) {
74
+					return $this->tag->handleCommand($command, $data);
75
+				}
76
+				break;
77
+		}
78
+
79
+		return parent::handleCommand($command, $data);
80
+	}
81
+
82
+	public function toArray(): array
83
+	{
84
+		$methods = self::$methods;
85
+		uksort($this->operations, static function ($a, $b) use ($methods) {
86
+			return array_search($a, $methods) - array_search($b, $methods);
87
+		});
88
+
89
+		return self::arrayFilterNull(array_merge(
90
+			self::objectsToArray($this->operations)
91
+			, parent::toArray()));
92
+	}
93
+
94
+	public function __toString()
95
+	{
96
+		end($this->operations);
97
+		return __CLASS__ . ' ' . key($this->operations);
98
+	}
99
+
100
+	/**
101
+	 * Check if an operation with the given id is registered to this Path.
102
+	 *
103
+	 * @param string $operationId
104
+	 * @return boolean
105
+	 */
106
+	public function hasOperationId($operationId)
107
+	{
108
+		foreach ($this->operations as $operation) {
109
+			if ($operation->getId() === $operationId) {
110
+				return true;
111
+			}
112
+		}
113
+
114
+		return false;
115
+	}
116 116
 
117 117
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
     public function toArray(): array
83 83
     {
84 84
         $methods = self::$methods;
85
-        uksort($this->operations, static function ($a, $b) use ($methods) {
85
+        uksort($this->operations, static function($a, $b) use ($methods) {
86 86
             return array_search($a, $methods) - array_search($b, $methods);
87 87
         });
88 88
 
Please login to merge, or discard this patch.
SwaggerGen/Swagger/AbstractDocumentableObject.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -14,38 +14,38 @@
 block discarded – undo
14 14
 abstract class AbstractDocumentableObject extends AbstractObject
15 15
 {
16 16
 
17
-    /**
18
-     * External documentation
19
-     * @var ExternalDocumentation
20
-     */
21
-    private $externalDocs = null;
17
+	/**
18
+	 * External documentation
19
+	 * @var ExternalDocumentation
20
+	 */
21
+	private $externalDocs = null;
22 22
 
23
-    /**
24
-     * @param string $command
25
-     * @param string $data
26
-     * @return AbstractObject|boolean
27
-     */
28
-    public function handleCommand($command, $data = null)
29
-    {
30
-        switch (strtolower($command)) {
31
-            case 'doc':
32
-            case 'docs':
33
-                $url = self::wordShift($data);
34
-                $this->externalDocs = new ExternalDocumentation($this, $url, $data);
35
-                return $this->externalDocs;
36
-        }
23
+	/**
24
+	 * @param string $command
25
+	 * @param string $data
26
+	 * @return AbstractObject|boolean
27
+	 */
28
+	public function handleCommand($command, $data = null)
29
+	{
30
+		switch (strtolower($command)) {
31
+			case 'doc':
32
+			case 'docs':
33
+				$url = self::wordShift($data);
34
+				$this->externalDocs = new ExternalDocumentation($this, $url, $data);
35
+				return $this->externalDocs;
36
+		}
37 37
 
38
-        return parent::handleCommand($command, $data);
39
-    }
38
+		return parent::handleCommand($command, $data);
39
+	}
40 40
 
41
-    /**
42
-     * @return array
43
-     */
44
-    public function toArray(): array
45
-    {
46
-        return self::arrayFilterNull(array_merge(array(
47
-            'externalDocs' => $this->externalDocs ? $this->externalDocs->toArray() : null,
48
-        ), parent::toArray()));
49
-    }
41
+	/**
42
+	 * @return array
43
+	 */
44
+	public function toArray(): array
45
+	{
46
+		return self::arrayFilterNull(array_merge(array(
47
+			'externalDocs' => $this->externalDocs ? $this->externalDocs->toArray() : null,
48
+		), parent::toArray()));
49
+	}
50 50
 
51 51
 }
Please login to merge, or discard this patch.
SwaggerGen/Swagger/ResponseReference.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,25 +13,25 @@
 block discarded – undo
13 13
 class ResponseReference extends AbstractObject
14 14
 {
15 15
 
16
-    private $reference;
17
-
18
-    public function __construct(AbstractObject $parent, $reference)
19
-    {
20
-        parent::__construct($parent);
21
-
22
-        $this->reference = $reference;
23
-    }
24
-
25
-    public function toArray(): array
26
-    {
27
-        return self::arrayFilterNull(array(
28
-            '$ref' => '#/responses/' . $this->reference,
29
-        ));
30
-    }
31
-
32
-    public function __toString()
33
-    {
34
-        return __CLASS__ . ' `' . $this->reference . '`';
35
-    }
16
+	private $reference;
17
+
18
+	public function __construct(AbstractObject $parent, $reference)
19
+	{
20
+		parent::__construct($parent);
21
+
22
+		$this->reference = $reference;
23
+	}
24
+
25
+	public function toArray(): array
26
+	{
27
+		return self::arrayFilterNull(array(
28
+			'$ref' => '#/responses/' . $this->reference,
29
+		));
30
+	}
31
+
32
+	public function __toString()
33
+	{
34
+		return __CLASS__ . ' `' . $this->reference . '`';
35
+	}
36 36
 
37 37
 }
Please login to merge, or discard this patch.
SwaggerGen/Swagger/License.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -14,94 +14,94 @@
 block discarded – undo
14 14
 class License extends AbstractObject
15 15
 {
16 16
 
17
-    // @todo make this a separate resource file? (licenseUrls.json)
18
-    private static $licenses = array(
19
-        'artistic-1.0' => 'http://opensource.org/licenses/artistic-license-1.0',
20
-        'artistic-1' => 'http://opensource.org/licenses/artistic-license-1.0',
21
-        'artistic-2.0' => 'http://opensource.org/licenses/artistic-license-2.0',
22
-        'artistic-2' => 'http://opensource.org/licenses/artistic-license-2.0',
23
-        'artistic' => 'http://opensource.org/licenses/artistic-license-2.0',
24
-        'bsd-new' => 'https://opensource.org/licenses/BSD-3-Clause',
25
-        'bsd-3' => 'https://opensource.org/licenses/BSD-3-Clause',
26
-        'bsd-2' => 'https://opensource.org/licenses/BSD-2-Clause',
27
-        'bsd' => 'https://opensource.org/licenses/BSD-2-Clause',
28
-        'epl-1.0' => 'http://www.eclipse.org/legal/epl-v10.html',
29
-        'epl-1' => 'http://www.eclipse.org/legal/epl-v10.html',
30
-        'epl' => 'http://www.eclipse.org/legal/epl-v10.html',
31
-        'apache-2.0' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
32
-        'apache-2' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
33
-        'apache' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
34
-        'gpl-1.0' => 'https://www.gnu.org/licenses/gpl-1.0.html',
35
-        'gpl-1' => 'https://www.gnu.org/licenses/gpl-1.0.html',
36
-        'gpl-2.0' => 'https://www.gnu.org/licenses/gpl-2.0.html',
37
-        'gpl-2' => 'https://www.gnu.org/licenses/gpl-2.0.html',
38
-        'gpl-3.0' => 'http://www.gnu.org/licenses/gpl-3.0.html',
39
-        'gpl-3' => 'http://www.gnu.org/licenses/gpl-3.0.html',
40
-        'gpl' => 'http://www.gnu.org/licenses/gpl-3.0.html',
41
-        'lgpl-2.0' => 'http://www.gnu.org/licenses/lgpl-2.0.html',
42
-        'lgpl-2.1' => 'http://www.gnu.org/licenses/lgpl-2.1.html',
43
-        'lgpl-2' => 'http://www.gnu.org/licenses/lgpl-2.1.html',
44
-        'lgpl-3.0' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
45
-        'lgpl-3' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
46
-        'lgpl' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
47
-        'mit' => 'http://opensource.org/licenses/MIT',
48
-        'mpl-1.1' => 'https://www.mozilla.org/en-US/MPL/1.1/',
49
-        'mpl-1' => 'https://www.mozilla.org/en-US/MPL/1.1/',
50
-        'mpl-2.0' => 'https://www.mozilla.org/en-US/MPL/',
51
-        'mpl-2' => 'https://www.mozilla.org/en-US/MPL/',
52
-        'mpl' => 'https://www.mozilla.org/en-US/MPL/',
53
-        'mspl' => 'https://msdn.microsoft.com/en-us/library/ff648068.aspx',
54
-    );
55
-    private $name;
56
-    private $url;
17
+	// @todo make this a separate resource file? (licenseUrls.json)
18
+	private static $licenses = array(
19
+		'artistic-1.0' => 'http://opensource.org/licenses/artistic-license-1.0',
20
+		'artistic-1' => 'http://opensource.org/licenses/artistic-license-1.0',
21
+		'artistic-2.0' => 'http://opensource.org/licenses/artistic-license-2.0',
22
+		'artistic-2' => 'http://opensource.org/licenses/artistic-license-2.0',
23
+		'artistic' => 'http://opensource.org/licenses/artistic-license-2.0',
24
+		'bsd-new' => 'https://opensource.org/licenses/BSD-3-Clause',
25
+		'bsd-3' => 'https://opensource.org/licenses/BSD-3-Clause',
26
+		'bsd-2' => 'https://opensource.org/licenses/BSD-2-Clause',
27
+		'bsd' => 'https://opensource.org/licenses/BSD-2-Clause',
28
+		'epl-1.0' => 'http://www.eclipse.org/legal/epl-v10.html',
29
+		'epl-1' => 'http://www.eclipse.org/legal/epl-v10.html',
30
+		'epl' => 'http://www.eclipse.org/legal/epl-v10.html',
31
+		'apache-2.0' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
32
+		'apache-2' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
33
+		'apache' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
34
+		'gpl-1.0' => 'https://www.gnu.org/licenses/gpl-1.0.html',
35
+		'gpl-1' => 'https://www.gnu.org/licenses/gpl-1.0.html',
36
+		'gpl-2.0' => 'https://www.gnu.org/licenses/gpl-2.0.html',
37
+		'gpl-2' => 'https://www.gnu.org/licenses/gpl-2.0.html',
38
+		'gpl-3.0' => 'http://www.gnu.org/licenses/gpl-3.0.html',
39
+		'gpl-3' => 'http://www.gnu.org/licenses/gpl-3.0.html',
40
+		'gpl' => 'http://www.gnu.org/licenses/gpl-3.0.html',
41
+		'lgpl-2.0' => 'http://www.gnu.org/licenses/lgpl-2.0.html',
42
+		'lgpl-2.1' => 'http://www.gnu.org/licenses/lgpl-2.1.html',
43
+		'lgpl-2' => 'http://www.gnu.org/licenses/lgpl-2.1.html',
44
+		'lgpl-3.0' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
45
+		'lgpl-3' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
46
+		'lgpl' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
47
+		'mit' => 'http://opensource.org/licenses/MIT',
48
+		'mpl-1.1' => 'https://www.mozilla.org/en-US/MPL/1.1/',
49
+		'mpl-1' => 'https://www.mozilla.org/en-US/MPL/1.1/',
50
+		'mpl-2.0' => 'https://www.mozilla.org/en-US/MPL/',
51
+		'mpl-2' => 'https://www.mozilla.org/en-US/MPL/',
52
+		'mpl' => 'https://www.mozilla.org/en-US/MPL/',
53
+		'mspl' => 'https://msdn.microsoft.com/en-us/library/ff648068.aspx',
54
+	);
55
+	private $name;
56
+	private $url;
57 57
 
58
-    public function __construct(AbstractObject $parent, $name, $url = null)
59
-    {
60
-        parent::__construct($parent);
58
+	public function __construct(AbstractObject $parent, $name, $url = null)
59
+	{
60
+		parent::__construct($parent);
61 61
 
62
-        $this->name = empty($name) ? null : $name;
62
+		$this->name = empty($name) ? null : $name;
63 63
 
64
-        if (!empty($url)) {
65
-            $this->url = $url;
66
-        } elseif (!empty(self::$licenses[strtolower($name)])) {
67
-            $this->url = self::$licenses[strtolower($name)];
68
-        }
69
-    }
64
+		if (!empty($url)) {
65
+			$this->url = $url;
66
+		} elseif (!empty(self::$licenses[strtolower($name)])) {
67
+			$this->url = self::$licenses[strtolower($name)];
68
+		}
69
+	}
70 70
 
71
-    /**
72
-     * @param string $command
73
-     * @param string $data
74
-     * @return AbstractObject|boolean
75
-     */
76
-    public function handleCommand($command, $data = null)
77
-    {
78
-        switch (strtolower($command)) {
79
-            case 'name':
80
-                $this->name = $data;
81
-                if (empty($this->url) && !empty(self::$licenses[strtolower($data)])) {
82
-                    $this->url = self::$licenses[strtolower($data)];
83
-                }
84
-                return $this;
71
+	/**
72
+	 * @param string $command
73
+	 * @param string $data
74
+	 * @return AbstractObject|boolean
75
+	 */
76
+	public function handleCommand($command, $data = null)
77
+	{
78
+		switch (strtolower($command)) {
79
+			case 'name':
80
+				$this->name = $data;
81
+				if (empty($this->url) && !empty(self::$licenses[strtolower($data)])) {
82
+					$this->url = self::$licenses[strtolower($data)];
83
+				}
84
+				return $this;
85 85
 
86
-            case 'url':
87
-                $this->url = $data;
88
-                return $this;
89
-        }
86
+			case 'url':
87
+				$this->url = $data;
88
+				return $this;
89
+		}
90 90
 
91
-        return parent::handleCommand($command, $data);
92
-    }
91
+		return parent::handleCommand($command, $data);
92
+	}
93 93
 
94
-    public function toArray(): array
95
-    {
96
-        return self::arrayFilterNull(array_merge(array(
97
-            'name' => $this->name,
98
-            'url' => $this->url,
99
-        ), parent::toArray()));
100
-    }
94
+	public function toArray(): array
95
+	{
96
+		return self::arrayFilterNull(array_merge(array(
97
+			'name' => $this->name,
98
+			'url' => $this->url,
99
+		), parent::toArray()));
100
+	}
101 101
 
102
-    public function __toString()
103
-    {
104
-        return __CLASS__ . " {$this->name}, {$this->url}";
105
-    }
102
+	public function __toString()
103
+	{
104
+		return __CLASS__ . " {$this->name}, {$this->url}";
105
+	}
106 106
 
107 107
 }
Please login to merge, or discard this patch.
SwaggerGen/Swagger/ParameterReference.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@
 block discarded – undo
13 13
 class ParameterReference extends AbstractObject implements IParameter
14 14
 {
15 15
 
16
-    private $reference;
17
-
18
-    public function __construct(AbstractObject $parent, $reference)
19
-    {
20
-        parent::__construct($parent);
21
-
22
-        $this->reference = $reference;
23
-    }
24
-
25
-    public function toArray(): array
26
-    {
27
-        return self::arrayFilterNull(array(
28
-            '$ref' => '#/parameters/' . $this->reference,
29
-        ));
30
-    }
31
-
32
-    public function __toString()
33
-    {
34
-        return __CLASS__ . ' `' . $this->reference . '`';
35
-    }
36
-
37
-    public function getName()
38
-    {
39
-        return $this->reference;
40
-    }
16
+	private $reference;
17
+
18
+	public function __construct(AbstractObject $parent, $reference)
19
+	{
20
+		parent::__construct($parent);
21
+
22
+		$this->reference = $reference;
23
+	}
24
+
25
+	public function toArray(): array
26
+	{
27
+		return self::arrayFilterNull(array(
28
+			'$ref' => '#/parameters/' . $this->reference,
29
+		));
30
+	}
31
+
32
+	public function __toString()
33
+	{
34
+		return __CLASS__ . ' `' . $this->reference . '`';
35
+	}
36
+
37
+	public function getName()
38
+	{
39
+		return $this->reference;
40
+	}
41 41
 
42 42
 }
Please login to merge, or discard this patch.
SwaggerGen/Swagger/Contact.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -14,49 +14,49 @@
 block discarded – undo
14 14
 class Contact extends AbstractObject
15 15
 {
16 16
 
17
-    private $name;
18
-    private $url;
19
-    private $email;
20
-
21
-    public function __construct(AbstractObject $parent, $name = null, $url = null, $email = null)
22
-    {
23
-        parent::__construct($parent);
24
-
25
-        $this->name = empty($name) ? null : $name;
26
-        $this->url = empty($url) ? null : $url;
27
-        $this->email = empty($email) ? null : $email;
28
-    }
29
-
30
-    /**
31
-     * @param string $command
32
-     * @param string $data
33
-     * @return AbstractObject|boolean
34
-     */
35
-    public function handleCommand($command, $data = null)
36
-    {
37
-        switch (strtolower($command)) {
38
-            case 'name':
39
-            case 'url':
40
-            case 'email':
41
-                $this->$command = $data;
42
-                return $this;
43
-        }
44
-
45
-        return parent::handleCommand($command, $data);
46
-    }
47
-
48
-    public function toArray(): array
49
-    {
50
-        return self::arrayFilterNull(array_merge(array(
51
-            'name' => $this->name,
52
-            'url' => $this->url,
53
-            'email' => $this->email,
54
-        ), parent::toArray()));
55
-    }
56
-
57
-    public function __toString()
58
-    {
59
-        return __CLASS__ . " {$this->name} <{$this->email}>, {$this->url}";
60
-    }
17
+	private $name;
18
+	private $url;
19
+	private $email;
20
+
21
+	public function __construct(AbstractObject $parent, $name = null, $url = null, $email = null)
22
+	{
23
+		parent::__construct($parent);
24
+
25
+		$this->name = empty($name) ? null : $name;
26
+		$this->url = empty($url) ? null : $url;
27
+		$this->email = empty($email) ? null : $email;
28
+	}
29
+
30
+	/**
31
+	 * @param string $command
32
+	 * @param string $data
33
+	 * @return AbstractObject|boolean
34
+	 */
35
+	public function handleCommand($command, $data = null)
36
+	{
37
+		switch (strtolower($command)) {
38
+			case 'name':
39
+			case 'url':
40
+			case 'email':
41
+				$this->$command = $data;
42
+				return $this;
43
+		}
44
+
45
+		return parent::handleCommand($command, $data);
46
+	}
47
+
48
+	public function toArray(): array
49
+	{
50
+		return self::arrayFilterNull(array_merge(array(
51
+			'name' => $this->name,
52
+			'url' => $this->url,
53
+			'email' => $this->email,
54
+		), parent::toArray()));
55
+	}
56
+
57
+	public function __toString()
58
+	{
59
+		return __CLASS__ . " {$this->name} <{$this->email}>, {$this->url}";
60
+	}
61 61
 
62 62
 }
Please login to merge, or discard this patch.