├── README.md
├── composer.json
├── modman
├── src
├── app
│ ├── code
│ │ └── community
│ │ │ └── Magehack
│ │ │ └── Bigdata
│ │ │ ├── Helper
│ │ │ └── Data.php
│ │ │ ├── Model
│ │ │ └── Categories.php
│ │ │ └── etc
│ │ │ └── config.xml
│ └── etc
│ │ └── modules
│ │ └── Magehack_Bigdata.xml
├── shell
│ ├── categoryGenerator.php
│ ├── productsGenerator.php
│ └── websiteGenerator.php
└── var
│ └── import
│ └── bigdata
│ └── category-base.xml
└── vendor
├── autoload.php
├── composer
├── ClassLoader.php
├── autoload_classmap.php
├── autoload_namespaces.php
├── autoload_psr4.php
├── autoload_real.php
└── installed.json
└── fzaninotto
└── faker
├── .gitignore
├── .travis.yml
├── CHANGELOG
├── LICENSE
├── composer.json
├── phpunit.xml.dist
├── readme.md
├── src
├── Faker
│ ├── Documentor.php
│ ├── Factory.php
│ ├── Generator.php
│ ├── Guesser
│ │ └── Name.php
│ ├── NullGenerator.php
│ ├── ORM
│ │ ├── Doctrine
│ │ │ ├── ColumnTypeGuesser.php
│ │ │ ├── EntityPopulator.php
│ │ │ └── Populator.php
│ │ ├── Mandango
│ │ │ ├── ColumnTypeGuesser.php
│ │ │ ├── EntityPopulator.php
│ │ │ └── Populator.php
│ │ └── Propel
│ │ │ ├── ColumnTypeGuesser.php
│ │ │ ├── EntityPopulator.php
│ │ │ └── Populator.php
│ ├── Provider
│ │ ├── Address.php
│ │ ├── Base.php
│ │ ├── Color.php
│ │ ├── Company.php
│ │ ├── DateTime.php
│ │ ├── File.php
│ │ ├── Image.php
│ │ ├── Internet.php
│ │ ├── Lorem.php
│ │ ├── Miscellaneous.php
│ │ ├── Payment.php
│ │ ├── Person.php
│ │ ├── PhoneNumber.php
│ │ ├── UserAgent.php
│ │ ├── Uuid.php
│ │ ├── bg_BG
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── cs_CZ
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── da_DK
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── de_AT
│ │ │ ├── Address.php
│ │ │ ├── Payment.php
│ │ │ └── Person.php
│ │ ├── de_DE
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── el_GR
│ │ │ ├── Address.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── en_AU
│ │ │ ├── Address.php
│ │ │ ├── Internet.php
│ │ │ └── PhoneNumber.php
│ │ ├── en_CA
│ │ │ ├── Address.php
│ │ │ └── PhoneNumber.php
│ │ ├── en_GB
│ │ │ ├── Address.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ └── PhoneNumber.php
│ │ ├── en_PH
│ │ │ └── Address.php
│ │ ├── en_US
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── en_ZA
│ │ │ ├── Address.php
│ │ │ ├── Internet.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── es_AR
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── es_ES
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── es_PE
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── fi_FI
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── fr_BE
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── fr_FR
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── hy_AM
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── is_IS
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── it_IT
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── ja_JP
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── lv_LV
│ │ │ ├── Address.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── nl_BE
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── nl_NL
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── pl_PL
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── pt_BR
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── ro_MD
│ │ │ ├── Address.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── ro_RO
│ │ │ ├── Address.php
│ │ │ └── Person.php
│ │ ├── ru_RU
│ │ │ ├── Address.php
│ │ │ ├── Color.php
│ │ │ ├── Internet.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── sk_SK
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── sr_Cyrl_RS
│ │ │ ├── Address.php
│ │ │ ├── Payment.php
│ │ │ └── Person.php
│ │ ├── sr_Latn_RS
│ │ │ ├── Address.php
│ │ │ ├── Payment.php
│ │ │ └── Person.php
│ │ ├── sr_RS
│ │ │ ├── Address.php
│ │ │ ├── Payment.php
│ │ │ └── Person.php
│ │ ├── tr_TR
│ │ │ ├── Address.php
│ │ │ ├── Internet.php
│ │ │ ├── Payment.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ ├── uk_UA
│ │ │ ├── Address.php
│ │ │ ├── Color.php
│ │ │ ├── Company.php
│ │ │ ├── Internet.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ │ └── zh_CN
│ │ │ ├── Address.php
│ │ │ ├── Company.php
│ │ │ ├── Person.php
│ │ │ └── PhoneNumber.php
│ └── UniqueGenerator.php
└── autoload.php
└── test
├── Faker
├── GeneratorTest.php
├── PHPUnit
│ └── Framework
│ │ └── Constraint
│ │ ├── IsValidSiren.php
│ │ ├── IsValidSirenSiret.php
│ │ └── IsValidSiret.php
└── Provider
│ ├── BaseTest.php
│ ├── ColorTest.php
│ ├── ImageTest.php
│ ├── LocalizationTest.php
│ ├── LoremTest.php
│ ├── PaymentTest.php
│ ├── PersonTest.php
│ ├── ProviderOverrideTest.php
│ ├── UserAgentTest.php
│ ├── UuidTest.php
│ └── fr_FR
│ └── CompanyTest.php
├── documentor.php
└── test.php
/composer.json:
--------------------------------------------------------------------------------
1 | {"require":{"fzaninotto/faker":"*"}}
2 |
--------------------------------------------------------------------------------
/modman:
--------------------------------------------------------------------------------
1 | src/shell/* shell/
2 | src/var/import/bigdata/ var/import/bigdata/
3 | src/app/etc/modules/* app/etc/modules/
4 | src/app/code/community/Magehack/* app/code/community/Magehack/
5 | vendor/ vendor/
6 |
--------------------------------------------------------------------------------
/src/app/code/community/Magehack/Bigdata/Helper/Data.php:
--------------------------------------------------------------------------------
1 | dryrun = false;
18 | $this->error = array();
19 | }
20 |
21 | public function setDryRun(){
22 | $this->dryrun = true;
23 | }
24 |
25 | public function setRootCategories($rootCategories){
26 | if(!is_int($rootCategories)) $rootCategories = 1;
27 | $this->rootCategories = $rootCategories;
28 | }
29 |
30 | public function setCategoryRecursion($categoryRecursion){
31 | if(!is_int($categoryRecursion)) $categoryRecursion = 1;
32 | $this->categoryRecursion = $categoryRecursion;
33 | }
34 |
35 | public function setTemplate($template){
36 | $baseFile = Mage::getBaseDir('var')."/import/bigdata/category-base.xml";
37 | $file = Mage::getBaseDir('var')."/import/bigdata/".$template;
38 | if(file_exists($file)){
39 | $this->generatorTemplate = json_decode(json_encode(simplexml_load_file($file)), TRUE);
40 | $this->generateTemplateType = $this->generatorTemplate['root']['@attributes']['type'];
41 | }else{
42 | $this->error[] = "Cannot Load XML Template";
43 | }
44 | }
45 |
46 | public function generate(){
47 | //Time to make some categories
48 |
49 | // Two Root Types: flat or dynamic
50 | if($this->generateTemplateType == "flat"){
51 | echo "Generating from Flat Template \n";
52 | $this->_flatGenerate();
53 | }elseif($this->generateTemplateType == "dynamic"){
54 | echo "Generating from Dynamic Template \n";
55 | echo "-- not implemented\n";
56 | //$this->_dynamicGenerate();
57 | }
58 |
59 | }
60 |
61 | private function _flatGenerate(){
62 | $baseCategory = $this->generatorTemplate['root'];
63 | $c = 0;
64 | //Loop Through categories, adding w/ children
65 | while($c < $this->rootCategories){
66 | $this->lastParent = 0; // Used in _createCategory
67 | $this->categoryPath = '1'; // Used in _createCategory
68 | $this->_createCategory($baseCategory);
69 | $c++;
70 | }
71 |
72 | }
73 |
74 | private function _createCategory($category){
75 | $_category = Mage::getModel('catalog/category');
76 | $_category->setStoreId(Mage::app()->getStore()->getId());
77 |
78 | //Name
79 | if(!isset($category['@attributes']['name']) || substr($category['@attributes']['name'],0,5) == "fake:"){
80 | $_category->setName("random");
81 | }else{
82 | $_category->setName($category['@attributes']['name']);
83 | }
84 |
85 | //is_active
86 | if(!isset($category['@attributes']['is_active']) ||substr($category['@attributes']['is_active'],0,5) == "fake:"){
87 | $_category->setIsActive(1);
88 | }else{
89 | $_category->setIsActive(1);
90 | }
91 |
92 | //is_anchor
93 | if(!isset($category['@attributes']['is_anchor']) ||substr($category['@attributes']['is_anchor'],0,5) == "fake:"){
94 | $_category->setIsAnchor(1);
95 | }else{
96 | $_category->setIsAnchor(0);
97 | }
98 |
99 | //Description
100 | if(!isset($category['@attributes']['description']) ||substr($category['@attributes']['description'],0,5) == "fake:"){
101 | $_category->setDescription("random");
102 | }else{
103 | $_category->setDescription($category['@attributes']['description']);
104 | }
105 |
106 | // URL Key - set to name for now
107 | $_category->setUrlKey($cat['name']); //url to access this category
108 |
109 | //$category->setPath($parentCategory->getPath())
110 | $_category->setPath('1');
111 |
112 |
113 | $_category->save();
114 |
115 |
116 | }
117 |
118 |
119 | }
--------------------------------------------------------------------------------
/src/app/code/community/Magehack/Bigdata/etc/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 0.0.1
6 |
7 |
8 |
9 |
10 |
11 | Magehack_Bigdata_Helper
12 |
13 |
14 |
15 |
16 | Magehack_Bigdata_Model
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/app/etc/modules/Magehack_Bigdata.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | true
6 | community
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/shell/categoryGenerator.php:
--------------------------------------------------------------------------------
1 | dryrun = false;
16 | $this->template = "category-base.xml";
17 | $this->rootCategories = 1;
18 | $this->categoryRecursion = 1;
19 | }
20 |
21 | /**
22 | * Run script
23 | *
24 | */
25 | public function run()
26 | {
27 | //Composer Autoload
28 | require_once(Mage::getBaseDir('base') . '/vendor/autoload.php' );
29 |
30 | //Set Defaults
31 | $this->setDefaults();
32 |
33 | $executedRun = false; //Check against, instead of using if/else on args
34 |
35 | $args = $this->_parseArgs(); // args can be non-linear
36 |
37 | $_categoryGenerator = Mage::getSingleton('generator/categories');
38 |
39 | if ($this->dryrun) {
40 | echo "Dry run initiated.\n";
41 | $_categoryGenerator->setDryRun();
42 | }
43 |
44 | // Settings
45 | $_categoryGenerator->setRootCategories($this->rootCategories);
46 | $_categoryGenerator->setCategoryRecursion($this->categoryRecursion);
47 | $_categoryGenerator->setTemplate($this->template);
48 |
49 | if(count($_categoryGenerator->error) > 0){
50 | //print_r($_categoryGenerator);
51 | echo "Errors have occured in pre-processing the generator settings:\n";
52 | print_r($_categoryGenerator->error);
53 | $executedRun = true;
54 | }else{
55 | //Run generator
56 | $executedRun = $_categoryGenerator->generate();
57 | $executedRun = true;
58 | }
59 |
60 |
61 |
62 | // Fallback to some helpful help message
63 | if(!$executedRun)
64 | {
65 | echo $this->usageHelp();
66 | print_r($args);
67 | }
68 | }
69 |
70 | /**
71 | * Parse through the args, build an array and parse in any details.
72 | *
73 | * @return array
74 | */
75 | protected function _parseArgs() {
76 | $args = array_slice(
77 | array_filter( $_SERVER['argv'],
78 | create_function( '$e',
79 | 'return $e != \'--\';' ) ),
80 | 1 );
81 |
82 | // Bring settings in - There has to be a cleaner way of doing this!
83 | foreach($args as $_arg){
84 | //strip the leading --
85 | if(substr($_arg,0,2) == "--") $_arg = substr($_arg,2);
86 |
87 | // $_arg[0] is the "command"
88 | // $_arg[1] is the "value"
89 | $_arg = explode("=",$_arg);
90 |
91 | if($_arg[0] == "-n"){
92 | $this->dryrun = true;
93 | }
94 |
95 | //bring in settings against existing class properties if they exist
96 | if(key_exists($_arg[0],$this)){
97 | $this->$_arg[0] = $_arg[1];
98 | }
99 |
100 | }
101 |
102 |
103 | return $args;
104 | }
105 |
106 | /**
107 | * Retrieve Usage Help Message
108 | *
109 | */
110 | public function usageHelp()
111 | {
112 | return <<run();
124 |
125 |
--------------------------------------------------------------------------------
/src/shell/productsGenerator.php:
--------------------------------------------------------------------------------
1 | _parseArgs();
15 | if ($args[0] == "stub") {
16 | print_r($args);
17 | } else {
18 | echo $this->usageHelp();
19 |
20 | }
21 | }
22 |
23 | /**
24 | * Get the real cleaned argv
25 | *
26 | * @return array
27 | */
28 | protected function _parseArgs() {
29 | $args = array_slice(
30 | array_filter( $_SERVER['argv'],
31 | create_function( '$e',
32 | 'return $e != \'--\';' ) ),
33 | 1 );
34 | return $args;
35 | }
36 |
37 | /**
38 | * Retrieve Usage Help Message
39 | *
40 | */
41 | public function usageHelp()
42 | {
43 | return <<run();
55 |
56 |
--------------------------------------------------------------------------------
/src/shell/websiteGenerator.php:
--------------------------------------------------------------------------------
1 | _parseArgs();
15 | if ($args[0] == "stub") {
16 | print_r($args);
17 | } else {
18 | echo $this->usageHelp();
19 |
20 | }
21 | }
22 |
23 | /**
24 | * Get the real cleaned argv
25 | *
26 | * @return array
27 | */
28 | protected function _parseArgs() {
29 | $args = array_slice(
30 | array_filter( $_SERVER['argv'],
31 | create_function( '$e',
32 | 'return $e != \'--\';' ) ),
33 | 1 );
34 | return $args;
35 | }
36 |
37 |
38 | /**
39 | * Retrieve Usage Help Message
40 | *
41 | */
42 | public function usageHelp()
43 | {
44 | return <<run();
55 |
56 |
--------------------------------------------------------------------------------
/src/var/import/bigdata/category-base.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/vendor/autoload.php:
--------------------------------------------------------------------------------
1 | array($vendorDir . '/fzaninotto/faker/test'),
10 | 'Faker' => array($vendorDir . '/fzaninotto/faker/src'),
11 | );
12 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_psr4.php:
--------------------------------------------------------------------------------
1 | $path) {
31 | $loader->set($namespace, $path);
32 | }
33 |
34 | $map = require __DIR__ . '/autoload_psr4.php';
35 | foreach ($map as $namespace => $path) {
36 | $loader->setPsr4($namespace, $path);
37 | }
38 |
39 | $classMap = require __DIR__ . '/autoload_classmap.php';
40 | if ($classMap) {
41 | $loader->addClassMap($classMap);
42 | }
43 |
44 | $loader->register(true);
45 |
46 | return $loader;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/vendor/composer/installed.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "fzaninotto/faker",
4 | "version": "v1.3.0",
5 | "version_normalized": "1.3.0.0",
6 | "source": {
7 | "type": "git",
8 | "url": "https://github.com/fzaninotto/Faker.git",
9 | "reference": "1d143fd8caf4d264602450bc01d7484af788706b"
10 | },
11 | "dist": {
12 | "type": "zip",
13 | "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/1d143fd8caf4d264602450bc01d7484af788706b",
14 | "reference": "1d143fd8caf4d264602450bc01d7484af788706b",
15 | "shasum": ""
16 | },
17 | "require": {
18 | "php": ">=5.3.3"
19 | },
20 | "time": "2013-12-16 21:56:48",
21 | "type": "library",
22 | "extra": {
23 | "branch-alias": {
24 | "dev-master": "1.3.0-dev"
25 | }
26 | },
27 | "installation-source": "dist",
28 | "autoload": {
29 | "psr-0": {
30 | "Faker": "src/",
31 | "Faker\\PHPUnit": "test/"
32 | }
33 | },
34 | "notification-url": "https://packagist.org/downloads/",
35 | "license": [
36 | "MIT"
37 | ],
38 | "authors": [
39 | {
40 | "name": "François Zaninotto"
41 | }
42 | ],
43 | "description": "Faker is a PHP library that generates fake data for you.",
44 | "keywords": [
45 | "data",
46 | "faker",
47 | "fixtures"
48 | ]
49 | }
50 | ]
51 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/.gitignore:
--------------------------------------------------------------------------------
1 | vendor
2 | composer.lock
3 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | before_script:
3 | - composer install --dev
4 | php:
5 | - 5.3
6 | - 5.4
7 | script: phpunit
8 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 François Zaninotto
2 | Portions Copyright (c) 2008 Caius Durling
3 | Portions Copyright (c) 2008 Adam Royle
4 | Portions Copyright (c) 2008 Fiona Burrows
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fzaninotto/faker",
3 | "type": "library",
4 | "description": "Faker is a PHP library that generates fake data for you.",
5 | "keywords": ["faker", "fixtures", "data"],
6 | "license": "MIT",
7 | "authors": [
8 | {
9 | "name": "François Zaninotto"
10 | }
11 | ],
12 | "require": {
13 | "php": ">=5.3.3"
14 | },
15 | "autoload": {
16 | "psr-0": {
17 | "Faker": "src/",
18 | "Faker\\PHPUnit": "test/"
19 | }
20 | },
21 | "extra": {
22 | "branch-alias": {
23 | "dev-master": "1.3.0-dev"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | ./test/Faker/
7 |
8 |
9 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Documentor.php:
--------------------------------------------------------------------------------
1 | generator = $generator;
12 | }
13 |
14 | public function getFormatters()
15 | {
16 | $formatters = array();
17 | $providers = array_reverse($this->generator->getProviders());
18 | $providers[]= new \Faker\Provider\Base($this->generator);
19 | foreach ($providers as $provider) {
20 | $providerClass = get_class($provider);
21 | $formatters[$providerClass] = array();
22 | $refl = new \ReflectionObject($provider);
23 | foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflmethod) {
24 | if ($reflmethod->getDeclaringClass()->getName() == 'Faker\Provider\Base' && $providerClass != 'Faker\Provider\Base') {
25 | continue;
26 | }
27 | $methodName = $reflmethod->name;
28 | if ($reflmethod->isConstructor()) {
29 | continue;
30 | }
31 | $parameters = array();
32 | foreach ($reflmethod->getParameters() as $reflparameter) {
33 | $parameter = '$'. $reflparameter->getName();
34 | if ($reflparameter->isDefaultValueAvailable()) {
35 | $parameter .= ' = ' . var_export($reflparameter->getDefaultValue(), true);
36 | }
37 | $parameters []= $parameter;
38 | }
39 | $parameters = $parameters ? '('. join(', ', $parameters) . ')' : '';
40 | $example = $this->generator->format($methodName);
41 | if (is_array($example)) {
42 | $example = "array('". join("', '", $example) . "')";
43 | } elseif ($example instanceof \DateTime) {
44 | $example = "DateTime('" . $example->format('Y-m-d H:i:s') . "')";
45 | } else {
46 | $example = var_export($example, true);
47 | }
48 | $formatters[$providerClass][$methodName . $parameters] = $example;
49 | }
50 | }
51 |
52 | return $formatters;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Factory.php:
--------------------------------------------------------------------------------
1 | addProvider(new $providerClassName($generator));
17 | }
18 |
19 | return $generator;
20 | }
21 |
22 | protected static function getProviderClassname($provider, $locale = '')
23 | {
24 | if ($providerClass = self::findProviderClassname($provider, $locale)) {
25 | return $providerClass;
26 | }
27 | // fallback to default locale
28 | if ($providerClass = self::findProviderClassname($provider, static::DEFAULT_LOCALE)) {
29 | return $providerClass;
30 | }
31 | // fallback to no locale
32 | $providerClass = self::findProviderClassname($provider);
33 | if (class_exists($providerClass)) {
34 | return $providerClass;
35 | }
36 | throw new \InvalidArgumentException(sprintf('Unable to find provider "%s" with locale "%s"', $provider, $locale));
37 | }
38 |
39 | protected static function findProviderClassname($provider, $locale = '')
40 | {
41 | $providerClass = 'Faker\\' . ($locale ? sprintf('Provider\%s\%s', $locale, $provider) : sprintf('Provider\%s', $provider));
42 | if (class_exists($providerClass, true)) {
43 | return $providerClass;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Guesser/Name.php:
--------------------------------------------------------------------------------
1 | generator = $generator;
14 | }
15 |
16 | public function guessFormat($name)
17 | {
18 | $name = Base::toLower($name);
19 | $generator = $this->generator;
20 | if (preg_match('/^is[_A-Z]/', $name)) {
21 | return function() use ($generator) { return $generator->boolean; };
22 | }
23 | if (preg_match('/(_a|A)t$/', $name)) {
24 | return function() use ($generator) { return $generator->dateTime; };
25 | }
26 | switch ($name) {
27 | case 'first_name':
28 | case 'firstname':
29 | return function() use ($generator) { return $generator->firstName; };
30 | case 'last_name':
31 | case 'lastname':
32 | return function() use ($generator) { return $generator->lastName; };
33 | case 'username':
34 | case 'login':
35 | return function() use ($generator) { return $generator->userName; };
36 | case 'email':
37 | return function() use ($generator) { return $generator->email; };
38 | case 'phone_number':
39 | case 'phonenumber':
40 | case 'phone':
41 | return function() use ($generator) { return $generator->phoneNumber; };
42 | case 'address':
43 | return function() use ($generator) { return $generator->address; };
44 | case 'city':
45 | return function() use ($generator) { return $generator->city; };
46 | case 'streetaddress':
47 | return function() use ($generator) { return $generator->streetAddress; };
48 | case 'postcode':
49 | case 'zipcode':
50 | return function() use ($generator) { return $generator->postcode; };
51 | case 'state':
52 | return function() use ($generator) { return $generator->state; };
53 | case 'country':
54 | return function() use ($generator) { return $generator->country; };
55 | case 'title':
56 | return function() use ($generator) { return $generator->sentence; };
57 | case 'body':
58 | case 'summary':
59 | return function() use ($generator) { return $generator->text; };
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/NullGenerator.php:
--------------------------------------------------------------------------------
1 | optional()
8 | */
9 | class NullGenerator
10 | {
11 |
12 | public function __get($attribute)
13 | {
14 | return null;
15 | }
16 |
17 | public function __call($method, $attributes)
18 | {
19 | return null;
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php:
--------------------------------------------------------------------------------
1 | generator = $generator;
14 | }
15 |
16 | public function guessFormat($fieldName, ClassMetadata $class)
17 | {
18 | $generator = $this->generator;
19 | $type = $class->getTypeOfField($fieldName);
20 | switch ($type) {
21 | case 'boolean':
22 | return function() use ($generator) { return $generator->boolean; };
23 | case 'decimal':
24 | $size = isset($class->fieldMappings[$fieldName]['precision']) ? $class->fieldMappings[$fieldName]['precision'] : 2;
25 |
26 | return function() use ($generator, $size) { return $generator->randomNumber($size + 2) / 100; };
27 | case 'smallint':
28 | return function() { return mt_rand(0,65535); };
29 | case 'integer':
30 | return function() { return mt_rand(0,intval('2147483647')); };
31 | case 'bigint':
32 | return function() { return mt_rand(0,intval('18446744073709551615')); };
33 | case 'float':
34 | return function() { return mt_rand(0,intval('4294967295'))/mt_rand(1,intval('4294967295')); };
35 | case 'string':
36 | $size = isset($class->fieldMappings[$fieldName]['length']) ? $class->fieldMappings[$fieldName]['length'] : 255;
37 |
38 | return function() use ($generator, $size) { return $generator->text($size); };
39 | case 'text':
40 | return function() use ($generator) { return $generator->text; };
41 | case 'datetime':
42 | case 'date':
43 | case 'time':
44 | return function() use ($generator) { return $generator->datetime; };
45 | default:
46 | // no smart way to guess what the user expects here
47 | return null;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/Populator.php:
--------------------------------------------------------------------------------
1 | generator = $generator;
22 | $this->manager = $manager;
23 | }
24 |
25 | /**
26 | * Add an order for the generation of $number records for $entity.
27 | *
28 | * @param mixed $entity A Doctrine classname, or a \Faker\ORM\Doctrine\EntityPopulator instance
29 | * @param int $number The number of entities to populate
30 | */
31 | public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array(), $generateId = false)
32 | {
33 | if (!$entity instanceof \Faker\ORM\Doctrine\EntityPopulator) {
34 | if (null === $this->manager) {
35 | throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator.");
36 | }
37 | $entity = new \Faker\ORM\Doctrine\EntityPopulator($this->manager->getClassMetadata($entity));
38 | }
39 | $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator));
40 | if ($customColumnFormatters) {
41 | $entity->mergeColumnFormattersWith($customColumnFormatters);
42 | }
43 | $entity->mergeModifiersWith($customModifiers);
44 | $this->generateId[$entity->getClass()] = $generateId;
45 |
46 | $class = $entity->getClass();
47 | $this->entities[$class] = $entity;
48 | $this->quantities[$class] = $number;
49 | }
50 |
51 | /**
52 | * Populate the database using all the Entity classes previously added.
53 | *
54 | * @param EntityManager $entityManager A Propel connection object
55 | *
56 | * @return array A list of the inserted PKs
57 | */
58 | public function execute($entityManager = null)
59 | {
60 | if (null === $entityManager) {
61 | $entityManager = $this->manager;
62 | }
63 | if (null === $entityManager) {
64 | throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator.");
65 | }
66 |
67 | $insertedEntities = array();
68 | foreach ($this->quantities as $class => $number) {
69 | $generateId = $this->generateId[$class];
70 | for ($i=0; $i < $number; $i++) {
71 | $insertedEntities[$class][]= $this->entities[$class]->execute($entityManager, $insertedEntities, $generateId);
72 | }
73 | $entityManager->flush();
74 | }
75 |
76 | return $insertedEntities;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/ColumnTypeGuesser.php:
--------------------------------------------------------------------------------
1 | generator = $generator;
12 | }
13 |
14 | public function guessFormat($field)
15 | {
16 | $generator = $this->generator;
17 | switch ($field['type']) {
18 | case 'boolean':
19 | return function() use ($generator) { return $generator->boolean; };
20 | case 'integer':
21 | return function() { return mt_rand(0,intval('4294967295')); };
22 | case 'float':
23 | return function() { return mt_rand(0,intval('4294967295'))/mt_rand(1,intval('4294967295')); };
24 | case 'string':
25 | return function() use ($generator) { return $generator->text(255); };
26 | case 'date':
27 | return function() use ($generator) { return $generator->datetime; };
28 | default:
29 | // no smart way to guess what the user expects here
30 | return null;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/EntityPopulator.php:
--------------------------------------------------------------------------------
1 | class = $class;
23 | }
24 |
25 | public function getClass()
26 | {
27 | return $this->class;
28 | }
29 |
30 | public function setColumnFormatters($columnFormatters)
31 | {
32 | $this->columnFormatters = $columnFormatters;
33 | }
34 |
35 | public function getColumnFormatters()
36 | {
37 | return $this->columnFormatters;
38 | }
39 |
40 | public function mergeColumnFormattersWith($columnFormatters)
41 | {
42 | $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters);
43 | }
44 |
45 | public function guessColumnFormatters(\Faker\Generator $generator, Mandango $mandango)
46 | {
47 | $formatters = array();
48 | $nameGuesser = new \Faker\Guesser\Name($generator);
49 | $columnTypeGuesser = new \Faker\ORM\Mandango\ColumnTypeGuesser($generator);
50 |
51 | $metadata = $mandango->getMetadata($this->class);
52 |
53 | // fields
54 | foreach ($metadata['fields'] as $fieldName => $field) {
55 | if ($formatter = $nameGuesser->guessFormat($fieldName)) {
56 | $formatters[$fieldName] = $formatter;
57 | continue;
58 | }
59 | if ($formatter = $columnTypeGuesser->guessFormat($field)) {
60 | $formatters[$fieldName] = $formatter;
61 | continue;
62 | }
63 | }
64 |
65 | // references
66 | foreach (array_merge($metadata['referencesOne'], $metadata['referencesMany']) as $referenceName => $reference) {
67 | if (!isset($reference['class'])) {
68 | continue;
69 | }
70 | $referenceClass = $reference['class'];
71 |
72 | $formatters[$referenceName] = function ($insertedEntities) use ($referenceClass) {
73 | if (isset($insertedEntities[$referenceClass])) {
74 | return $insertedEntities[$referenceClass][array_rand($insertedEntities[$referenceClass])];
75 | }
76 | };
77 | }
78 |
79 | return $formatters;
80 | }
81 |
82 | /**
83 | * Insert one new record using the Entity class.
84 | */
85 | public function execute(Mandango $mandango, $insertedEntities)
86 | {
87 | $metadata = $mandango->getMetadata($this->class);
88 |
89 | $obj = $mandango->create($this->class);
90 | foreach ($this->columnFormatters as $column => $format) {
91 | if (null !== $format) {
92 | $value = is_callable($format) ? $format($insertedEntities, $obj) : $format;
93 |
94 | if (
95 | isset($metadata['fields'][$column])
96 | ||
97 | isset($metadata['referencesOne'][$column])
98 | ) {
99 | $obj->set($column, $value);
100 | }
101 |
102 | if (isset($metadata['referencesMany'][$column])) {
103 | $adder = 'add'.ucfirst($column);
104 | $obj->$adder($value);
105 | }
106 | }
107 | }
108 | $mandango->persist($obj);
109 |
110 | return $obj;
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/Populator.php:
--------------------------------------------------------------------------------
1 | generator = $generator;
21 | $this->mandango = $mandango;
22 | }
23 |
24 | /**
25 | * Add an order for the generation of $number records for $entity.
26 | *
27 | * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance
28 | * @param int $number The number of entities to populate
29 | */
30 | public function addEntity($entity, $number, $customColumnFormatters = array())
31 | {
32 | if (!$entity instanceof \Faker\ORM\Mandango\EntityPopulator) {
33 | $entity = new \Faker\ORM\Mandango\EntityPopulator($entity);
34 | }
35 | $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator, $this->mandango));
36 | if ($customColumnFormatters) {
37 | $entity->mergeColumnFormattersWith($customColumnFormatters);
38 | }
39 | $class = $entity->getClass();
40 | $this->entities[$class] = $entity;
41 | $this->quantities[$class] = $number;
42 | }
43 |
44 | /**
45 | * Populate the database using all the Entity classes previously added.
46 | *
47 | * @return array A list of the inserted entities.
48 | */
49 | public function execute()
50 | {
51 | $insertedEntities = array();
52 | foreach ($this->quantities as $class => $number) {
53 | for ($i=0; $i < $number; $i++) {
54 | $insertedEntities[$class][]= $this->entities[$class]->execute($this->mandango, $insertedEntities);
55 | }
56 | }
57 | $this->mandango->flush();
58 |
59 | return $insertedEntities;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php:
--------------------------------------------------------------------------------
1 | generator = $generator;
15 | }
16 |
17 | public function guessFormat(ColumnMap $column)
18 | {
19 | $generator = $this->generator;
20 | if ($column->isTemporal()) {
21 | if ($column->isEpochTemporal()) {
22 | return function() use ($generator) { return $generator->dateTime; };
23 | } else {
24 | return function() use ($generator) { return $generator->dateTimeAD; };
25 | }
26 | }
27 | $type = $column->getType();
28 | switch ($type) {
29 | case PropelColumnTypes::BOOLEAN:
30 | case PropelColumnTypes::BOOLEAN_EMU:
31 | return function() use ($generator) { return $generator->boolean; };
32 | case PropelColumnTypes::NUMERIC:
33 | case PropelColumnTypes::DECIMAL:
34 | $size = $column->getSize();
35 |
36 | return function() use ($generator, $size) { return $generator->randomNumber($size + 2) / 100; };
37 | case PropelColumnTypes::TINYINT:
38 | return function() { return mt_rand(0,127); };
39 | case PropelColumnTypes::SMALLINT:
40 | return function() { return mt_rand(0,32767); };
41 | case PropelColumnTypes::INTEGER:
42 | return function() { return mt_rand(0,intval('2147483647')); };
43 | case PropelColumnTypes::BIGINT:
44 | return function() { return mt_rand(0,intval('9223372036854775807')); };
45 | case PropelColumnTypes::FLOAT:
46 | return function() { return mt_rand(0,intval('2147483647'))/mt_rand(1,intval('2147483647')); };
47 | case PropelColumnTypes::DOUBLE:
48 | case PropelColumnTypes::REAL:
49 | return function() { return mt_rand(0,intval('9223372036854775807'))/mt_rand(1,intval('9223372036854775807')); };
50 | case PropelColumnTypes::CHAR:
51 | case PropelColumnTypes::VARCHAR:
52 | case PropelColumnTypes::BINARY:
53 | case PropelColumnTypes::VARBINARY:
54 | $size = $column->getSize();
55 |
56 | return function() use ($generator, $size) { return $generator->text($size); };
57 | case PropelColumnTypes::LONGVARCHAR:
58 | case PropelColumnTypes::LONGVARBINARY:
59 | case PropelColumnTypes::CLOB:
60 | case PropelColumnTypes::CLOB_EMU:
61 | case PropelColumnTypes::BLOB:
62 | return function() use ($generator) { return $generator->text; };
63 | case PropelColumnTypes::ENUM:
64 | $valueSet = $column->getValueSet();
65 |
66 | return function() use ($generator, $valueSet) { return $generator->randomElement($valueSet); };
67 | case PropelColumnTypes::OBJECT:
68 | case PropelColumnTypes::PHP_ARRAY:
69 | // no smart way to guess what the user expects here
70 | return null;
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/ORM/Propel/Populator.php:
--------------------------------------------------------------------------------
1 | generator = $generator;
18 | }
19 |
20 | /**
21 | * Add an order for the generation of $number records for $entity.
22 | *
23 | * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance
24 | * @param int $number The number of entities to populate
25 | */
26 | public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array())
27 | {
28 | if (!$entity instanceof \Faker\ORM\Propel\EntityPopulator) {
29 | $entity = new \Faker\ORM\Propel\EntityPopulator($entity);
30 | }
31 | $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator));
32 | if ($customColumnFormatters) {
33 | $entity->mergeColumnFormattersWith($customColumnFormatters);
34 | }
35 | $entity->setModifiers($entity->guessModifiers($this->generator));
36 | if ($customModifiers) {
37 | $entity->mergeModifiersWith($customModifiers);
38 | }
39 | $class = $entity->getClass();
40 | $this->entities[$class] = $entity;
41 | $this->quantities[$class] = $number;
42 | }
43 |
44 | /**
45 | * Populate the database using all the Entity classes previously added.
46 | *
47 | * @param PropelPDO $con A Propel connection object
48 | *
49 | * @return array A list of the inserted PKs
50 | */
51 | public function execute($con = null)
52 | {
53 | if (null === $con) {
54 | $con = $this->getConnection();
55 | }
56 | $isInstancePoolingEnabled = \Propel::isInstancePoolingEnabled();
57 | \Propel::disableInstancePooling();
58 | $insertedEntities = array();
59 | $con->beginTransaction();
60 | foreach ($this->quantities as $class => $number) {
61 | for ($i=0; $i < $number; $i++) {
62 | $insertedEntities[$class][]= $this->entities[$class]->execute($con, $insertedEntities);
63 | }
64 | }
65 | $con->commit();
66 | if ($isInstancePoolingEnabled) {
67 | \Propel::enableInstancePooling();
68 | }
69 |
70 | return $insertedEntities;
71 | }
72 |
73 | protected function getConnection()
74 | {
75 | // use the first connection available
76 | $class = key($this->entities);
77 |
78 | if (!$class) {
79 | throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?');
80 | }
81 |
82 | $peer = $class::PEER;
83 |
84 | return \Propel::getConnection($peer::DATABASE_NAME, \Propel::CONNECTION_WRITE);
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/Address.php:
--------------------------------------------------------------------------------
1 | generator->parse($format);
58 | }
59 |
60 | /**
61 | * @example 'Crist Parks'
62 | */
63 | public function streetName()
64 | {
65 | $format = static::randomElement(static::$streetNameFormats);
66 |
67 | return $this->generator->parse($format);
68 | }
69 |
70 | /**
71 | * @example '791 Crist Parks'
72 | */
73 | public function streetAddress()
74 | {
75 | $format = static::randomElement(static::$streetAddressFormats);
76 |
77 | return $this->generator->parse($format);
78 | }
79 |
80 | /**
81 | * @example 86039-9874
82 | */
83 | public static function postcode()
84 | {
85 | return static::toUpper(static::bothify(static::randomElement(static::$postcode)));
86 | }
87 |
88 | /**
89 | * @example '791 Crist Parks, Sashabury, IL 86039-9874'
90 | */
91 | public function address()
92 | {
93 | $format = static::randomElement(static::$addressFormats);
94 |
95 | return $this->generator->parse($format);
96 | }
97 |
98 | /**
99 | * @example 'Japan'
100 | */
101 | public static function country()
102 | {
103 | return static::randomElement(static::$country);
104 | }
105 |
106 | /**
107 | * @example '77.147489'
108 | */
109 | public static function latitude()
110 | {
111 | return number_format(mt_rand(-90000000, 90000000)/1000000, 6);
112 | }
113 |
114 | /**
115 | * @example '86.211205'
116 | */
117 | public static function longitude()
118 | {
119 | return number_format(mt_rand(-180000000, 180000000)/1000000, 6);
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/Color.php:
--------------------------------------------------------------------------------
1 | generator->parse($format);
21 | }
22 |
23 | /**
24 | * @example 'Ltd'
25 | */
26 | public static function companySuffix()
27 | {
28 | return static::randomElement(static::$companySuffix);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/Image.php:
--------------------------------------------------------------------------------
1 | generator->parse($format));
33 | }
34 |
35 | /**
36 | * @example 'jdoe@example.com'
37 | */
38 | final public function safeEmail()
39 | {
40 | return preg_replace('/\s/u', '', $this->userName() . '@' . static::safeEmailDomain());
41 | }
42 |
43 | /**
44 | * @example 'jdoe@gmail.com'
45 | */
46 | public function freeEmail()
47 | {
48 | return preg_replace('/\s/u', '', $this->userName() . '@' . static::freeEmailDomain());
49 | }
50 |
51 | /**
52 | * @example 'jdoe@dawson.com'
53 | */
54 | public function companyEmail()
55 | {
56 | return preg_replace('/\s/u', '', $this->userName() . '@' . $this->domainName());
57 | }
58 |
59 | /**
60 | * @example 'gmail.com'
61 | */
62 | public static function freeEmailDomain()
63 | {
64 | return static::randomElement(static::$freeEmailDomain);
65 | }
66 |
67 | /**
68 | * @example 'example.org'
69 | */
70 | final public static function safeEmailDomain()
71 | {
72 | $domains = array(
73 | 'example.com',
74 | 'example.org',
75 | 'example.net'
76 | );
77 |
78 | return static::randomElement($domains);
79 | }
80 | /**
81 | * @example 'jdoe'
82 | */
83 | public function userName()
84 | {
85 | $format = static::randomElement(static::$userNameFormats);
86 |
87 | return static::toLower(static::bothify($this->generator->parse($format)));
88 | }
89 |
90 | /**
91 | * @example 'tiramisu.com'
92 | */
93 | public function domainName()
94 | {
95 | return $this->domainWord() . '.' . $this->tld();
96 | }
97 |
98 | /**
99 | * @example 'faber'
100 | */
101 | public function domainWord()
102 | {
103 | $company = $this->generator->format('company');
104 | $companyElements = explode(' ', $company);
105 | $company = $companyElements[0];
106 | $company = preg_replace('/\W/u', '', $company);
107 |
108 | return static::toLower($company);
109 | }
110 |
111 | /**
112 | * @example 'com'
113 | */
114 | public function tld()
115 | {
116 | return static::randomElement(static::$tld);
117 | }
118 |
119 | /**
120 | * @example 'http://www.runolfsdottir.com/'
121 | */
122 | public function url()
123 | {
124 | $format = static::randomElement(static::$urlFormats);
125 |
126 | return $this->generator->parse($format);
127 | }
128 |
129 | /**
130 | * @example '237.149.115.38'
131 | */
132 | public function ipv4()
133 | {
134 | return long2ip(mt_rand(0, 1) == 0 ? mt_rand(-2147483648, 0) : mt_rand(1, 2147483647));
135 | }
136 |
137 | /**
138 | * @example '35cd:186d:3e23:2986:ef9f:5b41:42a4:e6f1'
139 | */
140 | public function ipv6()
141 | {
142 | $res = array();
143 | for ($i=0; $i < 8; $i++) {
144 | $res []= dechex(mt_rand(0, "65535"));
145 | }
146 |
147 | return join(':', $res);
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/Person.php:
--------------------------------------------------------------------------------
1 | generator->parse($format);
23 | }
24 |
25 | /**
26 | * @example 'John'
27 | */
28 | public static function firstName()
29 | {
30 | return static::randomElement(static::$firstName);
31 | }
32 |
33 | /**
34 | * @example 'Doe'
35 | */
36 | public static function lastName()
37 | {
38 | return static::randomElement(static::$lastName);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/PhoneNumber.php:
--------------------------------------------------------------------------------
1 | > 8) | (($tLo & 0xff000000) >> 24);
31 | $tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8);
32 | $tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8);
33 | }
34 |
35 | // apply version number
36 | $tHi &= 0x0fff;
37 | $tHi |= (3 << 12);
38 |
39 | // cast to string
40 | $uuid = sprintf(
41 | '%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x',
42 | $tLo, $tMi, $tHi, $csHi, $csLo,
43 | $byte[10], $byte[11], $byte[12], $byte[13], $byte[14], $byte[15]
44 | );
45 |
46 | return $uuid;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/Internet.php:
--------------------------------------------------------------------------------
1 | generator->parse($format));
18 | }
19 |
20 | /**
21 | * @example 'faber'
22 | */
23 | public function domainWord()
24 | {
25 | $company = $this->generator->format('company');
26 | $companyElements = explode(' ', $company);
27 | $company = $companyElements[0];
28 | $company = preg_replace('/\W/u', '', $company);
29 |
30 | return $company;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/Payment.php:
--------------------------------------------------------------------------------
1 | toAscii(parent::email());
28 | }
29 |
30 | public function userName()
31 | {
32 | return $this->toAscii(parent::userName());
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Payment.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | class Company extends \Faker\Provider\Company
9 | {
10 | /**
11 | * @var array Danish company name formats.
12 | */
13 | protected static $formats = array(
14 | '{{lastName}} {{companySuffix}}',
15 | '{{lastName}} {{companySuffix}}',
16 | '{{lastName}} {{companySuffix}}',
17 | '{{firstname}} {{lastName}} {{companySuffix}}',
18 | '{{middleName}} {{companySuffix}}',
19 | '{{middleName}} {{companySuffix}}',
20 | '{{middleName}} {{companySuffix}}',
21 | '{{firstname}} {{middleName}} {{companySuffix}}',
22 | '{{lastName}} & {{lastName}} {{companySuffix}}',
23 | '{{lastName}} og {{lastName}} {{companySuffix}}',
24 | '{{lastName}} & {{lastName}} {{companySuffix}}',
25 | '{{lastName}} og {{lastName}} {{companySuffix}}',
26 | '{{middleName}} & {{middleName}} {{companySuffix}}',
27 | '{{middleName}} og {{middleName}} {{companySuffix}}',
28 | '{{middleName}} & {{lastName}}',
29 | '{{middleName}} og {{lastName}}',
30 | );
31 |
32 | /**
33 | * @var array Company suffixes.
34 | */
35 | protected static $companySuffix = array('ApS', 'A/S', 'I/S', 'K/S');
36 |
37 | /**
38 | * @link http://cvr.dk/Site/Forms/CMS/DisplayPage.aspx?pageid=60
39 | *
40 | * @var string CVR number format.
41 | */
42 | protected static $cvrFormat = '%#######';
43 |
44 | /**
45 | * @link http://cvr.dk/Site/Forms/CMS/DisplayPage.aspx?pageid=60
46 | *
47 | * @var string P number (production number) format.
48 | */
49 | protected static $pFormat = '%#########';
50 |
51 | /**
52 | * Generates a CVR number (8 digits).
53 | *
54 | * @return string
55 | */
56 | public static function cvr()
57 | {
58 | return static::numerify(static::$cvrFormat);
59 | }
60 |
61 | /**
62 | * Generates a P entity number (10 digits).
63 | *
64 | * @return string
65 | */
66 | public static function p()
67 | {
68 | return static::numerify(static::$pFormat);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Internet.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | class Internet extends \Faker\Provider\Internet
9 | {
10 | /**
11 | * @var array Some safe email TLD.
12 | */
13 | protected static $safeEmailTld = array(
14 | 'org', 'com', 'net', 'dk', 'dk', 'dk',
15 | );
16 |
17 | /**
18 | * @var array Some email domains in Denmark.
19 | */
20 | protected static $freeEmailDomain = array(
21 | 'gmail.com', 'yahoo.com', 'yahoo.dk', 'hotmail.com', 'hotmail.dk', 'mail.dk', 'live.dk'
22 | );
23 |
24 | /**
25 | * @var array Some TLD.
26 | */
27 | protected static $tld = array(
28 | 'com', 'com', 'com', 'biz', 'info', 'net', 'org', 'dk', 'dk', 'dk',
29 | );
30 |
31 | /**
32 | * Converts Danish characters to their ASCII representation
33 | *
34 | * @return string
35 | */
36 | private static function toAscii($string)
37 | {
38 | $from = array('æ', 'ø', 'å', 'Æ', 'Ø', 'Å');
39 | $to = array('ae', 'oe', 'aa', 'AE', 'OE', 'AA');
40 |
41 | return str_replace($from, $to, $string);
42 | }
43 |
44 | /**
45 | * @example 'jeppe'
46 | * @return string
47 | */
48 | public function userName()
49 | {
50 | $format = static::randomElement(static::$userNameFormats);
51 |
52 | return static::toLower(static::toAscii(static::bothify($this->generator->parse($format))));
53 | }
54 |
55 | /**
56 | * @example 'jensen.dk'
57 | * @return string
58 | */
59 | public function domainWord()
60 | {
61 | $company = $this->generator->format('company');
62 | $companyElements = explode(' ', $company);
63 | $company = $companyElements[0];
64 | $company = preg_replace('/\W/u', '', $company);
65 |
66 | return static::toLower(static::toAscii($company));
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Payment.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | class PhoneNumber extends \Faker\Provider\PhoneNumber
9 | {
10 | /**
11 | * @var array Danish phonenumber formats.
12 | */
13 | protected static $formats = array(
14 | '+45 ## ## ## ##',
15 | '+45 #### ####',
16 | '+45########',
17 | '## ## ## ##',
18 | '#### ####',
19 | '########',
20 | );
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Payment.php:
--------------------------------------------------------------------------------
1 | generator->parse($format))));
31 | }
32 |
33 | /**
34 | * @example 'faber'
35 | */
36 | public function domainWord()
37 | {
38 | $company = $this->generator->format('company');
39 | $companyElements = explode(' ', $company);
40 | $company = $companyElements[0];
41 | $company = preg_replace('/\W/u', '', $company);
42 |
43 | return static::toLower(static::toAscii($company));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/de_DE/Payment.php:
--------------------------------------------------------------------------------
1 | generator->parse($format));
31 |
32 | return str_replace('-', '.', static::toLower(static::toAscii($user)));
33 | }
34 |
35 | /**
36 | * @example 'lovato-exposito'
37 | */
38 | public function domainWord()
39 | {
40 | list($company) = explode(' ', $this->generator->format('company'));
41 |
42 | return static::toLower(static::toAscii(preg_replace('/\W/u', '', $company)));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/es_ES/Payment.php:
--------------------------------------------------------------------------------
1 | generator->parse($format))));
31 | }
32 |
33 | /**
34 | * @example 'faber'
35 | */
36 | public function domainWord()
37 | {
38 | $company = $this->generator->format('company');
39 | $companyElements = explode(' ', $company);
40 | $company = $companyElements[0];
41 | $company = preg_replace('/\W/u', '', $company);
42 |
43 | return static::toLower(static::toAscii($company));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/fr_BE/Payment.php:
--------------------------------------------------------------------------------
1 | generator->parse($format))));
31 | }
32 |
33 | /**
34 | * @example 'faber'
35 | */
36 | public function domainWord()
37 | {
38 | $company = $this->generator->format('company');
39 | $companyElements = explode(' ', $company);
40 | $company = $companyElements[0];
41 | $company = preg_replace('/\W/u', '', $company);
42 |
43 | return static::toLower(static::toAscii($company));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Payment.php:
--------------------------------------------------------------------------------
1 | generator->parse($format));
17 | }
18 |
19 | /**
20 | * @example 'faber'
21 | */
22 | public function domainWord()
23 | {
24 | $company = $this->generator->format('company');
25 | $companyElements = explode(' ', $company);
26 | $company = $companyElements[0];
27 | $company = preg_replace('/,/', '', $company);
28 |
29 | // Translit for armenian language
30 | $company = mb_strtolower($company, 'UTF-8');
31 | $company = str_replace(
32 | array('ու','ա','բ','գ','դ','ե','զ','է','ը','թ','ժ','ի','լ','խ','ծ','կ','հ','ձ','ղ','ճ','մ','յ','ն','շ','ո','չ','պ','ջ','ռ','ս','վ','տ','ր','ց','փ','ք','և','օ','ֆ',),
33 | array('u','a','b','g','d','e','z','e','y','t','zh','i','l','kh','ts','k','h','dz','gh','ch','m','y','n','sh','o','ch','p','j','r','s','v','t','r','ts','p','q','ev','o','f'),
34 | $company
35 | );
36 |
37 | return $company;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Person.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | class Company extends \Faker\Provider\Company
9 | {
10 | /**
11 | * @var array Danish company name formats.
12 | */
13 | protected static $formats = array(
14 | '{{lastName}} {{companySuffix}}',
15 | '{{lastName}} {{companySuffix}}',
16 | '{{lastName}} {{companySuffix}}',
17 | '{{firstname}} {{lastName}} {{companySuffix}}',
18 | '{{middleName}} {{companySuffix}}',
19 | '{{middleName}} {{companySuffix}}',
20 | '{{middleName}} {{companySuffix}}',
21 | '{{firstname}} {{middleName}} {{companySuffix}}',
22 | '{{lastName}} & {{lastName}} {{companySuffix}}',
23 | '{{lastName}} og {{lastName}} {{companySuffix}}',
24 | '{{lastName}} & {{lastName}} {{companySuffix}}',
25 | '{{lastName}} og {{lastName}} {{companySuffix}}',
26 | '{{middleName}} & {{middleName}} {{companySuffix}}',
27 | '{{middleName}} og {{middleName}} {{companySuffix}}',
28 | '{{middleName}} & {{lastName}}',
29 | '{{middleName}} og {{lastName}}',
30 | );
31 |
32 | /**
33 | * @var array Company suffixes.
34 | */
35 | protected static $companySuffix = array('ehf.', 'hf.', 'sf.');
36 |
37 | /**
38 | * @link http://www.rsk.is/atvinnurekstur/virdisaukaskattur/
39 | *
40 | * @var string VSK number format.
41 | */
42 | protected static $vskFormat = '%####';
43 |
44 | /**
45 | * Generates a VSK number (5 digits).
46 | *
47 | * @return string
48 | */
49 | public static function vsk()
50 | {
51 | return static::numerify(static::$vskFormat);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Internet.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | class Internet extends \Faker\Provider\Internet
9 | {
10 | /**
11 | * @var array Some email domains in Denmark.
12 | */
13 | protected static $freeEmailDomain = array(
14 | 'gmail.com', 'yahoo.com', 'hotmail.com', 'visir.is', 'simnet.is', 'internet.is'
15 | );
16 |
17 | /**
18 | * @var array Some TLD.
19 | */
20 | protected static $tld = array(
21 | 'com', 'com', 'com', 'net', 'is', 'is', 'is',
22 | );
23 |
24 | /**
25 | * Converts Icelandic characters to their ASCII representation
26 | *
27 | * @return string
28 | */
29 | private static function toAscii($string)
30 | {
31 | $from = array('Á','á','É','é','Ú','ú','Ý','ý','Ó','ó','Þ','þ','Ð','ð','Æ','æ','Ö','ö');
32 | $to = array('A','a','E','e','U','u','Y','y','O','o','Th','th','D','d','Ae','ae','O','o');
33 |
34 | return str_replace($from, $to, $string);
35 | }
36 |
37 | /**
38 | * @example 'jeppe'
39 | * @return string
40 | */
41 | public function userName()
42 | {
43 | $format = static::randomElement(static::$userNameFormats);
44 |
45 | return static::toLower(static::toAscii(static::bothify($this->generator->parse($format))));
46 | }
47 |
48 | /**
49 | * @example 'jensen.is'
50 | * @return string
51 | */
52 | public function domainWord()
53 | {
54 | $company = $this->generator->format('company');
55 | $companyElements = explode(' ', $company);
56 | $company = $companyElements[0];
57 | $company = preg_replace('/\W/u', '', $company);
58 |
59 | return static::toLower(static::toAscii($company));
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Payment.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | class PhoneNumber extends \Faker\Provider\PhoneNumber
9 | {
10 | /**
11 | * @var array Icelandic phonenumber formats.
12 | */
13 | protected static $formats = array(
14 | '+354 ### ####',
15 | '+354 #######',
16 | '+354#######',
17 | '### ####',
18 | '#######',
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/it_IT/Internet.php:
--------------------------------------------------------------------------------
1 | generator->parse($format))));
18 | }
19 |
20 | /**
21 | * Converts Italian characters to their ASCII representation
22 | *
23 | * @return string
24 | */
25 | private static function toAscii($string)
26 | {
27 | $from = array('à', 'À', 'é', 'É', 'è', 'È', 'ù', 'Ù', "'");
28 | $to = array('a', 'A', 'e', 'E', 'e', 'E', 'u', 'U', '');
29 |
30 | return str_replace($from, $to, $string);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/it_IT/Payment.php:
--------------------------------------------------------------------------------
1 | generator->parse($format));
48 | }
49 |
50 | /**
51 | * @example 'yamada.jp'
52 | */
53 | public function domainName()
54 | {
55 | return static::randomElement(static::$lastNameAscii) . '.' . $this->tld();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Person.php:
--------------------------------------------------------------------------------
1 | generator->parse($format));
18 | }
19 |
20 | /**
21 | * @example 'faber'
22 | */
23 | public function domainWord()
24 | {
25 | $company = $this->generator->format('company');
26 | $companyElements = explode(' ', $company);
27 | $company = $companyElements[0];
28 | $company = preg_replace('/,/u', '', $company);
29 |
30 | return $company;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Payment.php:
--------------------------------------------------------------------------------
1 | bothify("??######");
49 | }
50 |
51 | public function passportNumber()
52 | {
53 | return $this->bothify("??#######");
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/PhoneNumber.php:
--------------------------------------------------------------------------------
1 | generator->parse($format))));
31 | }
32 |
33 | /**
34 | * @example 'faber'
35 | */
36 | public function domainWord()
37 | {
38 | $company = $this->generator->format('company');
39 | $companyElements = explode(' ', $company);
40 | $company = $companyElements[0];
41 | $company = preg_replace('/\W/u', '', $company);
42 |
43 | return static::toLower(static::toAscii($company));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/Payment.php:
--------------------------------------------------------------------------------
1 | toAscii(parent::email());
28 | }
29 |
30 | /**
31 | * @example 'dominika16'
32 | */
33 | public function userName()
34 | {
35 | return $this->toAscii(parent::userName());
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/PhoneNumber.php:
--------------------------------------------------------------------------------
1 | generator->parse($format))));
30 | }
31 |
32 | /**
33 | * @example 'faber'
34 | */
35 | public function domainWord()
36 | {
37 | $company = $this->generator->format('company');
38 | $companyElements = explode(' ', $company);
39 | $company = $companyElements[0];
40 | $company = preg_replace('/\W/u', '', $company);
41 |
42 | return static::toLower(static::toAscii($company));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Payment.php:
--------------------------------------------------------------------------------
1 | generator->parse($format))));
31 | }
32 |
33 | /**
34 | * @example 'faber'
35 | */
36 | public function domainWord()
37 | {
38 | $company = $this->generator->format('company');
39 | $companyElements = explode(' ', $company);
40 | $company = $companyElements[0];
41 | $company = preg_replace('/\W/u', '', $company);
42 |
43 | return static::toLower(static::toAscii($company));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/PhoneNumber.php:
--------------------------------------------------------------------------------
1 | toAscii(parent::email());
28 | }
29 |
30 | public function userName()
31 | {
32 | return $this->toAscii(parent::userName());
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/Payment.php:
--------------------------------------------------------------------------------
1 | generator->parse($format))));
32 | }
33 |
34 | /**
35 | * @example 'faber'
36 | */
37 | public function domainWord()
38 | {
39 | $company = $this->generator->format('company');
40 | $companyElements = explode(' ', $company);
41 | $company = $companyElements[0];
42 | $company = preg_replace('/\W/u', '', $company);
43 |
44 | return static::toLower(static::toAscii($company));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Payment.php:
--------------------------------------------------------------------------------
1 | generator->parse($format);
33 | }
34 |
35 | public static function companyPrefix()
36 | {
37 | return static::randomElement(static::$companyPrefix);
38 | }
39 |
40 | public static function companyName()
41 | {
42 | return static::randomElement(static::$companyName);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Internet.php:
--------------------------------------------------------------------------------
1 | generator->parse($format))));
33 | }
34 |
35 | /**
36 | * @example 'smart-dizayn'
37 | */
38 | public function domainWord()
39 | {
40 | $company = $this->generator->format('company');
41 | $companyElements = explode(' ', $company);
42 | $company = $companyElements[0];
43 | $company = preg_replace('/\W/u', '', $company);
44 |
45 | return static::toLower(static::toAscii($company));
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Person.php:
--------------------------------------------------------------------------------
1 | city() . static::area();
34 | }
35 |
36 | public static function postcode()
37 | {
38 | $prefix = str_pad(mt_rand(1, 85), 2, 0, STR_PAD_LEFT);
39 | $suffix = '00';
40 |
41 | return $prefix . mt_rand(10, 88) . $suffix;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Company.php:
--------------------------------------------------------------------------------
1 | unique()
8 | */
9 | class UniqueGenerator
10 | {
11 | protected $generator;
12 | protected $maxRetries;
13 | protected $uniques = array();
14 |
15 | public function __construct(Generator $generator, $maxRetries)
16 | {
17 | $this->generator = $generator;
18 | $this->maxRetries = $maxRetries;
19 | }
20 |
21 | /**
22 | * Catch and proxy all generator calls but return only unique values
23 | */
24 | public function __get($attribute)
25 | {
26 | return $this->__call($attribute, array());
27 | }
28 |
29 | /**
30 | * Catch and proxy all generator calls with arguments but return only unique values
31 | */
32 | public function __call($name, $arguments)
33 | {
34 | if (!isset($this->uniques[$name])) {
35 | $this->uniques[$name] = array();
36 | }
37 | $i = 0;
38 | do {
39 | $res = call_user_func_array(array($this->generator, $name), $arguments);
40 | $i++;
41 | if ($i > $this->maxRetries) {
42 | throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a unique value', $this->maxRetries));
43 | }
44 | } while (in_array($res, $this->uniques[$name]));
45 | $this->uniques[$name][]= $res;
46 |
47 | return $res;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/src/autoload.php:
--------------------------------------------------------------------------------
1 | addProvider(new FooProvider());
13 | $generator->addProvider(new BarProvider());
14 | $this->assertEquals('barfoo', $generator->format('fooFormatter'));
15 | }
16 |
17 | public function testGetFormatterReturnsCallable()
18 | {
19 | $generator = new Generator;
20 | $provider = new FooProvider();
21 | $generator->addProvider($provider);
22 | $this->assertTrue(is_callable($generator->getFormatter('fooFormatter')));
23 | }
24 |
25 | public function testGetFormatterReturnsCorrectFormatter()
26 | {
27 | $generator = new Generator;
28 | $provider = new FooProvider();
29 | $generator->addProvider($provider);
30 | $expected = array($provider, 'fooFormatter');
31 | $this->assertEquals($expected, $generator->getFormatter('fooFormatter'));
32 | }
33 |
34 | /**
35 | * @expectedException InvalidArgumentException
36 | */
37 | public function testGetFormatterThrowsExceptionOnIncorrectProvider()
38 | {
39 | $generator = new Generator;
40 | $generator->getFormatter('fooFormatter');
41 | }
42 |
43 | /**
44 | * @expectedException InvalidArgumentException
45 | */
46 | public function testGetFormatterThrowsExceptionOnIncorrectFormatter()
47 | {
48 | $generator = new Generator;
49 | $provider = new FooProvider();
50 | $generator->addProvider($provider);
51 | $generator->getFormatter('barFormatter');
52 | }
53 |
54 | public function testFormatCallsFormatterOnProvider()
55 | {
56 | $generator = new Generator;
57 | $provider = new FooProvider();
58 | $generator->addProvider($provider);
59 | $this->assertEquals('foobar', $generator->format('fooFormatter'));
60 | }
61 |
62 | public function testFormatTransfersArgumentsToFormatter()
63 | {
64 | $generator = new Generator;
65 | $provider = new FooProvider();
66 | $generator->addProvider($provider);
67 | $this->assertEquals('bazfoo', $generator->format('fooFormatterWithArguments', array('foo')));
68 | }
69 |
70 | public function testParseReturnsSameStringWhenItContainsNoCurlyBraces()
71 | {
72 | $generator = new Generator();
73 | $this->assertEquals('fooBar#?', $generator->parse('fooBar#?'));
74 | }
75 |
76 | public function testParseReturnsStringWithTokensReplacedByFormatters()
77 | {
78 | $generator = new Generator();
79 | $provider = new FooProvider();
80 | $generator->addProvider($provider);
81 | $this->assertEquals('This is foobar a text with foobar', $generator->parse('This is {{fooFormatter}} a text with {{ fooFormatter }}'));
82 | }
83 |
84 | public function testMagicGetCallsFormat()
85 | {
86 | $generator = new Generator;
87 | $provider = new FooProvider();
88 | $generator->addProvider($provider);
89 | $this->assertEquals('foobar', $generator->fooFormatter);
90 | }
91 |
92 | public function testMagicCallCallsFormat()
93 | {
94 | $generator = new Generator;
95 | $provider = new FooProvider();
96 | $generator->addProvider($provider);
97 | $this->assertEquals('foobar', $generator->fooFormatter());
98 | }
99 |
100 | public function testMagicCallCallsFormatWithArguments()
101 | {
102 | $generator = new Generator;
103 | $provider = new FooProvider();
104 | $generator->addProvider($provider);
105 | $this->assertEquals('bazfoo', $generator->fooFormatterWithArguments('foo'));
106 | }
107 |
108 | }
109 |
110 | class FooProvider
111 | {
112 | public function fooFormatter()
113 | {
114 | return 'foobar';
115 | }
116 |
117 | public function fooFormatterWithArguments($value = '')
118 | {
119 | return 'baz' . $value;
120 | }
121 | }
122 |
123 | class BarProvider
124 | {
125 | public function fooFormatter()
126 | {
127 | return 'barfoo';
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/PHPUnit/Framework/Constraint/IsValidSiren.php:
--------------------------------------------------------------------------------
1 | getLength()) {
13 | return false;
14 | }
15 |
16 | $sum = 0;
17 | // IMPORTANT : from right to left
18 | $position = 1;
19 | for ($i = strlen($code) - 1; $i >= 0; $i--) {
20 | $isEven = (($position++ % 2) === 0);
21 | $tmp = $isEven ? $code[$i] * 2 : $code[$i];
22 | if ($tmp >= 10) $tmp -= 9;
23 | $sum += $tmp;
24 | }
25 |
26 | return ($sum % 10 === 0);
27 |
28 | }
29 |
30 | public function toString()
31 | {
32 | return sprintf('is a valid %s number', $this->getName());
33 | }
34 |
35 | abstract protected function getLength();
36 |
37 | abstract protected function getName();
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/PHPUnit/Framework/Constraint/IsValidSiret.php:
--------------------------------------------------------------------------------
1 | assertRegExp('/^#[a-f0-9]{6}$/i', Color::hexColor());
13 | }
14 |
15 | public function testRgbColorAsArray()
16 | {
17 | $this->assertEquals(3, count(Color::rgbColorAsArray()));
18 | }
19 |
20 | public function testRgbColor()
21 | {
22 | $regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])';
23 | $this->assertRegExp('/^' . $regexp . ',' . $regexp . ',' . $regexp . '$/i', Color::rgbColor());
24 | }
25 |
26 | public function testRgbCssColor()
27 | {
28 | $regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])';
29 | $this->assertRegExp('/^rgb\(' . $regexp . ',' . $regexp . ',' . $regexp . '\)$/i', Color::rgbCssColor());
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/Provider/ImageTest.php:
--------------------------------------------------------------------------------
1 | assertEquals(Image::imageUrl(), 'http://lorempixel.com/640/480/');
12 | }
13 |
14 | public function testUrlWithDimensions()
15 | {
16 | $this->assertEquals(Image::imageUrl(800, 400), 'http://lorempixel.com/800/400/');
17 | }
18 |
19 | public function testUrlWithDimensionsAndCategory()
20 | {
21 | $this->assertEquals(Image::imageUrl(800, 400, 'nature'), 'http://lorempixel.com/800/400/nature/');
22 | }
23 |
24 | /**
25 | * @expectedException \InvalidArgumentException
26 | */
27 | public function testUrlWithDimensionsAndBadCategory()
28 | {
29 | Image::imageUrl(800, 400, 'bullhonky');
30 | }
31 |
32 | public function testDownloadWithDefaults()
33 | {
34 | $file = Image::image(sys_get_temp_dir());
35 | $this->assertFileExists($file);
36 | if (function_exists('getimagesize')) {
37 | list($width, $height, $type, $attr) = getimagesize($file);
38 | $this->assertEquals(640, $width);
39 | $this->assertEquals(480, $height);
40 | $this->assertEquals(constant('IMAGETYPE_JPEG'), $type);
41 | } else {
42 | $this->assertEquals('jpg', pathinfo($file, PATHINFO_EXTENSION));
43 | }
44 | if (file_exists($file)) {
45 | unlink($file);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/Provider/LocalizationTest.php:
--------------------------------------------------------------------------------
1 | assertNotNull($faker->name(), 'Localized Name Provider ' . $matches[1] . ' does not throw errors');
15 | }
16 | }
17 |
18 | public function testLocalizedAddressProvidersDoNotThrowErrors()
19 | {
20 | foreach (glob(__DIR__ . '/../../../src/Faker/Provider/*/Address.php') as $localizedAddress) {
21 | preg_match('#/([a-zA-Z_]+)/Address\.php#', $localizedAddress, $matches);
22 | $faker = Factory::create($matches[1]);
23 | $this->assertNotNull($faker->address(), 'Localized Address Provider ' . $matches[1] . ' does not throw errors');
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/Provider/LoremTest.php:
--------------------------------------------------------------------------------
1 | assertEquals('Word word word word.', TestableLorem::text(24));
20 | }
21 |
22 | public function testTextReturnsSentencesWhenAskedSizeLessThan100()
23 | {
24 | $this->assertEquals('This is a test sentence. This is a test sentence. This is a test sentence.', TestableLorem::text(99));
25 | }
26 |
27 | public function testTextReturnsParagraphsWhenAskedSizeGreaterOrEqualThanThan100()
28 | {
29 | $this->assertEquals('This is a test paragraph. It has three sentences. Exactly three.', TestableLorem::text(100));
30 | }
31 |
32 | public function testSentenceWithZeroNbWordsReturnsEmptyString()
33 | {
34 | $this->assertEquals('', Lorem::sentence(0));
35 | }
36 |
37 | public function testSentenceWithNegativeNbWordsReturnsEmptyString()
38 | {
39 | $this->assertEquals('', Lorem::sentence(-1));
40 | }
41 |
42 | public function testParagraphWithZeroNbSentencesReturnsEmptyString()
43 | {
44 | $this->assertEquals('', Lorem::paragraph(0));
45 | }
46 |
47 | public function testParagraphWithNegativeNbSentencesReturnsEmptyString()
48 | {
49 | $this->assertEquals('', Lorem::paragraph(-1));
50 | }
51 |
52 | public function testSentenceWithPositiveNbWordsReturnsAtLeastOneWord()
53 | {
54 | $sentence = Lorem::sentence(1);
55 |
56 | $this->assertGreaterThan(1, strlen($sentence));
57 | $this->assertGreaterThanOrEqual(1, count(explode(' ', $sentence)));
58 | }
59 |
60 | public function testParagraphWithPositiveNbSentencesReturnsAtLeastOneWord()
61 | {
62 | $paragraph = Lorem::paragraph(1);
63 |
64 | $this->assertGreaterThan(1, strlen($paragraph));
65 | $this->assertGreaterThanOrEqual(1, count(explode(' ', $paragraph)));
66 | }
67 |
68 | public function testWordssAsText()
69 | {
70 | $words = TestableLorem::words(2, true);
71 |
72 | $this->assertEquals('word word', $words);
73 | }
74 |
75 | public function testSentencesAsText()
76 | {
77 | $sentences = TestableLorem::sentences(2, true);
78 |
79 | $this->assertEquals('This is a test sentence. This is a test sentence.', $sentences);
80 | }
81 |
82 | public function testParagraphsAsText()
83 | {
84 | $paragraphs = TestableLorem::paragraphs(2, true);
85 |
86 | $expected = "This is a test paragraph. It has three sentences. Exactly three.\n\nThis is a test paragraph. It has three sentences. Exactly three.";
87 | $this->assertEquals($expected, $paragraphs);
88 | }
89 | }
90 |
91 | class TestableLorem extends Lorem
92 | {
93 |
94 | public static function word()
95 | {
96 | return 'word';
97 | }
98 |
99 | public static function sentence($nbWords = 5, $variableNbWords = true)
100 | {
101 | return 'This is a test sentence.';
102 | }
103 |
104 | public static function paragraph($nbSentences = 3, $variableNbSentences = true)
105 | {
106 | return 'This is a test paragraph. It has three sentences. Exactly three.';
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/Provider/PaymentTest.php:
--------------------------------------------------------------------------------
1 | addProvider(new \Faker\Provider\Base($faker));
11 | $faker->addProvider(new \Faker\Provider\DateTime($faker));
12 | $faker->addProvider(new \Faker\Provider\Person($faker));
13 | $faker->addProvider(new \Faker\Provider\Payment($faker));
14 | $this->faker = $faker;
15 | }
16 |
17 | public function testCreditCardTypeReturnsValidVendorName()
18 | {
19 | $this->assertTrue(in_array($this->faker->creditCardType, array('Visa', 'MasterCard', 'American Express', 'Discover Card')));
20 | }
21 |
22 | public function testCreditCardNumberReturnsValidCreditCardNumber()
23 | {
24 | $this->assertRegExp('/^6011\d{12}$/', $this->faker->creditCardNumber('Discover Card'));
25 | }
26 |
27 | public function testCreditCardNumberCanFormatOutput()
28 | {
29 | $this->assertRegExp('/^6011-\d{4}-\d{4}-\d{4}$/', $this->faker->creditCardNumber('Discover Card', true));
30 | }
31 |
32 | public function testCreditCardExpirationDateReturnsValidDateByDefault()
33 | {
34 | $expirationDate = $this->faker->creditCardExpirationDate;
35 | $this->assertTrue(intval($expirationDate->format('U')) > strtotime('now'));
36 | $this->assertTrue(intval($expirationDate->format('U')) < strtotime('+36 months'));
37 | }
38 |
39 | public function testRandomCard()
40 | {
41 | $cardDetails = $this->faker->creditCardDetails;
42 | $this->assertEquals(count($cardDetails), 4);
43 | $this->assertEquals(array('type', 'number', 'name', 'expirationDate'), array_keys($cardDetails));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/Provider/PersonTest.php:
--------------------------------------------------------------------------------
1 | assertContains(Person::firstName(), array('John', 'Jane'));
13 | }
14 |
15 | public function testLastNameReturnsDoe()
16 | {
17 | $this->assertEquals(Person::lastName(), 'Doe');
18 | }
19 |
20 | public function testNameReturnsFirstNameAndLastName()
21 | {
22 | $faker = new Generator();
23 | $faker->addProvider(new Person($faker));
24 | $this->assertContains($faker->name(), array('John Doe', 'Jane Doe'));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/Provider/UserAgentTest.php:
--------------------------------------------------------------------------------
1 | assertNotNull(UserAgent::userAgent());
12 | }
13 |
14 | public function testFirefoxUserAgent()
15 | {
16 | $this->stringContains(' Firefox/', UserAgent::firefox());
17 | }
18 |
19 | public function testSafariUserAgent()
20 | {
21 | $this->stringContains('Safari/', UserAgent::safari());
22 | }
23 |
24 | public function testInternetExplorerUserAgent()
25 | {
26 | $this->assertStringStartsWith('Mozilla/5.0 (compatible; MSIE ', UserAgent::internetExplorer());
27 | }
28 |
29 | public function testOperaUserAgent()
30 | {
31 | $this->assertStringStartsWith('Opera/', UserAgent::opera());
32 | }
33 |
34 | public function testChromeUserAgent()
35 | {
36 | $this->stringContains('(KHTML, like Gecko) Chrome/', UserAgent::chrome());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/Provider/UuidTest.php:
--------------------------------------------------------------------------------
1 | assertTrue($this->isUuid($uuid));
13 | }
14 |
15 | public function testUuidExpectedSeed()
16 | {
17 | mt_srand(123);
18 | $this->assertEquals("8e2e0c84-50dd-367c-9e66-f3ab455c78d6", BaseProvider::uuid());
19 | $this->assertEquals("073eb60a-902c-30ab-93d0-a94db371f6c8", BaseProvider::uuid());
20 | }
21 |
22 | protected function isUuid($uuid)
23 | {
24 | return is_string($uuid) && (bool) preg_match('/^[a-f0-9]{8,8}-(?:[a-f0-9]{4,4}-){3,3}[a-f0-9]{12,12}$/i', $uuid);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php:
--------------------------------------------------------------------------------
1 | assertThat($siret, self::isValidSiret());
25 | $this->assertRegExp("/[\d]{3} [\d]{3} [\d]{3} 00[\d]{3}/", $siret);
26 | }
27 |
28 | public function testParagraphWithInvalidNbDigitsReturnsAWellFormattedSiret()
29 | {
30 | $siret = Company::siret(6);
31 |
32 | $this->assertThat($siret, self::isValidSiret());
33 | $this->assertRegExp("/[\d]{3} [\d]{3} [\d]{3} 00[\d]{3}/", $siret);
34 | }
35 |
36 | public function testParagraphWithValidNbDigitsReturnsAWellFormattedSiret()
37 | {
38 | $siret1 = Company::siret(1);
39 | $siret2 = Company::siret(2);
40 | $siret3 = Company::siret(3);
41 | $siret4 = Company::siret(4);
42 |
43 | $this->assertThat($siret1, self :: isValidSiret());
44 | $this->assertRegExp("/[\d]{3} [\d]{3} [\d]{3} 000[\d]{2}/", $siret1);
45 | $this->assertThat($siret2, self :: isValidSiret());
46 | $this->assertRegExp("/[\d]{3} [\d]{3} [\d]{3} 00[\d]{3}/", $siret2);
47 | $this->assertThat($siret3, self :: isValidSiret());
48 | $this->assertRegExp("/[\d]{3} [\d]{3} [\d]{3} 0[\d]{4}/", $siret3);
49 | $this->assertThat($siret4, self :: isValidSiret());
50 | $this->assertRegExp("/[\d]{3} [\d]{3} [\d]{3} [\d]{5}/", $siret4);
51 | }
52 |
53 | public function testSirenReturnsAValidAndWellFormattedSiren()
54 | {
55 | $siret = Company::siren();
56 |
57 | $this->assertThat($siret, self :: isValidSiren());
58 | $this->assertRegExp("/[\d]{3} [\d]{3} [\d]{3}/", $siret);
59 | }
60 |
61 | public function testCatchPhraseValidationReturnsFalse()
62 | {
63 | $isCatchPhraseValid = TestableCompany::isCatchPhraseValid('La sécurité de rouler en toute sécurité');
64 |
65 | $this->assertFalse($isCatchPhraseValid);
66 | }
67 |
68 | public function testCatchPhraseValidationReturnsTrue()
69 | {
70 | $isCatchPhraseValid = TestableCompany::isCatchPhraseValid('La sécurité de rouler en toute simplicité');
71 |
72 | $this->assertTrue($isCatchPhraseValid);
73 | }
74 | }
75 |
76 | class TestableCompany extends Company
77 | {
78 | public static function isCatchPhraseValid($catchPhrase)
79 | {
80 | return parent::isCatchPhraseValid($catchPhrase);
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/vendor/fzaninotto/faker/test/documentor.php:
--------------------------------------------------------------------------------
1 | seed(1);
6 | $documentor = new Faker\Documentor($generator);
7 | ?>
8 | getFormatters() as $provider => $formatters): ?>
9 |
10 | ### ``
11 |
12 | $example): ?>
13 | //
14 |
15 |
16 | seed(5);
6 | ?>
7 |
8 |
9 |
10 |
11 |
12 | boolean(25)): ?>
13 |
14 |
15 |
16 | streetAddress ?>
17 | city ?>
18 | postcode ?>
19 | state ?>
20 |
21 |
22 | boolean(33)): ?>
23 | bs ?>
24 |
25 | boolean(33)): ?>
26 |
27 |
28 |
29 | boolean(15)): ?>
30 |
31 | text(400) ?>
33 | ]]>
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------