Completed
Push — dev-v3 ( 0f682d )
by Propa
02:36
created
src/PhoneValidator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
      */
144 144
     protected function checkCountries($attribute)
145 145
     {
146
-        $countryField = (is_null($this->countryField) ? $attribute . '_country' : $this->countryField);
146
+        $countryField = (is_null($this->countryField) ? $attribute.'_country' : $this->countryField);
147 147
 
148 148
         if ($this->isInputField($countryField)) {
149 149
             $this->countries = [array_get($this->data, $countryField)];
150
-        } elseif (! $this->autodetect && ! $this->lenient && empty($this->countries)) {
150
+        } elseif (!$this->autodetect && !$this->lenient && empty($this->countries)) {
151 151
             throw new NoValidCountryFoundException;
152 152
         }
153 153
     }
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
     protected function parseTypes(array $types)
205 205
     {
206 206
         // Transform types to their namespaced class constant.
207
-        array_walk($types, function (&$type) {
208
-            $type = constant('\libphonenumber\PhoneNumberType::' . $type);
207
+        array_walk($types, function(&$type) {
208
+            $type = constant('\libphonenumber\PhoneNumberType::'.$type);
209 209
         });
210 210
 
211 211
         // Add in the unsure number type if applicable.
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function isInputField($field)
226 226
     {
227
-        return ! is_null(array_get($this->data, $field));
227
+        return !is_null(array_get($this->data, $field));
228 228
     }
229 229
 
230 230
     /**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         // Legacy support.
250 250
         $type = ($type == 'LANDLINE' ? 'FIXED_LINE' : $type);
251 251
 
252
-        return defined('\libphonenumber\PhoneNumberType::' . strtoupper($type));
252
+        return defined('\libphonenumber\PhoneNumberType::'.strtoupper($type));
253 253
     }
254 254
 
255 255
 }
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Illuminate\Support\Facades\App;
4 4
 use libphonenumber\PhoneNumberFormat;
5 5
 
6
-if (! function_exists('phone')) {
6
+if (!function_exists('phone')) {
7 7
     /**
8 8
      * Get the PhoneNumberUtil or format a phone number for display.
9 9
      *
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     {
14 14
         $lib = App::make('libphonenumber');
15 15
 
16
-        if (! $arguments = func_get_args()) {
16
+        if (!$arguments = func_get_args()) {
17 17
             return $lib;
18 18
         }
19 19
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     }
29 29
 }
30 30
 
31
-if (! function_exists('phone_format')) {
31
+if (!function_exists('phone_format')) {
32 32
     /**
33 33
      * Formats a phone number and country for display.
34 34
      *
Please login to merge, or discard this patch.
src/LaravelPhoneServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      */
24 24
     public function register()
25 25
     {
26
-        $this->app->singleton('libphonenumber', function ($app) {
26
+        $this->app->singleton('libphonenumber', function($app) {
27 27
             return PhoneNumberUtil::getInstance();
28 28
         });
29 29
 
Please login to merge, or discard this patch.
src/Exceptions/PhoneCountryException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1 1
 <?php namespace Propaganistas\LaravelPhone\Exceptions;
2 2
 
3
-class PhoneCountryException extends \Exception{}
3
+class PhoneCountryException extends \Exception {}
Please login to merge, or discard this patch.
src/Traits/ParsesCountries.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     {
26 26
         $countries = is_array($countries) ? $countries : func_get_args();
27 27
 
28
-        return array_filter($countries, function ($code) {
28
+        return array_filter($countries, function($code) {
29 29
             $code = strtoupper($code);
30 30
 
31 31
             return static::isCountryCode($code) ? $code : null;
Please login to merge, or discard this patch.
src/Traits/ParsesTypes.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public static function isType($type)
23 23
     {
24
-        return ! is_null(static::parseTypes($type));
24
+        return !is_null(static::parseTypes($type));
25 25
     }
26 26
 
27 27
     /**
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         $types = is_array($types) ? $types : func_get_args();
38 38
 
39
-        return array_filter($types, function ($type) {
39
+        return array_filter($types, function($type) {
40 40
             // If the type equals a constant's value, just return it.
41 41
             if (in_array($type, static::$types)) {
42 42
                 return $type;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
         $types = is_array($types) ? $types : func_get_args();
61 61
 
62
-        return array_filter($types, function ($type) {
62
+        return array_filter($types, function($type) {
63 63
             $type = strtoupper($type);
64 64
 
65 65
             // If the type equals a constant's name, just return it.
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     private static function loadTypes()
80 80
     {
81
-        if (! static::$types) {
81
+        if (!static::$types) {
82 82
             static::$types = with(new ReflectionClass(PhoneNumberType::class))->getConstants();
83 83
         }
84 84
     }
Please login to merge, or discard this patch.
src/Traits/ParsesFormats.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public static function isFormat($format)
23 23
     {
24
-        return ! is_null(static::parseFormat($format));
24
+        return !is_null(static::parseFormat($format));
25 25
     }
26 26
 
27 27
     /**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     private static function loadFormats()
50 50
     {
51
-        if (! static::$formats) {
51
+        if (!static::$formats) {
52 52
             static::$formats = with(new ReflectionClass(PhoneNumberFormat::class))->getConstants();
53 53
         }
54 54
     }
Please login to merge, or discard this patch.
src/Phone.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function format($format)
128 128
     {
129
-        if (! ($format = static::parseFormat($format))) {
130
-            return $this->throwFormatException('Unknown format "' . (string) $format . '"');
129
+        if (!($format = static::parseFormat($format))) {
130
+            return $this->throwFormatException('Unknown format "'.(string) $format.'"');
131 131
         }
132 132
 
133 133
         $country = Arr::get($this->countries, 0);
134 134
 
135
-        if (! $country && ! Str::startsWith($this->number, '+')) {
135
+        if (!$country && !Str::startsWith($this->number, '+')) {
136 136
             return $this->throwFormatException('A country should be provided or the number should be in international format');
137 137
         }
138 138
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function formatForCountry($country)
152 152
     {
153
-        if (! static::isCountryCode($country)) {
153
+        if (!static::isCountryCode($country)) {
154 154
             return $this->throwCountryException($country);
155 155
         }
156 156
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function formatForMobileDialingInCountry($country, $removeFormatting = false)
171 171
     {
172
-        if (! static::isCountryCode($country)) {
172
+        if (!static::isCountryCode($country)) {
173 173
             return $this->throwCountryException($country);
174 174
         }
175 175
 
Please login to merge, or discard this patch.