From 3cc52d0ad5f29a5183cc88b8a6ae4ec1bed734b3 Mon Sep 17 00:00:00 2001 From: mhamlet Date: Sun, 29 Nov 2015 16:24:24 +0400 Subject: [PATCH 1/3] Added some fixes to Armenian locale --- src/Faker/Provider/hy_AM/Color.php | 12 ++++++ src/Faker/Provider/hy_AM/Internet.php | 1 + src/Faker/Provider/hy_AM/PhoneNumber.php | 52 +++++++++++------------- 3 files changed, 37 insertions(+), 28 deletions(-) create mode 100644 src/Faker/Provider/hy_AM/Color.php diff --git a/src/Faker/Provider/hy_AM/Color.php b/src/Faker/Provider/hy_AM/Color.php new file mode 100644 index 0000000000..16b68d8b2b --- /dev/null +++ b/src/Faker/Provider/hy_AM/Color.php @@ -0,0 +1,12 @@ +generator->parse($number)); + } } From 3a425ea15828c6bcbe3ce8a45302cab09c5fc580 Mon Sep 17 00:00:00 2001 From: mhamlet Date: Mon, 29 Feb 2016 00:54:38 +0400 Subject: [PATCH 2/3] Using formatters to randomize the code and numberFormat choice. --- src/Faker/Provider/hy_AM/PhoneNumber.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Faker/Provider/hy_AM/PhoneNumber.php b/src/Faker/Provider/hy_AM/PhoneNumber.php index cbcd66cf51..d231ec82b2 100644 --- a/src/Faker/Provider/hy_AM/PhoneNumber.php +++ b/src/Faker/Provider/hy_AM/PhoneNumber.php @@ -14,20 +14,25 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber ); protected static $formats = array( - '0{code} {numberFormat}', - '(0{code}) {numberFormat}', - '+374{code} {numberFormat}', - '+374 {code} {numberFormat}', + '0{{code}} {{numberFormat}}', + '(0{{code}}) {{numberFormat}}', + '+374{{code}} {{numberFormat}}', + '+374 {{code}} {{numberFormat}}', ); public function phoneNumber() { - $format = static::randomElement(static::$formats); - $code = static::randomElement(static::$codes); - $numberFormat = static::randomElement(static::$numberFormats); + return static::numerify($this->generator->parse(static::randomElement(static::$formats))); + } - $number = str_replace(array('{code}', '{numberFormat}'), array($code, $numberFormat), $format); + public function code() { + return static::randomElement(static::$codes); + } - return static::numerify($this->generator->parse($number)); + /** + * @return mixed + */ + public function numberFormat() { + return static::randomElement(static::$numberFormats); } } From 4259ace0d78f211d34cdf2f6d94a036bfd8e12b8 Mon Sep 17 00:00:00 2001 From: mhamlet Date: Mon, 29 Feb 2016 01:03:12 +0400 Subject: [PATCH 3/3] Fixing CS - PSR2 --- src/Faker/Provider/hy_AM/PhoneNumber.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Faker/Provider/hy_AM/PhoneNumber.php b/src/Faker/Provider/hy_AM/PhoneNumber.php index d231ec82b2..aae914836d 100644 --- a/src/Faker/Provider/hy_AM/PhoneNumber.php +++ b/src/Faker/Provider/hy_AM/PhoneNumber.php @@ -25,14 +25,16 @@ public function phoneNumber() return static::numerify($this->generator->parse(static::randomElement(static::$formats))); } - public function code() { + public function code() + { return static::randomElement(static::$codes); } /** * @return mixed */ - public function numberFormat() { + public function numberFormat() + { return static::randomElement(static::$numberFormats); } }