From 5c726986ae1ecb926ae9d77e28848bb38d020041 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 4 Dec 2017 08:43:44 -0600 Subject: [PATCH] formatting --- .../Foundation/Testing/WithFaker.php | 35 +++++-------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/src/Illuminate/Foundation/Testing/WithFaker.php b/src/Illuminate/Foundation/Testing/WithFaker.php index 894a3fc067e3..27ec9229ee7d 100644 --- a/src/Illuminate/Foundation/Testing/WithFaker.php +++ b/src/Illuminate/Foundation/Testing/WithFaker.php @@ -8,14 +8,14 @@ trait WithFaker { /** - * Faker generator instance. + * The Faker instance. * * @var \Faker\Generator */ protected $faker; /** - * Setup up faker generator instance. + * Setup up the Faker instance. * * @return void */ @@ -25,43 +25,24 @@ protected function setUpFaker() } /** - * Get a default faker generator instance or get a new one for given locale. + * Get the default Faker instance for a given locale. * * @param string $locale * @return \Faker\Generator */ - protected function faker(string $locale = null) + protected function faker($locale = null) { - if (is_null($locale)) { - return $this->faker; - } - - return $this->makeFaker($locale); - } - - /** - * Set a new faker generator instance for given locale. - * - * @param string $locale - * @return void - */ - protected function fakerSetLocale(string $locale) - { - $this->faker = $this->makeFaker($locale); + return is_null($locale) ? $this->faker : $this->makeFaker($locale); } /** - * Make a faker generator instance for given or default locale. + * Create a Faker instance for the given locale. * * @param string $locale * @return \Faker\Generator */ - protected function makeFaker(string $locale = null) + protected function makeFaker($locale = null) { - if (is_null($locale)) { - $locale = Factory::DEFAULT_LOCALE; - } - - return Factory::create($locale); + return Factory::create($locale ?? Factory::DEFAULT_LOCALE); } }