This repository has been archived by the owner on Dec 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #371 from kix/add-ru-companies
Added Company generator for ru_RU locale
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Faker\Provider\ru_RU; | ||
|
||
class Company extends \Faker\Provider\Company | ||
{ | ||
protected static $companyNameFormats = array( | ||
'{{companyPrefix}} {{companyNameElement}}', | ||
'{{companyPrefix}} {{companyNameElement}}{{companyNameElement}}', | ||
'{{companyPrefix}} {{companyNameElement}}{{companyNameElement}}{{companyNameElement}}', | ||
'{{companyPrefix}} {{companyNameElement}}{{companyNameElement}}{{companyNameElement}}{{companyNameSuffix}}', | ||
); | ||
|
||
protected static $companyPrefixes = array( | ||
'ООО', 'ЗАО', 'ООО Компания', 'ОАО', 'ОАО' | ||
); | ||
|
||
protected static $companyNameSuffixes = array( | ||
'Маш', 'Наладка', 'Экспедиция', 'Пром', 'Комплекс', 'Машина', 'Снос', '-М', 'Лизинг', 'Траст' | ||
); | ||
|
||
protected static $companyElements = array( | ||
'ЖелДор', 'Гараж', 'Цемент', 'Асбоцемент', 'Строй', 'Лифт', 'Креп', 'Авто', 'Теле', 'Транс', 'Алмаз', 'Метиз', | ||
'Мотор', 'Рос', 'Тяж', 'Тех', 'Сантех', 'Урал', 'Башкир', 'Тверь', 'Казань', 'Обл', 'Бух', 'Хоз', 'Электро', | ||
'Текстиль' | ||
); | ||
|
||
/** | ||
* @example 'ООО АсбестЦементМонтаж' | ||
*/ | ||
public function company() | ||
{ | ||
$format = static::randomElement(static::$companyNameFormats); | ||
|
||
return $this->generator->parse($format); | ||
} | ||
|
||
public static function companyPrefix() | ||
{ | ||
return static::randomElement(static::$companyPrefixes); | ||
} | ||
|
||
public static function companyNameElement() | ||
{ | ||
return static::randomElement(static::$companyElements); | ||
} | ||
|
||
public static function companyNameSuffix() | ||
{ | ||
return static::randomElement(static::$companyNameSuffixes); | ||
} | ||
} |