| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Faker\Provider\fa_IR;
|
|
|
4 |
|
|
|
5 |
class Address extends \Faker\Provider\Address
|
|
|
6 |
{
|
|
|
7 |
protected static $cityPrefix = ['استان'];
|
|
|
8 |
protected static $streetPrefix = ['خیابان'];
|
|
|
9 |
protected static $buildingNamePrefix = ['ساختمان'];
|
|
|
10 |
protected static $buildingNumberPrefix = ['پلاک', 'قطعه'];
|
|
|
11 |
protected static $postcodePrefix = ['کد پستی'];
|
|
|
12 |
|
|
|
13 |
protected static $cityName = [
|
|
|
14 |
'آذربایجان شرقی', 'آذربایجان غربی', 'اردبیل', 'اصفهان', 'البرز', 'ایلام', 'بوشهر',
|
|
|
15 |
'تهران', 'خراسان جنوبی', 'خراسان رضوی', 'خراسان شمالی', 'خوزستان', 'زنجان', 'سمنان',
|
|
|
16 |
'سیستان و بلوچستان', 'فارس', 'قزوین', 'قم', 'لرستان', 'مازندران', 'مرکزی', 'هرمزگان',
|
|
|
17 |
'همدان', 'چهارمحال و بختیاری', 'کردستان', 'کرمان', 'کرمانشاه', 'کهگیلویه و بویراحمد',
|
|
|
18 |
'گلستان', 'گیلان', 'یزد',
|
|
|
19 |
];
|
|
|
20 |
|
|
|
21 |
protected static $cityFormats = [
|
|
|
22 |
'{{cityName}}',
|
|
|
23 |
'{{cityPrefix}} {{cityName}}',
|
|
|
24 |
];
|
|
|
25 |
protected static $streetNameFormats = [
|
|
|
26 |
'{{streetPrefix}} {{lastName}}',
|
|
|
27 |
];
|
|
|
28 |
protected static $streetAddressFormats = [
|
|
|
29 |
'{{streetName}} {{building}}',
|
|
|
30 |
];
|
|
|
31 |
protected static $addressFormats = [
|
|
|
32 |
'{{city}} {{streetAddress}} {{postcodePrefix}} {{postcode}}',
|
|
|
33 |
'{{city}} {{streetAddress}}',
|
|
|
34 |
];
|
|
|
35 |
protected static $buildingFormat = [
|
|
|
36 |
'{{buildingNamePrefix}} {{firstName}} {{buildingNumberPrefix}} {{buildingNumber}}',
|
|
|
37 |
'{{buildingNamePrefix}} {{firstName}}',
|
|
|
38 |
];
|
|
|
39 |
|
|
|
40 |
protected static $postcode = ['##########'];
|
|
|
41 |
protected static $country = ['ایران'];
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* @example 'استان'
|
|
|
45 |
*/
|
|
|
46 |
public static function cityPrefix()
|
|
|
47 |
{
|
|
|
48 |
return static::randomElement(static::$cityPrefix);
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
/**
|
|
|
52 |
* @example 'زنجان'
|
|
|
53 |
*/
|
|
|
54 |
public static function cityName()
|
|
|
55 |
{
|
|
|
56 |
return static::randomElement(static::$cityName);
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
* @example 'خیابان'
|
|
|
61 |
*/
|
|
|
62 |
public static function streetPrefix()
|
|
|
63 |
{
|
|
|
64 |
return static::randomElement(static::$streetPrefix);
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
/**
|
|
|
68 |
* @example 'ساختمان'
|
|
|
69 |
*/
|
|
|
70 |
public static function buildingNamePrefix()
|
|
|
71 |
{
|
|
|
72 |
return static::randomElement(static::$buildingNamePrefix);
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
/**
|
|
|
76 |
* @example 'پلاک'
|
|
|
77 |
*/
|
|
|
78 |
public static function buildingNumberPrefix()
|
|
|
79 |
{
|
|
|
80 |
return static::randomElement(static::$buildingNumberPrefix);
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
/**
|
|
|
84 |
* @example 'ساختمان آفتاب پلاک 24'
|
|
|
85 |
*/
|
|
|
86 |
public function building()
|
|
|
87 |
{
|
|
|
88 |
$format = static::randomElement(static::$buildingFormat);
|
|
|
89 |
|
|
|
90 |
return $this->generator->parse($format);
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
/**
|
|
|
94 |
* @example 'کد پستی'
|
|
|
95 |
*/
|
|
|
96 |
public static function postcodePrefix()
|
|
|
97 |
{
|
|
|
98 |
return static::randomElement(static::$postcodePrefix);
|
|
|
99 |
}
|
|
|
100 |
}
|