Completed
Pull Request — master (#30)
by John
02:51
created
src/APIRequest/URLParser/RegexURLParser/RegexURLParser.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
      * @param MIMEProvider|null $MIMEProvider
33 33
      * @throws InvalidRegexPatternException
34 34
      */
35
-    public function __construct(string $pattern, ?MIMEProvider $MIMEProvider = null)
35
+    public function __construct(string $pattern, ? MIMEProvider $MIMEProvider = null)
36 36
     {
37 37
         $this->pattern = $pattern;
38 38
 
39
-        if(@preg_match($pattern, null) === false) {
39
+        if (@preg_match($pattern, null) === false) {
40 40
             throw new InvalidRegexPatternException("Unable to parse regex pattern", preg_last_error());
41 41
         }
42 42
         $this->MIMEProvider = $MIMEProvider;
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     public function parse(UriInterface $uri): ParsedURL
52 52
     {
53 53
         $matches = [];
54
-        if(preg_match($this->pattern, $uri->getPath(), $matches) === 0) {
54
+        if (preg_match($this->pattern, $uri->getPath(), $matches) === 0) {
55 55
             throw new InvalidRequestURLException("Unable to parse request path: did not match regex");
56 56
         }
57
-        if(!($endpoint = $matches["endpoint"] ?? null)) {
57
+        if (!($endpoint = $matches["endpoint"] ?? null)) {
58 58
             throw new InvalidRequestURLException("Unable to match endpoint in url");
59 59
         }
60 60
         $element = $matches["element"] ?? null;
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
         $apiKey = $matches["apiKey"] ?? null;
63 63
 
64 64
         $acceptableMimeTypes = [];
65
-        if(($acceptableExtension = $matches["acceptableExtension"] ?? null)) {
66
-            if(!$this->MIMEProvider) {
65
+        if (($acceptableExtension = $matches["acceptableExtension"] ?? null)) {
66
+            if (!$this->MIMEProvider) {
67 67
                 throw new InvalidRequestURLException("Unable to accept acceptable extensions");
68 68
             } else {
69 69
                 try {
Please login to merge, or discard this patch.