From b0b6eb6029af2281742ff4375e945a6297f317a9 Mon Sep 17 00:00:00 2001 From: Roman Vasilyev Date: Sat, 1 Dec 2012 20:52:23 +0200 Subject: [PATCH] Added ua_UA provider --- src/Faker/Provider/ua_UA/Address.php | 344 +++++++++++++++++++++++ src/Faker/Provider/ua_UA/Company.php | 54 ++++ src/Faker/Provider/ua_UA/Internet.php | 32 +++ src/Faker/Provider/ua_UA/Person.php | 74 +++++ src/Faker/Provider/ua_UA/PhoneNumber.php | 30 ++ 5 files changed, 534 insertions(+) create mode 100644 src/Faker/Provider/ua_UA/Address.php create mode 100644 src/Faker/Provider/ua_UA/Company.php create mode 100644 src/Faker/Provider/ua_UA/Internet.php create mode 100644 src/Faker/Provider/ua_UA/Person.php create mode 100644 src/Faker/Provider/ua_UA/PhoneNumber.php diff --git a/src/Faker/Provider/ua_UA/Address.php b/src/Faker/Provider/ua_UA/Address.php new file mode 100644 index 00000000..2909aff0 --- /dev/null +++ b/src/Faker/Provider/ua_UA/Address.php @@ -0,0 +1,344 @@ +generator->parse($format, array()); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public static function city() + { + return static::randomElement(static::$city); + } + + /** + * Get city and region together + * We need it because city and region must comply each other in Ukraine + * @example 'Закарпатська область, місто Ужгород' + * @return string + */ + public function cityAndRegion() + { + $regionAndCityNumber = rand(0, count(static::$region) - 1); + $region = static::$region[$regionAndCityNumber]; + $city = static::$city[$regionAndCityNumber]; + $format = "$region {{regionSuffix}}, {{cityPrefix}} $city"; + return $this->generator->parse($format); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/src/Faker/Provider/ua_UA/Company.php b/src/Faker/Provider/ua_UA/Company.php new file mode 100644 index 00000000..0f6f59e5 --- /dev/null +++ b/src/Faker/Provider/ua_UA/Company.php @@ -0,0 +1,54 @@ +generator->parse($format); + } + + public function companyUrl() + { + $format = static::randomElement(static::$urlFormats); + return $this->generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefix); + } + + public static function companySuffix() + { + return static::randomElement(static::$companySuffix); + } + + public static function companyName() + { + return static::randomElement(static::$companyName); + } +} diff --git a/src/Faker/Provider/ua_UA/Internet.php b/src/Faker/Provider/ua_UA/Internet.php new file mode 100644 index 00000000..673de0b4 --- /dev/null +++ b/src/Faker/Provider/ua_UA/Internet.php @@ -0,0 +1,32 @@ +generator->parse($format)) + ) + ); + } + + /** + * @example 'smart-dizayn' + */ + public function domainWord() + { + $company = $this->generator->format('companyUrl'); + $company = str_replace(' ', '-', $company); + $company = Utils::cyrillicToLatin($company); + return $company; + } +} diff --git a/src/Faker/Provider/ua_UA/Person.php b/src/Faker/Provider/ua_UA/Person.php new file mode 100644 index 00000000..5d0b44ae --- /dev/null +++ b/src/Faker/Provider/ua_UA/Person.php @@ -0,0 +1,74 @@ +