Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #371 from kix/add-ru-companies
Browse files Browse the repository at this point in the history
Added Company generator for ru_RU locale
  • Loading branch information
fzaninotto committed Oct 29, 2014
2 parents 1e06929 + 93992e5 commit 0cc304a
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/Faker/Provider/ru_RU/Company.php
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);
}
}

0 comments on commit 0cc304a

Please sign in to comment.