@@ -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; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | $phone = string('0' . $prefix . randomNumber(7)); |
87 | 87 | |
88 | - return ( strlen($phone) !== 11 ? $phone . rand(1,10) : $phone ); |
|
88 | + return (strlen($phone) !== 11 ? $phone . rand(1, 10) : $phone); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | $service = $this->getRandomKey('mailServices'); |
115 | 115 | |
116 | - return string(randomString(30,'lowercase') . '@' . $service); |
|
116 | + return string(randomString(30, 'lowercase') . '@' . $service); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $domain = $this->getRandomKey('domains'); |
129 | 129 | |
130 | - return string(randomString(20,'lowercase') . $domain); |
|
130 | + return string(randomString(20, 'lowercase') . $domain); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function pageUrl() |
155 | 155 | { |
156 | - $rand = rand(3,7); |
|
156 | + $rand = rand(3, 7); |
|
157 | 157 | |
158 | 158 | $string = ''; |
159 | 159 | |
160 | - $count = rand(2,8); |
|
160 | + $count = rand(2, 8); |
|
161 | 161 | |
162 | - for($i=0;$i < $rand;$i++){ |
|
163 | - $string .= randomString($count,'lowercase') . '/'; |
|
162 | + for ($i = 0; $i < $rand; $i++) { |
|
163 | + $string .= randomString($count, 'lowercase') . '/'; |
|
164 | 164 | } |
165 | 165 | |
166 | - return rtrim($string,'/'); |
|
166 | + return rtrim($string, '/'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function age($min = 16, $max = 70) |
179 | 179 | { |
180 | - return rand($min,$max); |
|
180 | + return rand($min, $max); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | { |
216 | 216 | $code = $this->generateMeliCode(); |
217 | 217 | |
218 | - if(is_null($code)){ |
|
218 | + if (is_null($code)) { |
|
219 | 219 | $code = $this->generateMeliCode(); |
220 | 220 | } |
221 | 221 | |
@@ -233,31 +233,31 @@ discard block |
||
233 | 233 | { |
234 | 234 | $code = null; |
235 | 235 | |
236 | - for($i = 1;$i < 100;$i++){ |
|
236 | + for ($i = 1; $i < 100; $i++) { |
|
237 | 237 | |
238 | - $meli = randomNumber(10,true); |
|
238 | + $meli = randomNumber(10, true); |
|
239 | 239 | |
240 | - if(strlen($meli) != 10){ |
|
240 | + if (strlen($meli) != 10) { |
|
241 | 241 | continue; |
242 | 242 | } |
243 | 243 | |
244 | - $c = substr($meli,9,1); |
|
244 | + $c = substr($meli, 9, 1); |
|
245 | 245 | |
246 | - $n = substr($meli,0,1) * 10 + |
|
247 | - substr($meli,1,1) * 9 + |
|
248 | - substr($meli,2,1) * 8 + |
|
249 | - substr($meli,3,1) * 7 + |
|
250 | - substr($meli,4,1) * 6 + |
|
251 | - substr($meli,5,1) * 5 + |
|
252 | - substr($meli,6,1) * 4 + |
|
253 | - substr($meli,7,1) * 3 + |
|
254 | - substr($meli,8,1) * 2; |
|
246 | + $n = substr($meli, 0, 1) * 10 + |
|
247 | + substr($meli, 1, 1) * 9 + |
|
248 | + substr($meli, 2, 1) * 8 + |
|
249 | + substr($meli, 3, 1) * 7 + |
|
250 | + substr($meli, 4, 1) * 6 + |
|
251 | + substr($meli, 5, 1) * 5 + |
|
252 | + substr($meli, 6, 1) * 4 + |
|
253 | + substr($meli, 7, 1) * 3 + |
|
254 | + substr($meli, 8, 1) * 2; |
|
255 | 255 | |
256 | 256 | $r = $n - (int)($n / 11) * 11; |
257 | 257 | |
258 | 258 | if (($r == 0 && $r == $c) || ($r == 1 && $c == 1) || ($r > 1 && $c == 11 - $r)) { |
259 | 259 | |
260 | - if(! isMeliCode($meli)){ |
|
260 | + if (!isMeliCode($meli)) { |
|
261 | 261 | continue; |
262 | 262 | } |
263 | 263 | |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | $name = 0; |
287 | 287 | $array = []; |
288 | 288 | |
289 | - if(is_array($object)){ |
|
289 | + if (is_array($object)) { |
|
290 | 290 | $array = $object; |
291 | 291 | $name = array_rand($object); |
292 | - } elseif(is_string($object)) { |
|
292 | + } elseif (is_string($object)) { |
|
293 | 293 | $array = $this->objects[$object]; |
294 | 294 | $name = array_rand($array); |
295 | 295 | } |