From 28d1dad66ac13415bf58a4c22839086825b18018 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ferid=20M=C3=B6vs=C3=BCmov?= <faridmovsumov@gmail.com>
Date: Mon, 10 Dec 2012 15:17:09 +0200
Subject: [PATCH] Added Internet provider to tr_TR

---
 src/Faker/Provider/tr_TR/Internet.php | 133 ++++++++++++++++++++++++++
 1 file changed, 133 insertions(+)
 create mode 100644 src/Faker/Provider/tr_TR/Internet.php

diff --git a/src/Faker/Provider/tr_TR/Internet.php b/src/Faker/Provider/tr_TR/Internet.php
new file mode 100644
index 00000000..81955c1d
--- /dev/null
+++ b/src/Faker/Provider/tr_TR/Internet.php
@@ -0,0 +1,133 @@
+<?php
+
+namespace Faker\Provider\tr_TR;
+
+class Internet extends \Faker\Provider\Internet
+{
+	protected static $safeEmailTld = array('org', 'com', 'net');
+	protected static $freeEmailDomain = array('gmail.com', 'yahoo.com', 'hotmail.com');
+	protected static $tld = array('com', 'com', 'com', 'com', 'com', 'com.tr', 'biz', 'info', 'net', 'org','az');
+
+	protected static $userNameFormats = array(
+		'{{lastName}}.{{firstName}}',
+		'{{firstName}}.{{lastName}}',
+		'{{firstName}}##',
+		'?{{lastName}}',
+	);
+	protected static $emailFormats = array(
+		'{{userName}}@{{domainName}}',
+		'{{userName}}@{{freeEmailDomain}}',
+	);
+	protected static $urlFormats = array(
+		'http://www.{{domainName}}/',
+		'http://{{domainName}}/',
+	);
+
+	/**
+	 * @example 'jdoe@acme.biz'
+	 */
+	public function email()
+	{
+		$format = static::randomElement(static::$emailFormats);
+		return preg_replace('/\s/', '', $this->generator->parse($format));
+	}
+
+	/**
+	 * @example 'jdoe@example.com'
+	 */
+	public function safeEmail()
+	{
+		return $this->userName() . '@example.' . static::randomElement(static::$safeEmailTld);
+	}
+
+	/**
+	 * @example 'jdoe@gmail.com'
+	 */
+	public function freeEmail()
+	{
+		return $this->userName() . '@' . static::freeEmailDomain();
+	}
+
+	/**
+	 * @example 'jdoe@dawson.com'
+	 */
+	public function companyEmail()
+	{
+		return $this->userName() . '@' . $this->domainName();
+	}
+
+	/**
+	 * @example 'gmail.com'
+	 */
+	public static function freeEmailDomain()
+	{
+		return static::randomElement(static::$freeEmailDomain);
+	}
+
+	/**
+	 * @example 'jdoe'
+	 */
+	public function userName()
+	{
+		$format = static::randomElement(static::$userNameFormats);
+		return static::toLower(static::bothify($this->generator->parse($format)));
+	}
+
+	/**
+	 * @example 'tiramisu.com'
+	 */
+	public function domainName()
+	{
+		return $this->domainWord() . '.' . $this->tld();
+	}
+
+	/**
+	 * @example 'faber'
+	 */
+	public function domainWord()
+	{
+		$company = $this->generator->format('company');
+		$companyElements = explode(' ', $company);
+		$company = $companyElements[0];
+		$company = preg_replace('/\W/', '', $company);
+
+		return static::toLower($company);
+	}
+
+	/**
+	 * @example 'com'
+	 */
+	public function tld()
+	{
+		return static::randomElement(static::$tld);
+	}
+
+	/**
+	 * @example 'http://www.runolfsdottir.com/'
+	 */
+	public function url()
+	{
+		$format = static::randomElement(static::$urlFormats);
+		return $this->generator->parse($format);
+	}
+
+	/**
+	 * @example '237.149.115.38'
+	 */
+	public function ipv4()
+	{
+		return long2ip(mt_rand(-2147483648, 2147483647));
+	}
+
+	/**
+	 * @example '35cd:186d:3e23:2986:ef9f:5b41:42a4:e6f1'
+	 */
+	public function ipv6()
+	{
+		$res = array();
+		for ($i=0; $i < 8; $i++) {
+			$res []= dechex(mt_rand(0, "65535"));
+		}
+		return join(':', $res);
+	}
+}