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

Persian providers #500

Merged
merged 7 commits into from
Feb 19, 2015
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions src/Faker/Provider/fa_IR/Internet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace Faker\Provider\fa_IR;

class Internet extends \Faker\Provider\Internet
{
protected static $userNameFormats = array(
'{{lastNameAscii}}.{{firstNameAscii}}',
'{{firstNameAscii}}.{{lastNameAscii}}',
'{{firstNameAscii}}##',
'?{{lastNameAscii}}',
);

protected static $safeEmailTld = array(
'com', 'ir', 'me', 'net', 'org',
);

protected static $tld = array(
'biz', 'com', 'info', 'ir', 'net', 'org',
);

protected static $lastNameAscii = array(
'ahmadi', 'rezaei', 'mohammady', 'salari', 'zare', 'chamran', 'hosseini', 'hasan', 'shahriari', 'karimi', 'majidi', 'moosavi', 'soleimani', 'ebrahimi', 'abbasi', 'majedi', 'nili', 'yazdi', 'jalili', 'babaei', 'ghasemi',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need more random data than that...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like how much?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few dozen names at least. Look at the other providers for an example.

One question: can't translitteration from arabic work?

);
protected static $firstNameAscii = array(
'ali', 'reza', 'ahmad', 'hoda', 'mohsen', 'kamran', 'hanie', 'majid', 'hossein', 'maryam', 'arman', 'mohammad', 'amir', 'mahdi', 'bahar', 'zahra', 'marjan', 'behnaz', 'fateme', 'zeynab',
);

public static function lastNameAscii()
{
return static::randomElement(static::$lastNameAscii);
}

public static function firstNameAscii()
{
return static::randomElement(static::$firstNameAscii);
}

/**
* @example 'ali.rezaei'
*/
public function userName()
{
$format = static::randomElement(static::$userNameFormats);

return static::bothify($this->generator->parse($format));
}

/**
* @example 'ahmad.ir'
*/
public function domainName()
{
return static::randomElement(static::$lastNameAscii) . '.' . $this->tld();
}
}
Loading