x Sorry, these patches are not available anymore due to data migration. Please run a fresh inspection.
Completed
Push — develop ( cf98e3...51dac5 )
by Alireza
01:55
created
src/helpers.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace Josh\Faker;
4 4
 
5
-if(! function_exists('string')){
5
+if (!function_exists('string')) {
6 6
     /**
7 7
      * Return string of variable
8 8
      *
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     }
18 18
 }
19 19
 
20
-if(! function_exists('faker')){
20
+if (!function_exists('faker')) {
21 21
     /**
22 22
      * Return the faker instance
23 23
      *
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     }
32 32
 }
33 33
 
34
-if(! function_exists('randomNumber')){
34
+if (!function_exists('randomNumber')) {
35 35
     /**
36 36
      * Return random number
37 37
      *
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 
48 48
         $number  = '';
49 49
 
50
-        for($i = 1;$i <= $length;$i++){
51
-            $num = $numbers[rand(0,strlen($numbers) - 1)];
52
-            if($num == 0 && $i == 1){
50
+        for ($i = 1; $i <= $length; $i++) {
51
+            $num = $numbers[rand(0, strlen($numbers) - 1)];
52
+            if ($num == 0 && $i == 1) {
53 53
                 continue;
54 54
             }
55 55
 
56
-            $number .= $num ;
56
+            $number .= $num;
57 57
         }
58 58
 
59
-        if($int){
59
+        if ($int) {
60 60
             return (integer)$number;
61 61
         }
62 62
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     }
65 65
 }
66 66
 
67
-if(! function_exists('randomString')){
67
+if (!function_exists('randomString')) {
68 68
 
69 69
     /**
70 70
      * Get random string
@@ -76,27 +76,27 @@  discard block
 block discarded – undo
76 76
      * @return string
77 77
      * @throws \Exception
78 78
      */
79
-    function randomString($length = 20, $type = null){
79
+    function randomString($length = 20, $type = null) {
80 80
 
81 81
         $characters = [
82 82
             'uppercase' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
83 83
             'lowercase' => 'abcdefghijklmnopqrstuvwxyz'
84 84
         ];
85 85
 
86
-        if(($type !== 'uppercase' && $type !== 'lowercase') && ! is_null($type)){
86
+        if (($type !== 'uppercase' && $type !== 'lowercase') && !is_null($type)) {
87 87
             throw new \Exception("The type of $type does not exists!");
88 88
         }
89 89
 
90
-        if(! is_null($type)){
90
+        if (!is_null($type)) {
91 91
             $characters = $characters[$type];
92 92
         } else {
93 93
             $characters = $characters['lowercase'] . $characters['uppercase'];
94 94
         }
95 95
 
96
-        $string  = '';
96
+        $string = '';
97 97
 
98
-        for($i = 1;$i <= $length;$i++){
99
-            $string .= $characters[rand(0,strlen($characters) - 1)];
98
+        for ($i = 1; $i <= $length; $i++) {
99
+            $string .= $characters[rand(0, strlen($characters) - 1)];
100 100
         }
101 101
 
102 102
         return $string;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 }
106 106
 
107
-if(! function_exists('isMeliCode')){
107
+if (!function_exists('isMeliCode')) {
108 108
     /**
109 109
      * Check is meli code function
110 110
      *
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
             $value = '0' . $value;
124 124
         }
125 125
         for ($i = 0; $i <= 8; $i++) {
126
-            $sub = $sub + ( $value[$i] * ( 10 - $i ) );
126
+            $sub = $sub + ($value[$i] * (10 - $i));
127 127
         }
128
-        if (( $sub % 11 ) < 2) {
129
-            $control = ( $sub % 11 );
128
+        if (($sub % 11) < 2) {
129
+            $control = ($sub % 11);
130 130
         } else {
131
-            $control = 11 - ( $sub % 11 );
131
+            $control = 11 - ($sub % 11);
132 132
         }
133 133
         if ($value[9] == $control) {
134 134
             return true;
Please login to merge, or discard this patch.