@@ -3,21 +3,21 @@ discard block |
||
3 | 3 | return [ |
4 | 4 | |
5 | 5 | 'names' => [ |
6 | - 'عباس', 'وحید', 'علی', 'علیرضا', 'شاهرخ', 'سجاد', 'شایان' , 'حسام' , 'مهدی' , |
|
7 | - 'حسن' , 'حمید','شقایق', 'المیرا', 'شیما', 'مرجان', 'پرستو', 'نگار' , 'ترانه' , |
|
8 | - 'لیلا' , 'مریم' , 'سحر' , 'زهرا' , 'ریحانه' , 'منیر' , 'عطیه' , 'پروانه' , 'ترانه' |
|
6 | + 'عباس', 'وحید', 'علی', 'علیرضا', 'شاهرخ', 'سجاد', 'شایان', 'حسام', 'مهدی', |
|
7 | + 'حسن', 'حمید', 'شقایق', 'المیرا', 'شیما', 'مرجان', 'پرستو', 'نگار', 'ترانه', |
|
8 | + 'لیلا', 'مریم', 'سحر', 'زهرا', 'ریحانه', 'منیر', 'عطیه', 'پروانه', 'ترانه' |
|
9 | 9 | ], |
10 | 10 | |
11 | 11 | 'families' => [ |
12 | 12 | 'الماسی', 'جوشقانی', 'جمالیان', 'جعفری', 'فیض', 'نیاکان', 'بیات', |
13 | - 'پیرو' , 'حیدری' , 'نجاران' , 'اسد نژاد' , 'صمدی' , 'اسدی' , 'کریمی' , |
|
14 | - 'حسینی' , 'الماسی' , 'صدیقی' , 'مسقطی' , 'علی دوستی' , 'کریمزاده' , 'کوت آبادی' |
|
13 | + 'پیرو', 'حیدری', 'نجاران', 'اسد نژاد', 'صمدی', 'اسدی', 'کریمی', |
|
14 | + 'حسینی', 'الماسی', 'صدیقی', 'مسقطی', 'علی دوستی', 'کریمزاده', 'کوت آبادی' |
|
15 | 15 | ], |
16 | 16 | |
17 | 17 | 'companies' => [ |
18 | 18 | 'ای نتورک', 'خاورزمین', 'فرانش', 'کاروانرو', 'اسنپ', 'تپ سی', 'آواتک', |
19 | - 'بیدینگ' , 'سایت چک آپ' , 'شنبه' , 'دیجی کالا' , 'بامیلو' , 'ایرانسل' , |
|
20 | - 'همراه اول' , 'سرآوا پارس' , 'ایران خودرو' , 'سایپا' , 'تاژ' , 'هومکر' , 'کاموا' , |
|
19 | + 'بیدینگ', 'سایت چک آپ', 'شنبه', 'دیجی کالا', 'بامیلو', 'ایرانسل', |
|
20 | + 'همراه اول', 'سرآوا پارس', 'ایران خودرو', 'سایپا', 'تاژ', 'هومکر', 'کاموا', |
|
21 | 21 | 'کانگرو' |
22 | 22 | ], |
23 | 23 | |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | ], |
42 | 42 | |
43 | 43 | 'mailServices' => [ |
44 | - 'gmail.com' , 'mail.com' , 'yahoo.com' , 'outlook.com' |
|
44 | + 'gmail.com', 'mail.com', 'yahoo.com', 'outlook.com' |
|
45 | 45 | ], |
46 | 46 | |
47 | 47 | 'prefixTelePhones' => [ |
48 | - 912 , 931 , 932 , 933 , 901 , 921 , 919 , 912 , 913 , 917 , |
|
49 | - 915 , 916 , 910 , 939 , 938 , 937 , 918 , 914 , 911 , 934 |
|
48 | + 912, 931, 932, 933, 901, 921, 919, 912, 913, 917, |
|
49 | + 915, 916, 910, 939, 938, 937, 918, 914, 911, 934 |
|
50 | 50 | ], |
51 | 51 | |
52 | 52 | 'prefixPhones' => [ |
53 | - 21 , 25 , 253 , 32 , 45 , 67 , 11 , 12 , 93 , 65 , 34 , 67 |
|
53 | + 21, 25, 253, 32, 45, 67, 11, 12, 93, 65, 34, 67 |
|
54 | 54 | ], |
55 | 55 | |
56 | - 'protocols' => [ 'http' , 'https' ], |
|
56 | + 'protocols' => ['http', 'https'], |
|
57 | 57 | |
58 | 58 | |
59 | 59 | 'domains' => [ |
60 | - '.com' , '.org' , '.ir' , '.net' , '.me' , '.info' , '.co' |
|
60 | + '.com', '.org', '.ir', '.net', '.me', '.info', '.co' |
|
61 | 61 | ], |
62 | 62 | |
63 | 63 | 'city' => [ |
@@ -2,7 +2,7 @@ discard block |
||
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 |
||
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 |
||
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,18 +47,18 @@ discard block |
||
47 | 47 | |
48 | 48 | $number = ''; |
49 | 49 | |
50 | - for($i = 1;$i <= $length;$i++){ |
|
51 | - $num = $numbers[rand(0,strlen($numbers) - 1)]; |
|
50 | + for ($i = 1; $i <= $length; $i++) { |
|
51 | + $num = $numbers[rand(0, strlen($numbers) - 1)]; |
|
52 | 52 | |
53 | - if($num == 0 && $i == 1){ |
|
53 | + if ($num == 0 && $i == 1) { |
|
54 | 54 | $i = 1; |
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | |
58 | - $number .= $num ; |
|
58 | + $number .= $num; |
|
59 | 59 | } |
60 | 60 | |
61 | - if($int){ |
|
61 | + if ($int) { |
|
62 | 62 | return (integer)$number; |
63 | 63 | } |
64 | 64 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -if(! function_exists('randomString')){ |
|
69 | +if (!function_exists('randomString')) { |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Get random string |
@@ -78,27 +78,27 @@ discard block |
||
78 | 78 | * @return string |
79 | 79 | * @throws \Exception |
80 | 80 | */ |
81 | - function randomString($length = 20, $type = null){ |
|
81 | + function randomString($length = 20, $type = null) { |
|
82 | 82 | |
83 | 83 | $characters = [ |
84 | 84 | 'uppercase' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', |
85 | 85 | 'lowercase' => 'abcdefghijklmnopqrstuvwxyz' |
86 | 86 | ]; |
87 | 87 | |
88 | - if(($type !== 'uppercase' && $type !== 'lowercase') && ! is_null($type)){ |
|
88 | + if (($type !== 'uppercase' && $type !== 'lowercase') && !is_null($type)) { |
|
89 | 89 | throw new \Exception("The type of $type does not exists!"); |
90 | 90 | } |
91 | 91 | |
92 | - if(! is_null($type)){ |
|
92 | + if (!is_null($type)) { |
|
93 | 93 | $characters = $characters[$type]; |
94 | 94 | } else { |
95 | 95 | $characters = $characters['lowercase'] . $characters['uppercase']; |
96 | 96 | } |
97 | 97 | |
98 | - $string = ''; |
|
98 | + $string = ''; |
|
99 | 99 | |
100 | - for($i = 1;$i <= $length;$i++){ |
|
101 | - $string .= $characters[rand(0,strlen($characters) - 1)]; |
|
100 | + for ($i = 1; $i <= $length; $i++) { |
|
101 | + $string .= $characters[rand(0, strlen($characters) - 1)]; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | return $string; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | } |
108 | 108 | |
109 | -if(! function_exists('isMeliCode')){ |
|
109 | +if (!function_exists('isMeliCode')) { |
|
110 | 110 | /** |
111 | 111 | * Check is meli code function |
112 | 112 | * |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | $value = '0' . $value; |
126 | 126 | } |
127 | 127 | for ($i = 0; $i <= 8; $i++) { |
128 | - $sub = $sub + ( $value[$i] * ( 10 - $i ) ); |
|
128 | + $sub = $sub + ($value[$i] * (10 - $i)); |
|
129 | 129 | } |
130 | - if (( $sub % 11 ) < 2) { |
|
131 | - $control = ( $sub % 11 ); |
|
130 | + if (($sub % 11) < 2) { |
|
131 | + $control = ($sub % 11); |
|
132 | 132 | } else { |
133 | - $control = 11 - ( $sub % 11 ); |
|
133 | + $control = 11 - ($sub % 11); |
|
134 | 134 | } |
135 | 135 | if ($value[9] == $control) { |
136 | 136 | return true; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $service = $this->getRandomKey('mailServices'); |
113 | 113 | |
114 | - return string(randomString(30,'lowercase') . '@' . $service); |
|
114 | + return string(randomString(30, 'lowercase') . '@' . $service); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $domain = $this->getRandomKey('domains'); |
127 | 127 | |
128 | - return string(randomString(20,'lowercase') . $domain); |
|
128 | + return string(randomString(20, 'lowercase') . $domain); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function pageUrl() |
153 | 153 | { |
154 | - $rand = rand(3,7); |
|
154 | + $rand = rand(3, 7); |
|
155 | 155 | |
156 | 156 | $string = ''; |
157 | 157 | |
158 | - $count = rand(2,8); |
|
158 | + $count = rand(2, 8); |
|
159 | 159 | |
160 | - for($i=0;$i < $rand;$i++){ |
|
161 | - $string .= randomString($count,'lowercase') . '/'; |
|
160 | + for ($i = 0; $i < $rand; $i++) { |
|
161 | + $string .= randomString($count, 'lowercase') . '/'; |
|
162 | 162 | } |
163 | 163 | |
164 | - return rtrim($string,'/'); |
|
164 | + return rtrim($string, '/'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function age($min = 16, $max = 70) |
177 | 177 | { |
178 | - return rand($min,$max); |
|
178 | + return rand($min, $max); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -213,33 +213,33 @@ discard block |
||
213 | 213 | { |
214 | 214 | $i = 1; |
215 | 215 | |
216 | - $code= null; |
|
216 | + $code = null; |
|
217 | 217 | |
218 | - while($i <= 100){ |
|
218 | + while ($i <= 100) { |
|
219 | 219 | |
220 | - $meli = randomNumber(10,true); |
|
220 | + $meli = randomNumber(10, true); |
|
221 | 221 | |
222 | - if(strlen($meli) != 10){ |
|
222 | + if (strlen($meli) != 10) { |
|
223 | 223 | continue; |
224 | 224 | } |
225 | 225 | |
226 | - $c = substr($meli,9,1); |
|
226 | + $c = substr($meli, 9, 1); |
|
227 | 227 | |
228 | - $n = substr($meli,0,1) * 10 + |
|
229 | - substr($meli,1,1) * 9 + |
|
230 | - substr($meli,2,1) * 8 + |
|
231 | - substr($meli,3,1) * 7 + |
|
232 | - substr($meli,4,1) * 6 + |
|
233 | - substr($meli,5,1) * 5 + |
|
234 | - substr($meli,6,1) * 4 + |
|
235 | - substr($meli,7,1) * 3 + |
|
236 | - substr($meli,8,1) * 2; |
|
228 | + $n = substr($meli, 0, 1) * 10 + |
|
229 | + substr($meli, 1, 1) * 9 + |
|
230 | + substr($meli, 2, 1) * 8 + |
|
231 | + substr($meli, 3, 1) * 7 + |
|
232 | + substr($meli, 4, 1) * 6 + |
|
233 | + substr($meli, 5, 1) * 5 + |
|
234 | + substr($meli, 6, 1) * 4 + |
|
235 | + substr($meli, 7, 1) * 3 + |
|
236 | + substr($meli, 8, 1) * 2; |
|
237 | 237 | |
238 | 238 | $r = $n - (int)($n / 11) * 11; |
239 | 239 | |
240 | 240 | if (($r == 0 && $r == $c) || ($r == 1 && $c == 1) || ($r > 1 && $c == 11 - $r)) { |
241 | 241 | |
242 | - if(! isMeliCode($meli)){ |
|
242 | + if (!isMeliCode($meli)) { |
|
243 | 243 | continue; |
244 | 244 | } |
245 | 245 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | continue; |
251 | 251 | } |
252 | 252 | |
253 | - if(is_null($code)){ |
|
253 | + if (is_null($code)) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 | |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | $name = null; |
273 | 273 | $array = []; |
274 | 274 | |
275 | - if(is_array($object)){ |
|
275 | + if (is_array($object)) { |
|
276 | 276 | $array = $object; |
277 | 277 | $name = array_rand($object); |
278 | - } elseif(is_string($object)) { |
|
278 | + } elseif (is_string($object)) { |
|
279 | 279 | $array = $this->objects[$object]; |
280 | 280 | $name = array_rand($array); |
281 | 281 | } |