Passed
Push — master ( 0bee53...eca684 )
by Nicolaas
06:29 queued 03:53
created
src/ExternalURLField.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         }
76 76
 
77 77
         if (is_array($this->config[$name])) {
78
-            if (! is_array($val)) {
78
+            if (!is_array($val)) {
79 79
                 user_error("The value for {$name} must be an array");
80 80
             }
81 81
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $parentAttributes = parent::getAttributes();
112 112
         $attributes = [];
113 113
 
114
-        if (! isset($parentAttributes['placeholder'])) {
114
+        if (!isset($parentAttributes['placeholder'])) {
115 115
             $attributes['placeholder'] = $this->config['defaultparts']['scheme'] . '://example.com'; //example url
116 116
         }
117 117
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $this->value = trim($this->value);
156 156
         $regex = $this->config['validregex'];
157
-        if ($this->value && $regex && ! preg_match($regex, $this->value)) {
157
+        if ($this->value && $regex && !preg_match($regex, $this->value)) {
158 158
             $validator->validationError(
159 159
                 $this->name,
160 160
                 _t('ExternalURLField.VALIDATION', 'Please enter a valid URL'),
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
     protected function rebuildURL($url)
190 190
     {
191 191
         $defaults = $this->config['defaultparts'];
192
-        if (! preg_match('#^[a-zA-Z]+://#', $url)) {
192
+        if (!preg_match('#^[a-zA-Z]+://#', $url)) {
193 193
             $url = $defaults['scheme'] . '://' . $url;
194 194
         }
195 195
 
196 196
         $parts = parse_url($url);
197
-        if (! $parts) {
197
+        if (!$parts) {
198 198
             //can't parse url, abort
199 199
             return '';
200 200
         }
Please login to merge, or discard this patch.
src/ExternalURL.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,17 +104,17 @@
 block discarded – undo
104 104
         $fieldName = $this->name;
105 105
         if ($fieldName) {
106 106
             $url = (string) $this->value;
107
-            if (! $url) {
107
+            if (!$url) {
108 108
                 return '';
109 109
             }
110 110
             $config = Config::inst()->get(ExternalURLField::class, 'default_config');
111 111
             $defaults = $config['defaultparts'];
112
-            if (! preg_match('#^[a-zA-Z]+://#', $url)) {
112
+            if (!preg_match('#^[a-zA-Z]+://#', $url)) {
113 113
                 $url = $defaults['scheme'] . '://' . $url;
114 114
             }
115 115
 
116 116
             $parts = parse_url($url);
117
-            if (! $parts) {
117
+            if (!$parts) {
118 118
                 //can't parse url, abort
119 119
                 return '';
120 120
             }
Please login to merge, or discard this patch.
src/ExternalURLFinder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
     public static function find(string $link, string $className, string $field, ?bool $removeFinalSlash = true): DataList
23 23
     {
24 24
         $link = strtolower($link);
25
-        if($removeFinalSlash) {
25
+        if ($removeFinalSlash) {
26 26
             $link = rtrim($link, '/');
27 27
         }
28 28
         $linkObject = DBField::create_field('ExternalURL', $link);
29 29
         $domain = $linkObject->Domain();
30
-        if(strpos($domain, 'www.') === 0) {
30
+        if (strpos($domain, 'www.') === 0) {
31 31
             $domainWWW = $domain;
32 32
             $domainNoWWW = $linkObject->Domain()->noWWW();
33 33
         } else {
Please login to merge, or discard this patch.