This changes nothing, don't look

This commit is contained in:
2023-11-01 18:13:06 -04:00
commit f12a0a9b38
61 changed files with 14431 additions and 0 deletions

14
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,14 @@
stages:
- deploy
deploy:
stage: deploy
image: alpine:latest
only:
- tags
tags:
- build
script:
- apk add curl
- 'curl -iL --header "Job-Token: $CI_JOB_TOKEN" --data tag=${CI_COMMIT_TAG} "${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/composer"'
environment: production

744
CHANGELOG.md Normal file
View File

@@ -0,0 +1,744 @@
# CHANGELOG
## 2019-12-03, v1.9.1
- Add link to PHPStan extension to readme [\#1834](https://github.com/fzaninotto/Faker/pull/1834) ([finwe](https://github.com/finwe))
- Enhancement: Collect code coverage [\#1824](https://github.com/fzaninotto/Faker/pull/1824) ([localheinz](https://github.com/localheinz))
- Enhancement: Use all columns when running tests [\#1823](https://github.com/fzaninotto/Faker/pull/1823) ([localheinz](https://github.com/localheinz))
- Enhancement: Configure verbose output via phpunit.xml.dist [\#1822](https://github.com/fzaninotto/Faker/pull/1822) ([localheinz](https://github.com/localheinz))
- Curly braces for arrays is deprecated in PHP 7.4 [\#1843](https://github.com/fzaninotto/Faker/pull/1843) ([wimg](https://github.com/wimg))
- Fix: Reduce visibility of setUp\(\) and tearDown\(\) [\#1821](https://github.com/fzaninotto/Faker/pull/1821) ([localheinz](https://github.com/localheinz))
- Fix: Mark test classes as final [\#1820](https://github.com/fzaninotto/Faker/pull/1820) ([localheinz](https://github.com/localheinz))
- Fix: Remove unnecessary class-level DocBlocks [\#1819](https://github.com/fzaninotto/Faker/pull/1819) ([localheinz](https://github.com/localheinz))
## 2019-11-10, v1.9.0
This will the last minor release in the `1.x` cycle.
- Add all Iran's provinces land lines numbers [\#1806](https://github.com/fzaninotto/Faker/pull/1806) ([kingofnull](https://github.com/kingofnull))
- replace latin "B" to cyrillic "B" for uk\_UA locale [\#1800](https://github.com/fzaninotto/Faker/pull/1800) ([FI-LIFE](https://github.com/FI-LIFE))
- Add elgentos/masquerade to third-party library list [\#1798](https://github.com/fzaninotto/Faker/pull/1798) ([erikhansen](https://github.com/erikhansen))
- Add link to Gravatar provider repository [\#1796](https://github.com/fzaninotto/Faker/pull/1796) ([ottaviano](https://github.com/ottaviano))
- Add mobileNumber\(\) method for nb\_NO [\#1788](https://github.com/fzaninotto/Faker/pull/1788) ([carestad](https://github.com/carestad))
- Enhancement: Slightly clean up Company provider [\#1783](https://github.com/fzaninotto/Faker/pull/1783) ([localheinz](https://github.com/localheinz))
- Added some more information for autoloading in the readme [\#1780](https://github.com/fzaninotto/Faker/pull/1780) ([pimjansen](https://github.com/pimjansen))
- Enhancement: Add issue template for bug report [\#1779](https://github.com/fzaninotto/Faker/pull/1779) ([localheinz](https://github.com/localheinz))
- Add hslColor to ColorProvider [\#1776](https://github.com/fzaninotto/Faker/pull/1776) ([icanhazstring](https://github.com/icanhazstring))
- Enhancement: Consistently use composer package name for link content [\#1770](https://github.com/fzaninotto/Faker/pull/1770) ([localheinz](https://github.com/localheinz))
- Add Correct Thai words for streets,soi etc names and add Thai First a… [\#1769](https://github.com/fzaninotto/Faker/pull/1769) ([pierrejoye](https://github.com/pierrejoye))
- Enhancement: Assert that postcode generated by Austrian Address provider matches format [\#1766](https://github.com/fzaninotto/Faker/pull/1766) ([localheinz](https://github.com/localheinz))
- Enhancement: Update squizlabs/php\_codesniffer [\#1763](https://github.com/fzaninotto/Faker/pull/1763) ([localheinz](https://github.com/localheinz))
- Enhancement: Assert that imageUrl can be used with gray flag [\#1762](https://github.com/fzaninotto/Faker/pull/1762) ([localheinz](https://github.com/localheinz))
- Enhancement: Introduce build and help targets [\#1761](https://github.com/fzaninotto/Faker/pull/1761) ([localheinz](https://github.com/localheinz))
- Enhancement: Disable Xdebug as early as possible [\#1758](https://github.com/fzaninotto/Faker/pull/1758) ([localheinz](https://github.com/localheinz))
- Enhancement: Clean up .gitattributes [\#1756](https://github.com/fzaninotto/Faker/pull/1756) ([localheinz](https://github.com/localheinz))
- Enhancement: Reference phpunit.xsd as installed with composer [\#1755](https://github.com/fzaninotto/Faker/pull/1755) ([localheinz](https://github.com/localheinz))
- add id\_ID Color [\#1754](https://github.com/fzaninotto/Faker/pull/1754) ([cacing69](https://github.com/cacing69))
- PHP 7.4 compatibility [\#1748](https://github.com/fzaninotto/Faker/pull/1748) ([pimjansen](https://github.com/pimjansen))
- Add lastName gender specific on ru\_RU locale [\#1747](https://github.com/fzaninotto/Faker/pull/1747) ([aanfarhan](https://github.com/aanfarhan))
- Update README - Add a new faker. [\#1731](https://github.com/fzaninotto/Faker/pull/1731) ([drupol](https://github.com/drupol))
- Add faker-eddy-malou third-party library [\#1717](https://github.com/fzaninotto/Faker/pull/1717) ([Metrakit](https://github.com/Metrakit))
- \[de\_DE\] Company\JobTitle: list of common german job titles [\#1716](https://github.com/fzaninotto/Faker/pull/1716) ([amacado](https://github.com/amacado))
- Added 'red' to $safeColorNames [\#1701](https://github.com/fzaninotto/Faker/pull/1701) ([xfudox](https://github.com/xfudox))
- \[pt\_PT/Address\] Add abbreviature to 'travessa' and 'largo' [\#1606](https://github.com/fzaninotto/Faker/pull/1606) ([simaolemos](https://github.com/simaolemos))
- Fix method name for en\_NZ provider in readme [\#1595](https://github.com/fzaninotto/Faker/pull/1595) ([gdhnz](https://github.com/gdhnz))
- Refactoring of the TextTest class [\#1590](https://github.com/fzaninotto/Faker/pull/1590) ([stevegrunwell](https://github.com/stevegrunwell))
- add gender variants for last name \[lt\_LT\] [\#1586](https://github.com/fzaninotto/Faker/pull/1586) ([ikerasLT](https://github.com/ikerasLT))
- add .id TLD [\#1566](https://github.com/fzaninotto/Faker/pull/1566) ([ad3n](https://github.com/ad3n))
- Add Color provider to es\_ES locale [\#1559](https://github.com/fzaninotto/Faker/pull/1559) ([juananruiz](https://github.com/juananruiz))
- Enhancement: Keep packages sorted in composer.json [\#1551](https://github.com/fzaninotto/Faker/pull/1551) ([localheinz](https://github.com/localheinz))
- Portuguese providers for Companies and Internet [\#1537](https://github.com/fzaninotto/Faker/pull/1537) ([promatik](https://github.com/promatik))
- Improve Dutch company names [\#1529](https://github.com/fzaninotto/Faker/pull/1529) ([koole](https://github.com/koole))
- Document randomDigitNot base formatter. [\#1514](https://github.com/fzaninotto/Faker/pull/1514) ([shawnlindstrom](https://github.com/shawnlindstrom))
- Estonian names [\#1461](https://github.com/fzaninotto/Faker/pull/1461) ([much-rebel](https://github.com/much-rebel))
- add birthplace support for ID nik generator [\#1451](https://github.com/fzaninotto/Faker/pull/1451) ([mikk150](https://github.com/mikk150))
- List of banks in Brazil added [\#1427](https://github.com/fzaninotto/Faker/pull/1427) ([diegohenicka](https://github.com/diegohenicka))
- Remove last names from the male first names array \(et\_EE\) [\#1799](https://github.com/fzaninotto/Faker/pull/1799) ([Mihkel100](https://github.com/Mihkel100))
- Update out-of-date currency codes [\#1795](https://github.com/fzaninotto/Faker/pull/1795) ([Brindster](https://github.com/Brindster))
- Floor is not always returning an int [\#1790](https://github.com/fzaninotto/Faker/pull/1790) ([pimjansen](https://github.com/pimjansen))
- typo [\#1789](https://github.com/fzaninotto/Faker/pull/1789) ([enumag](https://github.com/enumag))
- Added batch inserts for doctrine orm populate [\#1781](https://github.com/fzaninotto/Faker/pull/1781) ([pimjansen](https://github.com/pimjansen))
- FIx: Avoid deprecation warning in newer CakePHP version [\#1777](https://github.com/fzaninotto/Faker/pull/1777) ([icanhazstring](https://github.com/icanhazstring))
- Fix: Consistently link to GitHub repositories [\#1774](https://github.com/fzaninotto/Faker/pull/1774) ([localheinz](https://github.com/localheinz))
- Fix: Name of package [\#1772](https://github.com/fzaninotto/Faker/pull/1772) ([localheinz](https://github.com/localheinz))
- Remove BV and HM country codes. [\#1767](https://github.com/fzaninotto/Faker/pull/1767) ([oliverpool](https://github.com/oliverpool))
- Fix: Remove sudo configuration [\#1760](https://github.com/fzaninotto/Faker/pull/1760) ([localheinz](https://github.com/localheinz))
- Fix: Allow nightly builds to fail [\#1759](https://github.com/fzaninotto/Faker/pull/1759) ([localheinz](https://github.com/localheinz))
- Fix: No need to update composer itself [\#1757](https://github.com/fzaninotto/Faker/pull/1757) ([localheinz](https://github.com/localheinz))
- duplicate first name and last name removal [\#1729](https://github.com/fzaninotto/Faker/pull/1729) ([sagautam5](https://github.com/sagautam5))
- Fix-Isreal--Israel [\#1724](https://github.com/fzaninotto/Faker/pull/1724) ([GitEvil](https://github.com/GitEvil))
- fix\(issue-1721\): add phpdoc method and properties annotations for php… [\#1722](https://github.com/fzaninotto/Faker/pull/1722) ([lugus](https://github.com/lugus))
- Typo in function PHPDoc [\#1711](https://github.com/fzaninotto/Faker/pull/1711) ([Dzhuneyt](https://github.com/Dzhuneyt))
- Fix: Add allowed type DateTime to param annotation [\#1697](https://github.com/fzaninotto/Faker/pull/1697) ([localheinz](https://github.com/localheinz))
- Calling a non static method as static not allowed. [\#1696](https://github.com/fzaninotto/Faker/pull/1696) ([wilco-1985](https://github.com/wilco-1985))
- Bug Fix en\_SG mobile number generation [\#1658](https://github.com/fzaninotto/Faker/pull/1658) ([ziming](https://github.com/ziming))
- Update ja\_JP Address Provider [\#1649](https://github.com/fzaninotto/Faker/pull/1649) ([atmngw](https://github.com/atmngw))
- Fixed realText on ja\_JP locale broken, /u missing [\#1634](https://github.com/fzaninotto/Faker/pull/1634) ([mihit](https://github.com/mihit))
- Removed comma and space from $firstNameMale for en\_IN [\#1608](https://github.com/fzaninotto/Faker/pull/1608) ([phpspider](https://github.com/phpspider))
- Prevent Transliterator class autoloading [\#1575](https://github.com/fzaninotto/Faker/pull/1575) ([MontealegreLuis](https://github.com/MontealegreLuis))
- building numbers in Germany never start with a zero or are zero [\#1530](https://github.com/fzaninotto/Faker/pull/1530) ([fostam](https://github.com/fostam))
- Fixing sk\_SK men last names set [\#1459](https://github.com/fzaninotto/Faker/pull/1459) ([pavoltanuska](https://github.com/pavoltanuska))
- Taiwan ID. The initial letter must be a capital letter. p-\>P [\#1434](https://github.com/fzaninotto/Faker/pull/1434) ([slawa-dev](https://github.com/slawa-dev))
- Revert "Added 'red' to $safeColorNames" [\#1778](https://github.com/fzaninotto/Faker/pull/1778) ([fzaninotto](https://github.com/fzaninotto))
- Added realText capability for fr\_CA [\#1686](https://github.com/fzaninotto/Faker/pull/1686) ([bobanum](https://github.com/bobanum))
- Add loremflickr.com Provider to the thrid parties [\#1683](https://github.com/fzaninotto/Faker/pull/1683) ([xvladxtremal](https://github.com/xvladxtremal))
- Add Undeclared Faker Instance to PhoneNumber Test in en\_NG [\#1682](https://github.com/fzaninotto/Faker/pull/1682) ([thearsalan](https://github.com/thearsalan))
- PSR-2 updates to readme [\#1679](https://github.com/fzaninotto/Faker/pull/1679) ([b3none](https://github.com/b3none))
- PHPDoc for `passthrough` function on Generator [\#1678](https://github.com/fzaninotto/Faker/pull/1678) ([tabakhase](https://github.com/tabakhase))
- Make en\_CA Phone Provider Extend the en\_US One [\#1676](https://github.com/fzaninotto/Faker/pull/1676) ([darrylhein](https://github.com/darrylhein))
- Add Valid National Code Generator to fa\_IR Person [\#1675](https://github.com/fzaninotto/Faker/pull/1675) ([thearsalan](https://github.com/thearsalan))
- Updated readme.md: added a missing backslash [\#1673](https://github.com/fzaninotto/Faker/pull/1673) ([aubryfr](https://github.com/aubryfr))
- Add 'Faker\Provider\en\_US\Company::catchPhrase' to ru\_RU locale [\#1668](https://github.com/fzaninotto/Faker/pull/1668) ([axklim](https://github.com/axklim))
- Update deprecated \PHPUnit\_Framework\_TestCase with PHPUnit\Framework\TestCase [\#1664](https://github.com/fzaninotto/Faker/pull/1664) ([thewhit](https://github.com/thewhit))
- Support populating Doctrine's immutable date types [\#1639](https://github.com/fzaninotto/Faker/pull/1639) ([voronkovich](https://github.com/voronkovich))
- add titleMale and titleFemale method to all Person classes [\#1635](https://github.com/fzaninotto/Faker/pull/1635) ([RiverDanceGit](https://github.com/RiverDanceGit))
- Minor typo fix [\#1631](https://github.com/fzaninotto/Faker/pull/1631) ([nhedger](https://github.com/nhedger))
- Add link to er1z/fakemock [\#1622](https://github.com/fzaninotto/Faker/pull/1622) ([er1z](https://github.com/er1z))
- Add Dutch \(nl\_NL\) job titles [\#1618](https://github.com/fzaninotto/Faker/pull/1618) ([SjorsO](https://github.com/SjorsO))
- Exclude files and folder from release archive [\#1617](https://github.com/fzaninotto/Faker/pull/1617) ([ankurk91](https://github.com/ankurk91))
- Update doc block [\#1615](https://github.com/fzaninotto/Faker/pull/1615) ([ankurk91](https://github.com/ankurk91))
- Suggest PSR-4 compliant autoloader in comment [\#1614](https://github.com/fzaninotto/Faker/pull/1614) ([samnela](https://github.com/samnela))
- Fix dateTimeBetween\(\) Argument on Generator phpdoc [\#1583](https://github.com/fzaninotto/Faker/pull/1583) ([hisomura](https://github.com/hisomura))
- Fix Dutch typo [\#1580](https://github.com/fzaninotto/Faker/pull/1580) ([gizburdt](https://github.com/gizburdt))
- Old city names changed to new ones [\#1578](https://github.com/fzaninotto/Faker/pull/1578) ([goszowski](https://github.com/goszowski))
- Correct documentation [\#1571](https://github.com/fzaninotto/Faker/pull/1571) ([rquadling](https://github.com/rquadling))
- Make $suffix protected not private in nl\_NL\Person provider [\#1561](https://github.com/fzaninotto/Faker/pull/1561) ([SpadXIII](https://github.com/SpadXIII))
- Add PicsumPhotos Provider to the thrid parties [\#1560](https://github.com/fzaninotto/Faker/pull/1560) ([bluemmb](https://github.com/bluemmb))
- fix austrian postal codes starting with invalid 0 [\#1545](https://github.com/fzaninotto/Faker/pull/1545) ([mpge](https://github.com/mpge))
- Restore a random seed when the Generator is destroyed [\#1534](https://github.com/fzaninotto/Faker/pull/1534) ([lyrixx](https://github.com/lyrixx))
- Add a swiss social security number \(AVS13\) generator [\#1533](https://github.com/fzaninotto/Faker/pull/1533) ([nhedger](https://github.com/nhedger))
- Small tweaks [\#1526](https://github.com/fzaninotto/Faker/pull/1526) ([carusogabriel](https://github.com/carusogabriel))
- fix ukraine first name person, delete space [\#1525](https://github.com/fzaninotto/Faker/pull/1525) ([Yasuslik](https://github.com/Yasuslik))
- Removed unknown postcode [\#1440](https://github.com/fzaninotto/Faker/pull/1440) ([ayanozturk](https://github.com/ayanozturk))
- Add more PhoneNumber options for es\_ES [\#1219](https://github.com/fzaninotto/Faker/pull/1219) ([driade](https://github.com/driade))
- Fix duplication in uk\_UA male first names [\#1214](https://github.com/fzaninotto/Faker/pull/1214) ([fre5h](https://github.com/fre5h))
- Added missing grayscale option/flag to Image provider [\#928](https://github.com/fzaninotto/Faker/pull/928) ([sebastianvilla](https://github.com/sebastianvilla))
## 2018-07-12, v1.8.0
- Typo in readme [\#1521](https://github.com/fzaninotto/Faker/pull/1521) ([jmhobbs](https://github.com/jmhobbs))
- Replaced Hilll with Hill [\#1516](https://github.com/fzaninotto/Faker/pull/1516) ([MarkVaughn](https://github.com/MarkVaughn))
- \[it\_IT\] Improve vat ID generated using official rules [\#1508](https://github.com/fzaninotto/Faker/pull/1508) ([mavimo](https://github.com/mavimo))
- \[hu\_HU\] Address: Fix unnecessary new line in string [\#1507](https://github.com/fzaninotto/Faker/pull/1507) ([ntomka](https://github.com/ntomka))
- add phone numer format [\#1506](https://github.com/fzaninotto/Faker/pull/1506) ([Enosh-Yu](https://github.com/Enosh-Yu))
- Fix typo in fr\_CA Provider [\#1505](https://github.com/fzaninotto/Faker/pull/1505) ([ultreson](https://github.com/ultreson))
- Add fake-car provider link [\#1497](https://github.com/fzaninotto/Faker/pull/1497) ([pelmered](https://github.com/pelmered))
- create `passthrough` function [\#1493](https://github.com/fzaninotto/Faker/pull/1493) ([browner12](https://github.com/browner12))
- update Polish bank list [\#1482](https://github.com/fzaninotto/Faker/pull/1482) ([IonBazan](https://github.com/IonBazan))
- Update the parameters to check if the setter is callable [\#1470](https://github.com/fzaninotto/Faker/pull/1470) ([rossmitchell](https://github.com/rossmitchell))
- Push the max date far into the future so the test can pass [\#1469](https://github.com/fzaninotto/Faker/pull/1469) ([rossmitchell](https://github.com/rossmitchell))
- Update Address.php [\#1465](https://github.com/fzaninotto/Faker/pull/1465) ([Saibamen](https://github.com/Saibamen))
- Turkish identity number for tr\_TR [\#1462](https://github.com/fzaninotto/Faker/pull/1462) ([aykutaras](https://github.com/aykutaras))
- Fixing rare iin with 13-digits. [\#1450](https://github.com/fzaninotto/Faker/pull/1450) ([vadimonus](https://github.com/vadimonus))
- Fix Polish PESEL faker [\#1449](https://github.com/fzaninotto/Faker/pull/1449) ([Dartui](https://github.com/Dartui))
- Adds valid 08 number formats for fr\_FR [\#1439](https://github.com/fzaninotto/Faker/pull/1439) ([ppelgrims](https://github.com/ppelgrims))
- Add YouTube provider link [\#1422](https://github.com/fzaninotto/Faker/pull/1422) ([aalaap](https://github.com/aalaap))
- Update PHPDoc of the DateTime provider. [\#1419](https://github.com/fzaninotto/Faker/pull/1419) ([tomzx](https://github.com/tomzx))
- Normalize name of variable [\#1412](https://github.com/fzaninotto/Faker/pull/1412) ([eaglewu](https://github.com/eaglewu))
- Added "blockchain" to en-us company provider catchPhrase method [\#1411](https://github.com/fzaninotto/Faker/pull/1411) ([samoldenburg](https://github.com/samoldenburg))
- Fix for Spot2 ORM EntityPopulator [\#1408](https://github.com/fzaninotto/Faker/pull/1408) ([michal-borek](https://github.com/michal-borek))
- TH color name [\#1404](https://github.com/fzaninotto/Faker/pull/1404) ([Naruedom](https://github.com/Naruedom))
- added Malaysia \[ms\_MY\] locale [\#1403](https://github.com/fzaninotto/Faker/pull/1403) ([kenfai](https://github.com/kenfai))
- Implementation of the function that generates Brazilian area codes fixed. [\#1401](https://github.com/fzaninotto/Faker/pull/1401) ([jackmiras](https://github.com/jackmiras))
- VISA retired the 13 digit PAN moved to new cardParams [\#1400](https://github.com/fzaninotto/Faker/pull/1400) ([hppycoder](https://github.com/hppycoder))
- Remove unused variable inside closure [\#1395](https://github.com/fzaninotto/Faker/pull/1395) ([carusogabriel](https://github.com/carusogabriel))
- .nz domain updates [\#1393](https://github.com/fzaninotto/Faker/pull/1393) ([xurizaemon](https://github.com/xurizaemon))
- Add licenceCode method in the to es\_ES person provider [\#1392](https://github.com/fzaninotto/Faker/pull/1392) ([ffiguereo](https://github.com/ffiguereo))
- allow `randomElements` to accept a Traversable object [\#1389](https://github.com/fzaninotto/Faker/pull/1389) ([browner12](https://github.com/browner12))
- Doc: rg remove formatting [\#1387](https://github.com/fzaninotto/Faker/pull/1387) ([emtudo](https://github.com/emtudo))
- Add numbers with start 4 [\#1386](https://github.com/fzaninotto/Faker/pull/1386) ([emtudo](https://github.com/emtudo))
- update th\_TH mobile number format [\#1385](https://github.com/fzaninotto/Faker/pull/1385) ([earthpyy](https://github.com/earthpyy))
- Translate country names for lv\_LV provider. [\#1383](https://github.com/fzaninotto/Faker/pull/1383) ([ronaldsgailis](https://github.com/ronaldsgailis))
- Clean elses [\#1382](https://github.com/fzaninotto/Faker/pull/1382) ([carusogabriel](https://github.com/carusogabriel))
- French vat formatter [\#1381](https://github.com/fzaninotto/Faker/pull/1381) ([ppelgrims](https://github.com/ppelgrims))
- Replaces rtrim with preg\_replace [\#1380](https://github.com/fzaninotto/Faker/pull/1380) ([ppelgrims](https://github.com/ppelgrims))
- Refactoring tests [\#1375](https://github.com/fzaninotto/Faker/pull/1375) ([carusogabriel](https://github.com/carusogabriel))
- Added link in readme to provider FakerRestaurant [\#1374](https://github.com/fzaninotto/Faker/pull/1374) ([jzonta](https://github.com/jzonta))
- Remove obsolete currency codes [\#1373](https://github.com/fzaninotto/Faker/pull/1373) ([tpraxl](https://github.com/tpraxl))
- \[ru\_RU\] Updated countries and added source link [\#1372](https://github.com/fzaninotto/Faker/pull/1372) ([ilyahoilik](https://github.com/ilyahoilik))
- Test against PHP 7.2 [\#1371](https://github.com/fzaninotto/Faker/pull/1371) ([carusogabriel](https://github.com/carusogabriel))
- Feature: nl\_BE text provider [\#1370](https://github.com/fzaninotto/Faker/pull/1370) ([rauwebieten](https://github.com/rauwebieten))
- default value for Payment::iban\(\) country code [\#1369](https://github.com/fzaninotto/Faker/pull/1369) ([madmanmax](https://github.com/madmanmax))
- skip test failing on bigendian [\#1365](https://github.com/fzaninotto/Faker/pull/1365) ([remicollet](https://github.com/remicollet))
- Update Person.php [\#1364](https://github.com/fzaninotto/Faker/pull/1364) ([majamusan](https://github.com/majamusan))
- Prevent errors on private methods [\#1363](https://github.com/fzaninotto/Faker/pull/1363) ([petecoop](https://github.com/petecoop))
- adds rijksregisternummer [\#1361](https://github.com/fzaninotto/Faker/pull/1361) ([ppelgrims](https://github.com/ppelgrims))
- Add secondary address to fr\_FR provider [\#1356](https://github.com/fzaninotto/Faker/pull/1356) ([nicodmf](https://github.com/nicodmf))
- Add company provider for tr\_TR [\#1355](https://github.com/fzaninotto/Faker/pull/1355) ([yuks](https://github.com/yuks))
- nb\_NO provider updates [\#1350](https://github.com/fzaninotto/Faker/pull/1350) ([alexqhj](https://github.com/alexqhj))
- only test available date range on 32-bit [\#1348](https://github.com/fzaninotto/Faker/pull/1348) ([remicollet](https://github.com/remicollet))
- Bump PHPUnit version for namespace compatibility [\#1345](https://github.com/fzaninotto/Faker/pull/1345) ([carusogabriel](https://github.com/carusogabriel))
- Use PSR-1 for PHPUnit TestCase [\#1344](https://github.com/fzaninotto/Faker/pull/1344) ([carusogabriel](https://github.com/carusogabriel))
- Fix FR\_fr 07 prefix mobile number generation [\#1343](https://github.com/fzaninotto/Faker/pull/1343) ([svanpoeck](https://github.com/svanpoeck))
- Update Text.php [\#1339](https://github.com/fzaninotto/Faker/pull/1339) ([gulaandrij](https://github.com/gulaandrij))
- Add two new company type in the Swiss Provider [\#1336](https://github.com/fzaninotto/Faker/pull/1336) ([pvullioud](https://github.com/pvullioud))
- Change symbol 'minus' with code 226 to 'minus' with code 45 [\#1333](https://github.com/fzaninotto/Faker/pull/1333) ([Negasus](https://github.com/Negasus))
- \[sl\_SI\] Created provider for Company [\#1331](https://github.com/fzaninotto/Faker/pull/1331) ([alesvaupotic](https://github.com/alesvaupotic))
- Update city name [\#1328](https://github.com/fzaninotto/Faker/pull/1328) ([s9801077](https://github.com/s9801077))
- Fix \#1305 realText in some cases breaks last character [\#1326](https://github.com/fzaninotto/Faker/pull/1326) ([iamraccoon](https://github.com/iamraccoon))
- Real Dutch postal codes [\#1323](https://github.com/fzaninotto/Faker/pull/1323) ([ametad](https://github.com/ametad))
- Added male and female titles for the en\_ZA locale [\#1321](https://github.com/fzaninotto/Faker/pull/1321) ([ViGouRCanberra](https://github.com/ViGouRCanberra))
- Add German Email Providers [\#1320](https://github.com/fzaninotto/Faker/pull/1320) ([Stoffo](https://github.com/Stoffo))
- Fix "Resource temporarily unavailable" [\#1319](https://github.com/fzaninotto/Faker/pull/1319) ([eberkund](https://github.com/eberkund))
- Introduced the ability to specify a default timezone... [\#1316](https://github.com/fzaninotto/Faker/pull/1316) ([telkins](https://github.com/telkins))
- South African licence codes [\#1315](https://github.com/fzaninotto/Faker/pull/1315) ([royalmitten](https://github.com/royalmitten))
- Fix with incorrect name city. [\#1309](https://github.com/fzaninotto/Faker/pull/1309) ([zzenmate](https://github.com/zzenmate))
- Fixed type-o in readme under section about Language specific formatters [\#1302](https://github.com/fzaninotto/Faker/pull/1302) ([espenkn](https://github.com/espenkn))
- Update Person.php [\#1298](https://github.com/fzaninotto/Faker/pull/1298) ([yappkahowe](https://github.com/yappkahowe))
- Allow children classes to access self::$suffix [\#1296](https://github.com/fzaninotto/Faker/pull/1296) ([greg0ire](https://github.com/greg0ire))
- Fix with namespace payment provider for uk\_UA [\#1293](https://github.com/fzaninotto/Faker/pull/1293) ([zzenmate](https://github.com/zzenmate))
- Update zh\_TW text provider [\#1292](https://github.com/fzaninotto/Faker/pull/1292) ([s9801077](https://github.com/s9801077))
- Fix CURL status code in ImageTest.php [\#1290](https://github.com/fzaninotto/Faker/pull/1290) ([Sanfra1407](https://github.com/Sanfra1407))
- Tax Id for companies and new formats for es\_VE [\#1287](https://github.com/fzaninotto/Faker/pull/1287) ([DIOHz0r](https://github.com/DIOHz0r))
- Added idNumber for nl\_NL [\#1283](https://github.com/fzaninotto/Faker/pull/1283) ([artorozenga](https://github.com/artorozenga))
- Feature/en us company ein [\#1273](https://github.com/fzaninotto/Faker/pull/1273) ([zachflower](https://github.com/zachflower))
## 2017-08-15, v1.7.0
- Added more Ukrainian banks [\#1271](https://github.com/fzaninotto/Faker/pull/1271) ([iamraccoon](https://github.com/iamraccoon))
- Hotfix/failing unit tests [\#1269](https://github.com/fzaninotto/Faker/pull/1269) ([zachflower](https://github.com/zachflower))
- Lock Travis-CI environment to Ubuntu Precise [\#1268](https://github.com/fzaninotto/Faker/pull/1268) ([zachflower](https://github.com/zachflower))
- Added Ukrainian job title [\#1267](https://github.com/fzaninotto/Faker/pull/1267) ([iamraccoon](https://github.com/iamraccoon))
- Add compliant en\_US SSN generator [\#1266](https://github.com/fzaninotto/Faker/pull/1266) ([zachflower](https://github.com/zachflower))
- Added more Ukrainian streets and removed irrelevant names. Added more Ukrainian mobile formats [\#1265](https://github.com/fzaninotto/Faker/pull/1265) ([iamraccoon](https://github.com/iamraccoon))
- Add Internet Format for ja\_JP. [\#1260](https://github.com/fzaninotto/Faker/pull/1260) ([itigoppo](https://github.com/itigoppo))
- rectify ISO 4217 codes [\#1258](https://github.com/fzaninotto/Faker/pull/1258) ([eidng8](https://github.com/eidng8))
- Corrected of grammar of Ukrainian middlenames and test added [\#1257](https://github.com/fzaninotto/Faker/pull/1257) ([vladbuk](https://github.com/vladbuk))
- Update ISO 4217 active codes [\#1251](https://github.com/fzaninotto/Faker/pull/1251) ([eidng8](https://github.com/eidng8))
- Update Composer File [\#1248](https://github.com/fzaninotto/Faker/pull/1248) ([vinkla](https://github.com/vinkla))
- Set capitals to false [\#1243](https://github.com/fzaninotto/Faker/pull/1243) ([Stichoza](https://github.com/Stichoza))
- Use static instead of self [\#1242](https://github.com/fzaninotto/Faker/pull/1242) ([Stichoza](https://github.com/Stichoza))
- Add VAT french format [\#1241](https://github.com/fzaninotto/Faker/pull/1241) ([baptistedonaux](https://github.com/baptistedonaux))
- Add swedish job titles [\#1234](https://github.com/fzaninotto/Faker/pull/1234) ([vinkla](https://github.com/vinkla))
- Name Simo shouldn't have comma in it [\#1230](https://github.com/fzaninotto/Faker/pull/1230) ([simoheinonen](https://github.com/simoheinonen))
- Fix: Add method annotation for ValidGenerator [\#1223](https://github.com/fzaninotto/Faker/pull/1223) ([localheinz](https://github.com/localheinz))
- Add real text for es\_ES [\#1220](https://github.com/fzaninotto/Faker/pull/1220) ([driade](https://github.com/driade))
- Fix spelling errors [\#1218](https://github.com/fzaninotto/Faker/pull/1218) ([driade](https://github.com/driade))
- Fix spelling errors [\#1217](https://github.com/fzaninotto/Faker/pull/1217) ([driade](https://github.com/driade))
- Fixes typo [\#1212](https://github.com/fzaninotto/Faker/pull/1212) ([skullboner](https://github.com/skullboner))
- Add Person::middleName for ru\_RU provider [\#1209](https://github.com/fzaninotto/Faker/pull/1209) ([JustBlackBird](https://github.com/JustBlackBird))
- Fix creditCardDetails type hint [\#1208](https://github.com/fzaninotto/Faker/pull/1208) ([jejung](https://github.com/jejung))
- Expand dictionaries for ru\_RU locale [\#1206](https://github.com/fzaninotto/Faker/pull/1206) ([pwsdotru](https://github.com/pwsdotru))
- Fix ng\_NG to en\_NG [\#1205](https://github.com/fzaninotto/Faker/pull/1205) ([raphaeldealmeida](https://github.com/raphaeldealmeida))
- Add INN and KPP support for ru\_RU locale [\#1204](https://github.com/fzaninotto/Faker/pull/1204) ([pwsdotru](https://github.com/pwsdotru))
- Remove break line on pt\_PT Address format [\#1203](https://github.com/fzaninotto/Faker/pull/1203) ([raphaeldealmeida](https://github.com/raphaeldealmeida))
- Fix syntax of phpdoc boolean property [\#1198](https://github.com/fzaninotto/Faker/pull/1198) ([pavelkovar](https://github.com/pavelkovar))
- add en\_HK provider [\#1196](https://github.com/fzaninotto/Faker/pull/1196) ([miklcct](https://github.com/miklcct))
- use secure https [\#1186](https://github.com/fzaninotto/Faker/pull/1186) ([jpuck](https://github.com/jpuck))
- Add PhoneNumberFormat for ja\_JP. [\#1185](https://github.com/fzaninotto/Faker/pull/1185) ([itigoppo](https://github.com/itigoppo))
- Fix: Add class-level method annotations for DateTime provider [\#1183](https://github.com/fzaninotto/Faker/pull/1183) ([localheinz](https://github.com/localheinz))
- Add ar\_SA Color Provider [\#1182](https://github.com/fzaninotto/Faker/pull/1182) ([alhoqbani](https://github.com/alhoqbani))
- Added uk\_UA Payment provider with bank name generator [\#1181](https://github.com/fzaninotto/Faker/pull/1181) ([spaghettimaster](https://github.com/spaghettimaster))
- Typos [\#1177](https://github.com/fzaninotto/Faker/pull/1177) ([ankitpokhrel](https://github.com/ankitpokhrel))
- Fix XML document example [\#1176](https://github.com/fzaninotto/Faker/pull/1176) ([ankitpokhrel](https://github.com/ankitpokhrel))
- Added Emoji to Miscellaneous [\#1175](https://github.com/fzaninotto/Faker/pull/1175) ([thomasfdm](https://github.com/thomasfdm))
- Typos and doc block fixes [\#1170](https://github.com/fzaninotto/Faker/pull/1170) ([ankitpokhrel](https://github.com/ankitpokhrel))
- Rewrote deprecated `each\(\)` usage [\#1168](https://github.com/fzaninotto/Faker/pull/1168) ([hboomsma](https://github.com/hboomsma))
- Refactor text method to remove duplication [\#1163](https://github.com/fzaninotto/Faker/pull/1163) ([ankitpokhrel](https://github.com/ankitpokhrel))
- Generate valid individual identification numbers kk\_KZ [\#1161](https://github.com/fzaninotto/Faker/pull/1161) ([YerlenZhubangaliyev](https://github.com/YerlenZhubangaliyev))
- Added Address and Company \[fa\_IR\] [\#1160](https://github.com/fzaninotto/Faker/pull/1160) ([thisissorna](https://github.com/thisissorna))
- Add Peruvian DNI generator [\#1158](https://github.com/fzaninotto/Faker/pull/1158) ([jgwong](https://github.com/jgwong))
- Removed double semicolon [\#1154](https://github.com/fzaninotto/Faker/pull/1154) ([pjona](https://github.com/pjona))
- Add prefixes for nl\_NL [\#1151](https://github.com/fzaninotto/Faker/pull/1151) ([hyperized](https://github.com/hyperized))
- Separated male and female names for sr\_RS locale. [\#1144](https://github.com/fzaninotto/Faker/pull/1144) ([bogdanpet](https://github.com/bogdanpet))
- Add personal ID, VAT for zh\_TW [\#1135](https://github.com/fzaninotto/Faker/pull/1135) ([Dagolin](https://github.com/Dagolin))
- Updating ninth digit on whole country [\#1132](https://github.com/fzaninotto/Faker/pull/1132) ([gpressutto5](https://github.com/gpressutto5))
- Indian states added to en\_IN locale [\#1131](https://github.com/fzaninotto/Faker/pull/1131) ([jiveshsg](https://github.com/jiveshsg))
- Add Text provider for ro\_MD [\#1129](https://github.com/fzaninotto/Faker/pull/1129) ([wecerny](https://github.com/wecerny))
- Add strict to randomNumber example [\#1124](https://github.com/fzaninotto/Faker/pull/1124) ([leepownall](https://github.com/leepownall))
- Say Eloquent is supported [\#1123](https://github.com/fzaninotto/Faker/pull/1123) ([guidocella](https://github.com/guidocella))
- Link Eloquent Populator [\#1120](https://github.com/fzaninotto/Faker/pull/1120) ([guidocella](https://github.com/guidocella))
- Removed dead code from Luhn.php [\#1118](https://github.com/fzaninotto/Faker/pull/1118) ([Newman101](https://github.com/Newman101))
- Improve Internet::transliterate performance [\#1112](https://github.com/fzaninotto/Faker/pull/1112) ([dunglas](https://github.com/dunglas))
- fix typo [\#1109](https://github.com/fzaninotto/Faker/pull/1109) ([johannesnagl](https://github.com/johannesnagl))
- \[cs\_CZ\] Fixed Czech phone numbers [\#1108](https://github.com/fzaninotto/Faker/pull/1108) ([tomasbedrich](https://github.com/tomasbedrich))
- Update MasterCard BIN Range [\#1103](https://github.com/fzaninotto/Faker/pull/1103) ([andysnell](https://github.com/andysnell))
- Add biggest german cities [\#1102](https://github.com/fzaninotto/Faker/pull/1102) ([Konafets](https://github.com/Konafets))
- Change postal code format for ko\_KR [\#1094](https://github.com/fzaninotto/Faker/pull/1094) ([coozplz](https://github.com/coozplz))
- Introduced the ability to specify the timezone for dateTimeThis\*\(\) methods [\#1090](https://github.com/fzaninotto/Faker/pull/1090) ([telkins](https://github.com/telkins))
- Fixed Issue \#1086 [\#1088](https://github.com/fzaninotto/Faker/pull/1088) ([Newman101](https://github.com/Newman101))
- \[ja\_JP\]kana of Japanese name by gender. [\#1087](https://github.com/fzaninotto/Faker/pull/1087) ([itigoppo](https://github.com/itigoppo))
- Fix unused code [\#1083](https://github.com/fzaninotto/Faker/pull/1083) ([borgogelli](https://github.com/borgogelli))
- Amended permissions for en\_GB AddressTest.php [\#1071](https://github.com/fzaninotto/Faker/pull/1071) ([Newman101](https://github.com/Newman101))
- Ensure unique IDs in randomHtml [\#1068](https://github.com/fzaninotto/Faker/pull/1068) ([vlakoff](https://github.com/vlakoff))
- Updated \[de\_DE\] city names [\#1067](https://github.com/fzaninotto/Faker/pull/1067) ([plxx](https://github.com/plxx))
- Update method signature in Generator phpdoc [\#1066](https://github.com/fzaninotto/Faker/pull/1066) ([vlakoff](https://github.com/vlakoff))
- Add Thai providers [\#1065](https://github.com/fzaninotto/Faker/pull/1065) ([tuwannu](https://github.com/tuwannu))
- \(Minor\) Fixed the default locale stated in the readme [\#1064](https://github.com/fzaninotto/Faker/pull/1064) ([taylankasap](https://github.com/taylankasap))
- \[nl\_NL\] Make person provider behave more realistically [\#1061](https://github.com/fzaninotto/Faker/pull/1061) ([curry684](https://github.com/curry684))
- Add allowDuplicates option to randomElements\(\) [\#1060](https://github.com/fzaninotto/Faker/pull/1060) ([vlakoff](https://github.com/vlakoff))
- Docblocks: Add some missing @method tags [\#1059](https://github.com/fzaninotto/Faker/pull/1059) ([Kurre](https://github.com/Kurre))
- \[fi\_FI\] Improve phone number generator [\#1054](https://github.com/fzaninotto/Faker/pull/1054) ([Kurre](https://github.com/Kurre))
- Add personalIdentityNumber\(\) to fi\_FI/Person.php [\#1053](https://github.com/fzaninotto/Faker/pull/1053) ([oittaa](https://github.com/oittaa))
- Issue \#1041 [\#1052](https://github.com/fzaninotto/Faker/pull/1052) ([daleattree](https://github.com/daleattree))
- Update Text.php [\#1051](https://github.com/fzaninotto/Faker/pull/1051) ([gulaandrij](https://github.com/gulaandrij))
- Fix French phone numbers with 07 prefix [\#1046](https://github.com/fzaninotto/Faker/pull/1046) ([fzaninotto](https://github.com/fzaninotto))
- \[Generator.php\] mt\_rand\(\) changed in PHP 7.1 [\#1045](https://github.com/fzaninotto/Faker/pull/1045) ([oittaa](https://github.com/oittaa))
- Add 'FI' to Payment Provider [\#1044](https://github.com/fzaninotto/Faker/pull/1044) ([oittaa](https://github.com/oittaa))
- Added id number generator to Person Provider for the en\_ZA locale [\#1039](https://github.com/fzaninotto/Faker/pull/1039) ([smithandre](https://github.com/smithandre))
- \[Feature\] Add nigerian provider [\#1030](https://github.com/fzaninotto/Faker/pull/1030) ([elchroy](https://github.com/elchroy))
- \[pl\_PL\] Handle state. [\#1029](https://github.com/fzaninotto/Faker/pull/1029) ([piotrooo](https://github.com/piotrooo))
- Fixed polish text - change '--' into '-'. [\#1027](https://github.com/fzaninotto/Faker/pull/1027) ([piotrooo](https://github.com/piotrooo))
- Update Text.php [\#1025](https://github.com/fzaninotto/Faker/pull/1025) ([gulaandrij](https://github.com/gulaandrij))
- Adding Nationalized Citizens to DNI in Person.php [\#1021](https://github.com/fzaninotto/Faker/pull/1021) ([celisflen-bers](https://github.com/celisflen-bers))
- Add nik to indonesia [\#1019](https://github.com/fzaninotto/Faker/pull/1019) ([Nuffic](https://github.com/Nuffic))
- fix mb\_substr missing parameter error when generating japanese string with realText method [\#1018](https://github.com/fzaninotto/Faker/pull/1018) ([horan-geeker](https://github.com/horan-geeker))
- IBAN Formatters for New Locales [\#1015](https://github.com/fzaninotto/Faker/pull/1015) ([okj579](https://github.com/okj579))
- German Bank Names [\#1014](https://github.com/fzaninotto/Faker/pull/1014) ([okj579](https://github.com/okj579))
- Adding countries for pl\_PL provider [\#1009](https://github.com/fzaninotto/Faker/pull/1009) ([mertcanesen](https://github.com/mertcanesen))
- Adding Pattern Lab plugin to list of 3rd party libraries [\#1008](https://github.com/fzaninotto/Faker/pull/1008) ([EvanLovely](https://github.com/EvanLovely))
- Korea top 100 lastName [\#1006](https://github.com/fzaninotto/Faker/pull/1006) ([tael](https://github.com/tael))
- Use real Belgian postcodes instead of random number [\#1004](https://github.com/fzaninotto/Faker/pull/1004) ([toonevdb](https://github.com/toonevdb))
- Add bankAccountNumber implementations [\#1000](https://github.com/fzaninotto/Faker/pull/1000) ([akramfares](https://github.com/akramfares))
- Generates a random NIR number \(fr\_FR\) [\#997](https://github.com/fzaninotto/Faker/pull/997) ([Ultim4T0m](https://github.com/Ultim4T0m))
- \#989 Fix country typo [\#996](https://github.com/fzaninotto/Faker/pull/996) ([adriantombu](https://github.com/adriantombu))
- adding back CNP [\#988](https://github.com/fzaninotto/Faker/pull/988) ([the-noob](https://github.com/the-noob))
- Fix phpunit tests fail on 64-bit systems \#982 [\#983](https://github.com/fzaninotto/Faker/pull/983) ([Powerhead13](https://github.com/Powerhead13))
- Remove trailing dot in username if any [\#975](https://github.com/fzaninotto/Faker/pull/975) ([vlakoff](https://github.com/vlakoff))
- HTML Lorem [\#971](https://github.com/fzaninotto/Faker/pull/971) ([rudkjobing](https://github.com/rudkjobing))
- Fix a mixup between male and female last names in Icelandic. [\#970](https://github.com/fzaninotto/Faker/pull/970) ([arthur-olafsson](https://github.com/arthur-olafsson))
- Remove duplicate [\#969](https://github.com/fzaninotto/Faker/pull/969) ([mijgame](https://github.com/mijgame))
- fix \[zh\_CN\]PhoneNumber illegal operator prefix [\#966](https://github.com/fzaninotto/Faker/pull/966) ([zhwei](https://github.com/zhwei))
- es\_ES: Generate VAT Number [\#964](https://github.com/fzaninotto/Faker/pull/964) ([miguelgf](https://github.com/miguelgf))
- Update Image.php [\#963](https://github.com/fzaninotto/Faker/pull/963) ([gulaandrij](https://github.com/gulaandrij))
- Remove cnp formatter from RO\_ro locale \(fails tests\) [\#962](https://github.com/fzaninotto/Faker/pull/962) ([fzaninotto](https://github.com/fzaninotto))
- Adding valid en\_GB postcodes [\#961](https://github.com/fzaninotto/Faker/pull/961) ([the-noob](https://github.com/the-noob))
- Adding Text for ro\_RO [\#959](https://github.com/fzaninotto/Faker/pull/959) ([the-noob](https://github.com/the-noob))
- Minor: Fixed trailing space in DateTime provider [\#956](https://github.com/fzaninotto/Faker/pull/956) ([tifabien](https://github.com/tifabien))
- Remove 'Stripper' from en\_US job titles [\#954](https://github.com/fzaninotto/Faker/pull/954) ([amcsi](https://github.com/amcsi))
- fix 32bits issue [\#953](https://github.com/fzaninotto/Faker/pull/953) ([remicollet](https://github.com/remicollet))
- Fix EAN8 checkSum generator [\#951](https://github.com/fzaninotto/Faker/pull/951) ([MatthieuMota](https://github.com/MatthieuMota))
- Fixed description and the use of early undocumented parameters. [\#949](https://github.com/fzaninotto/Faker/pull/949) ([andrey-helldar](https://github.com/andrey-helldar))
- Pushing new mobile prefixes in philippines [\#944](https://github.com/fzaninotto/Faker/pull/944) ([napoleon101392](https://github.com/napoleon101392))
- Update Company.php [\#943](https://github.com/fzaninotto/Faker/pull/943) ([thiagotalma](https://github.com/thiagotalma))
- Fix to Issue \#935 - German Locale [\#936](https://github.com/fzaninotto/Faker/pull/936) ([Newman101](https://github.com/Newman101))
- el\_CY Locale [\#930](https://github.com/fzaninotto/Faker/pull/930) ([softius](https://github.com/softius))
- Add phpdoc method dateTimeInInterval in Generator.php [\#926](https://github.com/fzaninotto/Faker/pull/926) ([KeithYeh](https://github.com/KeithYeh))
- Harmonize fr\_\*\Company [\#918](https://github.com/fzaninotto/Faker/pull/918) ([Max13](https://github.com/Max13))
- Fix: fix invalid parameter of mb\_substr\(\) [\#917](https://github.com/fzaninotto/Faker/pull/917) ([tkawaji](https://github.com/tkawaji))
- kk\_KZ Company/person identification numbers unit tests [\#916](https://github.com/fzaninotto/Faker/pull/916) ([YerlenZhubangaliyev](https://github.com/YerlenZhubangaliyev))
- ka\_GE: overall improvements to ka\_GE locale [\#913](https://github.com/fzaninotto/Faker/pull/913) ([hertzg](https://github.com/hertzg))
- Fix: Do not pick a random float less than minimum [\#909](https://github.com/fzaninotto/Faker/pull/909) ([localheinz](https://github.com/localheinz))
- Fix: Prefer dependencies installed from dist [\#908](https://github.com/fzaninotto/Faker/pull/908) ([localheinz](https://github.com/localheinz))
- Add a building number with letter to German speaking locales. [\#903](https://github.com/fzaninotto/Faker/pull/903) ([markuspoerschke](https://github.com/markuspoerschke))
- \[RFR\] Remove parts of the hu\_HU address formatters [\#902](https://github.com/fzaninotto/Faker/pull/902) ([fzaninotto](https://github.com/fzaninotto))
- use Luhn to calculate ar\_SA id numbers. [\#875](https://github.com/fzaninotto/Faker/pull/875) ([FooBarQuaxx](https://github.com/FooBarQuaxx))
- Fix Doctrine ODM Support [\#489](https://github.com/fzaninotto/Faker/pull/489) ([cbourgois](https://github.com/cbourgois))
## 2016-04-29, v1.6.0
- Remove parts of the Hungarian (hu\_HU) address formatters [\#902](https://github.com/fzaninotto/Faker/pull/902) ([fzaninotto](https://github.com/fzaninotto))
- Renamed norwegian (nb\_NO) locale [\#901](https://github.com/fzaninotto/Faker/pull/901) ([fzaninotto](https://github.com/fzaninotto))
- Improveed German (de\_DE) titles [\#897](https://github.com/fzaninotto/Faker/pull/897) ([christianbartels](https://github.com/christianbartels))
- Added VAT formatter to nl\_BE and fr\_BE providers [\#896](https://github.com/fzaninotto/Faker/pull/896) ([anvanza](https://github.com/anvanza))
- Fixed provider namespace for Lithuanian (lt\_LT) [\#894](https://github.com/fzaninotto/Faker/pull/894) ([sanis](https://github.com/sanis))
- Removed unnecessary (and incompatible) license from Russian and Ukrainian (uk\_UA & ru\_RU) Text providers [\#892](https://github.com/fzaninotto/Faker/pull/892) ([Newman101](https://github.com/Newman101))
- Improved `languageCode` formatted to include all ISO-639-1 standard codes [\#889](https://github.com/fzaninotto/Faker/pull/889) ([andrewnicols](https://github.com/andrewnicols))
- Improved Hungarian provider [\#883](https://github.com/fzaninotto/Faker/pull/883) ([balping](https://github.com/balping))
- Fixed typo in Austrian Person provider [\#880](https://github.com/fzaninotto/Faker/pull/880) ([xelan](https://github.com/xelan))
- Added Chines (zh\_CN) `catchPhrase` formatter [\#878](https://github.com/fzaninotto/Faker/pull/878) ([z-song](https://github.com/z-song))
- Added mention of Brazilian (pt\_BR) providers in readme [\#877](https://github.com/fzaninotto/Faker/pull/877) ([iget-master](https://github.com/iget-master))
- Updated composer `require` section to allow PHP 7 in safer way [\#874](https://github.com/fzaninotto/Faker/pull/874) ([TomasVotruba](https://github.com/TomasVotruba))
- Added Greek (el\_GR) `mobilePhoneNumber` and `tollFreeNumber` formatters [\#869](https://github.com/fzaninotto/Faker/pull/869) ([sebdesign](https://github.com/sebdesign))
- Added Lorempixel check for `ImageTest.php` to avoid test fails when the service is offline [\#866](https://github.com/fzaninotto/Faker/pull/866) ([Newman101](https://github.com/Newman101))
- Added Chinese (zh\_CN) Providers [\#864](https://github.com/fzaninotto/Faker/pull/864) ([z-song](https://github.com/z-song))
- Added unit tests for Canadian (en\_CA) provider [\#862](https://github.com/fzaninotto/Faker/pull/862) ([Newman101](https://github.com/Newman101))
- Added Dutch BTW \(vat\) Number [\#861](https://github.com/fzaninotto/Faker/pull/861) ([LauLaman](https://github.com/LauLaman))
- Improved Australian (en\_AU) provider [\#858](https://github.com/fzaninotto/Faker/pull/858) ([Newman101](https://github.com/Newman101))
- Added Propel2 ORM support [\#852](https://github.com/fzaninotto/Faker/pull/852) ([iTechDhaval](https://github.com/iTechDhaval))
- Added en\_IN unit test for `Address.php` [\#849](https://github.com/fzaninotto/Faker/pull/849) ([Newman101](https://github.com/Newman101))
- Updated docs to clarify that `randomElements` does not repeat input elements [\#848](https://github.com/fzaninotto/Faker/pull/848) ([sustmi](https://github.com/sustmi))
- Optimized Taiwanese (zh\_TW) `realText` provider [\#844](https://github.com/fzaninotto/Faker/pull/844) ([Newman101](https://github.com/Newman101))
- Added more Iranian (fa\_IR) TLDs [\#843](https://github.com/fzaninotto/Faker/pull/843) ([VagrantStory](https://github.com/VagrantStory))
- Added Hebrew (he\_IL) `country` formatter [\#841](https://github.com/fzaninotto/Faker/pull/841) ([yonirom](https://github.com/yonirom))
- Documented `boolean` formatter [\#840](https://github.com/fzaninotto/Faker/pull/840) ([danieliancu](https://github.com/danieliancu))
- Fixed modifiers anchor readme [\#838](https://github.com/fzaninotto/Faker/pull/838) ([danieliancu](https://github.com/danieliancu))
- Added Dutch (nl\_NL) real text provider [\#837](https://github.com/fzaninotto/Faker/pull/837) ([endroid](https://github.com/endroid))
- Added `valid` modifier [\#836](https://github.com/fzaninotto/Faker/pull/836) ([fzaninotto](https://github.com/fzaninotto))
- Added Iranian (fa\_IR) `PhoneNumber` provider [\#833](https://github.com/fzaninotto/Faker/pull/833) ([ghost](https://github.com/ghost))
- Add Brazilian (pt\_BR) `region` and `regionAbbr` formatters [\#828](https://github.com/fzaninotto/Faker/pull/828) ([francinaldo](https://github.com/francinaldo))
- Improved Austrian (de\_AT) names, states, and realtext [\#826](https://github.com/fzaninotto/Faker/pull/826) ([Findus23](https://github.com/Findus23))
- Improved German (de\_DE) names [\#825](https://github.com/fzaninotto/Faker/pull/825) ([Findus23](https://github.com/Findus23))
- Improved Latvian (lv\_LV) first names [\#823](https://github.com/fzaninotto/Faker/pull/823) ([veisis](https://github.com/veisis))
- Improved Latvian (lv\_LV) `phoneNumber` formatter [\#822](https://github.com/fzaninotto/Faker/pull/822) ([veisis](https://github.com/veisis))
- Updated phpDoc link to IBAN format reference in `Payment` provider [\#821](https://github.com/fzaninotto/Faker/pull/821) ([god107](https://github.com/god107))
- Updated Sport ORM populator to populate values for numeric fields [\#820](https://github.com/fzaninotto/Faker/pull/820) ([urisavka](https://github.com/urisavka))
- Updated Chinese (zh\_CN) operators' phone number prefix. [\#819](https://github.com/fzaninotto/Faker/pull/819) ([vistart](https://github.com/vistart))
- Optimized Spot ORM `EntityPopulator` [\#817](https://github.com/fzaninotto/Faker/pull/817) ([Newman101](https://github.com/Newman101))
- Added Korean (ko\_KR) `realText` formatter [\#815](https://github.com/fzaninotto/Faker/pull/815) ([jdssem](https://github.com/jdssem))
- Updated `imageUrl` formatter phpDoc [\#814](https://github.com/fzaninotto/Faker/pull/814) ([jonwurtzler](https://github.com/jonwurtzler))
- Optimized Taiwanese (zh\_TW) text provider [\#809](https://github.com/fzaninotto/Faker/pull/809) ([BePsvPT](https://github.com/BePsvPT))
- Added strict comparison to Czech (cs\_CS) `birthNumber` formatter [\#807](https://github.com/fzaninotto/Faker/pull/807) ([Newman101](https://github.com/Newman101))
- Added Greek (el\_GR) `realText` formatter [\#805](https://github.com/fzaninotto/Faker/pull/805) ([hootlex](https://github.com/hootlex))
- Added Simplified Chinese \(zh\_CN\) `state` and `stateAbbr` formatters [\#804](https://github.com/fzaninotto/Faker/pull/804) ([zhanghuanchong](https://github.com/zhanghuanchong))
- Update `Image` provider to allow generation of grayscale images [\#801](https://github.com/fzaninotto/Faker/pull/801) ([neutralrockets](https://github.com/neutralrockets))
- Fixed Taiwanese (zh_TW) incorrect `mb_substr()` arguments [\#799](https://github.com/fzaninotto/Faker/pull/799) ([BePsvPT](https://github.com/BePsvPT))
- Added Spot ORM populator [\#796](https://github.com/fzaninotto/Faker/pull/796) ([urisavka](https://github.com/urisavka))
- Added Italian (it\_IT) `vatId` and `taxId` formatters [\#790](https://github.com/fzaninotto/Faker/pull/790) ([brainrepo](https://github.com/brainrepo))
- Added some fixes to Armenian (hy\_AM) locale [\#788](https://github.com/fzaninotto/Faker/pull/788) ([mhamlet](https://github.com/mhamlet))
- Removed duplicate entries in `toAscii()` transliteration table, used in `Internet` provider [\#787](https://github.com/fzaninotto/Faker/pull/787) ([vlakoff](https://github.com/vlakoff))
- Added Indian (en\_IN) providers [\#785](https://github.com/fzaninotto/Faker/pull/785) ([kartiksomani](https://github.com/kartiksomani))
- Removed duplicate country names in various locales, removed non-random country arrays [\#784](https://github.com/fzaninotto/Faker/pull/784) ([fzaninotto](https://github.com/fzaninotto))
- Improved Swiss (de\_CH) phone numbers [\#782](https://github.com/fzaninotto/Faker/pull/782) ([z38](https://github.com/z38))
- Added Swiss (de\_CH) names [\#781](https://github.com/fzaninotto/Faker/pull/781) ([z38](https://github.com/z38))
- Make capitalization of first word optional in Text Provider [\#778](https://github.com/fzaninotto/Faker/pull/778) ([LagunaJavier](https://github.com/LagunaJavier))
- Added Georgian (ka\_GE) providers [\#777](https://github.com/fzaninotto/Faker/pull/777) ([akalongman](https://github.com/akalongman))
- Fix CakePHP populator [\#776](https://github.com/fzaninotto/Faker/pull/776) ([daniel-mueller](https://github.com/daniel-mueller))
- Added unit tests for `Address` provider in many locales [\#775](https://github.com/fzaninotto/Faker/pull/775) [\#773](https://github.com/fzaninotto/Faker/pull/773) [\#772](https://github.com/fzaninotto/Faker/pull/772) [\#767](https://github.com/fzaninotto/Faker/pull/767) [\#765](https://github.com/fzaninotto/Faker/pull/765) [\#764](https://github.com/fzaninotto/Faker/pull/764) [\#758](https://github.com/fzaninotto/Faker/pull/758) [\#756](https://github.com/fzaninotto/Faker/pull/756) [\#747](https://github.com/fzaninotto/Faker/pull/747) [\#741](https://github.com/fzaninotto/Faker/pull/741) ([Newman101](https://github.com/Newman101))
- Added `dbi` formatter to Spanish (es\_ES) Person provider [\#763](https://github.com/fzaninotto/Faker/pull/763) ([mikk150](https://github.com/mikk150))
- Added South Africa (en\_ZA) locale [\#761](https://github.com/fzaninotto/Faker/pull/761) ([smithandre](https://github.com/smithandre)) [\#760](https://github.com/fzaninotto/Faker/pull/760) ([smithandre](https://github.com/smithandre)) [\#759](https://github.com/fzaninotto/Faker/pull/759) ([smithandre](https://github.com/smithandre))
- Added E.164 phone number generator [\#753](https://github.com/fzaninotto/Faker/pull/753) ([daleattree](https://github.com/daleattree))
- Fixed serialization issue in `unique` modifier [\#749](https://github.com/fzaninotto/Faker/pull/749) ([EmanueleMinotto](https://github.com/EmanueleMinotto))
- Added Switzerland (de\_CH, fr\_CH, it\_CH) providers [\#739](https://github.com/fzaninotto/Faker/pull/739) ([r3h6](https://github.com/r3h6))
- Added PHPDocs, removed unused variable [\#738](https://github.com/fzaninotto/Faker/pull/738) ([daniel-mueller](https://github.com/daniel-mueller))
- Fixed building numbers to have non-zero first bumber [\#737](https://github.com/fzaninotto/Faker/pull/737) ([jmauerhan](https://github.com/jmauerhan))
- Updated ninth digit for Brazilian cell phone numbers [\#734](https://github.com/fzaninotto/Faker/pull/734) ([igorsantos07](https://github.com/igorsantos07))
- Simplified Factory code [\#732](https://github.com/fzaninotto/Faker/pull/732) ([vlakoff](https://github.com/vlakoff))
- Added mention of [images-generator](https://github.com/bruceheller/images-generator) in readme [\#731](https://github.com/fzaninotto/Faker/pull/731) ([bruceheller](https://github.com/bruceheller))
- Optimize Internet::toAscii\(\) by using a static cache and translitteration [\#730](https://github.com/fzaninotto/Faker/pull/730) [\#729](https://github.com/fzaninotto/Faker/pull/729)
[\#725](https://github.com/fzaninotto/Faker/pull/725) [\#724](https://github.com/fzaninotto/Faker/pull/724) ([vlakoff](https://github.com/vlakoff))
- Added more English (en\_GB) Phone Number formats [\#721](https://github.com/fzaninotto/Faker/pull/721) ([nickwebcouk](https://github.com/nickwebcouk))
- Cleaned up `use` statements across the code [\#719](https://github.com/fzaninotto/Faker/pull/719) ([pomaxa](https://github.com/pomaxa))
- Fixed CackePHP populator [\#718](https://github.com/fzaninotto/Faker/pull/718) ([sdustinh](https://github.com/sdustinh))
- Cleaned up various phpmd notices [\#715](https://github.com/fzaninotto/Faker/pull/715) ([pomaxa](https://github.com/pomaxa))
- Added `Color` provider to Latvian (lv_LV) locale [\#714](https://github.com/fzaninotto/Faker/pull/714) ([pomaxa](https://github.com/pomaxa))
- Fixed bad randomization in Doctrine populator [\#713](https://github.com/fzaninotto/Faker/pull/713) ([pomaxa](https://github.com/pomaxa))
- Added Mongolian (mn\_MN) providers [\#709](https://github.com/fzaninotto/Faker/pull/709) ([selmonal](https://github.com/selmonal))
- Improved Australian (en\_AU) `postcode` formatter [\#703](https://github.com/fzaninotto/Faker/pull/703) ([xfxf](https://github.com/xfxf))
- Added support for asterisks in `bothify` and `optimize` [\#701](https://github.com/fzaninotto/Faker/pull/701) ([nineinchnick](https://github.com/nineinchnick))
- Fixed important distinction between ORM and database framework in READMEs reference to an external Faker provider for POMM that I have never even tested. Anyway, POMM is highly recommended if you are a Postgres fan, or if you want to please Grégoire and help him finish his lifelong project of listening to music on a hi-fi audio equipment he built from his own hands [\#696](https://github.com/fzaninotto/Faker/pull/696) ([chanmix51](https://github.com/chanmix51))
- Fixed example `text()` output in README [\#694](https://github.com/fzaninotto/Faker/pull/694) ([vlakoff](https://github.com/vlakoff))
- Added mention of CakePHP 2.x Seeder Plugin to readme [\#691](https://github.com/fzaninotto/Faker/pull/691) ([ravage84](https://github.com/ravage84))
- Fixed invalid email bug for Korean (ko\_KR) [\#690](https://github.com/fzaninotto/Faker/pull/690) ([pearlc](https://github.com/pearlc))
- Removed an invalid Dutch (nl\_NL) lastname that breaks email generator [\#689](https://github.com/fzaninotto/Faker/pull/689) ([SpaceK33z](https://github.com/SpaceK33z))
- Updated `numberBetween()` to be order agnostic [\#683](https://github.com/fzaninotto/Faker/pull/683) ([xfxf](https://github.com/xfxf))
- Added several English (en\_US) bank-related formatters [\#682](https://github.com/fzaninotto/Faker/pull/682) ([okj579](https://github.com/okj579))
- Fixed `ipv4` formatter to avoid generating special purpose addresses [\#681](https://github.com/fzaninotto/Faker/pull/681) ([ravage84](https://github.com/ravage84))
- Moved `intl` extension to `require-dev` in `composer.json` file [\#680](https://github.com/fzaninotto/Faker/pull/680) ([jaschweder](https://github.com/jaschweder))
- Added more Turkish (tr\_TR) phones number formats [\#678](https://github.com/fzaninotto/Faker/pull/678) ([Quanthir](https://github.com/Quanthir))
- Fixed primary Key warning in CakePHP ORM populator [\#677](https://github.com/fzaninotto/Faker/pull/677) ([davidyell](https://github.com/davidyell))
- Added time zone support for provider methods returning DateTime instance [\#675](https://github.com/fzaninotto/Faker/pull/675) ([bishopb](https://github.com/bishopb))
- Removed trailing spaces from some Argentinian (es\_AR) female first names [\#674](https://github.com/fzaninotto/Faker/pull/674) ([ivanmirson](https://github.com/ivanmirson))
- Added Lithuanian (lt\_LT) locale [\#673](https://github.com/fzaninotto/Faker/pull/673) ([ekateiva](https://github.com/ekateiva))
- Added mention of Alice to readme [\#665](https://github.com/fzaninotto/Faker/pull/665) ([Seldaek](https://github.com/Seldaek))
- Fixed namespace in tests [\#663](https://github.com/fzaninotto/Faker/pull/663) ([localheinz](https://github.com/localheinz))
- Fixed trailing spaces in `Color` provider [\#662](https://github.com/fzaninotto/Faker/pull/662) ([apsylone](https://github.com/apsylone))
- Removed duplicate country names in Russian (ru\_RU) `Address` provider [\#659](https://github.com/fzaninotto/Faker/pull/659) ([nurolopher](https://github.com/nurolopher))
- Added `rgba` formatter to `Color` provider [\#653](https://github.com/fzaninotto/Faker/pull/653) ([apsylone](https://github.com/apsylone))
- Fixed bad randomization in CakePHP populator [\#648](https://github.com/fzaninotto/Faker/pull/648) ([jadb](https://github.com/jadb))
- Updated phpunit configuration to better use colors [\#643](https://github.com/fzaninotto/Faker/pull/643) ([localheinz](https://github.com/localheinz))
- Updated `makefile` to install dev dependencies by default [\#642](https://github.com/fzaninotto/Faker/pull/642) ([localheinz](https://github.com/localheinz))
- Updated Travis configuration to cache dependencies between builds [\#641](https://github.com/fzaninotto/Faker/pull/641) ([localheinz](https://github.com/localheinz))
- Added SVG badge to readme for displaying Travis build status [\#640](https://github.com/fzaninotto/Faker/pull/640) ([localheinz](https://github.com/localheinz))
- Added Croatian (hr\_HR) locale [\#638](https://github.com/fzaninotto/Faker/pull/638) ([toniperic](https://github.com/toniperic))
- Updated `dateTimeBetween` PHPDoc [\#635](https://github.com/fzaninotto/Faker/pull/635) ([theofidry](https://github.com/theofidry))
- Add mention of Symfony2 bundles in readme [\#634](https://github.com/fzaninotto/Faker/pull/634) ([theofidry](https://github.com/theofidry))
- Added Hebrew (he\_IL) locale [\#633](https://github.com/fzaninotto/Faker/pull/633) ([yonirom](https://github.com/yonirom))
- Updated `seed` to accept non-integer seeds [\#632](https://github.com/fzaninotto/Faker/pull/632) ([theofidry](https://github.com/theofidry))
- Added DocBlock to `Factory::create()` [\#631](https://github.com/fzaninotto/Faker/pull/631) ([tonynelson19](https://github.com/tonynelson19))
- Added `jobTitle` generator [\#630](https://github.com/fzaninotto/Faker/pull/630) ([gregoryduckworth](https://github.com/gregoryduckworth))
- Updated Chinese (zh\_CN) `Person` provider to generate more correct names [\#628](https://github.com/fzaninotto/Faker/pull/628) ([phoenixgao](https://github.com/phoenixgao))
- Updated Brazilian (pt\_BR) `cellphone` formatter to make it more flexible [\#623](https://github.com/fzaninotto/Faker/pull/623) ([igorsantos07](https://github.com/igorsantos07))
- Add Arabic for Saudi Arabia (ar\_SA) locale [\#618](https://github.com/fzaninotto/Faker/pull/618) ([ibrasho](https://github.com/ibrasho))
- Updated en\_US phone numbers [\#615](https://github.com/fzaninotto/Faker/pull/615) ([okj579](https://github.com/okj579))
- Fixed typos in variable names and exceptions [\#614](https://github.com/fzaninotto/Faker/pull/614) ([pborreli](https://github.com/pborreli))
- Added a table of contents to the readme file. [\#613](https://github.com/fzaninotto/Faker/pull/613) ([camilopayan](https://github.com/camilopayan))
- Added Brazilian (es_BR) credit card formatters [\#608](https://github.com/fzaninotto/Faker/pull/608) ([igorsantos07](https://github.com/igorsantos07))
- Updated `iban` formatter to be cross-locale [\#607](https://github.com/fzaninotto/Faker/pull/607) ([okj579](https://github.com/okj579))
- Improved ORM name guesser logic [\#606](https://github.com/fzaninotto/Faker/pull/606) ([watermanio](https://github.com/watermanio))
- Fixed doc typo [\#605](https://github.com/fzaninotto/Faker/pull/605) ([igorsantos07](https://github.com/igorsantos07))
- Removed executable bits [\#593](https://github.com/fzaninotto/Faker/pull/593) ([siwinski](https://github.com/siwinski))
- Fixed `iban` generator [\#590](https://github.com/fzaninotto/Faker/pull/590) ([okj579](https://github.com/okj579))
- Added Philippines (en\_PH) `mobileNumber` formatter [\#589](https://github.com/fzaninotto/Faker/pull/589) ([lozadaOmr](https://github.com/lozadaOmr))
- Added support for min / max params in `latitude` and `longitude` formatters [\#570](https://github.com/fzaninotto/Faker/pull/570) ([actuallymab](https://github.com/actuallymab))
- Added Czech (cs_CZ) `birthNumber` formatter [\#535](https://github.com/fzaninotto/Faker/pull/535) ([tomasbedrich](https://github.com/tomasbedrich))
- Added `dateTimeInInterval` formatter [\#526](https://github.com/fzaninotto/Faker/pull/526) ([nicodmf](https://github.com/nicodmf))
- Updated `optional` and `boolean` apis to be more consistent [\#513](https://github.com/fzaninotto/Faker/pull/513) ([EmanueleMinotto](https://github.com/EmanueleMinotto))
- Added Greek (el\_GR) `Address` provider [\#504](https://github.com/fzaninotto/Faker/pull/504) ([drakakisgeo](https://github.com/drakakisgeo))
## 2015-05-29, v1.5.0
* Added ability to print custom text on the images fetched by the Image provider [\#583](https://github.com/fzaninotto/Faker/pull/583) ([fzaninotto](https://github.com/fzaninotto))
* Fixed typos in Peruvian (es\_PE) Person provider [\#581](https://github.com/fzaninotto/Faker/pull/581) [\#580](https://github.com/fzaninotto/Faker/pull/580) ([ysramirez](https://github.com/ysramirez))
* Added instructions for installing with composer to readme.md [\#572](https://github.com/fzaninotto/Faker/pull/572) ([totophe](https://github.com/totophe))
* Added Kazakh (kk\_KZ) locale [\#569](https://github.com/fzaninotto/Faker/pull/569) ([YerlenZhubangaliyev](https://github.com/YerlenZhubangaliyev))
* Added Korean (ko\_KR) locale [\#566](https://github.com/fzaninotto/Faker/pull/566) ([pearlc](https://github.com/pearlc))
* Fixed file provider to ignore unreadable and special files [\#565](https://github.com/fzaninotto/Faker/pull/565) ([svrnm](https://github.com/svrnm))
* Fixed Dutch (nl\_NL) Address and Person providers [\#560](https://github.com/fzaninotto/Faker/pull/560) ([killerog](https://github.com/killerog))
* Fixed Dutch (nl\_NL) Person provider [\#559](https://github.com/fzaninotto/Faker/pull/559) ([pauledenburg](https://github.com/pauledenburg))
* Added Russian (ru\_RU) Bank names provider [\#553](https://github.com/fzaninotto/Faker/pull/553) ([wizardjedi](https://github.com/wizardjedi))
* Added mobile phone function in French (fr\_FR) provider [\#552](https://github.com/fzaninotto/Faker/pull/552) ([kletellier](https://github.com/kletellier))
* Added phpdoc for new magic methods in Generator to help IntelliSense completion [\#550](https://github.com/fzaninotto/Faker/pull/550) ([stof](https://github.com/stof))
* Fixed File provider bug 'The first argument to copy() function cannot be a directory' [\#547](https://github.com/fzaninotto/Faker/pull/547) ([svrnm](https://github.com/svrnm))
* Added new Brazilian (pt\_BR) Providers [\#545](https://github.com/fzaninotto/Faker/pull/545) ([igorsantos07](https://github.com/igorsantos07))
* Fixed ability to seed the generator [\#543](https://github.com/fzaninotto/Faker/pull/543) ([schmengler](https://github.com/schmengler))
* Added streetAddress formatter to Russian (ru\_RU) provider [\#542](https://github.com/fzaninotto/Faker/pull/542) ([ZAYEC77](https://github.com/ZAYEC77))
* Fixed Internet provider warning "Could not create transliterator"* [\#541](https://github.com/fzaninotto/Faker/pull/541) ([fonsecas72](https://github.com/fonsecas72))
* Fixed Spanish for Argentina (es\_AR) Address provider [\#540](https://github.com/fzaninotto/Faker/pull/540) ([ivanmirson](https://github.com/ivanmirson))
* Fixed region names in French for Belgium (fr\_BE) address provider [\#536](https://github.com/fzaninotto/Faker/pull/536) ([miclf](https://github.com/miclf))
* Fixed broken Doctrine2 link in README [\#534](https://github.com/fzaninotto/Faker/pull/534) ([JonathanKryza](https://github.com/JonathanKryza))
* Added link to faker-context Behat extension in readme [\#532](https://github.com/fzaninotto/Faker/pull/532) ([denheck](https://github.com/denheck))
* Added PHP 7.0 nightly to Travis build targets [\#525](https://github.com/fzaninotto/Faker/pull/525) ([TomasVotruba](https://github.com/TomasVotruba))
* Added Dutch (nl\_NL) color names [\#523](https://github.com/fzaninotto/Faker/pull/523) ([belendel](https://github.com/belendel))
* Fixed Chinese (zh\_CN) Address provider (remove Taipei) [\#522](https://github.com/fzaninotto/Faker/pull/522) ([asika32764](https://github.com/asika32764))
* Fixed phonenumber formats in Dutch (nl\_NL) PhoneNumber provider [\#521](https://github.com/fzaninotto/Faker/pull/521) ([SpaceK33z](https://github.com/SpaceK33z))
* Fixed Russian (ru\_RU) Address provider [\#518](https://github.com/fzaninotto/Faker/pull/518) ([glagola](https://github.com/glagola))
* Added Italian (it\_IT) Text provider [\#517](https://github.com/fzaninotto/Faker/pull/517) ([endelwar](https://github.com/endelwar))
* Added Norwegian (no\_NO) locale [\#515](https://github.com/fzaninotto/Faker/pull/515) ([phaza](https://github.com/phaza))
* Added VAT number to Bulgarian (bg\_BG) Payment provider [\#512](https://github.com/fzaninotto/Faker/pull/512) ([ronanguilloux](https://github.com/ronanguilloux))
* Fixed UserAgent provider outdated user agents [\#511](https://github.com/fzaninotto/Faker/pull/511) ([ajbdev](https://github.com/ajbdev))
* Fixed `image()` formatter to make it work with temp dir of any (decent) OS [\#507](https://github.com/fzaninotto/Faker/pull/507) ([ronanguilloux](https://github.com/ronanguilloux))
* Added Persian (fa\_IR) locale [\#500](https://github.com/fzaninotto/Faker/pull/500) ([zoli](https://github.com/zoli))
* Added Currency Code formatter [\#497](https://github.com/fzaninotto/Faker/pull/497) ([stelgenhof](https://github.com/stelgenhof))
* Added VAT number to Belgium (be_BE) Payment provider [\#495](https://github.com/fzaninotto/Faker/pull/495) ([ronanguilloux](https://github.com/ronanguilloux))
* Fixed `imageUrl` formatter bug where it would always return the same image [\#494](https://github.com/fzaninotto/Faker/pull/494) ([fzaninotto](https://github.com/fzaninotto))
* Added more Indonesian (id\_ID) providers [\#493](https://github.com/fzaninotto/Faker/pull/493) ([deerawan](https://github.com/deerawan))
* Added Indonesian (id\_ID) locale [\#492](https://github.com/fzaninotto/Faker/pull/492) ([stoutZero](https://github.com/stoutZero))
* Fixed unique generator performance [\#491](https://github.com/fzaninotto/Faker/pull/491) ([ikwattro](https://github.com/ikwattro))
* Added transliterator to `email` and `username` [\#490](https://github.com/fzaninotto/Faker/pull/490) ([fzaninotto](https://github.com/fzaninotto))
* Added Hungarian (hu\_HU) Text provider [\#486](https://github.com/fzaninotto/Faker/pull/486) ([lintaba](https://github.com/lintaba))
* Fixed CakePHP Entity Popolator (some cases where no entities prev. inserted) [\#483](https://github.com/fzaninotto/Faker/pull/483) ([jadb](https://github.com/jadb))
* Added Color and DateTime Turkish (tr\_TR) Providers [\#481](https://github.com/fzaninotto/Faker/pull/481) ([behramcelen](https://github.com/behramcelen))
* Added Latvian (lv\_LV) `personalIdentityNumber` formatter [\#472](https://github.com/fzaninotto/Faker/pull/472) ([MatissJanis](https://github.com/MatissJanis))
* Added VAT number to Austrian (at_AT) Payment provider [\#470](https://github.com/fzaninotto/Faker/pull/470) ([ronanguilloux](https://github.com/ronanguilloux))
* Fixed missing @return phpDoc in Payment provider [\#469](https://github.com/fzaninotto/Faker/pull/469) ([ronanguilloux](https://github.com/ronanguilloux))
* Added SWIFT/BIC payment type formatter to the Payment provider [\#465](https://github.com/fzaninotto/Faker/pull/465) ([ronanguilloux](https://github.com/ronanguilloux))
* Fixed small typo in Base provider exception [\#460](https://github.com/fzaninotto/Faker/pull/460) ([miclf](https://github.com/miclf))
* Added Georgian (ka\_Ge) locale [\#457](https://github.com/fzaninotto/Faker/pull/457) ([lperto](https://github.com/lperto))
* Added PSR-4 Autoloading [\#455](https://github.com/fzaninotto/Faker/pull/455) ([GrahamCampbell](https://github.com/GrahamCampbell))
* Added Uganda (en_UG) locale [\#454](https://github.com/fzaninotto/Faker/pull/454) ([tharoldD](https://github.com/tharoldD))
* Added `regexify` formatter, generating a random string based on a regular expression [\#453](https://github.com/fzaninotto/Faker/pull/453) ([fzaninotto](https://github.com/fzaninotto))
* Added shuffle formatter, to shuffle an array or a string [\#452](https://github.com/fzaninotto/Faker/pull/452) ([fzaninotto](https://github.com/fzaninotto))
* Added ISBN-10 & ISBN-13 codes formatters to Barcode provider [\#451](https://github.com/fzaninotto/Faker/pull/451) ([gietos](https://github.com/gietos))
* Fixed Russian (ru\_RU) middle names (different for different genders) [\#450](https://github.com/fzaninotto/Faker/pull/450) ([gietos](https://github.com/gietos))
* Fixed Ukranian (uk\_UA) Person provider [\#448](https://github.com/fzaninotto/Faker/pull/448) ([aivus](https://github.com/aivus))
* Added Vietnamese (vi\_VN) locale [\#447](https://github.com/fzaninotto/Faker/pull/447) ([huy95](https://github.com/huy95))
* Added type hint to the Documentor constructor [\#446](https://github.com/fzaninotto/Faker/pull/446) ([JeroenDeDauw](https://github.com/JeroenDeDauw))
* Fixed Russian (ru\_RU) Person provider (joined names) [\#445](https://github.com/fzaninotto/Faker/pull/445) ([aivus](https://github.com/aivus))
* Added English (en\_GB) `mobileNumber` methods [\#438](https://github.com/fzaninotto/Faker/pull/438) ([daveblake](https://github.com/daveblake))
* Added Traditional Chinese (zh\_TW) Realtext provider [\#434](https://github.com/fzaninotto/Faker/pull/434) ([tzhuan](https://github.com/tzhuan))
* Fixed first name in Spanish for Argentina (es\_AR) Person provider [\#433](https://github.com/fzaninotto/Faker/pull/433) ([fzaninotto](https://github.com/fzaninotto))
* Fixed Canadian (en_CA) state abbreviation for Nunavut [\#430](https://github.com/fzaninotto/Faker/pull/430) ([julien-c](https://github.com/julien-c))
* Added CakePHP ORM entity populator [\#428](https://github.com/fzaninotto/Faker/pull/428) ([jadb](https://github.com/jadb))
* Added Traditional Chinese (zh\_TW) locale [\#427](https://github.com/fzaninotto/Faker/pull/427) ([tzhuan](https://github.com/tzhuan))
* Fixed typo in Doctrine Populator phpDoc [\#425](https://github.com/fzaninotto/Faker/pull/425) ([ihsanudin](https://github.com/ihsanudin))
* Added Chinese (zh_CN) Internet provider [\#424](https://github.com/fzaninotto/Faker/pull/424) ([Lisso-Me](https://github.com/Lisso-Me))
* Added Country ISO 3166-1 alpha-3 code to the Miscellaneous provider[\#422](https://github.com/fzaninotto/Faker/pull/422) ([gido](https://github.com/gido))
* Added English (en\_GB) Person provider [\#421](https://github.com/fzaninotto/Faker/pull/421) ([AlexCutts](https://github.com/AlexCutts))
* Added missing tests for the Color Provider [\#420](https://github.com/fzaninotto/Faker/pull/420) ([bessl](https://github.com/bessl))
* Added Nepali (ne\_NP) locale [\#419](https://github.com/fzaninotto/Faker/pull/419) ([ankitpokhrel](https://github.com/ankitpokhrel))
* Fixed latitude and longitude formatters bug (numeric value out of range for 32bits) [\#416](https://github.com/fzaninotto/Faker/pull/416) ([fzaninotto](https://github.com/fzaninotto))
* Added a dedicated calculator Luhn calculator service [\#414](https://github.com/fzaninotto/Faker/pull/414) ([fzaninotto](https://github.com/fzaninotto))
* Fixed Russian (ru_RU) Person provider (removed lowercase duplications) [\#413](https://github.com/fzaninotto/Faker/pull/413) ([Ragazzo](https://github.com/Ragazzo))
* Fixed barcode formatter (improved speed, added tests) [\#412](https://github.com/fzaninotto/Faker/pull/412) ([fzaninotto](https://github.com/fzaninotto))
* Added ipv4 and barcode formatters tests [\#410](https://github.com/fzaninotto/Faker/pull/410) ([bessl](https://github.com/bessl))
* Fixed typos in various comments blocks [\#409](https://github.com/fzaninotto/Faker/pull/409) ([bessl](https://github.com/bessl))
* Fixed InternetTest (replaced regex with PHP filter) [\#406](https://github.com/fzaninotto/Faker/pull/406) ([bessl](https://github.com/bessl))
* Added password formatter to the Internet provider[\#402](https://github.com/fzaninotto/Faker/pull/402) ([fzaninotto](https://github.com/fzaninotto))
* Added Company and Internet Austrian (de\_AT) Providers [\#400](https://github.com/fzaninotto/Faker/pull/400) ([bessl](https://github.com/bessl))
* Added third-party libraries section in README [\#399](https://github.com/fzaninotto/Faker/pull/399) ([fzaninotto](https://github.com/fzaninotto))
* Added Spanish for Venezuela (es\_VE) locale [\#398](https://github.com/fzaninotto/Faker/pull/398) ([DIOHz0r](https://github.com/DIOHz0r))
* Added PhoneNumber Autrian (de\_AT) Provider, and missing test for the 'locale' method. [\#395](https://github.com/fzaninotto/Faker/pull/395) ([bessl](https://github.com/bessl))
* Removed wrongly localized Lorem provider [\#394](https://github.com/fzaninotto/Faker/pull/394) ([fzaninotto](https://github.com/fzaninotto))
* Fixed Miscellaneous provider (made the `locale` formatter static) [\#390](https://github.com/fzaninotto/Faker/pull/390) ([bessl](https://github.com/bessl))
* Added a unit test file for the Miscellaneous Provider [\#389](https://github.com/fzaninotto/Faker/pull/389) ([bessl](https://github.com/bessl))
* Added warning in README about using `rand()`` and the seed functions [\#386](https://github.com/fzaninotto/Faker/pull/386) ([paulvalla](https://github.com/paulvalla))
* Fixed French (fr\_FR) Person provider (Uppercased a first name) [\#385](https://github.com/fzaninotto/Faker/pull/385) ([netcarver](https://github.com/netcarver))
* Added Russian (ru\_RU) and Ukrainian (uk\_UA) Text providers [\#383](https://github.com/fzaninotto/Faker/pull/383) ([terion-name](https://github.com/terion-name))
* Added more street prefixes to French (fr\_FR) Address provider [\#381](https://github.com/fzaninotto/Faker/pull/381) ([ronanguilloux](https://github.com/ronanguilloux))
* Added PHP 5.6 to CI targets [\#378](https://github.com/fzaninotto/Faker/pull/378) ([GrahamCampbell](https://github.com/GrahamCampbell))
* Fixed spaces remaining at the end of liine in various files [\#377](https://github.com/fzaninotto/Faker/pull/377) ([GrahamCampbell](https://github.com/GrahamCampbell))
* Fixed UserAgent provider (added space before processor on linux platform) [\#374](https://github.com/fzaninotto/Faker/pull/374) ([TomK](https://github.com/TomK))
* Added Company generator for Russian (ru\_RU) locale [\#371](https://github.com/fzaninotto/Faker/pull/371) ([kix](https://github.com/kix))
* Fixed Russian (ru\_RU) Color provider (uppercase letters) [\#370](https://github.com/fzaninotto/Faker/pull/370) ([semanser](https://github.com/semanser))
* Added more Polish (pl\_PL) phone numbers [\#369](https://github.com/fzaninotto/Faker/pull/369) ([piotrantosik](https://github.com/piotrantosik))
* Fixed Ruby Faker link in readme [\#368](https://github.com/fzaninotto/Faker/pull/368) ([philsturgeon](https://github.com/philsturgeon))
* Added more Japanese (ja\_JP) names in Person provider [\#366](https://github.com/fzaninotto/Faker/pull/366) ([kumamidori](https://github.com/kumamidori))
* Added Slovenian (sl\_SL) locale [\#363](https://github.com/fzaninotto/Faker/pull/363) ([alesf](https://github.com/alesf))
* Fixed German (de\_DE) Person provider (first names) [\#362](https://github.com/fzaninotto/Faker/pull/362) ([mikehaertl](https://github.com/mikehaertl))
* Fixed Ukrainian (uk\_UA) Person providr (there is no such letter "ы" in Ukrainian) [\#359](https://github.com/fzaninotto/Faker/pull/359) ([nazar-pc](https://github.com/nazar-pc))
* Fixed Chinese (zh\_CN) PhoneNumber provider (the length of mobile phone number is 11) [\#358](https://github.com/fzaninotto/Faker/pull/358) ([byan](https://github.com/byan))
* Added Arabic (ar_\JO) Locale [\#357](https://github.com/fzaninotto/Faker/pull/357) ([zrashwani](https://github.com/zrashwani))
* Fixed Czech (cs\_CZ) Person provider (missing lowercase in last name) [\#355](https://github.com/fzaninotto/Faker/pull/355) ([halaxa](https://github.com/halaxa))
* Fixed French for Belgium (fr\_BE) Address Provider (doubled city names) [\#354](https://github.com/fzaninotto/Faker/pull/354) ([miclf](https://github.com/miclf))
* Added Biased Integer Provider [\#332](https://github.com/fzaninotto/Faker/pull/332) ([TimWolla](https://github.com/TimWolla))
* Added Swedish (sv\_SE) locale [\#316](https://github.com/fzaninotto/Faker/pull/316) ([ulrikjohansson](https://github.com/ulrikjohansson))
* Added English for New Zealand (en\_NZ) locale [\#283](https://github.com/fzaninotto/Faker/pull/283) ([JasonMortonNZ](https://github.com/JasonMortonNZ))
* Added mention of external Provider for cron expressions to readme[\#498](https://github.com/fzaninotto/Faker/pull/498) ([swekaj](https://github.com/swekaj))
## 2014-06-04, v1.4.0
* Fixed typo in Slovak person names (cinan)
* Added tests for uk_UA providers (serge-kuharev)
* Fixed numerify() performance by making it 30% faster (fzaninotto)
* Added strict option to randomNumber to force number of digits (fzaninotto)
* Fixed randomNumber usage duplicating numberBetween (fzaninotto)
* Fixed address provider for latvian language (MatissJA)
* Added Czech Republic (cs_CZ) address, company, datetime and text providers (Mikulas)
* Fixed da_DK Person provider data containing an 'unnamed' person (tolnem)
* Added slug provider (fzaninotto)
* Fixed IDE insights for new local IP and MAC address providers (hugofonseca)
* Added firstname gender method to all Person providers (csanquer)
* Fixed tr_TR email service, city name, person, and phone number formats (ogunkarakus)
* Fixed US_en state list (fzaninotto)
* Fixed en_US address provider so state abbr are ISO 3166 codes (Garbee)
* Added local IP and MAC address providers (kielabokkie)
* Fixed typo in century list affecting the century provider (fzaninotto)
* Added default value to optional modifier (joshuajabbour)
* Fixed Portuguese phonenumbers have 9 digits (hugofonseca)
* Added fileCopy to File provider to simulate file upload (stefanosala)
* Added pt_PT providers (hugofonseca)
* Fixed dead code in text provider (hugofonseca)
* Fixed IDE insights for magic properties (hugofonseca)
* Added tin (NIF) generator for pt_PT provider (hugofonseca)
* Fixed numberBetween max default value handling (fzaninotto)
* Added pt_PT phone number provider (hugofonseca)
* Fixed PSR-2 standards and add make task to force it on Travis (terite)
* Added new ro_RO Personal Numerical Code (CNP) and phone number providers (avataru)
* Fixed Internet provider for sk_SK locale (cinan)
* Fixed typo in en_ZA Internet provider (bjorntheart)
* Fixed phpdoc for DateTime magic methods (stof)
* Added doc about seeding with maximum timestamp using dateTime formatters (fzaninotto)
* Added Maximum Timestamp option to get always same unix timestamp when using a fixed seed (csanquer)
* Added Montenegrian (me_ME) providers (ognjenm)
* Added ean barcode provider (nineinchnick)
* Added fullPath parameter to Image provider (stefanosala)
* Added more Polish company formats (nineinchnick)
* Added Polish realText provider (nineinchnick)
* Fixed remaining non-seedable random generators (terite)
* Added randomElements provider (terite)
* Added French realText provider (fzaninotto)
* Fixed realText provider bootstrap slowness (fzaninotto)
* Added realText provider for English and German, based on Markov Chains Generator (TimWolla)
* Fixed address format in nl_NL provider (doenietzomoeilijk)
* Fixed potentially offensive word from last name list (joshuajabbour)
* Fixed reamde documentation about the optional modifier (cryode)
* Fixed Image provider and documentor routine (fzaninotto)
* Fixed IDE insights for methods (PedroTroller)
* Fixed missing data in en_US Address provider (Garbee)
* Added Bengali (bn_BD) providers (masnun)
* Fixed warning on test file when short tags are on (bateller)
* Fixed Doctrine populator undefined index warning (dbojdo)
* Added French Canadian (fr_CA) Address and Person providers (marcaube)
* Fixed typo in NullGenerator (mhanson01)
* Fixed Doctrine populator issue with one-to-one nullable relationship (jpetitcolas)
* Added Canadian English (en_CA) address and phone number providers (cviebrock)
* Fixed duplicated Payment example in readme (Garbee)
* Fixed Polish (pl_PL) Person provider data (czogori)
* Added Hungarian (hu_HU) providers (sagikazarmark)
* Added 'kana' (ja_JP) name formatters (kzykhys)
* Added allow_failure for hhvm to travis-ci and test against php 5.5 (toin0u)
## 2013-12-16, v1.3.0
* Fixed state generator in Australian (en_AU) provider (sebklaus)
* Fixed IDE insights for locale specific providers (ulrikjohansson)
* Added English (South Africa) (en_ZA) person, address, Internet and phone number providers (dmfaux)
* Fixed integer values overflowing on signed INTEGER columns on Doctrine populator (Thinkscape)
* Fixed spelling error in French (fr_FR) address provider (leihog)
* Added improvements based on SensioLabsInsights analysis
* Fixed Italian (it_IT) email provider (garak)
* Added Spanish (es_ES) Internet provider (eusonlito)
* Added English Philippines (en_PH) address provider (kamote)
* Added Brazilian (pt_BR) email provider data (KennedyTedesco)
* Fixed UK country code (pgscandeias)
* Added Peruvian (es_PE) person, address, phone number, and company providers (cslucano)
* Added Ukrainian (uk_UA) color provider (ruden)
* Fixed Ukrainian (uk_UA) namespace and email translitteration (ruden)
* Added Romanian (Moldova) (ro_MD) person, address, and phone number providers (AlexanderC)
* Added IBAN generator for every currently known locale that uses it (nineinchnick)
* Added Image generation powered by LoremPixel (weotch)
* Fixed missing timezone with dateTimeBetween (baldurrensch)
* Fixed call to undefined method cardType in Payment (WMeldon)
* Added Romanian (ro_RO) address and person providers (calina-c)
* Fixed Doctrine populator to use ObjectManager instead of EntityManagerInterface (mgiustiniani)
* Fixed docblock for Provider\Base::unique() (pschultz)
* Added Payment providers (creditCardType, creditCardNumber, creditCardExpirationDate, creditCardExpirationDateString) (pomaxa)
* Added unique() modifier
* Added IDE insights to allow better intellisense/phpStorm autocompletion (thallisphp)
* Added Polish (pl_PL) address provider, personal identity number and pesel number generator (nineinchnick)
* Added Turkish (tr_TR) address provider, and improved internet provider (hasandz)
* Fixed Propel column number guesser to use signed range of values (gunnarlium)
* Added Greek (el_GR) person, address, and phone number providers (georgeharito)
* Added Austrian (en_AU) address, Internet, and phone number providers (rcuddy)
* Fixed phpDoc in Doctrine Entity populator (rogamoore)
* Added French (fr_FR) phone number formats (vchabot)
* Added optional() modifier (weotch)
* Fixed typo in the Person provider documentation (jtreminio)
* Fixed Russian (ru_RU) person format (alexshadow007)
* Added Japanese (ja_JP) person, address, Internet, phone number, and company providers (kumamidori)
* Added color providers, driver license and passport number formats for the ru_RU locale (pomaxa)
* Added Latvian (lv_LV) person, address, Internet, and phone number providers (pomaxa)
* Added Brazilian (pt_BR) Internet provider (vjnrv)
* Added more Czech (cs_CZ) lastnames (petrkle)
* Added Chinese Simplified (zh_CN) person, address, Internet, and phone number providers (tlikai)
* Fixed Typos (pborelli)
* Added Color provider with hexColor, rgbColor, rgbColorAsArray, rgbCssColor, safeColorName, and colorName formatters (lsv)
* Added support for associative arrays in `randomElement` (aRn0D)
## 2013-06-09, v1.2.0
* Added new provider for fr_BE locale (jflefebvre)
* Updated locale provider to use a static locale list (spawn-guy)
* Fixed invalid UTF-8 sequence in domain provider with the Bulgarian provider (Dynom)
* Fixed the nl_NL Person provider (Dynom)
* Removed all requires and added the autoload definition to composer (Dynom)
* Fixed encoding problems in nl_NL Address provider (Dynom)
* Added icelandic provider (is_IS) (birkir)
* Added en_CA address and phone numbers (cviebrock)
* Updated safeEmail provider to be really safe (TimWolla)
* Documented alternative randomNumber usage (Seldaek)
* Added basic file provider (anroots)
* Fixed use of fourth argument on Doctrine addEntity (ecentinela)
* Added nl_BE provider (wimvds)
* Added Random Float provider (csanquer)
* Fixed bug in Faker\ORM\Doctrine\Populator (mmf-amarcos)
* Updated ru_RU provider (rmrevin)
* Added safe email domain provider (csanquer)
* Fixed latitude provider (rumpl)
* Fixed unpredictability of fake data generated by Faker\Provider\Base::numberBetween() (goatherd)
* Added uuid provider (goatherd)
* Added possibility to call methods on Doctrine entities, possibility to generate unique id (nenadalm)
* Fixed prefixes typos in 'pl_PL' Person provider (krymen)
* Added more fake data to the Ukraininan providers (lysenkobv)
* Added more fake data to the Italian providers (EmanueleMinotto)
* Fixed spaces appearing in generated emails (alchy58)
* Added Armenian (hy_AM) provider (artash)
* Added Generation of valid SIREN & SIRET codes to French providers (alexsegura)
* Added Dutch (nl_NL) provider (WouterJ)
* Fixed missing typehint in Base::__construct() (benja-M-1)
* Fixed typo in README (benja-M-1)
* Added Ukrainian (ua_UA) provider (rsvasilyev)
* Added Turkish (tr_TR) Provider (faridmovsumov)
* Fixed executable bit in some PHP files (siwinski)
* Added Brazilian Portuguese (pt_BR) provider (oliveiraev)
* Added Spanish (es_ES) provider (ivannis)
* Fixed Doctrine populator to allow for the population of entity data that has associations to other entities (afishnamedsquish)
* Added Danish (da_DK) providers (toin0u)
* Cleaned up whitespaces (toin0u)
* Fixed utf-8 bug with lowercase generators (toin0u)
* Fixed composer.json (Seldaek)
* Fixed bug in Doctrine EntityPopulator (beberlei)
* Added Finnish (fi_FI) provider (drodil)
## 2012-10-29, v1.1.0
* Updated text provider to return paragraphs as a string instead of array. Great for populating markdown textarea fields (Seldaek)
* Updated dateTimeBetween to accept DateTime instances (Seldaek)
* Added random number generator between a and b, simply like rand() (Seldaek)
* Fixed spaces in generated emails (blaugueux)
* Fixed Person provider in Russian locale (Isamashii)
* Added new UserAgent provider (blaugueux)
* Added locale generator to Miscellaneous provider (blaugueux)
* Added timezone generator to DateTime provider (blaugueux)
* Added new generators to French Address providers (departments, regions) (geoffrey-brier)
* Added new generators to French Company provider (catch phrase, SIREN, and SIRET numbers) (geoffrey-brier)
* Added state generator to German Address provider (Powerhamster)
* Added Slovak provider (bazo)
* Added latitude and longitude formatters to Address provider (fixe)
* Added Serbian provider (umpirsky)
## 2012-07-10, v1.0.0
* Initial Version

22
LICENSE Normal file
View File

@@ -0,0 +1,22 @@
Copyright (c) 2011 François Zaninotto
Portions Copyright (c) 2008 Caius Durling
Portions Copyright (c) 2008 Adam Royle
Portions Copyright (c) 2008 Fiona Burrows
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

38
composer.json Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "siteworxpro/faker",
"type": "library",
"description": "Faker is a PHP library that generates fake data for you.",
"keywords": [
"faker",
"fixtures",
"data"
],
"license": "MIT",
"authors": [
{
"name": "François Zaninotto"
}
],
"require": {
"php": "^8.1"
},
"require-dev": {
"ext-intl": "*",
"phpunit/phpunit": "^9.5.10",
"squizlabs/php_codesniffer": "^3.6.1",
"slevomat/coding-standard": "^7.0.18"
},
"autoload": {
"psr-4": {
"Siteworx\\Faker\\": "src/Faker/"
}
},
"autoload-dev": {
"psr-4": {
"Siteworx\\Faker\\Test\\": "test/Faker/"
}
},
"config": {
"sort-packages": true
}
}

1794
readme.md Normal file

File diff suppressed because it is too large Load Diff

50
rules.xml Normal file
View File

@@ -0,0 +1,50 @@
<?xml version="1.0"?>
<ruleset name="siteworxpro">
<!-- relative path from PHPCS source location -->
<config name="installed_paths" value="vendor/slevomat/coding-standard"/>
<config name="installed_paths" value="vendor/squizlabs/php_codesniffer/src"/>
<rule ref="PSR12">
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
</rule>
<rule ref="Zend">
<exclude name="Generic.Files.LineLength"/>
<exclude name="Zend.NamingConventions.ValidVariableName.PrivateNoUnderscore"/>
<exclude name="Zend.NamingConventions.ValidVariableName.ContainsNumbers"/>
<exclude name="Zend.NamingConventions.ValidVariableName.MemberVarContainsNumbers"/>
</rule>
<!-- specific sniffs to include -->
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TypeHints/ReturnTypeHintSpacingSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Variables/UselessVariableSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Functions/UselessParameterDefaultValueSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/UselessAliasSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/UseFromSameNamespaceSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/UseDoesNotStartWithBackslashSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Operators/RequireCombinedAssignmentOperatorSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/PHP/TypeCastSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/PHP/UselessParenthesesSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/PHP/UselessSemicolonSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Arrays/DisallowImplicitArrayCreationSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/AssignmentInConditionSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/DisallowContinueWithoutIntegerOperandInSwitchSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/DisallowShortTernaryOperatorSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/DisallowYodaComparisonSniff.php" />
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/LanguageConstructWithParenthesesSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/FixmeSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterCastSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Metrics/NestingLevelSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/BacktickOperatorSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/CharacterBeforePHPOpeningTagSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/NoSilencedErrorsSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/DisallowTabIndentSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/IncrementDecrementSpacingSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/SuperfluousWhitespaceSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/MemberVarSpacingSniff.php" />
<rule ref="vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/PropertyLabelSpacingSniff.php" />
</ruleset>

View File

@@ -0,0 +1,55 @@
<?php
namespace Siteworx\Faker\Calculator;
/**
* Utility class for validating EAN-8 and EAN-13 numbers
*
* @package Faker\Calculator
*/
class Ean
{
/** @var string EAN validation pattern */
public const PATTERN = '/^(?:\d{8}|\d{13})$/';
/**
* Computes the checksum of an EAN number.
*
* @see https://en.wikipedia.org/wiki/International_Article_Number
*
* @param string $digits
* @return int
*/
public static function checksum($digits)
{
$length = strlen($digits);
$even = 0;
for ($i = $length - 1; $i >= 0; $i -= 2) {
$even += $digits[$i];
}
$odd = 0;
for ($i = $length - 2; $i >= 0; $i -= 2) {
$odd += $digits[$i];
}
return (10 - ((3 * $even + $odd) % 10)) % 10;
}
/**
* Checks whether the provided number is an EAN compliant number and that
* the checksum is correct.
*
* @param string $ean An EAN number
* @return boolean
*/
public static function isValid($ean)
{
if (!preg_match(self::PATTERN, $ean)) {
return false;
}
return self::checksum(substr($ean, 0, -1)) === intval(substr($ean, -1));
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace Siteworx\Faker\Calculator;
class Iban
{
/**
* Generates IBAN Checksum
*
* @param string $iban
* @return string Checksum (numeric string)
*/
public static function checksum($iban)
{
// Move first four digits to end and set checksum to '00'
$checkString = substr($iban, 4) . substr($iban, 0, 2) . '00';
// Replace all letters with their number equivalents
$checkString = preg_replace_callback('/[A-Z]/', array('self','alphaToNumberCallback'), $checkString);
// Perform mod 97 and subtract from 98
$checksum = 98 - self::mod97($checkString);
return str_pad($checksum, 2, '0', STR_PAD_LEFT);
}
/**
* @param string $match
*
* @return int
*/
private static function alphaToNumberCallback($match)
{
return self::alphaToNumber($match[0]);
}
/**
* Converts letter to number
*
* @param string $char
* @return int
*/
public static function alphaToNumber($char)
{
return ord($char) - 55;
}
/**
* Calculates mod97 on a numeric string
*
* @param string $number Numeric string
* @return int
*/
public static function mod97($number)
{
$checksum = (int) $number[0];
for ($i = 1, $size = strlen($number); $i < $size; $i++) {
$checksum = (10 * $checksum + (int) $number[$i]) % 97;
}
return $checksum;
}
/**
* Checks whether an IBAN has a valid checksum
*
* @param string $iban
* @return boolean
*/
public static function isValid($iban)
{
return self::checksum($iban) === substr($iban, 2, 2);
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Siteworx\Faker\Calculator;
class Inn
{
/**
* Generates INN Checksum
*
* https://ru.wikipedia.org/wiki/%D0%98%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80_%D0%BD%D0%B0%D0%BB%D0%BE%D0%B3%D0%BE%D0%BF%D0%BB%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D1%89%D0%B8%D0%BA%D0%B0
*
* @param string $inn
* @return string Checksum (one digit)
*/
public static function checksum($inn)
{
$multipliers = array(1 => 2, 2 => 4, 3 => 10, 4 => 3, 5 => 5, 6 => 9, 7 => 4, 8 => 6, 9 => 8);
$sum = 0;
for ($i = 1; $i <= 9; $i++) {
$sum += intval(substr($inn, $i - 1, 1)) * $multipliers[$i];
}
return strval($sum % 11 % 10);
}
/**
* Checks whether an INN has a valid checksum
*
* @param string $inn
* @return boolean
*/
public static function isValid($inn)
{
return self::checksum(substr($inn, 0, -1)) === substr($inn, -1, 1);
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace Siteworx\Faker\Calculator;
use InvalidArgumentException;
/**
* Utility class for generating and validating Luhn numbers.
*
* Luhn algorithm is used to validate credit card numbers, IMEI numbers, and
* National Provider Identifier numbers.
*
* @see http://en.wikipedia.org/wiki/Luhn_algorithm
*/
class Luhn
{
/**
* @param string $number
* @return int
*/
private static function checksum($number)
{
$number = (string) $number;
$length = strlen($number);
$sum = 0;
for ($i = $length - 1; $i >= 0; $i -= 2) {
$sum += $number[$i];
}
for ($i = $length - 2; $i >= 0; $i -= 2) {
$sum += array_sum(str_split($number[$i] * 2));
}
return $sum % 10;
}
/**
* @param $partialNumber
* @return string
*/
public static function computeCheckDigit($partialNumber)
{
$checkDigit = self::checksum($partialNumber . '0');
if ($checkDigit === 0) {
return 0;
}
return (string) (10 - $checkDigit);
}
/**
* Checks whether a number (partial number + check digit) is Luhn compliant
*
* @param string $number
* @return bool
*/
public static function isValid($number)
{
return self::checksum($number) === 0;
}
/**
* Generate a Luhn compliant number.
*
* @param string $partialValue
*
* @return string
*/
public static function generateLuhnNumber($partialValue)
{
if (!preg_match('/^\d+$/', $partialValue)) {
throw new InvalidArgumentException('Argument should be an integer.');
}
return $partialValue . Luhn::computeCheckDigit($partialValue);
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace Siteworx\Faker\Calculator;
use InvalidArgumentException;
class TCNo
{
/**
* Generates Turkish Identity Number Checksum
* Gets first 9 digit as prefix and calculates checksum
*
* https://en.wikipedia.org/wiki/Turkish_Identification_Number
*
* @param string $identityPrefix
* @return string Checksum (two digit)
*/
public static function checksum($identityPrefix)
{
if (strlen((string) $identityPrefix) !== 9) {
throw new InvalidArgumentException('Argument should be an integer and should be 9 digits.');
}
$oddSum = 0;
$evenSum = 0;
$identityArray = array_map('intval', str_split($identityPrefix)); // Creates array from int
foreach ($identityArray as $index => $digit) {
if ($index % 2 == 0) {
$evenSum += $digit;
} else {
$oddSum += $digit;
}
}
$tenthDigit = (7 * $evenSum - $oddSum) % 10;
$eleventhDigit = ($evenSum + $oddSum + $tenthDigit) % 10;
return $tenthDigit . $eleventhDigit;
}
/**
* Checks whether a TCNo has a valid checksum
*
* @param string $tcNo
* @return boolean
*/
public static function isValid($tcNo)
{
return self::checksum(substr($tcNo, 0, -2)) === substr($tcNo, -2, 2);
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Siteworx\Faker;
/**
* This generator returns a default value for all called properties
* and methods. It works with Faker\Generator\Base->optional().
*/
class DefaultGenerator
{
protected $default;
public function __construct($default = null)
{
$this->default = $default;
}
/**
* @param string $attribute
*
* @return mixed
*/
public function __get(string $attribute)
{
return $this->default;
}
/**
* @param string $method
* @param array $attributes
*
* @return mixed
*/
public function __call(string $method, array $attributes)
{
return $this->default;
}
}

69
src/Faker/Documentor.php Normal file
View File

@@ -0,0 +1,69 @@
<?php
namespace Siteworx\Faker;
use Siteworx\Faker\Provider\Base;
class Documentor
{
protected Generator $generator;
/**
* @param Generator $generator
*/
public function __construct(Generator $generator)
{
$this->generator = $generator;
}
/**
* @return array
*/
public function getFormatters(): array
{
$formatters = array();
$providers = array_reverse($this->generator->getProviders());
$providers[] = new Provider\Base($this->generator);
foreach ($providers as $provider) {
$providerClass = get_class($provider);
$formatters[$providerClass] = array();
$refl = new \ReflectionObject($provider);
foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflmethod) {
if ($providerClass !== Base::class && $reflmethod->getDeclaringClass()->getName() === 'Faker\Provider\Base') {
continue;
}
$methodName = $reflmethod->name;
if ($reflmethod->isConstructor()) {
continue;
}
$parameters = array();
foreach ($reflmethod->getParameters() as $reflparameter) {
$parameter = '$' . $reflparameter->getName();
if ($reflparameter->isDefaultValueAvailable()) {
$parameter .= ' = ' . var_export($reflparameter->getDefaultValue(), true);
}
$parameters [] = $parameter;
}
$parameters = $parameters ? '(' . join(', ', $parameters) . ')' : '';
try {
$example = $this->generator->format($methodName);
} catch (\InvalidArgumentException $e) {
$example = '';
}
if (is_array($example)) {
$example = "array('" . join("', '", $example) . "')";
} elseif ($example instanceof \DateTime) {
$example = "DateTime('" . $example->format('Y-m-d H:i:s') . "')";
} elseif ($example instanceof Generator || $example instanceof UniqueGenerator) { // modifier
$example = '';
} else {
$example = var_export($example, true);
}
$formatters[$providerClass][$methodName . $parameters] = $example;
}
}
return $formatters;
}
}

68
src/Faker/Factory.php Normal file
View File

@@ -0,0 +1,68 @@
<?php
namespace Siteworx\Faker;
class Factory
{
public const DEFAULT_LOCALE = 'en_US';
protected static array $defaultProviders = ['Address', 'Barcode', 'Biased', 'Color', 'Company', 'DateTime', 'File', 'HtmlLorem', 'Image', 'Internet', 'Lorem', 'Miscellaneous', 'Payment', 'Person', 'PhoneNumber', 'Text', 'UserAgent', 'Uuid'];
/**
* Create a new generator
*
* @param string $locale
* @return Generator
*/
public static function create(string $locale = self::DEFAULT_LOCALE): Generator
{
$generator = new Generator();
foreach (static::$defaultProviders as $provider) {
$providerClassName = self::getProviderClassname($provider, $locale);
$generator->addProvider(new $providerClassName($generator));
}
return $generator;
}
/**
* @param string $provider
* @param string $locale
* @return string
*/
protected static function getProviderClassname(string $provider, string $locale = ''): string
{
$providerClass = self::findProviderClassname($provider, $locale);
if ($providerClass) {
return $providerClass;
}
// fallback to default locale
$providerClass = self::findProviderClassname($provider, static::DEFAULT_LOCALE);
if ($providerClass) {
return $providerClass;
}
// fallback to no locale
$providerClass = self::findProviderClassname($provider);
if ($providerClass) {
return $providerClass;
}
throw new \InvalidArgumentException(sprintf('Unable to find provider "%s" with locale "%s"', $provider, $locale));
}
/**
* @param string $provider
* @param string $locale
* @return string
*/
protected static function findProviderClassname(string $provider, string $locale = ''): ?string
{
$providerClass = 'Siteworx\\Faker\\' . ($locale ? sprintf('Provider\%s\%s', $locale, $provider) : sprintf('Provider\%s', $provider));
if (class_exists($providerClass, true)) {
return $providerClass;
}
return null;
}
}

319
src/Faker/Generator.php Normal file
View File

@@ -0,0 +1,319 @@
<?php
namespace Siteworx\Faker;
/**
* @property string $name
* @method string name(string $gender = null)
* @property string $firstName
* @method string firstName(string $gender = null)
* @property string $firstNameMale
* @property string $firstNameFemale
* @property string $lastName
* @property string $title
* @method string title(string $gender = null)
* @property string $titleMale
* @property string $titleFemale
*
* @property string $citySuffix
* @property string $streetSuffix
* @property string $buildingNumber
* @property string $city
* @property string $streetName
* @property string $streetAddress
* @property string $secondaryAddress
* @property string $postcode
* @property string $address
* @property string $state
* @property string $country
* @property float $latitude
* @property float $longitude
*
* @property string $ean13
* @property string $ean8
* @property string $isbn13
* @property string $isbn10
*
* @property string $phoneNumber
* @property string $e164PhoneNumber
*
* @property string $catchPhrase
* @property string $bs
* @property string $company
* @property string $companySuffix
* @property string $jobTitle
*
* @property string $creditCardType
* @property string $creditCardNumber
* @method string creditCardNumber($type = null, $formatted = false, $separator = '-')
* @property \DateTime $creditCardExpirationDate
* @property string $creditCardExpirationDateString
* @property array $creditCardDetails
* @property string $bankAccountNumber
* @method string iban($countryCode = null, $prefix = '', $length = null)
* @property string $swiftBicNumber
* @property string $vat
*
* @property string $word
* @property string|array $words
* @method string|array words($nb = 3, $asText = false)
* @method string word()
* @property string $sentence
* @method string sentence($nbWords = 6, $variableNbWords = true)
* @property string|array $sentences
* @method string|array sentences($nb = 3, $asText = false)
* @property string $paragraph
* @method string paragraph($nbSentences = 3, $variableNbSentences = true)
* @property string|array $paragraphs
* @method string|array paragraphs($nb = 3, $asText = false)
* @property string $text
* @method string text($maxNbChars = 200)
*
* @method string realText($maxNbChars = 200, $indexSize = 2)
*
* @property string $email
* @property string $safeEmail
* @property string $freeEmail
* @property string $companyEmail
* @property string $freeEmailDomain
* @property string $safeEmailDomain
* @property string $userName
* @property string $password
* @method string password($minLength = 6, $maxLength = 20)
* @property string $domainName
* @property string $domainWord
* @property string $tld
* @property string $url
* @property string $slug
* @method string slug($nbWords = 6, $variableNbWords = true)
* @property string $ipv4
* @property string $ipv6
* @property string $localIpv4
* @property string $macAddress
*
* @property int $unixTime
* @property \DateTime $dateTime
* @property \DateTime $dateTimeAD
* @property string $iso8601
* @property \DateTime $dateTimeThisCentury
* @property \DateTime $dateTimeThisDecade
* @property \DateTime $dateTimeThisYear
* @property \DateTime $dateTimeThisMonth
* @property string $amPm
* @property string $dayOfMonth
* @property string $dayOfWeek
* @property string $month
* @property string $monthName
* @property string $year
* @property string $century
* @property string $timezone
* @method string amPm($max = 'now')
* @method string date($format = 'Y-m-d', $max = 'now')
* @method string dayOfMonth($max = 'now')
* @method string dayOfWeek($max = 'now')
* @method string iso8601($max = 'now')
* @method string month($max = 'now')
* @method string monthName($max = 'now')
* @method string time($format = 'H:i:s', $max = 'now')
* @method int unixTime($max = 'now')
* @method string year($max = 'now')
* @method \DateTime dateTime($max = 'now', $timezone = null)
* @method \DateTime dateTimeAd($max = 'now', $timezone = null)
* @method \DateTime dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null)
* @method \DateTime dateTimeInInterval($date = '-30 years', $interval = '+5 days', $timezone = null)
* @method \DateTime dateTimeThisCentury($max = 'now', $timezone = null)
* @method \DateTime dateTimeThisDecade($max = 'now', $timezone = null)
* @method \DateTime dateTimeThisYear($max = 'now', $timezone = null)
* @method \DateTime dateTimeThisMonth($max = 'now', $timezone = null)
*
* @property string $md5
* @property string $sha1
* @property string $sha256
* @property string $locale
* @property string $countryCode
* @property string $countryISOAlpha3
* @property string $languageCode
* @property string $currencyCode
* @property boolean $boolean
* @method boolean boolean($chanceOfGettingTrue = 50)
*
* @property int $randomDigit
* @property int $randomDigitNot
* @property int $randomDigitNotNull
* @property string $randomLetter
* @property string $randomAscii
* @method int randomNumber($nbDigits = null, $strict = false)
* @method int|string|null randomKey(array $array = array())
* @method int numberBetween($min = 0, $max = 2147483647)
* @method float randomFloat($nbMaxDecimals = null, $min = 0, $max = null)
* @method mixed randomElement(array $array = array('a', 'b', 'c'))
* @method array randomElements(array $array = array('a', 'b', 'c'), $count = 1, $allowDuplicates = false)
* @method array|string shuffle($arg = '')
* @method array shuffleArray(array $array = array())
* @method string shuffleString($string = '', $encoding = 'UTF-8')
* @method string numerify($string = '###')
* @method string lexify($string = '????')
* @method string bothify($string = '## ??')
* @method string asciify($string = '****')
* @method string regexify($regex = '')
* @method string toLower($string = '')
* @method string toUpper($string = '')
* @method Generator optional($weight = 0.5, $default = null)
* @method Generator unique($reset = false, $maxRetries = 10000)
* @method Generator valid($validator = null, $maxRetries = 10000)
* @method mixed passthrough($passthrough)
*
* @method integer biasedNumberBetween($min = 0, $max = 100, $function = 'sqrt')
*
* @property string $macProcessor
* @property string $linuxProcessor
* @property string $userAgent
* @property string $chrome
* @property string $firefox
* @property string $safari
* @property string $opera
* @property string $internetExplorer
* @property string $windowsPlatformToken
* @property string $macPlatformToken
* @property string $linuxPlatformToken
*
* @property string $uuid
*
* @property string $mimeType
* @property string $fileExtension
* @method string file($sourceDirectory = '/tmp', $targetDirectory = '/tmp', $fullPath = true)
*
* @method string imageUrl($width = 640, $height = 480, $category = null, $randomize = true, $word = null, $gray = false)
* @method string image($dir = null, $width = 640, $height = 480, $category = null, $fullPath = true, $randomize = true, $word = null)
*
* @property string $hexColor
* @property string $safeHexColor
* @property string $rgbColor
* @property array $rgbColorAsArray
* @property string $rgbCssColor
* @property string $safeColorName
* @property string $colorName
*
* @method string randomHtml($maxDepth = 4, $maxWidth = 4)
*
*/
class Generator
{
protected array $providers = [];
protected array $formatters = [];
public function addProvider($provider): void
{
array_unshift($this->providers, $provider);
}
public function getProviders(): array
{
return $this->providers;
}
public function seed($seed = null): void
{
if ($seed === null) {
mt_srand();
} elseif (PHP_VERSION_ID < 70100) {
mt_srand((int) $seed);
} else {
mt_srand((int) $seed, MT_RAND_PHP);
}
}
/**
* @param array $providers
* @return Generator
*/
public function setProviders(array $providers): Generator
{
$this->providers = $providers;
return $this;
}
public function format($formatter, $arguments = array())
{
return call_user_func_array($this->getFormatter($formatter), $arguments);
}
/**
* @param string $formatter
*
* @return Callable
*/
public function getFormatter(string $formatter)
{
if (isset($this->formatters[$formatter])) {
return $this->formatters[$formatter];
}
foreach ($this->providers as $provider) {
if (method_exists($provider, $formatter)) {
$this->formatters[$formatter] = array($provider, $formatter);
return $this->formatters[$formatter];
}
}
throw new \InvalidArgumentException(sprintf('Unknown formatter "%s"', $formatter));
}
/**
* Replaces tokens ('{{ tokenName }}') with the result from the token method call
*
* @param string $string String that needs to bet parsed
* @return string
*/
public function parse(string $string): string
{
return preg_replace_callback('/{{\s?(\w+)\s?}}/u', array($this, 'callFormatWithMatches'), $string);
}
protected function callFormatWithMatches($matches)
{
return $this->format($matches[1]);
}
/**
* @param string $attribute
*
* @return mixed
*/
public function __get(string $attribute)
{
return $this->format($attribute);
}
public function __isset($name)
{
}
public function __set(string $key, $value)
{
throw new \RuntimeException('Faker is immutable.');
}
/**
* @param string $method
* @param array $attributes
*
* @return mixed
*/
public function __call(string $method, array $attributes)
{
return $this->format($method, $attributes);
}
public function __destruct()
{
$this->seed();
}
public function __wakeup()
{
$this->formatters = [];
}
}

158
src/Faker/Guesser/Name.php Normal file
View File

@@ -0,0 +1,158 @@
<?php
namespace Siteworx\Faker\Guesser;
use Siteworx\Faker\Generator;
use Siteworx\Faker\Provider\Base;
class Name
{
protected Generator $generator;
/**
* @param Generator $generator
*/
public function __construct(Generator $generator)
{
$this->generator = $generator;
}
/**
* @param string $name
* @param int|null $size Length of field, if known
* @return callable
*/
public function guessFormat(string $name, int $size = null): ?callable
{
$name = Base::toLower($name);
$generator = $this->generator;
if (preg_match('/^is[_A-Z]/', $name)) {
return static function () use ($generator) {
return $generator->boolean;
};
}
if (preg_match('/(_a|A)t$/', $name)) {
return static function () use ($generator) {
return $generator->dateTime;
};
}
switch (str_replace('_', '', $name)) {
case 'firstname':
return static function () use ($generator) {
return $generator->firstName;
};
case 'lastname':
return static function () use ($generator) {
return $generator->lastName;
};
case 'username':
case 'login':
return static function () use ($generator) {
return $generator->userName;
};
case 'email':
case 'emailaddress':
return function () use ($generator) {
return $generator->email;
};
case 'phonenumber':
case 'phone':
case 'telephone':
case 'telnumber':
return function () use ($generator) {
return $generator->phoneNumber;
};
case 'address':
return function () use ($generator) {
return $generator->address;
};
case 'city':
case 'town':
return function () use ($generator) {
return $generator->city;
};
case 'streetaddress':
return function () use ($generator) {
return $generator->streetAddress;
};
case 'postcode':
case 'zipcode':
return function () use ($generator) {
return $generator->postcode;
};
case 'state':
return function () use ($generator) {
return $generator->state;
};
case 'county':
if ($this->generator->locale == 'en_US') {
return function () use ($generator) {
return sprintf('%s County', $generator->city);
};
}
return function () use ($generator) {
return $generator->state;
};
case 'country':
switch ($size) {
case 2:
return function () use ($generator) {
return $generator->countryCode;
};
case 3:
return function () use ($generator) {
return $generator->countryISOAlpha3;
};
case 5:
case 6:
return function () use ($generator) {
return $generator->locale;
};
default:
return function () use ($generator) {
return $generator->country;
};
}
break;
case 'locale':
return function () use ($generator) {
return $generator->locale;
};
case 'currency':
case 'currencycode':
return function () use ($generator) {
return $generator->currencyCode;
};
case 'url':
case 'website':
return function () use ($generator) {
return $generator->url;
};
case 'company':
case 'companyname':
case 'employer':
return function () use ($generator) {
return $generator->company;
};
case 'title':
if ($size !== null && $size <= 10) {
return function () use ($generator) {
return $generator->title;
};
}
return function () use ($generator) {
return $generator->sentence;
};
case 'body':
case 'summary':
case 'article':
case 'description':
return function () use ($generator) {
return $generator->text;
};
}
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace Siteworx\Faker\ORM\CakePHP;
class ColumnTypeGuesser
{
protected $generator;
public function __construct(\Siteworx\Faker\Generator $generator)
{
$this->generator = $generator;
}
/**
* @return \Closure|null
*/
public function guessFormat($column, $table)
{
$generator = $this->generator;
$schema = $table->schema();
switch ($schema->columnType($column)) {
case 'boolean':
return function () use ($generator) {
return $generator->boolean;
};
case 'integer':
return function () {
return mt_rand(0, intval('2147483647'));
};
case 'biginteger':
return function () {
return mt_rand(0, intval('9223372036854775807'));
};
case 'decimal':
case 'float':
return function () use ($generator) {
return $generator->randomFloat();
};
case 'uuid':
return function () use ($generator) {
return $generator->uuid();
};
case 'string':
if (method_exists($schema, 'getColumn')) {
$columnData = $schema->getColumn($column);
} else {
$columnData = $schema->column($column);
}
$length = $columnData['length'];
return function () use ($generator, $length) {
return $generator->text($length);
};
case 'text':
return function () use ($generator) {
return $generator->text();
};
case 'date':
case 'datetime':
case 'timestamp':
case 'time':
return function () use ($generator) {
return $generator->datetime();
};
case 'binary':
default:
return null;
}
}
}

View File

@@ -0,0 +1,172 @@
<?php
namespace Siteworx\Faker\ORM\CakePHP;
use Cake\ORM\TableRegistry;
class EntityPopulator
{
protected $class;
protected $connectionName;
protected $columnFormatters = [];
protected $modifiers = [];
public function __construct($class)
{
$this->class = $class;
}
/**
* @param string $name
*/
public function __get($name)
{
return $this->{$name};
}
/**
* @param string $name
*/
public function __set($name, $value)
{
$this->{$name} = $value;
}
public function mergeColumnFormattersWith($columnFormatters)
{
$this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters);
}
public function mergeModifiersWith($modifiers)
{
$this->modifiers = array_merge($this->modifiers, $modifiers);
}
/**
* @return array
*/
public function guessColumnFormatters($populator)
{
$formatters = [];
$class = $this->class;
$table = $this->getTable($class);
$schema = $table->schema();
$pk = $schema->primaryKey();
$guessers = $populator->getGuessers() + ['ColumnTypeGuesser' => new ColumnTypeGuesser($populator->getGenerator())];
$isForeignKey = function ($column) use ($table) {
foreach ($table->associations()->type('BelongsTo') as $assoc) {
if ($column == $assoc->foreignKey()) {
return true;
}
}
return false;
};
foreach ($schema->columns() as $column) {
if ($column == $pk[0] || $isForeignKey($column)) {
continue;
}
foreach ($guessers as $guesser) {
if ($formatter = $guesser->guessFormat($column, $table)) {
$formatters[$column] = $formatter;
break;
}
}
}
return $formatters;
}
/**
* @return array
*/
public function guessModifiers()
{
$modifiers = [];
$table = $this->getTable($this->class);
$belongsTo = $table->associations()->type('BelongsTo');
foreach ($belongsTo as $assoc) {
$modifiers['belongsTo' . $assoc->name()] = function ($data, $insertedEntities) use ($assoc) {
$table = $assoc->target();
$foreignModel = $table->alias();
$foreignKeys = [];
if (!empty($insertedEntities[$foreignModel])) {
$foreignKeys = $insertedEntities[$foreignModel];
} else {
$foreignKeys = $table->find('all')
->select(['id'])
->map(
function ($row) {
return $row->id;
}
)
->toArray();
}
if (empty($foreignKeys)) {
throw new \Exception(sprintf('%s belongsTo %s, which seems empty at this point.', $this->getTable($this->class)->table(), $assoc->table()));
}
$foreignKey = $foreignKeys[array_rand($foreignKeys)];
$data[$assoc->foreignKey()] = $foreignKey;
return $data;
};
}
// TODO check if TreeBehavior attached to modify lft/rgt cols
return $modifiers;
}
/**
* @param array $options
*/
public function execute($class, $insertedEntities, $options = [])
{
$table = $this->getTable($class);
$entity = $table->newEntity();
foreach ($this->columnFormatters as $column => $format) {
if (!is_null($format)) {
$entity->{$column} = is_callable($format) ? $format($insertedEntities, $table) : $format;
}
}
foreach ($this->modifiers as $modifier) {
$entity = $modifier($entity, $insertedEntities);
}
if (!$entity = $table->save($entity, $options)) {
throw new \RuntimeException("Failed saving $class record");
}
$pk = $table->primaryKey();
if (is_string($pk)) {
return $entity->{$pk};
}
return $entity->{$pk[0]};
}
public function setConnection($name)
{
$this->connectionName = $name;
}
protected function getTable($class)
{
$options = [];
if (!empty($this->connectionName)) {
$options['connection'] = $this->connectionName;
}
return TableRegistry::get($class, $options);
}
}

View File

@@ -0,0 +1,112 @@
<?php
namespace Siteworx\Faker\ORM\CakePHP;
class Populator
{
protected $generator;
protected $entities = [];
protected $quantities = [];
protected $guessers = [];
/**
* @param \Siteworx\Faker\Generator $generator
*/
public function __construct(\Siteworx\Faker\Generator $generator)
{
$this->generator = $generator;
}
/**
* @return \Siteworx\Faker\Generator
*/
public function getGenerator()
{
return $this->generator;
}
/**
* @return array
*/
public function getGuessers()
{
return $this->guessers;
}
/**
* @return $this
*/
public function removeGuesser($name)
{
if ($this->guessers[$name]) {
unset($this->guessers[$name]);
}
return $this;
}
/**
* @return $this
* @throws \Exception
*/
public function addGuesser($class)
{
if (!is_object($class)) {
$class = new $class($this->generator);
}
if (!method_exists($class, 'guessFormat')) {
throw new \Exception('Missing required custom guesser method: ' . get_class($class) . '::guessFormat()');
}
$this->guessers[get_class($class)] = $class;
return $this;
}
/**
* @param array $customColumnFormatters
* @param array $customModifiers
* @return $this
*/
public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = [])
{
if (!$entity instanceof EntityPopulator) {
$entity = new EntityPopulator($entity);
}
$entity->columnFormatters = $entity->guessColumnFormatters($this);
if ($customColumnFormatters) {
$entity->mergeColumnFormattersWith($customColumnFormatters);
}
$entity->modifiers = $entity->guessModifiers($this);
if ($customModifiers) {
$entity->mergeModifiersWith($customModifiers);
}
$class = $entity->class;
$this->entities[$class] = $entity;
$this->quantities[$class] = $number;
return $this;
}
/**
* @param array $options
* @return array
*/
public function execute($options = [])
{
$insertedEntities = [];
foreach ($this->quantities as $class => $number) {
for ($i = 0; $i < $number; $i++) {
$insertedEntities[$class][] = $this->entities[$class]->execute($class, $insertedEntities, $options);
}
}
return $insertedEntities;
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace Siteworx\Faker\ORM\Doctrine;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
class ColumnTypeGuesser
{
protected $generator;
/**
* @param \Siteworx\Faker\Generator $generator
*/
public function __construct(\Siteworx\Faker\Generator $generator)
{
$this->generator = $generator;
}
/**
* @param ClassMetadata $class
* @return \Closure|null
*/
public function guessFormat($fieldName, ClassMetadata $class)
{
$generator = $this->generator;
$type = $class->getTypeOfField($fieldName);
switch ($type) {
case 'boolean':
return function () use ($generator) {
return $generator->boolean;
};
case 'decimal':
$size = isset($class->fieldMappings[$fieldName]['precision']) ? $class->fieldMappings[$fieldName]['precision'] : 2;
return function () use ($generator, $size) {
return $generator->randomNumber($size + 2) / 100;
};
case 'smallint':
return function () {
return mt_rand(0, 65535);
};
case 'integer':
return function () {
return mt_rand(0, intval('2147483647'));
};
case 'bigint':
return function () {
return mt_rand(0, intval('18446744073709551615'));
};
case 'float':
return function () {
return mt_rand(0, intval('4294967295')) / mt_rand(1, intval('4294967295'));
};
case 'string':
$size = isset($class->fieldMappings[$fieldName]['length']) ? $class->fieldMappings[$fieldName]['length'] : 255;
return function () use ($generator, $size) {
return $generator->text($size);
};
case 'text':
return function () use ($generator) {
return $generator->text;
};
case 'datetime':
case 'date':
case 'time':
return function () use ($generator) {
return $generator->datetime;
};
case 'datetime_immutable':
case 'date_immutable':
case 'time_immutable':
return function () use ($generator) {
return \DateTimeImmutable::createFromMutable($generator->datetime);
};
default:
// no smart way to guess what the user expects here
return null;
}
}
}

View File

@@ -0,0 +1,256 @@
<?php
namespace Siteworx\Faker\ORM\Doctrine;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
/**
* Service class for populating a table through a Doctrine Entity class.
*/
class EntityPopulator
{
/**
* @var ClassMetadata
*/
protected $class;
/**
* @var array
*/
protected $columnFormatters = array();
/**
* @var array
*/
protected $modifiers = array();
/**
* Class constructor.
*
* @param ClassMetadata $class
*/
public function __construct(ClassMetadata $class)
{
$this->class = $class;
}
/**
* @return string
*/
public function getClass()
{
return $this->class->getName();
}
/**
* @param $columnFormatters
*/
public function setColumnFormatters($columnFormatters)
{
$this->columnFormatters = $columnFormatters;
}
/**
* @return array
*/
public function getColumnFormatters()
{
return $this->columnFormatters;
}
public function mergeColumnFormattersWith($columnFormatters)
{
$this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters);
}
/**
* @param array $modifiers
*/
public function setModifiers(array $modifiers)
{
$this->modifiers = $modifiers;
}
/**
* @return array
*/
public function getModifiers()
{
return $this->modifiers;
}
/**
* @param array $modifiers
*/
public function mergeModifiersWith(array $modifiers)
{
$this->modifiers = array_merge($this->modifiers, $modifiers);
}
/**
* @param \Siteworx\Faker\Generator $generator
* @return array
*/
public function guessColumnFormatters(\Siteworx\Faker\Generator $generator)
{
$formatters = array();
$nameGuesser = new \Siteworx\Faker\Guesser\Name($generator);
$columnTypeGuesser = new ColumnTypeGuesser($generator);
foreach ($this->class->getFieldNames() as $fieldName) {
if ($this->class->isIdentifier($fieldName) || !$this->class->hasField($fieldName)) {
continue;
}
$size = isset($this->class->fieldMappings[$fieldName]['length']) ? $this->class->fieldMappings[$fieldName]['length'] : null;
if ($formatter = $nameGuesser->guessFormat($fieldName, $size)) {
$formatters[$fieldName] = $formatter;
continue;
}
if ($formatter = $columnTypeGuesser->guessFormat($fieldName, $this->class)) {
$formatters[$fieldName] = $formatter;
continue;
}
}
foreach ($this->class->getAssociationNames() as $assocName) {
if ($this->class->isCollectionValuedAssociation($assocName)) {
continue;
}
$relatedClass = $this->class->getAssociationTargetClass($assocName);
$unique = $optional = false;
if ($this->class instanceof \Doctrine\ORM\Mapping\ClassMetadata) {
$mappings = $this->class->getAssociationMappings();
foreach ($mappings as $mapping) {
if ($mapping['targetEntity'] == $relatedClass) {
if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadata::ONE_TO_ONE) {
$unique = true;
$optional = isset($mapping['joinColumns'][0]['nullable']) ? $mapping['joinColumns'][0]['nullable'] : false;
break;
}
}
}
} elseif ($this->class instanceof \Doctrine\ODM\MongoDB\Mapping\ClassMetadata) {
$mappings = $this->class->associationMappings;
foreach ($mappings as $mapping) {
if ($mapping['targetDocument'] == $relatedClass) {
if ($mapping['type'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::ONE && $mapping['association'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::REFERENCE_ONE) {
$unique = true;
$optional = isset($mapping['nullable']) ? $mapping['nullable'] : false;
break;
}
}
}
}
$index = 0;
$formatters[$assocName] = function ($inserted) use ($relatedClass, &$index, $unique, $optional) {
if (isset($inserted[$relatedClass])) {
if ($unique) {
$related = null;
if (isset($inserted[$relatedClass][$index]) || !$optional) {
$related = $inserted[$relatedClass][$index];
}
$index++;
return $related;
}
return $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)];
}
return null;
};
}
return $formatters;
}
/**
* Insert one new record using the Entity class.
* @param ObjectManager $manager
* @param bool $generateId
* @return EntityPopulator
*/
public function execute(ObjectManager $manager, $insertedEntities, $generateId = false)
{
$obj = $this->class->newInstance();
$this->fillColumns($obj, $insertedEntities);
$this->callMethods($obj, $insertedEntities);
if ($generateId) {
$idsName = $this->class->getIdentifier();
foreach ($idsName as $idName) {
$id = $this->generateId($obj, $idName, $manager);
$this->class->reflFields[$idName]->setValue($obj, $id);
}
}
$manager->persist($obj);
return $obj;
}
private function fillColumns($obj, $insertedEntities)
{
foreach ($this->columnFormatters as $field => $format) {
if ($format !== null) {
// Add some extended debugging information to any errors thrown by the formatter
try {
$value = is_callable($format) ? $format($insertedEntities, $obj) : $format;
} catch (\InvalidArgumentException $ex) {
throw new \InvalidArgumentException(
sprintf(
"Failed to generate a value for %s::%s: %s",
get_class($obj),
$field,
$ex->getMessage()
)
);
}
// Try a standard setter if it's available, otherwise fall back on reflection
$setter = sprintf("set%s", ucfirst($field));
if (is_callable(array($obj, $setter))) {
$obj->$setter($value);
} else {
$this->class->reflFields[$field]->setValue($obj, $value);
}
}
}
}
private function callMethods($obj, $insertedEntities)
{
foreach ($this->getModifiers() as $modifier) {
$modifier($obj, $insertedEntities);
}
}
/**
* @param ObjectManager $manager
* @return int|null
*/
private function generateId($obj, $column, ObjectManager $manager)
{
/* @var $repository \Doctrine\Common\Persistence\ObjectRepository */
$repository = $manager->getRepository(get_class($obj));
$result = $repository->createQueryBuilder('e')
->select(sprintf('e.%s', $column))
->getQuery()
->execute();
$ids = array_map('current', $result->toArray());
$id = null;
do {
$id = mt_rand();
} while (in_array($id, $ids));
return $id;
}
}

View File

@@ -0,0 +1,109 @@
<?php
namespace Siteworx\Faker\ORM\Doctrine;
use Doctrine\Common\Persistence\ObjectManager;
use Siteworx\Faker\Generator;
/**
* Service class for populating a database using the Doctrine ORM or ODM.
* A Populator can populate several tables using ActiveRecord classes.
*/
class Populator
{
/** @var int */
protected $batchSize;
/** @var Generator */
protected $generator;
/** @var ObjectManager|null */
protected $manager;
/** @var array */
protected $entities = array();
/** @var array */
protected $quantities = array();
/** @var array */
protected $generateId = array();
/**
* Populator constructor.
* @param Generator $generator
* @param ObjectManager|null $manager
* @param int $batchSize
*/
public function __construct(Generator $generator, ObjectManager $manager = null, $batchSize = 1000)
{
$this->generator = $generator;
$this->manager = $manager;
$this->batchSize = $batchSize;
}
/**
* Add an order for the generation of $number records for $entity.
*
* @param mixed $entity A Doctrine classname, or a \Faker\ORM\Doctrine\EntityPopulator instance
* @param int $number The number of entities to populate
*/
public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array(), $generateId = false)
{
if (!$entity instanceof \Siteworx\Faker\ORM\Doctrine\EntityPopulator) {
if ($this->manager === null) {
throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator.");
}
$entity = new \Siteworx\Faker\ORM\Doctrine\EntityPopulator($this->manager->getClassMetadata($entity));
}
$entity->setColumnFormatters($entity->guessColumnFormatters($this->generator));
if ($customColumnFormatters) {
$entity->mergeColumnFormattersWith($customColumnFormatters);
}
$entity->mergeModifiersWith($customModifiers);
$this->generateId[$entity->getClass()] = $generateId;
$class = $entity->getClass();
$this->entities[$class] = $entity;
$this->quantities[$class] = $number;
}
/**
* Populate the database using all the Entity classes previously added.
*
* Please note that large amounts of data will result in more memory usage since the the Populator will return
* all newly created primary keys after executing.
*
* @param null|EntityManager $entityManager A Doctrine connection object
*
* @return array A list of the inserted PKs
*/
public function execute($entityManager = null)
{
if ($entityManager === null) {
$entityManager = $this->manager;
}
if ($entityManager === null) {
throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator.");
}
$insertedEntities = array();
foreach ($this->quantities as $class => $number) {
$generateId = $this->generateId[$class];
for ($i = 0; $i < $number; $i++) {
$insertedEntities[$class][] = $this->entities[$class]->execute(
$entityManager,
$insertedEntities,
$generateId
);
if (count($insertedEntities) % $this->batchSize === 0) {
$entityManager->flush();
}
}
$entityManager->flush();
}
return $insertedEntities;
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Siteworx\Faker\ORM\Mandango;
class ColumnTypeGuesser
{
protected $generator;
/**
* @param \Siteworx\Faker\Generator $generator
*/
public function __construct(\Siteworx\Faker\Generator $generator)
{
$this->generator = $generator;
}
/**
* @return \Closure|null
*/
public function guessFormat($field)
{
$generator = $this->generator;
switch ($field['type']) {
case 'boolean':
return function () use ($generator) {
return $generator->boolean;
};
case 'integer':
return function () {
return mt_rand(0, intval('4294967295'));
};
case 'float':
return function () {
return mt_rand(0, intval('4294967295')) / mt_rand(1, intval('4294967295'));
};
case 'string':
return function () use ($generator) {
return $generator->text(255);
};
case 'date':
return function () use ($generator) {
return $generator->datetime;
};
default:
// no smart way to guess what the user expects here
return null;
}
}
}

View File

@@ -0,0 +1,126 @@
<?php
namespace Siteworx\Faker\ORM\Mandango;
use Mandango\Mandango;
use Siteworx\Faker\Provider\Base;
/**
* Service class for populating a table through a Mandango ActiveRecord class.
*/
class EntityPopulator
{
protected $class;
protected $columnFormatters = array();
/**
* Class constructor.
*
* @param string $class A Mandango ActiveRecord classname
*/
public function __construct($class)
{
$this->class = $class;
}
/**
* @return string
*/
public function getClass()
{
return $this->class;
}
public function setColumnFormatters($columnFormatters)
{
$this->columnFormatters = $columnFormatters;
}
/**
* @return array
*/
public function getColumnFormatters()
{
return $this->columnFormatters;
}
public function mergeColumnFormattersWith($columnFormatters)
{
$this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters);
}
/**
* @param \Siteworx\Faker\Generator $generator
* @param Mandango $mandango
* @return array
*/
public function guessColumnFormatters(\Siteworx\Faker\Generator $generator, Mandango $mandango)
{
$formatters = array();
$nameGuesser = new \Siteworx\Faker\Guesser\Name($generator);
$columnTypeGuesser = new \Siteworx\Faker\ORM\Mandango\ColumnTypeGuesser($generator);
$metadata = $mandango->getMetadata($this->class);
// fields
foreach ($metadata['fields'] as $fieldName => $field) {
if ($formatter = $nameGuesser->guessFormat($fieldName)) {
$formatters[$fieldName] = $formatter;
continue;
}
if ($formatter = $columnTypeGuesser->guessFormat($field)) {
$formatters[$fieldName] = $formatter;
continue;
}
}
// references
foreach (array_merge($metadata['referencesOne'], $metadata['referencesMany']) as $referenceName => $reference) {
if (!isset($reference['class'])) {
continue;
}
$referenceClass = $reference['class'];
$formatters[$referenceName] = function ($insertedEntities) use ($referenceClass) {
if (isset($insertedEntities[$referenceClass])) {
return Base::randomElement($insertedEntities[$referenceClass]);
}
};
}
return $formatters;
}
/**
* Insert one new record using the Entity class.
* @param Mandango $mandango
*/
public function execute(Mandango $mandango, $insertedEntities)
{
$metadata = $mandango->getMetadata($this->class);
$obj = $mandango->create($this->class);
foreach ($this->columnFormatters as $column => $format) {
if ($format !== null) {
$value = is_callable($format) ? $format($insertedEntities, $obj) : $format;
if (
isset($metadata['fields'][$column]) ||
isset($metadata['referencesOne'][$column])
) {
$obj->set($column, $value);
}
if (isset($metadata['referencesMany'][$column])) {
$adder = 'add' . ucfirst($column);
$obj->$adder($value);
}
}
}
$mandango->persist($obj);
return $obj;
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace Siteworx\Faker\ORM\Mandango;
use Mandango\Mandango;
/**
* Service class for populating a database using Mandango.
* A Populator can populate several tables using ActiveRecord classes.
*/
class Populator
{
protected $generator;
protected $mandango;
protected $entities = array();
protected $quantities = array();
/**
* @param \Siteworx\Faker\Generator $generator
* @param Mandango $mandango
*/
public function __construct(\Siteworx\Faker\Generator $generator, Mandango $mandango)
{
$this->generator = $generator;
$this->mandango = $mandango;
}
/**
* Add an order for the generation of $number records for $entity.
*
* @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance
* @param int $number The number of entities to populate
*/
public function addEntity($entity, $number, $customColumnFormatters = array())
{
if (!$entity instanceof \Siteworx\Faker\ORM\Mandango\EntityPopulator) {
$entity = new \Siteworx\Faker\ORM\Mandango\EntityPopulator($entity);
}
$entity->setColumnFormatters($entity->guessColumnFormatters($this->generator, $this->mandango));
if ($customColumnFormatters) {
$entity->mergeColumnFormattersWith($customColumnFormatters);
}
$class = $entity->getClass();
$this->entities[$class] = $entity;
$this->quantities[$class] = $number;
}
/**
* Populate the database using all the Entity classes previously added.
*
* @return array A list of the inserted entities.
*/
public function execute()
{
$insertedEntities = array();
foreach ($this->quantities as $class => $number) {
for ($i = 0; $i < $number; $i++) {
$insertedEntities[$class][] = $this->entities[$class]->execute($this->mandango, $insertedEntities);
}
}
$this->mandango->flush();
return $insertedEntities;
}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace Siteworx\Faker\ORM\Propel;
use PropelColumnTypes;
use ColumnMap;
class ColumnTypeGuesser
{
protected $generator;
/**
* @param \Siteworx\Faker\Generator $generator
*/
public function __construct(\Siteworx\Faker\Generator $generator)
{
$this->generator = $generator;
}
/**
* @param ColumnMap $column
* @return \Closure|null
*/
public function guessFormat(ColumnMap $column)
{
$generator = $this->generator;
if ($column->isTemporal()) {
if ($column->isEpochTemporal()) {
return function () use ($generator) {
return $generator->dateTime;
};
}
return function () use ($generator) {
return $generator->dateTimeAD;
};
}
$type = $column->getType();
switch ($type) {
case PropelColumnTypes::BOOLEAN:
case PropelColumnTypes::BOOLEAN_EMU:
return function () use ($generator) {
return $generator->boolean;
};
case PropelColumnTypes::NUMERIC:
case PropelColumnTypes::DECIMAL:
$size = $column->getSize();
return function () use ($generator, $size) {
return $generator->randomNumber($size + 2) / 100;
};
case PropelColumnTypes::TINYINT:
return function () {
return mt_rand(0, 127);
};
case PropelColumnTypes::SMALLINT:
return function () {
return mt_rand(0, 32767);
};
case PropelColumnTypes::INTEGER:
return function () {
return mt_rand(0, intval('2147483647'));
};
case PropelColumnTypes::BIGINT:
return function () {
return mt_rand(0, intval('9223372036854775807'));
};
case PropelColumnTypes::FLOAT:
return function () {
return mt_rand(0, intval('2147483647')) / mt_rand(1, intval('2147483647'));
};
case PropelColumnTypes::DOUBLE:
case PropelColumnTypes::REAL:
return function () {
return mt_rand(0, intval('9223372036854775807')) / mt_rand(1, intval('9223372036854775807'));
};
case PropelColumnTypes::CHAR:
case PropelColumnTypes::VARCHAR:
case PropelColumnTypes::BINARY:
case PropelColumnTypes::VARBINARY:
$size = $column->getSize();
return function () use ($generator, $size) {
return $generator->text($size);
};
case PropelColumnTypes::LONGVARCHAR:
case PropelColumnTypes::LONGVARBINARY:
case PropelColumnTypes::CLOB:
case PropelColumnTypes::CLOB_EMU:
case PropelColumnTypes::BLOB:
return function () use ($generator) {
return $generator->text;
};
case PropelColumnTypes::ENUM:
$valueSet = $column->getValueSet();
return function () use ($generator, $valueSet) {
return $generator->randomElement($valueSet);
};
case PropelColumnTypes::OBJECT:
case PropelColumnTypes::PHP_ARRAY:
default:
// no smart way to guess what the user expects here
return null;
}
}
}

View File

@@ -0,0 +1,194 @@
<?php
namespace Siteworx\Faker\ORM\Propel;
use Siteworx\Faker\Provider\Base;
use ColumnMap;
/**
* Service class for populating a table through a Propel ActiveRecord class.
*/
class EntityPopulator
{
protected $class;
protected $columnFormatters = array();
protected $modifiers = array();
/**
* Class constructor.
*
* @param string $class A Propel ActiveRecord classname
*/
public function __construct($class)
{
$this->class = $class;
}
/**
* @return string
*/
public function getClass()
{
return $this->class;
}
public function setColumnFormatters($columnFormatters)
{
$this->columnFormatters = $columnFormatters;
}
/**
* @return array
*/
public function getColumnFormatters()
{
return $this->columnFormatters;
}
public function mergeColumnFormattersWith($columnFormatters)
{
$this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters);
}
/**
* @param \Siteworx\Faker\Generator $generator
* @return array
*/
public function guessColumnFormatters(\Siteworx\Faker\Generator $generator)
{
$formatters = array();
$class = $this->class;
$peerClass = $class::PEER;
$tableMap = $peerClass::getTableMap();
$nameGuesser = new \Siteworx\Faker\Guesser\Name($generator);
$columnTypeGuesser = new \Siteworx\Faker\ORM\Propel\ColumnTypeGuesser($generator);
foreach ($tableMap->getColumns() as $columnMap) {
// skip behavior columns, handled by modifiers
if ($this->isColumnBehavior($columnMap)) {
continue;
}
if ($columnMap->isForeignKey()) {
$relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname();
$formatters[$columnMap->getPhpName()] = function ($inserted) use ($relatedClass) {
return isset($inserted[$relatedClass]) ? $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)] : null;
};
continue;
}
if ($columnMap->isPrimaryKey()) {
continue;
}
if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) {
$formatters[$columnMap->getPhpName()] = $formatter;
continue;
}
if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) {
$formatters[$columnMap->getPhpName()] = $formatter;
continue;
}
}
return $formatters;
}
/**
* @param ColumnMap $columnMap
* @return bool
*/
protected function isColumnBehavior(ColumnMap $columnMap)
{
foreach ($columnMap->getTable()->getBehaviors() as $name => $params) {
$columnName = Base::toLower($columnMap->getName());
switch ($name) {
case 'nested_set':
$columnNames = array($params['left_column'], $params['right_column'], $params['level_column']);
if (in_array($columnName, $columnNames)) {
return true;
}
break;
case 'timestampable':
$columnNames = array($params['create_column'], $params['update_column']);
if (in_array($columnName, $columnNames)) {
return true;
}
break;
}
}
return false;
}
public function setModifiers($modifiers)
{
$this->modifiers = $modifiers;
}
/**
* @return array
*/
public function getModifiers()
{
return $this->modifiers;
}
public function mergeModifiersWith($modifiers)
{
$this->modifiers = array_merge($this->modifiers, $modifiers);
}
/**
* @param \Siteworx\Faker\Generator $generator
* @return array
*/
public function guessModifiers(\Siteworx\Faker\Generator $generator)
{
$modifiers = array();
$class = $this->class;
$peerClass = $class::PEER;
$tableMap = $peerClass::getTableMap();
foreach ($tableMap->getBehaviors() as $name => $params) {
switch ($name) {
case 'nested_set':
$modifiers['nested_set'] = function ($obj, $inserted) use ($class, $generator) {
if (isset($inserted[$class])) {
$queryClass = $class . 'Query';
$parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class]));
$obj->insertAsLastChildOf($parent);
} else {
$obj->makeRoot();
}
};
break;
case 'sortable':
$modifiers['sortable'] = function ($obj, $inserted) use ($class) {
$maxRank = isset($inserted[$class]) ? count($inserted[$class]) : 0;
$obj->insertAtRank(mt_rand(1, $maxRank + 1));
};
break;
}
}
return $modifiers;
}
/**
* Insert one new record using the Entity class.
*/
public function execute($con, $insertedEntities)
{
$obj = new $this->class();
foreach ($this->getColumnFormatters() as $column => $format) {
if ($format !== null) {
$obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format);
}
}
foreach ($this->getModifiers() as $modifier) {
$modifier($obj, $insertedEntities);
}
$obj->save($con);
return $obj->getPrimaryKey();
}
}

View File

@@ -0,0 +1,92 @@
<?php
namespace Siteworx\Faker\ORM\Propel;
/**
* Service class for populating a database using the Propel ORM.
* A Populator can populate several tables using ActiveRecord classes.
*/
class Populator
{
protected $generator;
protected $entities = array();
protected $quantities = array();
/**
* @param \Siteworx\Faker\Generator $generator
*/
public function __construct(\Siteworx\Faker\Generator $generator)
{
$this->generator = $generator;
}
/**
* Add an order for the generation of $number records for $entity.
*
* @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance
* @param int $number The number of entities to populate
*/
public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array())
{
if (!$entity instanceof \Siteworx\Faker\ORM\Propel\EntityPopulator) {
$entity = new \Siteworx\Faker\ORM\Propel\EntityPopulator($entity);
}
$entity->setColumnFormatters($entity->guessColumnFormatters($this->generator));
if ($customColumnFormatters) {
$entity->mergeColumnFormattersWith($customColumnFormatters);
}
$entity->setModifiers($entity->guessModifiers($this->generator));
if ($customModifiers) {
$entity->mergeModifiersWith($customModifiers);
}
$class = $entity->getClass();
$this->entities[$class] = $entity;
$this->quantities[$class] = $number;
}
/**
* Populate the database using all the Entity classes previously added.
*
* @param PropelPDO $con A Propel connection object
*
* @return array A list of the inserted PKs
*/
public function execute($con = null)
{
if ($con === null) {
$con = $this->getConnection();
}
$isInstancePoolingEnabled = \Propel::isInstancePoolingEnabled();
\Propel::disableInstancePooling();
$insertedEntities = array();
$con->beginTransaction();
foreach ($this->quantities as $class => $number) {
for ($i = 0; $i < $number; $i++) {
$insertedEntities[$class][] = $this->entities[$class]->execute($con, $insertedEntities);
}
}
$con->commit();
if ($isInstancePoolingEnabled) {
\Propel::enableInstancePooling();
}
return $insertedEntities;
}
protected function getConnection()
{
// use the first connection available
$class = key($this->entities);
if (!$class) {
throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?');
}
$peer = $class::PEER;
return \Propel::getConnection($peer::DATABASE_NAME, \Propel::CONNECTION_WRITE);
}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace Siteworx\Faker\ORM\Propel2;
use Propel\Generator\Model\PropelTypes;
use Propel\Runtime\Map\ColumnMap;
class ColumnTypeGuesser
{
protected $generator;
/**
* @param \Siteworx\Faker\Generator $generator
*/
public function __construct(\Siteworx\Faker\Generator $generator)
{
$this->generator = $generator;
}
/**
* @param ColumnMap $column
* @return \Closure|null
*/
public function guessFormat(ColumnMap $column)
{
$generator = $this->generator;
if ($column->isTemporal()) {
if ($column->getType() == PropelTypes::BU_DATE || $column->getType() == PropelTypes::BU_TIMESTAMP) {
return function () use ($generator) {
return $generator->dateTime;
};
}
return function () use ($generator) {
return $generator->dateTimeAD;
};
}
$type = $column->getType();
switch ($type) {
case PropelTypes::BOOLEAN:
case PropelTypes::BOOLEAN_EMU:
return function () use ($generator) {
return $generator->boolean;
};
case PropelTypes::NUMERIC:
case PropelTypes::DECIMAL:
$size = $column->getSize();
return function () use ($generator, $size) {
return $generator->randomNumber($size + 2) / 100;
};
case PropelTypes::TINYINT:
return function () {
return mt_rand(0, 127);
};
case PropelTypes::SMALLINT:
return function () {
return mt_rand(0, 32767);
};
case PropelTypes::INTEGER:
return function () {
return mt_rand(0, intval('2147483647'));
};
case PropelTypes::BIGINT:
return function () {
return mt_rand(0, intval('9223372036854775807'));
};
case PropelTypes::FLOAT:
return function () {
return mt_rand(0, intval('2147483647')) / mt_rand(1, intval('2147483647'));
};
case PropelTypes::DOUBLE:
case PropelTypes::REAL:
return function () {
return mt_rand(0, intval('9223372036854775807')) / mt_rand(1, intval('9223372036854775807'));
};
case PropelTypes::CHAR:
case PropelTypes::VARCHAR:
case PropelTypes::BINARY:
case PropelTypes::VARBINARY:
$size = $column->getSize();
return function () use ($generator, $size) {
return $generator->text($size);
};
case PropelTypes::LONGVARCHAR:
case PropelTypes::LONGVARBINARY:
case PropelTypes::CLOB:
case PropelTypes::CLOB_EMU:
case PropelTypes::BLOB:
return function () use ($generator) {
return $generator->text;
};
case PropelTypes::ENUM:
$valueSet = $column->getValueSet();
return function () use ($generator, $valueSet) {
return $generator->randomElement($valueSet);
};
case PropelTypes::OBJECT:
case PropelTypes::PHP_ARRAY:
default:
// no smart way to guess what the user expects here
return null;
}
}
}

View File

@@ -0,0 +1,195 @@
<?php
namespace Siteworx\Faker\ORM\Propel2;
use Siteworx\Faker\Provider\Base;
use Propel\Runtime\Map\ColumnMap;
/**
* Service class for populating a table through a Propel ActiveRecord class.
*/
class EntityPopulator
{
protected $class;
protected $columnFormatters = array();
protected $modifiers = array();
/**
* Class constructor.
*
* @param string $class A Propel ActiveRecord classname
*/
public function __construct($class)
{
$this->class = $class;
}
/**
* @return string
*/
public function getClass()
{
return $this->class;
}
public function setColumnFormatters($columnFormatters)
{
$this->columnFormatters = $columnFormatters;
}
/**
* @return array
*/
public function getColumnFormatters()
{
return $this->columnFormatters;
}
public function mergeColumnFormattersWith($columnFormatters)
{
$this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters);
}
/**
* @param \Siteworx\Faker\Generator $generator
* @return array
*/
public function guessColumnFormatters(\Siteworx\Faker\Generator $generator)
{
$formatters = array();
$class = $this->class;
$peerClass = $class::TABLE_MAP;
$tableMap = $peerClass::getTableMap();
$nameGuesser = new \Siteworx\Faker\Guesser\Name($generator);
$columnTypeGuesser = new \Siteworx\Faker\ORM\Propel2\ColumnTypeGuesser($generator);
foreach ($tableMap->getColumns() as $columnMap) {
// skip behavior columns, handled by modifiers
if ($this->isColumnBehavior($columnMap)) {
continue;
}
if ($columnMap->isForeignKey()) {
$relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname();
$formatters[$columnMap->getPhpName()] = function ($inserted) use ($relatedClass) {
$relatedClass = trim($relatedClass, "\\");
return isset($inserted[$relatedClass]) ? $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)] : null;
};
continue;
}
if ($columnMap->isPrimaryKey()) {
continue;
}
if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) {
$formatters[$columnMap->getPhpName()] = $formatter;
continue;
}
if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) {
$formatters[$columnMap->getPhpName()] = $formatter;
continue;
}
}
return $formatters;
}
/**
* @param ColumnMap $columnMap
* @return bool
*/
protected function isColumnBehavior(ColumnMap $columnMap)
{
foreach ($columnMap->getTable()->getBehaviors() as $name => $params) {
$columnName = Base::toLower($columnMap->getName());
switch ($name) {
case 'nested_set':
$columnNames = array($params['left_column'], $params['right_column'], $params['level_column']);
if (in_array($columnName, $columnNames)) {
return true;
}
break;
case 'timestampable':
$columnNames = array($params['create_column'], $params['update_column']);
if (in_array($columnName, $columnNames)) {
return true;
}
break;
}
}
return false;
}
public function setModifiers($modifiers)
{
$this->modifiers = $modifiers;
}
/**
* @return array
*/
public function getModifiers()
{
return $this->modifiers;
}
public function mergeModifiersWith($modifiers)
{
$this->modifiers = array_merge($this->modifiers, $modifiers);
}
/**
* @param \Siteworx\Faker\Generator $generator
* @return array
*/
public function guessModifiers(\Siteworx\Faker\Generator $generator)
{
$modifiers = array();
$class = $this->class;
$peerClass = $class::TABLE_MAP;
$tableMap = $peerClass::getTableMap();
foreach ($tableMap->getBehaviors() as $name => $params) {
switch ($name) {
case 'nested_set':
$modifiers['nested_set'] = function ($obj, $inserted) use ($class, $generator) {
if (isset($inserted[$class])) {
$queryClass = $class . 'Query';
$parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class]));
$obj->insertAsLastChildOf($parent);
} else {
$obj->makeRoot();
}
};
break;
case 'sortable':
$modifiers['sortable'] = function ($obj, $inserted) use ($class) {
$maxRank = isset($inserted[$class]) ? count($inserted[$class]) : 0;
$obj->insertAtRank(mt_rand(1, $maxRank + 1));
};
break;
}
}
return $modifiers;
}
/**
* Insert one new record using the Entity class.
*/
public function execute($con, $insertedEntities)
{
$obj = new $this->class();
foreach ($this->getColumnFormatters() as $column => $format) {
if ($format !== null) {
$obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format);
}
}
foreach ($this->getModifiers() as $modifier) {
$modifier($obj, $insertedEntities);
}
$obj->save($con);
return $obj->getPrimaryKey();
}
}

View File

@@ -0,0 +1,95 @@
<?php
namespace Siteworx\Faker\ORM\Propel2;
use Propel\Runtime\Propel;
use Propel\Runtime\ServiceContainer\ServiceContainerInterface;
/**
* Service class for populating a database using the Propel ORM.
* A Populator can populate several tables using ActiveRecord classes.
*/
class Populator
{
protected $generator;
protected $entities = array();
protected $quantities = array();
/**
* @param \Siteworx\Faker\Generator $generator
*/
public function __construct(\Siteworx\Faker\Generator $generator)
{
$this->generator = $generator;
}
/**
* Add an order for the generation of $number records for $entity.
*
* @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel2\EntityPopulator instance
* @param int $number The number of entities to populate
*/
public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array())
{
if (!$entity instanceof \Siteworx\Faker\ORM\Propel2\EntityPopulator) {
$entity = new \Siteworx\Faker\ORM\Propel2\EntityPopulator($entity);
}
$entity->setColumnFormatters($entity->guessColumnFormatters($this->generator));
if ($customColumnFormatters) {
$entity->mergeColumnFormattersWith($customColumnFormatters);
}
$entity->setModifiers($entity->guessModifiers($this->generator));
if ($customModifiers) {
$entity->mergeModifiersWith($customModifiers);
}
$class = $entity->getClass();
$this->entities[$class] = $entity;
$this->quantities[$class] = $number;
}
/**
* Populate the database using all the Entity classes previously added.
*
* @param PropelPDO $con A Propel connection object
*
* @return array A list of the inserted PKs
*/
public function execute($con = null)
{
if ($con === null) {
$con = $this->getConnection();
}
$isInstancePoolingEnabled = Propel::isInstancePoolingEnabled();
Propel::disableInstancePooling();
$insertedEntities = array();
$con->beginTransaction();
foreach ($this->quantities as $class => $number) {
for ($i = 0; $i < $number; $i++) {
$insertedEntities[$class][] = $this->entities[$class]->execute($con, $insertedEntities);
}
}
$con->commit();
if ($isInstancePoolingEnabled) {
Propel::enableInstancePooling();
}
return $insertedEntities;
}
protected function getConnection()
{
// use the first connection available
$class = key($this->entities);
if (!$class) {
throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?');
}
$peer = $class::TABLE_MAP;
return Propel::getConnection($peer::DATABASE_NAME, ServiceContainerInterface::CONNECTION_WRITE);
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace Siteworx\Faker\ORM\Spot;
use Siteworx\Faker\Generator;
class ColumnTypeGuesser
{
protected $generator;
/**
* ColumnTypeGuesser constructor.
* @param Generator $generator
*/
public function __construct(Generator $generator)
{
$this->generator = $generator;
}
/**
* @param array $field
* @return \Closure|null
*/
public function guessFormat(array $field)
{
$generator = $this->generator;
$type = $field['type'];
switch ($type) {
case 'boolean':
return function () use ($generator) {
return $generator->boolean;
};
case 'decimal':
$size = isset($field['precision']) ? $field['precision'] : 2;
return function () use ($generator, $size) {
return $generator->randomNumber($size + 2) / 100;
};
case 'smallint':
return function () use ($generator) {
return $generator->numberBetween(0, 65535);
};
case 'integer':
return function () use ($generator) {
return $generator->numberBetween(0, intval('2147483647'));
};
case 'bigint':
return function () use ($generator) {
return $generator->numberBetween(0, intval('18446744073709551615'));
};
case 'float':
return function () use ($generator) {
return $generator->randomFloat(null, 0, intval('4294967295'));
};
case 'string':
$size = isset($field['length']) ? $field['length'] : 255;
return function () use ($generator, $size) {
return $generator->text($size);
};
case 'text':
return function () use ($generator) {
return $generator->text;
};
case 'datetime':
case 'date':
case 'time':
return function () use ($generator) {
return $generator->datetime;
};
default:
// no smart way to guess what the user expects here
return null;
}
}
}

View File

@@ -0,0 +1,220 @@
<?php
namespace Siteworx\Faker\ORM\Spot;
use Siteworx\Faker\Generator;
use Siteworx\Faker\Guesser\Name;
use Spot\Locator;
use Spot\Mapper;
use Spot\Relation\BelongsTo;
/**
* Service class for populating a table through a Spot Entity class.
*/
class EntityPopulator
{
/**
* When fetching existing data - fetch only few first rows.
*/
const RELATED_FETCH_COUNT = 10;
/**
* @var Mapper
*/
protected $mapper;
/**
* @var Locator
*/
protected $locator;
/**
* @var array
*/
protected $columnFormatters = array();
/**
* @var array
*/
protected $modifiers = array();
/**
* @var bool
*/
protected $useExistingData = false;
/**
* Class constructor.
*
* @param Mapper $mapper
* @param Locator $locator
* @param $useExistingData
*/
public function __construct(Mapper $mapper, Locator $locator, $useExistingData = false)
{
$this->mapper = $mapper;
$this->locator = $locator;
$this->useExistingData = $useExistingData;
}
/**
* @return string
*/
public function getMapper()
{
return $this->mapper;
}
/**
* @param $columnFormatters
*/
public function setColumnFormatters($columnFormatters)
{
$this->columnFormatters = $columnFormatters;
}
/**
* @return array
*/
public function getColumnFormatters()
{
return $this->columnFormatters;
}
/**
* @param $columnFormatters
*/
public function mergeColumnFormattersWith($columnFormatters)
{
$this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters);
}
/**
* @param array $modifiers
*/
public function setModifiers(array $modifiers)
{
$this->modifiers = $modifiers;
}
/**
* @return array
*/
public function getModifiers()
{
return $this->modifiers;
}
/**
* @param array $modifiers
*/
public function mergeModifiersWith(array $modifiers)
{
$this->modifiers = array_merge($this->modifiers, $modifiers);
}
/**
* @param Generator $generator
* @return array
*/
public function guessColumnFormatters(Generator $generator)
{
$formatters = array();
$nameGuesser = new Name($generator);
$columnTypeGuesser = new ColumnTypeGuesser($generator);
$fields = $this->mapper->fields();
foreach ($fields as $fieldName => $field) {
if ($field['primary'] === true) {
continue;
}
if ($formatter = $nameGuesser->guessFormat($fieldName)) {
$formatters[$fieldName] = $formatter;
continue;
}
if ($formatter = $columnTypeGuesser->guessFormat($field)) {
$formatters[$fieldName] = $formatter;
continue;
}
}
$entityName = $this->mapper->entity();
$entity = $this->mapper->build([]);
$relations = $entityName::relations($this->mapper, $entity);
foreach ($relations as $relation) {
// We don't need any other relation here.
if ($relation instanceof BelongsTo) {
$fieldName = $relation->localKey();
$entityName = $relation->entityName();
$field = $fields[$fieldName];
$required = $field['required'];
$locator = $this->locator;
$formatters[$fieldName] = function ($inserted) use ($required, $entityName, $locator) {
if (!empty($inserted[$entityName])) {
return $inserted[$entityName][mt_rand(0, count($inserted[$entityName]) - 1)]->get('id');
}
if ($required && $this->useExistingData) {
// We did not add anything like this, but it's required,
// So let's find something existing in DB.
$mapper = $locator->mapper($entityName);
$records = $mapper->all()->limit(self::RELATED_FETCH_COUNT)->toArray();
if (empty($records)) {
return null;
}
return $records[mt_rand(0, count($records) - 1)]['id'];
}
return null;
};
}
}
return $formatters;
}
/**
* Insert one new record using the Entity class.
*
* @param $insertedEntities
* @return string
*/
public function execute($insertedEntities)
{
$obj = $this->mapper->build([]);
$this->fillColumns($obj, $insertedEntities);
$this->callMethods($obj, $insertedEntities);
$this->mapper->insert($obj);
return $obj;
}
/**
* @param $obj
* @param $insertedEntities
*/
private function fillColumns($obj, $insertedEntities)
{
foreach ($this->columnFormatters as $field => $format) {
if ($format !== null) {
$value = is_callable($format) ? $format($insertedEntities, $obj) : $format;
$obj->set($field, $value);
}
}
}
/**
* @param $obj
* @param $insertedEntities
*/
private function callMethods($obj, $insertedEntities)
{
foreach ($this->getModifiers() as $modifier) {
$modifier($obj, $insertedEntities);
}
}
}

View File

@@ -0,0 +1,92 @@
<?php
namespace Siteworx\Faker\ORM\Spot;
use Spot\Locator;
/**
* Service class for populating a database using the Spot ORM.
*/
class Populator
{
protected $generator;
protected $locator;
protected $entities = array();
protected $quantities = array();
/**
* Populator constructor.
* @param \Siteworx\Faker\Generator $generator
* @param Locator|null $locator
*/
public function __construct(\Siteworx\Faker\Generator $generator, Locator $locator = null)
{
$this->generator = $generator;
$this->locator = $locator;
}
/**
* Add an order for the generation of $number records for $entity.
*
* @param $entityName string Name of Entity object to generate
* @param $number int The number of entities to populate
* @param $customColumnFormatters array
* @param $customModifiers array
* @param $useExistingData bool Should we use existing rows (e.g. roles) to populate relations?
*/
public function addEntity(
$entityName,
$number,
$customColumnFormatters = array(),
$customModifiers = array(),
$useExistingData = false
)
{
$mapper = $this->locator->mapper($entityName);
if ($mapper === null) {
throw new \InvalidArgumentException("No mapper can be found for entity " . $entityName);
}
$entity = new EntityPopulator($mapper, $this->locator, $useExistingData);
$entity->setColumnFormatters($entity->guessColumnFormatters($this->generator));
if ($customColumnFormatters) {
$entity->mergeColumnFormattersWith($customColumnFormatters);
}
$entity->mergeModifiersWith($customModifiers);
$this->entities[$entityName] = $entity;
$this->quantities[$entityName] = $number;
}
/**
* Populate the database using all the Entity classes previously added.
*
* @param Locator $locator A Spot locator
*
* @return array A list of the inserted PKs
*/
public function execute($locator = null)
{
if ($locator === null) {
$locator = $this->locator;
}
if ($locator === null) {
throw new \InvalidArgumentException("No entity manager passed to Spot Populator.");
}
$insertedEntities = array();
foreach ($this->quantities as $entityName => $number) {
for ($i = 0; $i < $number; $i++) {
$insertedEntities[$entityName][] = $this->entities[$entityName]->execute(
$insertedEntities
);
}
}
return $insertedEntities;
}
}

View File

@@ -0,0 +1,147 @@
<?php
namespace Siteworx\Faker\Provider;
class Address extends Base
{
protected static $citySuffix = array('Ville');
protected static $streetSuffix = array('Street');
protected static $cityFormats = array(
'{{firstName}}{{citySuffix}}',
);
protected static $streetNameFormats = array(
'{{lastName}} {{streetSuffix}}'
);
protected static $streetAddressFormats = array(
'{{buildingNumber}} {{streetName}}'
);
protected static $addressFormats = array(
'{{streetAddress}} {{postcode}} {{city}}',
);
protected static $buildingNumber = array('%#');
protected static $postcode = array('#####');
protected static $country = array();
/**
* @example 'town'
*/
public static function citySuffix()
{
return static::randomElement(static::$citySuffix);
}
/**
* @example 'Avenue'
*/
public static function streetSuffix()
{
return static::randomElement(static::$streetSuffix);
}
/**
* @example '791'
*/
public static function buildingNumber()
{
return static::numerify(static::randomElement(static::$buildingNumber));
}
/**
* @example 'Sashabury'
*/
public function city()
{
$format = static::randomElement(static::$cityFormats);
return $this->generator->parse($format);
}
/**
* @example 'Crist Parks'
*/
public function streetName()
{
$format = static::randomElement(static::$streetNameFormats);
return $this->generator->parse($format);
}
/**
* @example '791 Crist Parks'
*/
public function streetAddress()
{
$format = static::randomElement(static::$streetAddressFormats);
return $this->generator->parse($format);
}
/**
* @example 86039-9874
*/
public static function postcode()
{
return static::toUpper(static::bothify(static::randomElement(static::$postcode)));
}
/**
* @example '791 Crist Parks, Sashabury, IL 86039-9874'
*/
public function address()
{
$format = static::randomElement(static::$addressFormats);
return $this->generator->parse($format);
}
/**
* @example 'Japan'
*/
public static function country()
{
return static::randomElement(static::$country);
}
/**
* @example '77.147489'
* @param float|int $min
* @param float|int $max
* @return float Uses signed degrees format (returns a float number between -90 and 90)
*/
public static function latitude($min = -90, $max = 90)
{
return static::randomFloat(6, $min, $max);
}
/**
* @example '86.211205'
* @param float|int $min
* @param float|int $max
* @return float Uses signed degrees format (returns a float number between -180 and 180)
*/
public static function longitude($min = -180, $max = 180)
{
return static::randomFloat(6, $min, $max);
}
/**
* @example array('77.147489', '86.211205')
* @return array | latitude, longitude
*/
public static function localCoordinates()
{
return array(
'latitude' => static::latitude(),
'longitude' => static::longitude()
);
}
}

View File

@@ -0,0 +1,114 @@
<?php
namespace Siteworx\Faker\Provider;
/**
* @see http://en.wikipedia.org/wiki/EAN-13
* @see http://en.wikipedia.org/wiki/ISBN
*/
class Barcode extends Base
{
private function ean($length = 13)
{
$code = static::numerify(str_repeat('#', $length - 1));
return $code . static::eanChecksum($code);
}
/**
* Utility function for computing EAN checksums
*
* @param string $input
*
* @return integer
*/
protected static function eanChecksum($input)
{
$sequence = strlen($input) + 1 === 8 ? array(3, 1) : array(1, 3);
$sums = 0;
foreach (str_split($input) as $n => $digit) {
$sums += $digit * $sequence[$n % 2];
}
return (10 - $sums % 10) % 10;
}
/**
* ISBN-10 check digit
* @link http://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digits
*
* @param string $input ISBN without check-digit
* @throws \LengthException When wrong input length passed
*
* @return integer Check digit
*/
protected static function isbnChecksum($input)
{
// We're calculating check digit for ISBN-10
// so, the length of the input should be 9
$length = 9;
if (strlen($input) !== $length) {
throw new \LengthException(sprintf('Input length should be equal to %d', $length));
}
$digits = str_split($input);
array_walk(
$digits,
function (&$digit, $position) {
$digit = (10 - $position) * $digit;
}
);
$result = (11 - array_sum($digits) % 11) % 11;
// 10 is replaced by X
return $result < 10 ? $result : 'X';
}
/**
* Get a random EAN13 barcode.
* @return string
* @example '4006381333931'
*/
public function ean13()
{
return $this->ean(13);
}
/**
* Get a random EAN8 barcode.
* @return string
* @example '73513537'
*/
public function ean8()
{
return $this->ean(8);
}
/**
* Get a random ISBN-10 code
* @link http://en.wikipedia.org/wiki/International_Standard_Book_Number
*
* @return string
* @example '4881416324'
*/
public function isbn10()
{
$code = static::numerify(str_repeat('#', 9));
return $code . static::isbnChecksum($code);
}
/**
* Get a random ISBN-13 code
* @link http://en.wikipedia.org/wiki/International_Standard_Book_Number
*
* @return string
* @example '9790404436093'
*/
public function isbn13()
{
$code = '97' . static::numberBetween(8, 9) . static::numerify(str_repeat('#', 9));
return $code . static::eanChecksum($code);
}
}

643
src/Faker/Provider/Base.php Normal file
View File

@@ -0,0 +1,643 @@
<?php
namespace Siteworx\Faker\Provider;
use Siteworx\Faker\Generator;
use Siteworx\Faker\DefaultGenerator;
use Siteworx\Faker\UniqueGenerator;
use Siteworx\Faker\ValidGenerator;
class Base
{
/**
* @var \Siteworx\Faker\Generator
*/
protected $generator;
/**
* @var \Siteworx\Faker\UniqueGenerator
*/
protected $unique;
/**
* @param \Siteworx\Faker\Generator $generator
*/
public function __construct(Generator $generator)
{
$this->generator = $generator;
}
/**
* Returns a random number between 0 and 9
*
* @return integer
*/
public static function randomDigit()
{
return mt_rand(0, 9);
}
/**
* Returns a random number between 1 and 9
*
* @return integer
*/
public static function randomDigitNotNull()
{
return mt_rand(1, 9);
}
/**
* Generates a random digit, which cannot be $except
*
* @param int $except
* @return int
*/
public static function randomDigitNot($except)
{
$result = self::numberBetween(0, 8);
if ($result >= $except) {
$result++;
}
return $result;
}
/**
* Returns a random integer with 0 to $nbDigits digits.
*
* The maximum value returned is mt_getrandmax()
*
* @param integer $nbDigits Defaults to a random number between 1 and 9
* @param boolean $strict Whether the returned number should have exactly $nbDigits
* @example 79907610
*
* @return integer
*/
public static function randomNumber($nbDigits = null, $strict = false)
{
if (!is_bool($strict)) {
throw new \InvalidArgumentException('randomNumber() generates numbers of fixed width. To generate numbers between two boundaries, use numberBetween() instead.');
}
if ($nbDigits === null) {
$nbDigits = static::randomDigitNotNull();
}
$max = pow(10, $nbDigits) - 1;
if ($max > mt_getrandmax()) {
throw new \InvalidArgumentException('randomNumber() can only generate numbers up to mt_getrandmax()');
}
if ($strict) {
return mt_rand(pow(10, $nbDigits - 1), $max);
}
return mt_rand(0, $max);
}
/**
* Return a random float number
*
* @param int $nbMaxDecimals
* @param int|float $min
* @param int|float $max
* @example 48.8932
*
* @return float
*/
public static function randomFloat($nbMaxDecimals = null, $min = 0, $max = null)
{
if ($nbMaxDecimals === null) {
$nbMaxDecimals = static::randomDigit();
}
if ($max === null) {
$max = static::randomNumber();
if ($min > $max) {
$max = $min;
}
}
if ($min > $max) {
$tmp = $min;
$min = $max;
$max = $tmp;
}
return round($min + mt_rand() / mt_getrandmax() * ($max - $min), $nbMaxDecimals);
}
/**
* Returns a random number between $int1 and $int2 (any order)
*
* @param integer $int1 default to 0
* @param integer $int2 defaults to 32 bit max integer, ie 2147483647
* @example 79907610
*
* @return integer
*/
public static function numberBetween($int1 = 0, $int2 = 2147483647)
{
$min = $int1 < $int2 ? $int1 : $int2;
$max = $int1 < $int2 ? $int2 : $int1;
return mt_rand($min, $max);
}
/**
* Returns the passed value
*
* @param mixed $value
*
* @return mixed
*/
public static function passthrough($value)
{
return $value;
}
/**
* Returns a random letter from a to z
*
* @return string
*/
public static function randomLetter()
{
return chr(mt_rand(97, 122));
}
/**
* Returns a random ASCII character (excluding accents and special chars)
*/
public static function randomAscii()
{
return chr(mt_rand(33, 126));
}
/**
* Returns randomly ordered subsequence of $count elements from a provided array
*
* @param array $array Array to take elements from. Defaults to a-c
* @param integer $count Number of elements to take.
* @param boolean $allowDuplicates Allow elements to be picked several times. Defaults to false
* @throws \LengthException When requesting more elements than provided
*
* @return array New array with $count elements from $array
*/
public static function randomElements($array = array('a', 'b', 'c'), $count = 1, $allowDuplicates = false)
{
$traversables = array();
if ($array instanceof \Traversable) {
foreach ($array as $element) {
$traversables[] = $element;
}
}
$arr = count($traversables) ? $traversables : $array;
$allKeys = array_keys($arr);
$numKeys = count($allKeys);
if (!$allowDuplicates && $numKeys < $count) {
throw new \LengthException(sprintf('Cannot get %d elements, only %d in array', $count, $numKeys));
}
$highKey = $numKeys - 1;
$keys = $elements = array();
$numElements = 0;
while ($numElements < $count) {
$num = mt_rand(0, $highKey);
if (!$allowDuplicates) {
if (isset($keys[$num])) {
continue;
}
$keys[$num] = true;
}
$elements[] = $arr[$allKeys[$num]];
$numElements++;
}
return $elements;
}
/**
* Returns a random element from a passed array
*
* @param array $array
* @return mixed
*/
public static function randomElement($array = array('a', 'b', 'c'))
{
if (!$array || ($array instanceof \Traversable && !count($array))) {
return null;
}
$elements = static::randomElements($array, 1);
return $elements[0];
}
/**
* Returns a random key from a passed associative array
*
* @param array $array
* @return int|string|null
*/
public static function randomKey($array = array())
{
if (!$array) {
return null;
}
$keys = array_keys($array);
return $keys[mt_rand(0, count($keys) - 1)];
}
/**
* Returns a shuffled version of the argument.
*
* This function accepts either an array, or a string.
*
* @example $faker->shuffle([1, 2, 3]); // [2, 1, 3]
* @example $faker->shuffle('hello, world'); // 'rlo,h eold!lw'
*
* @see shuffleArray()
* @see shuffleString()
*
* @param array|string $arg The set to shuffle
* @return array|string The shuffled set
*/
public static function shuffle($arg = '')
{
if (is_array($arg)) {
return static::shuffleArray($arg);
}
if (is_string($arg)) {
return static::shuffleString($arg);
}
throw new \InvalidArgumentException('shuffle() only supports strings or arrays');
}
/**
* Returns a shuffled version of the array.
*
* This function does not mutate the original array. It uses the
* FisherYates algorithm, which is unbiased, together with a Mersenne
* twister random generator. This function is therefore more random than
* PHP's shuffle() function, and it is seedable.
*
* @link http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
*
* @example $faker->shuffleArray([1, 2, 3]); // [2, 1, 3]
*
* @param array $array The set to shuffle
* @return array The shuffled set
*/
public static function shuffleArray($array = array())
{
$shuffledArray = array();
$i = 0;
reset($array);
foreach ($array as $key => $value) {
if ($i == 0) {
$j = 0;
} else {
$j = mt_rand(0, $i);
}
if ($j == $i) {
$shuffledArray[] = $value;
} else {
$shuffledArray[] = $shuffledArray[$j];
$shuffledArray[$j] = $value;
}
$i++;
}
return $shuffledArray;
}
/**
* Returns a shuffled version of the string.
*
* This function does not mutate the original string. It uses the
* FisherYates algorithm, which is unbiased, together with a Mersenne
* twister random generator. This function is therefore more random than
* PHP's shuffle() function, and it is seedable. Additionally, it is
* UTF8 safe if the mb extension is available.
*
* @link http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
*
* @example $faker->shuffleString('hello, world'); // 'rlo,h eold!lw'
*
* @param string $string The set to shuffle
* @param string $encoding The string encoding (defaults to UTF-8)
* @return string The shuffled set
*/
public static function shuffleString($string = '', $encoding = 'UTF-8')
{
if (function_exists('mb_strlen')) {
// UTF8-safe str_split()
$array = array();
$strlen = mb_strlen($string, $encoding);
for ($i = 0; $i < $strlen; $i++) {
$array [] = mb_substr($string, $i, 1, $encoding);
}
} else {
$array = str_split($string, 1);
}
return implode('', static::shuffleArray($array));
}
private static function replaceWildcard($string, $wildcard = '#', $callback = 'static::randomDigit')
{
if (($pos = strpos($string, $wildcard)) === false) {
return $string;
}
for ($i = $pos, $last = strrpos($string, $wildcard, $pos) + 1; $i < $last; $i++) {
if ($string[$i] === $wildcard) {
$string[$i] = call_user_func($callback);
}
}
return $string;
}
/**
* Replaces all hash sign ('#') occurrences with a random number
* Replaces all percentage sign ('%') occurrences with a not null number
*
* @param string $string String that needs to bet parsed
* @return string
*/
public static function numerify($string = '###')
{
// instead of using randomDigit() several times, which is slow,
// count the number of hashes and generate once a large number
$toReplace = array();
if (($pos = strpos($string, '#')) !== false) {
for ($i = $pos, $last = strrpos($string, '#', $pos) + 1; $i < $last; $i++) {
if ($string[$i] === '#') {
$toReplace[] = $i;
}
}
}
if ($nbReplacements = count($toReplace)) {
$maxAtOnce = strlen((string) mt_getrandmax()) - 1;
$numbers = '';
$i = 0;
while ($i < $nbReplacements) {
$size = min($nbReplacements - $i, $maxAtOnce);
$numbers .= str_pad(static::randomNumber($size), $size, '0', STR_PAD_LEFT);
$i += $size;
}
for ($i = 0; $i < $nbReplacements; $i++) {
$string[$toReplace[$i]] = $numbers[$i];
}
}
$string = self::replaceWildcard($string, '%', 'static::randomDigitNotNull');
return $string;
}
/**
* Replaces all question mark ('?') occurrences with a random letter
*
* @param string $string String that needs to bet parsed
* @return string
*/
public static function lexify($string = '????')
{
return self::replaceWildcard($string, '?', 'static::randomLetter');
}
/**
* Replaces hash signs ('#') and question marks ('?') with random numbers and letters
* An asterisk ('*') is replaced with either a random number or a random letter
*
* @param string $string String that needs to bet parsed
* @return string
*/
public static function bothify($string = '## ??')
{
$string = self::replaceWildcard(
$string,
'*',
function () {
return mt_rand(0, 1) ? '#' : '?';
}
);
return static::lexify(static::numerify($string));
}
/**
* Replaces * signs with random numbers and letters and special characters
*
* @example $faker->asciify(''********'); // "s5'G!uC3"
*
* @param string $string String that needs to bet parsed
* @return string
*/
public static function asciify($string = '****')
{
return preg_replace_callback('/\*/u', 'static::randomAscii', $string);
}
/**
* Transforms a basic regular expression into a random string satisfying the expression.
*
* @example $faker->regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // sm0@y8k96a.ej
*
* Regex delimiters '/.../' and begin/end markers '^...$' are ignored.
*
* Only supports a small subset of the regex syntax. For instance,
* unicode, negated classes, unbounded ranges, subpatterns, back references,
* assertions, recursive patterns, and comments are not supported. Escaping
* support is extremely fragile.
*
* This method is also VERY slow. Use it only when no other formatter
* can generate the fake data you want. For instance, prefer calling
* `$faker->email` rather than `regexify` with the previous regular
* expression.
*
* Also note than `bothify` can probably do most of what this method does,
* but much faster. For instance, for a dummy email generation, try
* `$faker->bothify('?????????@???.???')`.
*
* @see https://github.com/icomefromthenet/ReverseRegex for a more robust implementation
*
* @param string $regex A regular expression (delimiters are optional)
* @return string
*/
public static function regexify($regex = '')
{
// ditch the anchors
$regex = preg_replace('/^\/?\^?/', '', $regex);
$regex = preg_replace('/\$?\/?$/', '', $regex);
// All {2} become {2,2}
$regex = preg_replace('/\{(\d+)\}/', '{\1,\1}', $regex);
// Single-letter quantifiers (?, *, +) become bracket quantifiers ({0,1}, {0,rand}, {1, rand})
$regex = preg_replace('/(?<!\\\)\?/', '{0,1}', $regex);
$regex = preg_replace('/(?<!\\\)\*/', '{0,' . static::randomDigitNotNull() . '}', $regex);
$regex = preg_replace('/(?<!\\\)\+/', '{1,' . static::randomDigitNotNull() . '}', $regex);
// [12]{1,2} becomes [12] or [12][12]
$regex = preg_replace_callback(
'/(\[[^\]]+\])\{(\d+),(\d+)\}/',
function ($matches) {
return str_repeat($matches[1], Base::randomElement(range($matches[2], $matches[3])));
},
$regex
);
// (12|34){1,2} becomes (12|34) or (12|34)(12|34)
$regex = preg_replace_callback(
'/(\([^\)]+\))\{(\d+),(\d+)\}/',
function ($matches) {
return str_repeat($matches[1], Base::randomElement(range($matches[2], $matches[3])));
},
$regex
);
// A{1,2} becomes A or AA or \d{3} becomes \d\d\d
$regex = preg_replace_callback(
'/(\\\?.)\{(\d+),(\d+)\}/',
function ($matches) {
return str_repeat($matches[1], Base::randomElement(range($matches[2], $matches[3])));
},
$regex
);
// (this|that) becomes 'this' or 'that'
$regex = preg_replace_callback(
'/\((.*?)\)/',
function ($matches) {
return Base::randomElement(explode('|', str_replace(array('(', ')'), '', $matches[1])));
},
$regex
);
// All A-F inside of [] become ABCDEF
$regex = preg_replace_callback(
'/\[([^\]]+)\]/',
function ($matches) {
return '[' . preg_replace_callback(
'/(\w|\d)\-(\w|\d)/',
function ($range) {
return implode('', range($range[1], $range[2]));
},
$matches[1]
) . ']';
},
$regex
);
// All [ABC] become B (or A or C)
$regex = preg_replace_callback(
'/\[([^\]]+)\]/',
function ($matches) {
return Base::randomElement(str_split($matches[1]));
},
$regex
);
// replace \d with number and \w with letter and . with ascii
$regex = preg_replace_callback('/\\\w/', 'static::randomLetter', $regex);
$regex = preg_replace_callback('/\\\d/', 'static::randomDigit', $regex);
$regex = preg_replace_callback('/(?<!\\\)\./', 'static::randomAscii', $regex);
// remove remaining backslashes
$regex = str_replace('\\', '', $regex);
// phew
return $regex;
}
/**
* Converts string to lowercase.
* Uses mb_string extension if available.
*
* @param string $string String that should be converted to lowercase
* @return string
*/
public static function toLower($string = '')
{
return extension_loaded('mbstring') ? mb_strtolower($string, 'UTF-8') : strtolower($string);
}
/**
* Converts string to uppercase.
* Uses mb_string extension if available.
*
* @param string $string String that should be converted to uppercase
* @return string
*/
public static function toUpper($string = '')
{
return extension_loaded('mbstring') ? mb_strtoupper($string, 'UTF-8') : strtoupper($string);
}
/**
* Chainable method for making any formatter optional.
*
* @param float|integer $weight Set the probability of receiving a null value.
* "0" will always return null, "1" will always return the generator.
* If $weight is an integer value, then the same system works
* between 0 (always get false) and 100 (always get true).
* @return mixed|null
*/
public function optional($weight = 0.5, $default = null)
{
// old system based on 0.1 <= $weight <= 0.9
// TODO: remove in v2
if ($weight > 0 && $weight < 1 && mt_rand() / mt_getrandmax() <= $weight) {
return $this->generator;
}
// new system with percentage
if (is_int($weight) && mt_rand(1, 100) <= $weight) {
return $this->generator;
}
return new DefaultGenerator($default);
}
/**
* Chainable method for making any formatter unique.
*
* <code>
* // will never return twice the same value
* $faker->unique()->randomElement(array(1, 2, 3));
* </code>
*
* @param boolean $reset If set to true, resets the list of existing values
* @param integer $maxRetries Maximum number of retries to find a unique value,
* After which an OverflowException is thrown.
* @throws \OverflowException When no unique value can be found by iterating $maxRetries times
*
* @return UniqueGenerator A proxy class returning only non-existing values
*/
public function unique($reset = false, $maxRetries = 10000)
{
if ($reset || !$this->unique) {
$this->unique = new UniqueGenerator($this->generator, $maxRetries);
}
return $this->unique;
}
/**
* Chainable method for forcing any formatter to return only valid values.
*
* The value validity is determined by a function passed as first argument.
*
* <code>
* $values = array();
* $evenValidator = function ($digit) {
* return $digit % 2 === 0;
* };
* for ($i=0; $i < 10; $i++) {
* $values []= $faker->valid($evenValidator)->randomDigit;
* }
* print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6]
* </code>
*
* @param Closure $validator A function returning true for valid values
* @param integer $maxRetries Maximum number of retries to find a unique value,
* After which an OverflowException is thrown.
* @throws \OverflowException When no valid value can be found by iterating $maxRetries times
*
* @return ValidGenerator A proxy class returning only valid values
*/
public function valid($validator = null, $maxRetries = 10000)
{
return new ValidGenerator($this->generator, $validator, $maxRetries);
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace Siteworx\Faker\Provider;
class Biased extends Base
{
/**
* Returns a biased integer between $min and $max (both inclusive).
* The distribution depends on $function.
*
* The algorithm creates two doubles, x ∈ [0, 1], y ∈ [0, 1) and checks whether the
* return value of $function for x is greater than or equal to y. If this is
* the case the number is accepted and x is mapped to the appropriate integer
* between $min and $max. Otherwise two new doubles are created until the pair
* is accepted.
*
* @param integer $min Minimum value of the generated integers.
* @param integer $max Maximum value of the generated integers.
* @param callable $function A function mapping x ∈ [0, 1] onto a double ∈ [0, 1]
* @return integer An integer between $min and $max.
*/
public function biasedNumberBetween($min = 0, $max = 100, $function = 'sqrt')
{
do {
$x = mt_rand() / mt_getrandmax();
$y = mt_rand() / (mt_getrandmax() + 1);
} while (call_user_func($function, $x) < $y);
return (int) floor($x * ($max - $min + 1) + $min);
}
/**
* 'unbiased' creates an unbiased distribution by giving
* each value the same value of one.
*
* @return integer
*/
protected static function unbiased()
{
return 1;
}
/**
* 'linearLow' favors lower numbers. The probability decreases
* in a linear fashion.
*
* @return integer
*/
protected static function linearLow($x)
{
return 1 - $x;
}
/**
* 'linearHigh' favors higher numbers. The probability increases
* in a linear fashion.
*
* @return integer
*/
protected static function linearHigh($x)
{
return $x;
}
}

View File

@@ -0,0 +1,144 @@
<?php
namespace Siteworx\Faker\Provider;
/**
* @author lsv
*/
class Color extends Base
{
protected static $safeColorNames = array(
'black', 'maroon', 'green', 'navy', 'olive',
'purple', 'teal', 'lime', 'blue', 'silver',
'gray', 'yellow', 'fuchsia', 'aqua', 'white'
);
protected static $allColorNames = array(
'AliceBlue', 'AntiqueWhite', 'Aqua', 'Aquamarine',
'Azure', 'Beige', 'Bisque', 'Black', 'BlanchedAlmond',
'Blue', 'BlueViolet', 'Brown', 'BurlyWood', 'CadetBlue',
'Chartreuse', 'Chocolate', 'Coral', 'CornflowerBlue',
'Cornsilk', 'Crimson', 'Cyan', 'DarkBlue', 'DarkCyan',
'DarkGoldenRod', 'DarkGray', 'DarkGreen', 'DarkKhaki',
'DarkMagenta', 'DarkOliveGreen', 'Darkorange', 'DarkOrchid',
'DarkRed', 'DarkSalmon', 'DarkSeaGreen', 'DarkSlateBlue',
'DarkSlateGray', 'DarkTurquoise', 'DarkViolet', 'DeepPink',
'DeepSkyBlue', 'DimGray', 'DimGrey', 'DodgerBlue', 'FireBrick',
'FloralWhite', 'ForestGreen', 'Fuchsia', 'Gainsboro', 'GhostWhite',
'Gold', 'GoldenRod', 'Gray', 'Green', 'GreenYellow', 'HoneyDew',
'HotPink', 'IndianRed', 'Indigo', 'Ivory', 'Khaki', 'Lavender',
'LavenderBlush', 'LawnGreen', 'LemonChiffon', 'LightBlue', 'LightCoral',
'LightCyan', 'LightGoldenRodYellow', 'LightGray', 'LightGreen', 'LightPink',
'LightSalmon', 'LightSeaGreen', 'LightSkyBlue', 'LightSlateGray', 'LightSteelBlue',
'LightYellow', 'Lime', 'LimeGreen', 'Linen', 'Magenta', 'Maroon', 'MediumAquaMarine',
'MediumBlue', 'MediumOrchid', 'MediumPurple', 'MediumSeaGreen', 'MediumSlateBlue',
'MediumSpringGreen', 'MediumTurquoise', 'MediumVioletRed', 'MidnightBlue',
'MintCream', 'MistyRose', 'Moccasin', 'NavajoWhite', 'Navy', 'OldLace', 'Olive',
'OliveDrab', 'Orange', 'OrangeRed', 'Orchid', 'PaleGoldenRod', 'PaleGreen',
'PaleTurquoise', 'PaleVioletRed', 'PapayaWhip', 'PeachPuff', 'Peru', 'Pink', 'Plum',
'PowderBlue', 'Purple', 'Red', 'RosyBrown', 'RoyalBlue', 'SaddleBrown', 'Salmon',
'SandyBrown', 'SeaGreen', 'SeaShell', 'Sienna', 'Silver', 'SkyBlue', 'SlateBlue',
'SlateGray', 'Snow', 'SpringGreen', 'SteelBlue', 'Tan', 'Teal', 'Thistle', 'Tomato',
'Turquoise', 'Violet', 'Wheat', 'White', 'WhiteSmoke', 'Yellow', 'YellowGreen'
);
/**
* @example '#fa3cc2'
*/
public static function hexColor()
{
return '#' . str_pad(dechex(mt_rand(1, 16777215)), 6, '0', STR_PAD_LEFT);
}
/**
* @example '#ff0044'
*/
public static function safeHexColor()
{
$color = str_pad(dechex(mt_rand(0, 255)), 3, '0', STR_PAD_LEFT);
return '#' . $color[0] . $color[0] . $color[1] . $color[1] . $color[2] . $color[2];
}
/**
* @example 'array(0,255,122)'
*/
public static function rgbColorAsArray()
{
$color = static::hexColor();
return array(
hexdec(substr($color, 1, 2)),
hexdec(substr($color, 3, 2)),
hexdec(substr($color, 5, 2))
);
}
/**
* @example '0,255,122'
*/
public static function rgbColor()
{
return implode(',', static::rgbColorAsArray());
}
/**
* @example 'rgb(0,255,122)'
*/
public static function rgbCssColor()
{
return 'rgb(' . static::rgbColor() . ')';
}
/**
* @example 'rgba(0,255,122,0.8)'
*/
public static function rgbaCssColor()
{
return 'rgba(' . static::rgbColor() . ',' . static::randomFloat(1, 0, 1) . ')';
}
/**
* @example 'blue'
*/
public static function safeColorName()
{
return static::randomElement(static::$safeColorNames);
}
/**
* @example 'NavajoWhite'
*/
public static function colorName()
{
return static::randomElement(static::$allColorNames);
}
/**
* @example '340,50,20'
* @return string
*/
public static function hslColor()
{
return sprintf(
'%s,%s,%s',
static::numberBetween(0, 360),
static::numberBetween(0, 100),
static::numberBetween(0, 100)
);
}
/**
* @example array(340, 50, 20)
* @return array
*/
public static function hslColorAsArray()
{
return array(
static::numberBetween(0, 360),
static::numberBetween(0, 100),
static::numberBetween(0, 100)
);
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace Siteworx\Faker\Provider;
class Company extends Base
{
protected static $formats = array(
'{{lastName}} {{companySuffix}}',
);
protected static $companySuffix = array('Ltd');
protected static $jobTitleFormat = array(
'{{word}}',
);
/**
* @example 'Acme Ltd'
*
* @return string
*/
public function company()
{
$format = static::randomElement(static::$formats);
return $this->generator->parse($format);
}
/**
* @example 'Ltd'
*
* @return string
*/
public static function companySuffix()
{
return static::randomElement(static::$companySuffix);
}
/**
* @example 'Job'
*
* @return string
*/
public function jobTitle()
{
$format = static::randomElement(static::$jobTitleFormat);
return $this->generator->parse($format);
}
}

View File

@@ -0,0 +1,341 @@
<?php
namespace Siteworx\Faker\Provider;
class DateTime extends Base
{
protected static $century = array('I','II','III','IV','V','VI','VII','VIII','IX','X','XI','XII','XIII','XIV','XV','XVI','XVII','XVIII','XIX','XX','XXI');
protected static $defaultTimezone = null;
/**
* @param \DateTime|string|float|int $max
* @return int|false
*/
protected static function getMaxTimestamp($max = 'now')
{
if (is_numeric($max)) {
return (int) $max;
}
if ($max instanceof \DateTime) {
return $max->getTimestamp();
}
return strtotime(empty($max) ? 'now' : $max);
}
/**
* Get a timestamp between January 1, 1970 and now
*
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return int
*
* @example 1061306726
*/
public static function unixTime($max = 'now')
{
return mt_rand(0, static::getMaxTimestamp($max));
}
/**
* Get a datetime object for a date between January 1, 1970 and now
*
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @param string $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get`
* @example DateTime('2005-08-16 20:39:21')
* @return \DateTime
* @see http://php.net/manual/en/timezones.php
* @see http://php.net/manual/en/function.date-default-timezone-get.php
*/
public static function dateTime($max = 'now', $timezone = null)
{
return static::setTimezone(
new \DateTime('@' . static::unixTime($max)),
$timezone
);
}
/**
* Get a datetime object for a date between January 1, 001 and now
*
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get`
* @example DateTime('1265-03-22 21:15:52')
* @return \DateTime
* @see http://php.net/manual/en/timezones.php
* @see http://php.net/manual/en/function.date-default-timezone-get.php
*/
public static function dateTimeAD($max = 'now', $timezone = null)
{
$min = (PHP_INT_SIZE > 4 ? -62135597361 : -PHP_INT_MAX);
return static::setTimezone(
new \DateTime('@' . mt_rand($min, static::getMaxTimestamp($max))),
$timezone
);
}
/**
* get a date string formatted with ISO8601
*
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return string
* @example '2003-10-21T16:05:52+0000'
*/
public static function iso8601($max = 'now')
{
return static::date(\DateTime::ISO8601, $max);
}
/**
* Get a date string between January 1, 1970 and now
*
* @param string $format
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return string
* @example '2008-11-27'
*/
public static function date($format = 'Y-m-d', $max = 'now')
{
return static::dateTime($max)->format($format);
}
/**
* Get a time string (24h format by default)
*
* @param string $format
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return string
* @example '15:02:34'
*/
public static function time($format = 'H:i:s', $max = 'now')
{
return static::dateTime($max)->format($format);
}
/**
* Get a DateTime object based on a random date between two given dates.
* Accepts date strings that can be recognized by strtotime().
*
* @param \DateTime|string $startDate Defaults to 30 years ago
* @param \DateTime|string $endDate Defaults to "now"
* @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get`
* @example DateTime('1999-02-02 11:42:52')
* @return \DateTime
* @see http://php.net/manual/en/timezones.php
* @see http://php.net/manual/en/function.date-default-timezone-get.php
*/
public static function dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null)
{
$startTimestamp = $startDate instanceof \DateTime ? $startDate->getTimestamp() : strtotime($startDate);
$endTimestamp = static::getMaxTimestamp($endDate);
if ($startTimestamp > $endTimestamp) {
throw new \InvalidArgumentException('Start date must be anterior to end date.');
}
$timestamp = mt_rand($startTimestamp, $endTimestamp);
return static::setTimezone(
new \DateTime('@' . $timestamp),
$timezone
);
}
/**
* Get a DateTime object based on a random date between one given date and
* an interval
* Accepts date string that can be recognized by strtotime().
*
* @param \DateTime|string $date Defaults to 30 years ago
* @param string $interval Defaults to 5 days after
* @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get`
* @example dateTimeInInterval('1999-02-02 11:42:52', '+ 5 days')
* @return \DateTime
* @see http://php.net/manual/en/timezones.php
* @see http://php.net/manual/en/function.date-default-timezone-get.php
*/
public static function dateTimeInInterval($date = '-30 years', $interval = '+5 days', $timezone = null)
{
$intervalObject = \DateInterval::createFromDateString($interval);
$datetime = $date instanceof \DateTime ? $date : new \DateTime($date);
$otherDatetime = clone $datetime;
$otherDatetime->add($intervalObject);
$begin = $datetime > $otherDatetime ? $otherDatetime : $datetime;
$end = $datetime === $begin ? $otherDatetime : $datetime;
return static::dateTimeBetween(
$begin,
$end,
$timezone
);
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get`
* @example DateTime('1964-04-04 11:02:02')
* @return \DateTime
*/
public static function dateTimeThisCentury($max = 'now', $timezone = null)
{
return static::dateTimeBetween('-100 year', $max, $timezone);
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get`
* @example DateTime('2010-03-10 05:18:58')
* @return \DateTime
*/
public static function dateTimeThisDecade($max = 'now', $timezone = null)
{
return static::dateTimeBetween('-10 year', $max, $timezone);
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get`
* @example DateTime('2011-09-19 09:24:37')
* @return \DateTime
*/
public static function dateTimeThisYear($max = 'now', $timezone = null)
{
return static::dateTimeBetween('first day of january this year', $max, $timezone);
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get`
* @example DateTime('2011-10-05 12:51:46')
* @return \DateTime
*/
public static function dateTimeThisMonth($max = 'now', $timezone = null)
{
return static::dateTimeBetween('-1 month', $max, $timezone);
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return string
* @example 'am'
*/
public static function amPm($max = 'now')
{
return static::dateTime($max)->format('a');
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return string
* @example '22'
*/
public static function dayOfMonth($max = 'now')
{
return static::dateTime($max)->format('d');
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return string
* @example 'Tuesday'
*/
public static function dayOfWeek($max = 'now')
{
return static::dateTime($max)->format('l');
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return string
* @example '7'
*/
public static function month($max = 'now')
{
return static::dateTime($max)->format('m');
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return string
* @example 'September'
*/
public static function monthName($max = 'now')
{
return static::dateTime($max)->format('F');
}
/**
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @return string
* @example '1673'
*/
public static function year($max = 'now')
{
return static::dateTime($max)->format('Y');
}
/**
* @return string
* @example 'XVII'
*/
public static function century()
{
return static::randomElement(static::$century);
}
/**
* @return string
* @example 'Europe/Paris'
*/
public static function timezone()
{
return static::randomElement(\DateTimeZone::listIdentifiers());
}
/**
* Internal method to set the time zone on a DateTime.
*
* @param \DateTime $dt
* @param string|null $timezone
*
* @return \DateTime
*/
private static function setTimezone(\DateTime $dt, $timezone)
{
return $dt->setTimezone(new \DateTimeZone(static::resolveTimezone($timezone)));
}
/**
* Sets default time zone.
*
* @param string $timezone
*
* @return void
*/
public static function setDefaultTimezone($timezone = null)
{
static::$defaultTimezone = $timezone;
}
/**
* Gets default time zone.
*
* @return string|null
*/
public static function getDefaultTimezone()
{
return static::$defaultTimezone;
}
/**
* @param string|null $timezone
* @return null|string
*/
private static function resolveTimezone($timezone)
{
return $timezone === null ? (static::$defaultTimezone === null ? date_default_timezone_get() : static::$defaultTimezone) : $timezone;
}
}

610
src/Faker/Provider/File.php Normal file
View File

@@ -0,0 +1,610 @@
<?php
namespace Siteworx\Faker\Provider;
class File extends Base
{
/**
* MIME types from the apache.org file. Some types are truncated.
*
* @var array Map of MIME types => file extension(s)
* @link http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
*/
protected static $mimeTypes = array(
'application/atom+xml' => 'atom',
'application/ecmascript' => 'ecma',
'application/emma+xml' => 'emma',
'application/epub+zip' => 'epub',
'application/java-archive' => 'jar',
'application/java-vm' => 'class',
'application/javascript' => 'js',
'application/json' => 'json',
'application/jsonml+json' => 'jsonml',
'application/lost+xml' => 'lostxml',
'application/mathml+xml' => 'mathml',
'application/mets+xml' => 'mets',
'application/mods+xml' => 'mods',
'application/mp4' => 'mp4s',
'application/msword' => array('doc', 'dot'),
'application/octet-stream' => array(
'bin',
'dms',
'lrf',
'mar',
'so',
'dist',
'distz',
'pkg',
'bpk',
'dump',
'elc',
'deploy'
),
'application/ogg' => 'ogx',
'application/omdoc+xml' => 'omdoc',
'application/pdf' => 'pdf',
'application/pgp-encrypted' => 'pgp',
'application/pgp-signature' => array('asc', 'sig'),
'application/pkix-pkipath' => 'pkipath',
'application/pkixcmp' => 'pki',
'application/pls+xml' => 'pls',
'application/postscript' => array('ai', 'eps', 'ps'),
'application/pskc+xml' => 'pskcxml',
'application/rdf+xml' => 'rdf',
'application/reginfo+xml' => 'rif',
'application/rss+xml' => 'rss',
'application/rtf' => 'rtf',
'application/sbml+xml' => 'sbml',
'application/vnd.adobe.air-application-installer-package+zip' => 'air',
'application/vnd.adobe.xdp+xml' => 'xdp',
'application/vnd.adobe.xfdf' => 'xfdf',
'application/vnd.ahead.space' => 'ahead',
'application/vnd.dart' => 'dart',
'application/vnd.data-vision.rdz' => 'rdz',
'application/vnd.dece.data' => array('uvf', 'uvvf', 'uvd', 'uvvd'),
'application/vnd.dece.ttml+xml' => array('uvt', 'uvvt'),
'application/vnd.dece.unspecified' => array('uvx', 'uvvx'),
'application/vnd.dece.zip' => array('uvz', 'uvvz'),
'application/vnd.denovo.fcselayout-link' => 'fe_launch',
'application/vnd.dna' => 'dna',
'application/vnd.dolby.mlp' => 'mlp',
'application/vnd.dpgraph' => 'dpg',
'application/vnd.dreamfactory' => 'dfac',
'application/vnd.ds-keypoint' => 'kpxx',
'application/vnd.dvb.ait' => 'ait',
'application/vnd.dvb.service' => 'svc',
'application/vnd.dynageo' => 'geo',
'application/vnd.ecowin.chart' => 'mag',
'application/vnd.enliven' => 'nml',
'application/vnd.epson.esf' => 'esf',
'application/vnd.epson.msf' => 'msf',
'application/vnd.epson.quickanime' => 'qam',
'application/vnd.epson.salt' => 'slt',
'application/vnd.epson.ssf' => 'ssf',
'application/vnd.ezpix-album' => 'ez2',
'application/vnd.ezpix-package' => 'ez3',
'application/vnd.fdf' => 'fdf',
'application/vnd.fdsn.mseed' => 'mseed',
'application/vnd.fdsn.seed' => array('seed', 'dataless'),
'application/vnd.flographit' => 'gph',
'application/vnd.fluxtime.clip' => 'ftc',
'application/vnd.hal+xml' => 'hal',
'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx',
'application/vnd.ibm.minipay' => 'mpy',
'application/vnd.ibm.secure-container' => 'sc',
'application/vnd.iccprofile' => array('icc', 'icm'),
'application/vnd.igloader' => 'igl',
'application/vnd.immervision-ivp' => 'ivp',
'application/vnd.kde.karbon' => 'karbon',
'application/vnd.kde.kchart' => 'chrt',
'application/vnd.kde.kformula' => 'kfo',
'application/vnd.kde.kivio' => 'flw',
'application/vnd.kde.kontour' => 'kon',
'application/vnd.kde.kpresenter' => array('kpr', 'kpt'),
'application/vnd.kde.kspread' => 'ksp',
'application/vnd.kde.kword' => array('kwd', 'kwt'),
'application/vnd.kenameaapp' => 'htke',
'application/vnd.kidspiration' => 'kia',
'application/vnd.kinar' => array('kne', 'knp'),
'application/vnd.koan' => array('skp', 'skd', 'skt', 'skm'),
'application/vnd.kodak-descriptor' => 'sse',
'application/vnd.las.las+xml' => 'lasxml',
'application/vnd.llamagraphics.life-balance.desktop' => 'lbd',
'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe',
'application/vnd.lotus-1-2-3' => '123',
'application/vnd.lotus-approach' => 'apr',
'application/vnd.lotus-freelance' => 'pre',
'application/vnd.lotus-notes' => 'nsf',
'application/vnd.lotus-organizer' => 'org',
'application/vnd.lotus-screencam' => 'scm',
'application/vnd.mozilla.xul+xml' => 'xul',
'application/vnd.ms-artgalry' => 'cil',
'application/vnd.ms-cab-compressed' => 'cab',
'application/vnd.ms-excel' => array(
'xls',
'xlm',
'xla',
'xlc',
'xlt',
'xlw'
),
'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam',
'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb',
'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm',
'application/vnd.ms-excel.template.macroenabled.12' => 'xltm',
'application/vnd.ms-fontobject' => 'eot',
'application/vnd.ms-htmlhelp' => 'chm',
'application/vnd.ms-ims' => 'ims',
'application/vnd.ms-lrm' => 'lrm',
'application/vnd.ms-officetheme' => 'thmx',
'application/vnd.ms-pki.seccat' => 'cat',
'application/vnd.ms-pki.stl' => 'stl',
'application/vnd.ms-powerpoint' => array('ppt', 'pps', 'pot'),
'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam',
'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm',
'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm',
'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm',
'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm',
'application/vnd.ms-project' => array('mpp', 'mpt'),
'application/vnd.ms-word.document.macroenabled.12' => 'docm',
'application/vnd.ms-word.template.macroenabled.12' => 'dotm',
'application/vnd.ms-works' => array('wps', 'wks', 'wcm', 'wdb'),
'application/vnd.ms-wpl' => 'wpl',
'application/vnd.ms-xpsdocument' => 'xps',
'application/vnd.mseq' => 'mseq',
'application/vnd.musician' => 'mus',
'application/vnd.oasis.opendocument.chart' => 'odc',
'application/vnd.oasis.opendocument.chart-template' => 'otc',
'application/vnd.oasis.opendocument.database' => 'odb',
'application/vnd.oasis.opendocument.formula' => 'odf',
'application/vnd.oasis.opendocument.formula-template' => 'odft',
'application/vnd.oasis.opendocument.graphics' => 'odg',
'application/vnd.oasis.opendocument.graphics-template' => 'otg',
'application/vnd.oasis.opendocument.image' => 'odi',
'application/vnd.oasis.opendocument.image-template' => 'oti',
'application/vnd.oasis.opendocument.presentation' => 'odp',
'application/vnd.oasis.opendocument.presentation-template' => 'otp',
'application/vnd.oasis.opendocument.spreadsheet' => 'ods',
'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots',
'application/vnd.oasis.opendocument.text' => 'odt',
'application/vnd.oasis.opendocument.text-master' => 'odm',
'application/vnd.oasis.opendocument.text-template' => 'ott',
'application/vnd.oasis.opendocument.text-web' => 'oth',
'application/vnd.olpc-sugar' => 'xo',
'application/vnd.oma.dd2+xml' => 'dd2',
'application/vnd.openofficeorg.extension' => 'oxt',
'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx',
'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx',
'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx',
'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx',
'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx',
'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx',
'application/vnd.pvi.ptid1' => 'ptid',
'application/vnd.quark.quarkxpress' => array(
'qxd',
'qxt',
'qwd',
'qwt',
'qxl',
'qxb'
),
'application/vnd.realvnc.bed' => 'bed',
'application/vnd.recordare.musicxml' => 'mxl',
'application/vnd.recordare.musicxml+xml' => 'musicxml',
'application/vnd.rig.cryptonote' => 'cryptonote',
'application/vnd.rim.cod' => 'cod',
'application/vnd.rn-realmedia' => 'rm',
'application/vnd.rn-realmedia-vbr' => 'rmvb',
'application/vnd.route66.link66+xml' => 'link66',
'application/vnd.sailingtracker.track' => 'st',
'application/vnd.seemail' => 'see',
'application/vnd.sema' => 'sema',
'application/vnd.semd' => 'semd',
'application/vnd.semf' => 'semf',
'application/vnd.shana.informed.formdata' => 'ifm',
'application/vnd.shana.informed.formtemplate' => 'itp',
'application/vnd.shana.informed.interchange' => 'iif',
'application/vnd.shana.informed.package' => 'ipk',
'application/vnd.simtech-mindmapper' => array('twd', 'twds'),
'application/vnd.smaf' => 'mmf',
'application/vnd.stepmania.stepchart' => 'sm',
'application/vnd.sun.xml.calc' => 'sxc',
'application/vnd.sun.xml.calc.template' => 'stc',
'application/vnd.sun.xml.draw' => 'sxd',
'application/vnd.sun.xml.draw.template' => 'std',
'application/vnd.sun.xml.impress' => 'sxi',
'application/vnd.sun.xml.impress.template' => 'sti',
'application/vnd.sun.xml.math' => 'sxm',
'application/vnd.sun.xml.writer' => 'sxw',
'application/vnd.sun.xml.writer.global' => 'sxg',
'application/vnd.sun.xml.writer.template' => 'stw',
'application/vnd.sus-calendar' => array('sus', 'susp'),
'application/vnd.svd' => 'svd',
'application/vnd.symbian.install' => array('sis', 'sisx'),
'application/vnd.syncml+xml' => 'xsm',
'application/vnd.syncml.dm+wbxml' => 'bdm',
'application/vnd.syncml.dm+xml' => 'xdm',
'application/vnd.tao.intent-module-archive' => 'tao',
'application/vnd.tcpdump.pcap' => array('pcap', 'cap', 'dmp'),
'application/vnd.tmobile-livetv' => 'tmo',
'application/vnd.trid.tpt' => 'tpt',
'application/vnd.triscape.mxs' => 'mxs',
'application/vnd.trueapp' => 'tra',
'application/vnd.ufdl' => array('ufd', 'ufdl'),
'application/vnd.uiq.theme' => 'utz',
'application/vnd.umajin' => 'umj',
'application/vnd.unity' => 'unityweb',
'application/vnd.uoml+xml' => 'uoml',
'application/vnd.vcx' => 'vcx',
'application/vnd.visio' => array('vsd', 'vst', 'vss', 'vsw'),
'application/vnd.visionary' => 'vis',
'application/vnd.vsf' => 'vsf',
'application/vnd.wap.wbxml' => 'wbxml',
'application/vnd.wap.wmlc' => 'wmlc',
'application/vnd.wap.wmlscriptc' => 'wmlsc',
'application/vnd.webturbo' => 'wtb',
'application/vnd.wolfram.player' => 'nbp',
'application/vnd.wordperfect' => 'wpd',
'application/vnd.wqd' => 'wqd',
'application/vnd.wt.stf' => 'stf',
'application/vnd.xara' => 'xar',
'application/vnd.xfdl' => 'xfdl',
'application/voicexml+xml' => 'vxml',
'application/widget' => 'wgt',
'application/winhlp' => 'hlp',
'application/wsdl+xml' => 'wsdl',
'application/wspolicy+xml' => 'wspolicy',
'application/x-7z-compressed' => '7z',
'application/x-bittorrent' => 'torrent',
'application/x-blorb' => array('blb', 'blorb'),
'application/x-bzip' => 'bz',
'application/x-cdlink' => 'vcd',
'application/x-cfs-compressed' => 'cfs',
'application/x-chat' => 'chat',
'application/x-chess-pgn' => 'pgn',
'application/x-conference' => 'nsc',
'application/x-cpio' => 'cpio',
'application/x-csh' => 'csh',
'application/x-debian-package' => array('deb', 'udeb'),
'application/x-dgc-compressed' => 'dgc',
'application/x-director' => array(
'dir',
'dcr',
'dxr',
'cst',
'cct',
'cxt',
'w3d',
'fgd',
'swa'
),
'application/x-font-ttf' => array('ttf', 'ttc'),
'application/x-font-type1' => array('pfa', 'pfb', 'pfm', 'afm'),
'application/x-font-woff' => 'woff',
'application/x-freearc' => 'arc',
'application/x-futuresplash' => 'spl',
'application/x-gca-compressed' => 'gca',
'application/x-glulx' => 'ulx',
'application/x-gnumeric' => 'gnumeric',
'application/x-gramps-xml' => 'gramps',
'application/x-gtar' => 'gtar',
'application/x-hdf' => 'hdf',
'application/x-install-instructions' => 'install',
'application/x-iso9660-image' => 'iso',
'application/x-java-jnlp-file' => 'jnlp',
'application/x-latex' => 'latex',
'application/x-lzh-compressed' => array('lzh', 'lha'),
'application/x-mie' => 'mie',
'application/x-mobipocket-ebook' => array('prc', 'mobi'),
'application/x-ms-application' => 'application',
'application/x-ms-shortcut' => 'lnk',
'application/x-ms-wmd' => 'wmd',
'application/x-ms-wmz' => 'wmz',
'application/x-ms-xbap' => 'xbap',
'application/x-msaccess' => 'mdb',
'application/x-msbinder' => 'obd',
'application/x-mscardfile' => 'crd',
'application/x-msclip' => 'clp',
'application/x-msdownload' => array('exe', 'dll', 'com', 'bat', 'msi'),
'application/x-msmediaview' => array(
'mvb',
'm13',
'm14'
),
'application/x-msmetafile' => array('wmf', 'wmz', 'emf', 'emz'),
'application/x-rar-compressed' => 'rar',
'application/x-research-info-systems' => 'ris',
'application/x-sh' => 'sh',
'application/x-shar' => 'shar',
'application/x-shockwave-flash' => 'swf',
'application/x-silverlight-app' => 'xap',
'application/x-sql' => 'sql',
'application/x-stuffit' => 'sit',
'application/x-stuffitx' => 'sitx',
'application/x-subrip' => 'srt',
'application/x-sv4cpio' => 'sv4cpio',
'application/x-sv4crc' => 'sv4crc',
'application/x-t3vm-image' => 't3',
'application/x-tads' => 'gam',
'application/x-tar' => 'tar',
'application/x-tcl' => 'tcl',
'application/x-tex' => 'tex',
'application/x-tex-tfm' => 'tfm',
'application/x-texinfo' => array('texinfo', 'texi'),
'application/x-tgif' => 'obj',
'application/x-ustar' => 'ustar',
'application/x-wais-source' => 'src',
'application/x-x509-ca-cert' => array('der', 'crt'),
'application/x-xfig' => 'fig',
'application/x-xliff+xml' => 'xlf',
'application/x-xpinstall' => 'xpi',
'application/x-xz' => 'xz',
'application/x-zmachine' => 'z1',
'application/xaml+xml' => 'xaml',
'application/xcap-diff+xml' => 'xdf',
'application/xenc+xml' => 'xenc',
'application/xhtml+xml' => array('xhtml', 'xht'),
'application/xml' => array('xml', 'xsl'),
'application/xml-dtd' => 'dtd',
'application/xop+xml' => 'xop',
'application/xproc+xml' => 'xpl',
'application/xslt+xml' => 'xslt',
'application/xspf+xml' => 'xspf',
'application/xv+xml' => array('mxml', 'xhvml', 'xvml', 'xvm'),
'application/yang' => 'yang',
'application/yin+xml' => 'yin',
'application/zip' => 'zip',
'audio/adpcm' => 'adp',
'audio/basic' => array('au', 'snd'),
'audio/midi' => array('mid', 'midi', 'kar', 'rmi'),
'audio/mp4' => 'mp4a',
'audio/mpeg' => array(
'mpga',
'mp2',
'mp2a',
'mp3',
'm2a',
'm3a'
),
'audio/ogg' => array('oga', 'ogg', 'spx'),
'audio/vnd.dece.audio' => array('uva', 'uvva'),
'audio/vnd.rip' => 'rip',
'audio/webm' => 'weba',
'audio/x-aac' => 'aac',
'audio/x-aiff' => array('aif', 'aiff', 'aifc'),
'audio/x-caf' => 'caf',
'audio/x-flac' => 'flac',
'audio/x-matroska' => 'mka',
'audio/x-mpegurl' => 'm3u',
'audio/x-ms-wax' => 'wax',
'audio/x-ms-wma' => 'wma',
'audio/x-pn-realaudio' => array('ram', 'ra'),
'audio/x-pn-realaudio-plugin' => 'rmp',
'audio/x-wav' => 'wav',
'audio/xm' => 'xm',
'image/bmp' => 'bmp',
'image/cgm' => 'cgm',
'image/g3fax' => 'g3',
'image/gif' => 'gif',
'image/ief' => 'ief',
'image/jpeg' => array('jpeg', 'jpg', 'jpe'),
'image/ktx' => 'ktx',
'image/png' => 'png',
'image/prs.btif' => 'btif',
'image/sgi' => 'sgi',
'image/svg+xml' => array('svg', 'svgz'),
'image/tiff' => array('tiff', 'tif'),
'image/vnd.adobe.photoshop' => 'psd',
'image/vnd.dece.graphic' => array('uvi', 'uvvi', 'uvg', 'uvvg'),
'image/vnd.dvb.subtitle' => 'sub',
'image/vnd.djvu' => array('djvu', 'djv'),
'image/vnd.dwg' => 'dwg',
'image/vnd.dxf' => 'dxf',
'image/vnd.fastbidsheet' => 'fbs',
'image/vnd.fpx' => 'fpx',
'image/vnd.fst' => 'fst',
'image/vnd.fujixerox.edmics-mmr' => 'mmr',
'image/vnd.fujixerox.edmics-rlc' => 'rlc',
'image/vnd.ms-modi' => 'mdi',
'image/vnd.ms-photo' => 'wdp',
'image/vnd.net-fpx' => 'npx',
'image/vnd.wap.wbmp' => 'wbmp',
'image/vnd.xiff' => 'xif',
'image/webp' => 'webp',
'image/x-3ds' => '3ds',
'image/x-cmu-raster' => 'ras',
'image/x-cmx' => 'cmx',
'image/x-freehand' => array('fh', 'fhc', 'fh4', 'fh5', 'fh7'),
'image/x-icon' => 'ico',
'image/x-mrsid-image' => 'sid',
'image/x-pcx' => 'pcx',
'image/x-pict' => array('pic', 'pct'),
'image/x-portable-anymap' => 'pnm',
'image/x-portable-bitmap' => 'pbm',
'image/x-portable-graymap' => 'pgm',
'image/x-portable-pixmap' => 'ppm',
'image/x-rgb' => 'rgb',
'image/x-tga' => 'tga',
'image/x-xbitmap' => 'xbm',
'image/x-xpixmap' => 'xpm',
'image/x-xwindowdump' => 'xwd',
'message/rfc822' => array('eml', 'mime'),
'model/iges' => array('igs', 'iges'),
'model/mesh' => array('msh', 'mesh', 'silo'),
'model/vnd.collada+xml' => 'dae',
'model/vnd.dwf' => 'dwf',
'model/vnd.gdl' => 'gdl',
'model/vnd.gtw' => 'gtw',
'model/vnd.mts' => 'mts',
'model/vnd.vtu' => 'vtu',
'model/vrml' => array('wrl', 'vrml'),
'model/x3d+binary' => 'x3db',
'model/x3d+vrml' => 'x3dv',
'model/x3d+xml' => 'x3d',
'text/cache-manifest' => 'appcache',
'text/calendar' => array('ics', 'ifb'),
'text/css' => 'css',
'text/csv' => 'csv',
'text/html' => array('html', 'htm'),
'text/n3' => 'n3',
'text/plain' => array(
'txt',
'text',
'conf',
'def',
'list',
'log',
'in'
),
'text/prs.lines.tag' => 'dsc',
'text/richtext' => 'rtx',
'text/sgml' => array('sgml', 'sgm'),
'text/tab-separated-values' => 'tsv',
'text/troff' => array(
't',
'tr',
'roff',
'man',
'me',
'ms'
),
'text/turtle' => 'ttl',
'text/uri-list' => array('uri', 'uris', 'urls'),
'text/vcard' => 'vcard',
'text/vnd.curl' => 'curl',
'text/vnd.curl.dcurl' => 'dcurl',
'text/vnd.curl.scurl' => 'scurl',
'text/vnd.curl.mcurl' => 'mcurl',
'text/vnd.dvb.subtitle' => 'sub',
'text/vnd.fly' => 'fly',
'text/vnd.fmi.flexstor' => 'flx',
'text/vnd.graphviz' => 'gv',
'text/vnd.in3d.3dml' => '3dml',
'text/vnd.in3d.spot' => 'spot',
'text/vnd.sun.j2me.app-descriptor' => 'jad',
'text/vnd.wap.wml' => 'wml',
'text/vnd.wap.wmlscript' => 'wmls',
'text/x-asm' => array('s', 'asm'),
'text/x-fortran' => array('f', 'for', 'f77', 'f90'),
'text/x-java-source' => 'java',
'text/x-opml' => 'opml',
'text/x-pascal' => array('p', 'pas'),
'text/x-nfo' => 'nfo',
'text/x-setext' => 'etx',
'text/x-sfv' => 'sfv',
'text/x-uuencode' => 'uu',
'text/x-vcalendar' => 'vcs',
'text/x-vcard' => 'vcf',
'video/3gpp' => '3gp',
'video/3gpp2' => '3g2',
'video/h261' => 'h261',
'video/h263' => 'h263',
'video/h264' => 'h264',
'video/jpeg' => 'jpgv',
'video/jpm' => array('jpm', 'jpgm'),
'video/mj2' => 'mj2',
'video/mp4' => 'mp4',
'video/mpeg' => array('mpeg', 'mpg', 'mpe', 'm1v', 'm2v'),
'video/ogg' => 'ogv',
'video/quicktime' => array('qt', 'mov'),
'video/vnd.dece.hd' => array('uvh', 'uvvh'),
'video/vnd.dece.mobile' => array('uvm', 'uvvm'),
'video/vnd.dece.pd' => array('uvp', 'uvvp'),
'video/vnd.dece.sd' => array('uvs', 'uvvs'),
'video/vnd.dece.video' => array('uvv', 'uvvv'),
'video/vnd.dvb.file' => 'dvb',
'video/vnd.fvt' => 'fvt',
'video/vnd.mpegurl' => array('mxu', 'm4u'),
'video/vnd.ms-playready.media.pyv' => 'pyv',
'video/vnd.uvvu.mp4' => array('uvu', 'uvvu'),
'video/vnd.vivo' => 'viv',
'video/webm' => 'webm',
'video/x-f4v' => 'f4v',
'video/x-fli' => 'fli',
'video/x-flv' => 'flv',
'video/x-m4v' => 'm4v',
'video/x-matroska' => array('mkv', 'mk3d', 'mks'),
'video/x-mng' => 'mng',
'video/x-ms-asf' => array('asf', 'asx'),
'video/x-ms-vob' => 'vob',
'video/x-ms-wm' => 'wm',
'video/x-ms-wmv' => 'wmv',
'video/x-ms-wmx' => 'wmx',
'video/x-ms-wvx' => 'wvx',
'video/x-msvideo' => 'avi',
'video/x-sgi-movie' => 'movie',
);
/**
* Get a random MIME type
*
* @return string
* @example 'video/avi'
*/
public static function mimeType()
{
return static::randomElement(array_keys(static::$mimeTypes));
}
/**
* Get a random file extension (without a dot)
*
* @example avi
* @return string
*/
public static function fileExtension()
{
$random_extension = static::randomElement(array_values(static::$mimeTypes));
return is_array($random_extension) ? static::randomElement($random_extension) : $random_extension;
}
/**
* Copy a random file from the source directory to the target directory and returns the filename/fullpath
*
* @param string $sourceDirectory The directory to look for random file taking
* @param string $targetDirectory
* @param boolean $fullPath Whether to have the full path or just the filename
* @return string
*/
public static function file($sourceDirectory = '/tmp', $targetDirectory = '/tmp', $fullPath = true)
{
if (!is_dir($sourceDirectory)) {
throw new \InvalidArgumentException(sprintf('Source directory %s does not exist or is not a directory.', $sourceDirectory));
}
if (!is_dir($targetDirectory)) {
throw new \InvalidArgumentException(sprintf('Target directory %s does not exist or is not a directory.', $targetDirectory));
}
if ($sourceDirectory == $targetDirectory) {
throw new \InvalidArgumentException('Source and target directories must differ.');
}
// Drop . and .. and reset array keys
$files = array_filter(
array_values(array_diff(scandir($sourceDirectory), array('.', '..'))),
function ($file) use ($sourceDirectory) {
return is_file($sourceDirectory . DIRECTORY_SEPARATOR . $file) && is_readable($sourceDirectory . DIRECTORY_SEPARATOR . $file);
}
);
if (empty($files)) {
throw new \InvalidArgumentException(sprintf('Source directory %s is empty.', $sourceDirectory));
}
$sourceFullPath = $sourceDirectory . DIRECTORY_SEPARATOR . static::randomElement($files);
$destinationFile = Uuid::uuid() . '.' . pathinfo($sourceFullPath, PATHINFO_EXTENSION);
$destinationFullPath = $targetDirectory . DIRECTORY_SEPARATOR . $destinationFile;
if (copy($sourceFullPath, $destinationFullPath) === false) {
return false;
}
return $fullPath ? $destinationFullPath : $destinationFile;
}
}

View File

@@ -0,0 +1,276 @@
<?php
namespace Siteworx\Faker\Provider;
use Siteworx\Faker\Generator;
use Siteworx\Faker\UniqueGenerator;
class HtmlLorem extends Base
{
const HTML_TAG = "html";
const HEAD_TAG = "head";
const BODY_TAG = "body";
const DIV_TAG = "div";
const P_TAG = "p";
const A_TAG = "a";
const SPAN_TAG = "span";
const TABLE_TAG = "table";
const THEAD_TAG = "thead";
const TBODY_TAG = "tbody";
const TR_TAG = "tr";
const TD_TAG = "td";
const TH_TAG = "th";
const UL_TAG = "ul";
const LI_TAG = "li";
const H_TAG = "h";
const B_TAG = "b";
const I_TAG = "i";
const TITLE_TAG = "title";
const FORM_TAG = "form";
const INPUT_TAG = "input";
const LABEL_TAG = "label";
private $idGenerator;
public function __construct(Generator $generator)
{
parent::__construct($generator);
$generator->addProvider(new Lorem($generator));
$generator->addProvider(new Internet($generator));
}
/**
* @param integer $maxDepth
* @param integer $maxWidth
*
* @return string
*/
public function randomHtml($maxDepth = 4, $maxWidth = 4)
{
$document = new \DOMDocument();
$this->idGenerator = new UniqueGenerator($this->generator);
$head = $document->createElement("head");
$this->addRandomTitle($head);
$body = $document->createElement("body");
$this->addLoginForm($body);
$this->addRandomSubTree($body, $maxDepth, $maxWidth);
$html = $document->createElement("html");
$html->appendChild($head);
$html->appendChild($body);
$document->appendChild($html);
return $document->saveHTML();
}
private function addRandomSubTree(\DOMElement $root, $maxDepth, $maxWidth)
{
$maxDepth--;
if ($maxDepth <= 0) {
return $root;
}
$siblings = mt_rand(1, $maxWidth);
for ($i = 0; $i < $siblings; $i++) {
if ($maxDepth == 1) {
$this->addRandomLeaf($root);
} else {
$sibling = $root->ownerDocument->createElement("div");
$root->appendChild($sibling);
$this->addRandomAttribute($sibling);
$this->addRandomSubTree($sibling, mt_rand(0, $maxDepth), $maxWidth);
}
}
return $root;
}
private function addRandomLeaf(\DOMElement $node)
{
$rand = mt_rand(1, 10);
switch ($rand) {
case 1:
$this->addRandomP($node);
break;
case 2:
$this->addRandomA($node);
break;
case 3:
$this->addRandomSpan($node);
break;
case 4:
$this->addRandomUL($node);
break;
case 5:
$this->addRandomH($node);
break;
case 6:
$this->addRandomB($node);
break;
case 7:
$this->addRandomI($node);
break;
case 8:
$this->addRandomTable($node);
break;
default:
$this->addRandomText($node);
break;
}
}
private function addRandomAttribute(\DOMElement $node)
{
$rand = mt_rand(1, 2);
switch ($rand) {
case 1:
$node->setAttribute("class", $this->generator->word);
break;
case 2:
$node->setAttribute("id", (string) $this->idGenerator->randomNumber(5));
break;
}
}
private function addRandomP(\DOMElement $element, $maxLength = 10)
{
$node = $element->ownerDocument->createElement(static::P_TAG);
$node->textContent = $this->generator->sentence(mt_rand(1, $maxLength));
$element->appendChild($node);
}
private function addRandomText(\DOMElement $element, $maxLength = 10)
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength)));
$element->appendChild($text);
}
private function addRandomA(\DOMElement $element, $maxLength = 10)
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::A_TAG);
$node->setAttribute("href", $this->generator->safeEmailDomain);
$node->appendChild($text);
$element->appendChild($node);
}
private function addRandomTitle(\DOMElement $element, $maxLength = 10)
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::TITLE_TAG);
$node->appendChild($text);
$element->appendChild($node);
}
private function addRandomH(\DOMElement $element, $maxLength = 10)
{
$h = static::H_TAG . (string) mt_rand(1, 3);
$text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength)));
$node = $element->ownerDocument->createElement($h);
$node->appendChild($text);
$element->appendChild($node);
}
private function addRandomB(\DOMElement $element, $maxLength = 10)
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::B_TAG);
$node->appendChild($text);
$element->appendChild($node);
}
private function addRandomI(\DOMElement $element, $maxLength = 10)
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::I_TAG);
$node->appendChild($text);
$element->appendChild($node);
}
private function addRandomSpan(\DOMElement $element, $maxLength = 10)
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::SPAN_TAG);
$node->appendChild($text);
$element->appendChild($node);
}
private function addLoginForm(\DOMElement $element)
{
$textInput = $element->ownerDocument->createElement(static::INPUT_TAG);
$textInput->setAttribute("type", "text");
$textInput->setAttribute("id", "username");
$textLabel = $element->ownerDocument->createElement(static::LABEL_TAG);
$textLabel->setAttribute("for", "username");
$textLabel->textContent = $this->generator->word;
$passwordInput = $element->ownerDocument->createElement(static::INPUT_TAG);
$passwordInput->setAttribute("type", "password");
$passwordInput->setAttribute("id", "password");
$passwordLabel = $element->ownerDocument->createElement(static::LABEL_TAG);
$passwordLabel->setAttribute("for", "password");
$passwordLabel->textContent = $this->generator->word;
$submit = $element->ownerDocument->createElement(static::INPUT_TAG);
$submit->setAttribute("type", "submit");
$submit->setAttribute("value", $this->generator->word);
$submit = $element->ownerDocument->createElement(static::FORM_TAG);
$submit->setAttribute("action", $this->generator->safeEmailDomain);
$submit->setAttribute("method", "POST");
$submit->appendChild($textLabel);
$submit->appendChild($textInput);
$submit->appendChild($passwordLabel);
$submit->appendChild($passwordInput);
$element->appendChild($submit);
}
private function addRandomTable(\DOMElement $element, $maxRows = 10, $maxCols = 6, $maxTitle = 4, $maxLength = 10)
{
$rows = mt_rand(1, $maxRows);
$cols = mt_rand(1, $maxCols);
$table = $element->ownerDocument->createElement(static::TABLE_TAG);
$thead = $element->ownerDocument->createElement(static::THEAD_TAG);
$tbody = $element->ownerDocument->createElement(static::TBODY_TAG);
$table->appendChild($thead);
$table->appendChild($tbody);
$tr = $element->ownerDocument->createElement(static::TR_TAG);
$thead->appendChild($tr);
for ($i = 0; $i < $cols; $i++) {
$th = $element->ownerDocument->createElement(static::TH_TAG);
$th->textContent = $this->generator->sentence(mt_rand(1, $maxTitle));
$tr->appendChild($th);
}
for ($i = 0; $i < $rows; $i++) {
$tr = $element->ownerDocument->createElement(static::TR_TAG);
$tbody->appendChild($tr);
for ($j = 0; $j < $cols; $j++) {
$th = $element->ownerDocument->createElement(static::TD_TAG);
$th->textContent = $this->generator->sentence(mt_rand(1, $maxLength));
$tr->appendChild($th);
}
}
$element->appendChild($table);
}
private function addRandomUL(\DOMElement $element, $maxItems = 11, $maxLength = 4)
{
$num = mt_rand(1, $maxItems);
$ul = $element->ownerDocument->createElement(static::UL_TAG);
for ($i = 0; $i < $num; $i++) {
$li = $element->ownerDocument->createElement(static::LI_TAG);
$li->textContent = $this->generator->sentence(mt_rand(1, $maxLength));
$ul->appendChild($li);
}
$element->appendChild($ul);
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace Siteworx\Faker\Provider;
/**
* Depends on image generation from http://lorempixel.com/
*/
class Image extends Base
{
protected static $categories = array(
'abstract', 'animals', 'business', 'cats', 'city', 'food', 'nightlife',
'fashion', 'people', 'nature', 'sports', 'technics', 'transport'
);
/**
* Generate the URL that will return a random image
*
* Set randomize to false to remove the random GET parameter at the end of the url.
*
* @example 'http://lorempixel.com/640/480/?12345'
*
* @param integer $width
* @param integer $height
* @param string|null $category
* @param bool $randomize
* @param string|null $word
* @param bool $gray
*
* @return string
*/
public static function imageUrl($width = 640, $height = 480, $category = null, $randomize = true, $word = null, $gray = false)
{
$baseUrl = "https://lorempixel.com/";
$url = "{$width}/{$height}/";
if ($gray) {
$url = "gray/" . $url;
}
if ($category) {
if (!in_array($category, static::$categories)) {
throw new \InvalidArgumentException(sprintf('Unknown image category "%s"', $category));
}
$url .= "{$category}/";
if ($word) {
$url .= "{$word}/";
}
}
if ($randomize) {
$url .= '?' . static::randomNumber(5, true);
}
return $baseUrl . $url;
}
/**
* Download a remote random image to disk and return its location
*
* Requires curl, or allow_url_fopen to be on in php.ini.
*
* @example '/path/to/dir/13b73edae8443990be1aa8f1a483bc27.jpg'
*/
public static function image($dir = null, $width = 640, $height = 480, $category = null, $fullPath = true, $randomize = true, $word = null, $gray = false)
{
$dir = is_null($dir) ? sys_get_temp_dir() : $dir; // GNU/Linux / OS X / Windows compatible
// Validate directory path
if (!is_dir($dir) || !is_writable($dir)) {
throw new \InvalidArgumentException(sprintf('Cannot write to directory "%s"', $dir));
}
// Generate a random filename. Use the server address so that a file
// generated at the same time on a different server won't have a collision.
$name = md5(uniqid(empty($_SERVER['SERVER_ADDR']) ? '' : $_SERVER['SERVER_ADDR'], true));
$filename = $name . '.jpg';
$filepath = $dir . DIRECTORY_SEPARATOR . $filename;
$url = static::imageUrl($width, $height, $category, $randomize, $word, $gray);
// save file
if (function_exists('curl_exec')) {
// use cURL
$fp = fopen($filepath, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$success = curl_exec($ch) && curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200;
fclose($fp);
curl_close($ch);
if (!$success) {
unlink($filepath);
// could not contact the distant URL or HTTP error - fail silently.
return false;
}
} elseif (ini_get('allow_url_fopen')) {
// use remote fopen() via copy()
$success = copy($url, $filepath);
} else {
return new \RuntimeException('The image formatter downloads an image from a remote HTTP server. Therefore, it requires that PHP can request remote hosts, either via cURL or fopen()');
}
return $fullPath ? $filepath : $filename;
}
}

View File

@@ -0,0 +1,366 @@
<?php
namespace Siteworx\Faker\Provider;
class Internet extends Base
{
protected static $freeEmailDomain = array('gmail.com', 'yahoo.com', 'hotmail.com');
protected static $tld = array('com', 'com', 'com', 'com', 'com', 'com', 'biz', 'info', 'net', 'org');
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}}/',
'http://www.{{domainName}}/{{slug}}',
'http://www.{{domainName}}/{{slug}}',
'https://www.{{domainName}}/{{slug}}',
'http://www.{{domainName}}/{{slug}}.html',
'http://{{domainName}}/{{slug}}',
'http://{{domainName}}/{{slug}}',
'http://{{domainName}}/{{slug}}.html',
'https://{{domainName}}/{{slug}}.html',
);
/**
* @example 'jdoe@acme.biz'
*/
public function email()
{
$format = static::randomElement(static::$emailFormats);
return $this->generator->parse($format);
}
/**
* @example 'jdoe@example.com'
*/
final public function safeEmail()
{
return preg_replace('/\s/u', '', $this->userName() . '@' . static::safeEmailDomain());
}
/**
* @example 'jdoe@gmail.com'
*/
public function freeEmail()
{
return preg_replace('/\s/u', '', $this->userName() . '@' . static::freeEmailDomain());
}
/**
* @example 'jdoe@dawson.com'
*/
public function companyEmail()
{
return preg_replace('/\s/u', '', $this->userName() . '@' . $this->domainName());
}
/**
* @example 'gmail.com'
*/
public static function freeEmailDomain()
{
return static::randomElement(static::$freeEmailDomain);
}
/**
* @example 'example.org'
*/
final public static function safeEmailDomain()
{
$domains = array(
'example.com',
'example.org',
'example.net'
);
return static::randomElement($domains);
}
/**
* @example 'jdoe'
*/
public function userName()
{
$format = static::randomElement(static::$userNameFormats);
$username = static::bothify($this->generator->parse($format));
$username = strtolower(static::transliterate($username));
// check if transliterate() didn't support the language and removed all letters
if (trim($username, '._') === '') {
throw new \Exception('userName failed with the selected locale. Try a different locale or activate the "intl" PHP extension.');
}
// clean possible trailing dots from first/last names
$username = str_replace('..', '.', $username);
$username = rtrim($username, '.');
return $username;
}
/**
* @example 'fY4èHdZv68'
*/
public function password($minLength = 6, $maxLength = 20)
{
$pattern = str_repeat('*', $this->numberBetween($minLength, $maxLength));
return $this->asciify($pattern);
}
/**
* @example 'tiramisu.com'
*/
public function domainName()
{
return $this->domainWord() . '.' . $this->tld();
}
/**
* @example 'faber'
*/
public function domainWord()
{
$lastName = $this->generator->format('lastName');
$lastName = strtolower(static::transliterate($lastName));
// check if transliterate() didn't support the language and removed all letters
if (trim($lastName, '._') === '') {
throw new \Exception('domainWord failed with the selected locale. Try a different locale or activate the "intl" PHP extension.');
}
// clean possible trailing dot from last name
$lastName = rtrim($lastName, '.');
return $lastName;
}
/**
* @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 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum'
*/
public function slug($nbWords = 6, $variableNbWords = true)
{
if ($nbWords <= 0) {
return '';
}
if ($variableNbWords) {
$nbWords = (int) ($nbWords * mt_rand(60, 140) / 100) + 1;
}
$words = $this->generator->words($nbWords);
return join('-', $words);
}
/**
* @example '237.149.115.38'
*/
public function ipv4()
{
return long2ip(mt_rand(0, 1) == 0 ? mt_rand(-2147483648, -2) : mt_rand(16777216, 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);
}
/**
* @example '10.1.1.17'
*/
public static function localIpv4()
{
if (static::numberBetween(0, 1) === 0) {
// 10.x.x.x range
return long2ip(static::numberBetween(ip2long("10.0.0.0"), ip2long("10.255.255.255")));
}
// 192.168.x.x range
return long2ip(static::numberBetween(ip2long("192.168.0.0"), ip2long("192.168.255.255")));
}
/**
* @example '32:F1:39:2F:D6:18'
*/
public static function macAddress()
{
for ($i = 0; $i < 6; $i++) {
$mac[] = sprintf('%02X', static::numberBetween(0, 0xff));
}
$mac = implode(':', $mac);
return $mac;
}
protected static function transliterate($string)
{
if (preg_match('/[^A-Za-z0-9_.]/', $string) === 0) {
return $string;
}
$transId = 'Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC;';
if (class_exists('Transliterator', false) && $transliterator = \Transliterator::create($transId)) {
$transString = $transliterator->transliterate($string);
} else {
$transString = static::toAscii($string);
}
return preg_replace('/[^A-Za-z0-9_.]/u', '', $transString);
}
protected static function toAscii($string)
{
static $arrayFrom, $arrayTo;
if (empty($arrayFrom)) {
$transliterationTable = array(
'IJ' => 'I', 'Ö' => 'O', 'Œ' => 'O', 'Ü' => 'U', 'ä' => 'a', 'æ' => 'a',
'ij' => 'i', 'ö' => 'o', 'œ' => 'o', 'ü' => 'u', 'ß' => 's', 'ſ' => 's',
'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A',
'Æ' => 'A', 'Ā' => 'A', 'Ą' => 'A', 'Ă' => 'A', 'Ç' => 'C', 'Ć' => 'C',
'Č' => 'C', 'Ĉ' => 'C', 'Ċ' => 'C', 'Ď' => 'D', 'Đ' => 'D', 'È' => 'E',
'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ē' => 'E', 'Ę' => 'E', 'Ě' => 'E',
'Ĕ' => 'E', 'Ė' => 'E', 'Ĝ' => 'G', 'Ğ' => 'G', 'Ġ' => 'G', 'Ģ' => 'G',
'Ĥ' => 'H', 'Ħ' => 'H', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I',
'Ī' => 'I', 'Ĩ' => 'I', 'Ĭ' => 'I', 'Į' => 'I', 'İ' => 'I', 'Ĵ' => 'J',
'Ķ' => 'K', 'Ľ' => 'K', 'Ĺ' => 'K', 'Ļ' => 'K', 'Ŀ' => 'K', 'Ł' => 'L',
'Ñ' => 'N', 'Ń' => 'N', 'Ň' => 'N', 'Ņ' => 'N', 'Ŋ' => 'N', 'Ò' => 'O',
'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ø' => 'O', 'Ō' => 'O', 'Ő' => 'O',
'Ŏ' => 'O', 'Ŕ' => 'R', 'Ř' => 'R', 'Ŗ' => 'R', 'Ś' => 'S', 'Ş' => 'S',
'Ŝ' => 'S', 'Ș' => 'S', 'Š' => 'S', 'Ť' => 'T', 'Ţ' => 'T', 'Ŧ' => 'T',
'Ț' => 'T', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ū' => 'U', 'Ů' => 'U',
'Ű' => 'U', 'Ŭ' => 'U', 'Ũ' => 'U', 'Ų' => 'U', 'Ŵ' => 'W', 'Ŷ' => 'Y',
'Ÿ' => 'Y', 'Ý' => 'Y', 'Ź' => 'Z', 'Ż' => 'Z', 'Ž' => 'Z', 'à' => 'a',
'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ā' => 'a', 'ą' => 'a', 'ă' => 'a',
'å' => 'a', 'ç' => 'c', 'ć' => 'c', 'č' => 'c', 'ĉ' => 'c', 'ċ' => 'c',
'ď' => 'd', 'đ' => 'd', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e',
'ē' => 'e', 'ę' => 'e', 'ě' => 'e', 'ĕ' => 'e', 'ė' => 'e', 'ƒ' => 'f',
'ĝ' => 'g', 'ğ' => 'g', 'ġ' => 'g', 'ģ' => 'g', 'ĥ' => 'h', 'ħ' => 'h',
'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ī' => 'i', 'ĩ' => 'i',
'ĭ' => 'i', 'į' => 'i', 'ı' => 'i', 'ĵ' => 'j', 'ķ' => 'k', 'ĸ' => 'k',
'ł' => 'l', 'ľ' => 'l', 'ĺ' => 'l', 'ļ' => 'l', 'ŀ' => 'l', 'ñ' => 'n',
'ń' => 'n', 'ň' => 'n', 'ņ' => 'n', 'ʼn' => 'n', 'ŋ' => 'n', 'ò' => 'o',
'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ø' => 'o', 'ō' => 'o', 'ő' => 'o',
'ŏ' => 'o', 'ŕ' => 'r', 'ř' => 'r', 'ŗ' => 'r', 'ś' => 's', 'š' => 's',
'ť' => 't', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ū' => 'u', 'ů' => 'u',
'ű' => 'u', 'ŭ' => 'u', 'ũ' => 'u', 'ų' => 'u', 'ŵ' => 'w', 'ÿ' => 'y',
'ý' => 'y', 'ŷ' => 'y', 'ż' => 'z', 'ź' => 'z', 'ž' => 'z', 'Α' => 'A',
'Ά' => 'A', 'Ἀ' => 'A', 'Ἁ' => 'A', 'Ἂ' => 'A', 'Ἃ' => 'A', 'Ἄ' => 'A',
'Ἅ' => 'A', 'Ἆ' => 'A', 'Ἇ' => 'A', 'ᾈ' => 'A', 'ᾉ' => 'A', 'ᾊ' => 'A',
'ᾋ' => 'A', 'ᾌ' => 'A', 'ᾍ' => 'A', 'ᾎ' => 'A', 'ᾏ' => 'A', 'Ᾰ' => 'A',
'Ᾱ' => 'A', 'Ὰ' => 'A', 'ᾼ' => 'A', 'Β' => 'B', 'Γ' => 'G', 'Δ' => 'D',
'Ε' => 'E', 'Έ' => 'E', 'Ἐ' => 'E', 'Ἑ' => 'E', 'Ἒ' => 'E', 'Ἓ' => 'E',
'Ἔ' => 'E', 'Ἕ' => 'E', 'Ὲ' => 'E', 'Ζ' => 'Z', 'Η' => 'I', 'Ή' => 'I',
'Ἠ' => 'I', 'Ἡ' => 'I', 'Ἢ' => 'I', 'Ἣ' => 'I', 'Ἤ' => 'I', 'Ἥ' => 'I',
'Ἦ' => 'I', 'Ἧ' => 'I', 'ᾘ' => 'I', 'ᾙ' => 'I', 'ᾚ' => 'I', 'ᾛ' => 'I',
'ᾜ' => 'I', 'ᾝ' => 'I', 'ᾞ' => 'I', 'ᾟ' => 'I', 'Ὴ' => 'I', 'ῌ' => 'I',
'Θ' => 'T', 'Ι' => 'I', 'Ί' => 'I', 'Ϊ' => 'I', 'Ἰ' => 'I', 'Ἱ' => 'I',
'Ἲ' => 'I', 'Ἳ' => 'I', 'Ἴ' => 'I', 'Ἵ' => 'I', 'Ἶ' => 'I', 'Ἷ' => 'I',
'Ῐ' => 'I', 'Ῑ' => 'I', 'Ὶ' => 'I', 'Κ' => 'K', 'Λ' => 'L', 'Μ' => 'M',
'Ν' => 'N', 'Ξ' => 'K', 'Ο' => 'O', 'Ό' => 'O', 'Ὀ' => 'O', 'Ὁ' => 'O',
'Ὂ' => 'O', 'Ὃ' => 'O', 'Ὄ' => 'O', 'Ὅ' => 'O', 'Ὸ' => 'O', 'Π' => 'P',
'Ρ' => 'R', 'Ῥ' => 'R', 'Σ' => 'S', 'Τ' => 'T', 'Υ' => 'Y', 'Ύ' => 'Y',
'Ϋ' => 'Y', 'Ὑ' => 'Y', 'Ὓ' => 'Y', 'Ὕ' => 'Y', 'Ὗ' => 'Y', 'Ῠ' => 'Y',
'Ῡ' => 'Y', 'Ὺ' => 'Y', 'Φ' => 'F', 'Χ' => 'X', 'Ψ' => 'P', 'Ω' => 'O',
'Ώ' => 'O', 'Ὠ' => 'O', 'Ὡ' => 'O', 'Ὢ' => 'O', 'Ὣ' => 'O', 'Ὤ' => 'O',
'Ὥ' => 'O', 'Ὦ' => 'O', 'Ὧ' => 'O', 'ᾨ' => 'O', 'ᾩ' => 'O', 'ᾪ' => 'O',
'ᾫ' => 'O', 'ᾬ' => 'O', 'ᾭ' => 'O', 'ᾮ' => 'O', 'ᾯ' => 'O', 'Ὼ' => 'O',
'ῼ' => 'O', 'α' => 'a', 'ά' => 'a', 'ἀ' => 'a', 'ἁ' => 'a', 'ἂ' => 'a',
'ἃ' => 'a', 'ἄ' => 'a', 'ἅ' => 'a', 'ἆ' => 'a', 'ἇ' => 'a', 'ᾀ' => 'a',
'ᾁ' => 'a', 'ᾂ' => 'a', 'ᾃ' => 'a', 'ᾄ' => 'a', 'ᾅ' => 'a', 'ᾆ' => 'a',
'ᾇ' => 'a', 'ὰ' => 'a', 'ᾰ' => 'a', 'ᾱ' => 'a', 'ᾲ' => 'a', 'ᾳ' => 'a',
'ᾴ' => 'a', 'ᾶ' => 'a', 'ᾷ' => 'a', 'β' => 'b', 'γ' => 'g', 'δ' => 'd',
'ε' => 'e', 'έ' => 'e', 'ἐ' => 'e', 'ἑ' => 'e', 'ἒ' => 'e', 'ἓ' => 'e',
'ἔ' => 'e', 'ἕ' => 'e', 'ὲ' => 'e', 'ζ' => 'z', 'η' => 'i', 'ή' => 'i',
'ἠ' => 'i', 'ἡ' => 'i', 'ἢ' => 'i', 'ἣ' => 'i', 'ἤ' => 'i', 'ἥ' => 'i',
'ἦ' => 'i', 'ἧ' => 'i', 'ᾐ' => 'i', 'ᾑ' => 'i', 'ᾒ' => 'i', 'ᾓ' => 'i',
'ᾔ' => 'i', 'ᾕ' => 'i', 'ᾖ' => 'i', 'ᾗ' => 'i', 'ὴ' => 'i', 'ῂ' => 'i',
'ῃ' => 'i', 'ῄ' => 'i', 'ῆ' => 'i', 'ῇ' => 'i', 'θ' => 't', 'ι' => 'i',
'ί' => 'i', 'ϊ' => 'i', 'ΐ' => 'i', 'ἰ' => 'i', 'ἱ' => 'i', 'ἲ' => 'i',
'ἳ' => 'i', 'ἴ' => 'i', 'ἵ' => 'i', 'ἶ' => 'i', 'ἷ' => 'i', 'ὶ' => 'i',
'ῐ' => 'i', 'ῑ' => 'i', 'ῒ' => 'i', 'ῖ' => 'i', 'ῗ' => 'i', 'κ' => 'k',
'λ' => 'l', 'μ' => 'm', 'ν' => 'n', 'ξ' => 'k', 'ο' => 'o', 'ό' => 'o',
'ὀ' => 'o', 'ὁ' => 'o', 'ὂ' => 'o', 'ὃ' => 'o', 'ὄ' => 'o', 'ὅ' => 'o',
'ὸ' => 'o', 'π' => 'p', 'ρ' => 'r', 'ῤ' => 'r', 'ῥ' => 'r', 'σ' => 's',
'ς' => 's', 'τ' => 't', 'υ' => 'y', 'ύ' => 'y', 'ϋ' => 'y', 'ΰ' => 'y',
'ὐ' => 'y', 'ὑ' => 'y', 'ὒ' => 'y', 'ὓ' => 'y', 'ὔ' => 'y', 'ὕ' => 'y',
'ὖ' => 'y', 'ὗ' => 'y', 'ὺ' => 'y', 'ῠ' => 'y', 'ῡ' => 'y', 'ῢ' => 'y',
'ῦ' => 'y', 'ῧ' => 'y', 'φ' => 'f', 'χ' => 'x', 'ψ' => 'p', 'ω' => 'o',
'ώ' => 'o', 'ὠ' => 'o', 'ὡ' => 'o', 'ὢ' => 'o', 'ὣ' => 'o', 'ὤ' => 'o',
'ὥ' => 'o', 'ὦ' => 'o', 'ὧ' => 'o', 'ᾠ' => 'o', 'ᾡ' => 'o', 'ᾢ' => 'o',
'ᾣ' => 'o', 'ᾤ' => 'o', 'ᾥ' => 'o', 'ᾦ' => 'o', 'ᾧ' => 'o', 'ὼ' => 'o',
'ῲ' => 'o', 'ῳ' => 'o', 'ῴ' => 'o', 'ῶ' => 'o', 'ῷ' => 'o', 'А' => 'A',
'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'E',
'Ж' => 'Z', 'З' => 'Z', 'И' => 'I', 'Й' => 'I', 'К' => 'K', 'Л' => 'L',
'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S',
'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'K', 'Ц' => 'T', 'Ч' => 'C',
'Ш' => 'S', 'Щ' => 'S', 'Ы' => 'Y', 'Э' => 'E', 'Ю' => 'Y', 'Я' => 'Y',
'а' => 'A', 'б' => 'B', 'в' => 'V', 'г' => 'G', 'д' => 'D', 'е' => 'E',
'ё' => 'E', 'ж' => 'Z', 'з' => 'Z', 'и' => 'I', 'й' => 'I', 'к' => 'K',
'л' => 'L', 'м' => 'M', 'н' => 'N', 'о' => 'O', 'п' => 'P', 'р' => 'R',
'с' => 'S', 'т' => 'T', 'у' => 'U', 'ф' => 'F', 'х' => 'K', 'ц' => 'T',
'ч' => 'C', 'ш' => 'S', 'щ' => 'S', 'ы' => 'Y', 'э' => 'E', 'ю' => 'Y',
'я' => 'Y', 'ð' => 'd', 'Ð' => 'D', 'þ' => 't', 'Þ' => 'T', 'ა' => 'a',
'ბ' => 'b', 'გ' => 'g', 'დ' => 'd', 'ე' => 'e', 'ვ' => 'v', 'ზ' => 'z',
'თ' => 't', 'ი' => 'i', 'კ' => 'k', 'ლ' => 'l', 'მ' => 'm', 'ნ' => 'n',
'ო' => 'o', 'პ' => 'p', 'ჟ' => 'z', 'რ' => 'r', 'ს' => 's', 'ტ' => 't',
'უ' => 'u', 'ფ' => 'p', 'ქ' => 'k', 'ღ' => 'g', '' => 'q', 'შ' => 's',
'ჩ' => 'c', 'ც' => 't', 'ძ' => 'd', 'წ' => 't', 'ჭ' => 'c', 'ხ' => 'k',
'ჯ' => 'j', 'ჰ' => 'h', 'ţ' => 't', 'ʼ' => "'", '̧' => '', 'ḩ' => 'h',
'' => "'", '' => "'", 'ừ' => 'u', '/' => '', 'ế' => 'e', 'ả' => 'a',
'ị' => 'i', 'ậ' => 'a', 'ệ' => 'e', 'ỉ' => 'i', 'ồ' => 'o', 'ề' => 'e',
'ơ' => 'o', 'ạ' => 'a', 'ẵ' => 'a', 'ư' => 'u', 'ằ' => 'a', 'ầ' => 'a',
'ḑ' => 'd', 'Ḩ' => 'H', 'Ḑ' => 'D', 'ș' => 's', 'ț' => 't', 'ộ' => 'o',
'ắ' => 'a', 'ş' => 's', "'" => '', 'ու' => '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',
);
$arrayFrom = array_keys($transliterationTable);
$arrayTo = array_values($transliterationTable);
}
return str_replace($arrayFrom, $arrayTo, $string);
}
}

View File

@@ -0,0 +1,204 @@
<?php
namespace Siteworx\Faker\Provider;
class Lorem extends Base
{
protected static $wordList = array(
'alias', 'consequatur', 'aut', 'perferendis', 'sit', 'voluptatem',
'accusantium', 'doloremque', 'aperiam', 'eaque','ipsa', 'quae', 'ab',
'illo', 'inventore', 'veritatis', 'et', 'quasi', 'architecto',
'beatae', 'vitae', 'dicta', 'sunt', 'explicabo', 'aspernatur', 'aut',
'odit', 'aut', 'fugit', 'sed', 'quia', 'consequuntur', 'magni',
'dolores', 'eos', 'qui', 'ratione', 'voluptatem', 'sequi', 'nesciunt',
'neque', 'dolorem', 'ipsum', 'quia', 'dolor', 'sit', 'amet',
'consectetur', 'adipisci', 'velit', 'sed', 'quia', 'non', 'numquam',
'eius', 'modi', 'tempora', 'incidunt', 'ut', 'labore', 'et', 'dolore',
'magnam', 'aliquam', 'quaerat', 'voluptatem', 'ut', 'enim', 'ad',
'minima', 'veniam', 'quis', 'nostrum', 'exercitationem', 'ullam',
'corporis', 'nemo', 'enim', 'ipsam', 'voluptatem', 'quia', 'voluptas',
'sit', 'suscipit', 'laboriosam', 'nisi', 'ut', 'aliquid', 'ex', 'ea',
'commodi', 'consequatur', 'quis', 'autem', 'vel', 'eum', 'iure',
'reprehenderit', 'qui', 'in', 'ea', 'voluptate', 'velit', 'esse',
'quam', 'nihil', 'molestiae', 'et', 'iusto', 'odio', 'dignissimos',
'ducimus', 'qui', 'blanditiis', 'praesentium', 'laudantium', 'totam',
'rem', 'voluptatum', 'deleniti', 'atque', 'corrupti', 'quos',
'dolores', 'et', 'quas', 'molestias', 'excepturi', 'sint',
'occaecati', 'cupiditate', 'non', 'provident', 'sed', 'ut',
'perspiciatis', 'unde', 'omnis', 'iste', 'natus', 'error',
'similique', 'sunt', 'in', 'culpa', 'qui', 'officia', 'deserunt',
'mollitia', 'animi', 'id', 'est', 'laborum', 'et', 'dolorum', 'fuga',
'et', 'harum', 'quidem', 'rerum', 'facilis', 'est', 'et', 'expedita',
'distinctio', 'nam', 'libero', 'tempore', 'cum', 'soluta', 'nobis',
'est', 'eligendi', 'optio', 'cumque', 'nihil', 'impedit', 'quo',
'porro', 'quisquam', 'est', 'qui', 'minus', 'id', 'quod', 'maxime',
'placeat', 'facere', 'possimus', 'omnis', 'voluptas', 'assumenda',
'est', 'omnis', 'dolor', 'repellendus', 'temporibus', 'autem',
'quibusdam', 'et', 'aut', 'consequatur', 'vel', 'illum', 'qui',
'dolorem', 'eum', 'fugiat', 'quo', 'voluptas', 'nulla', 'pariatur',
'at', 'vero', 'eos', 'et', 'accusamus', 'officiis', 'debitis', 'aut',
'rerum', 'necessitatibus', 'saepe', 'eveniet', 'ut', 'et',
'voluptates', 'repudiandae', 'sint', 'et', 'molestiae', 'non',
'recusandae', 'itaque', 'earum', 'rerum', 'hic', 'tenetur', 'a',
'sapiente', 'delectus', 'ut', 'aut', 'reiciendis', 'voluptatibus',
'maiores', 'doloribus', 'asperiores', 'repellat'
);
/**
* @example 'Lorem'
* @return string
*/
public static function word()
{
return static::randomElement(static::$wordList);
}
/**
* Generate an array of random words
*
* @example array('Lorem', 'ipsum', 'dolor')
* @param integer $nb how many words to return
* @param bool $asText if true the sentences are returned as one string
* @return array|string
*/
public static function words($nb = 3, $asText = false)
{
$words = array();
for ($i = 0; $i < $nb; $i++) {
$words [] = static::word();
}
return $asText ? implode(' ', $words) : $words;
}
/**
* Generate a random sentence
*
* @example 'Lorem ipsum dolor sit amet.'
* @param integer $nbWords around how many words the sentence should contain
* @param boolean $variableNbWords set to false if you want exactly $nbWords returned,
* otherwise $nbWords may vary by +/-40% with a minimum of 1
* @return string
*/
public static function sentence($nbWords = 6, $variableNbWords = true)
{
if ($nbWords <= 0) {
return '';
}
if ($variableNbWords) {
$nbWords = self::randomizeNbElements($nbWords);
}
$words = static::words($nbWords);
$words[0] = ucwords($words[0]);
return implode(' ', $words) . '.';
}
/**
* Generate an array of sentences
*
* @example array('Lorem ipsum dolor sit amet.', 'Consectetur adipisicing eli.')
* @param integer $nb how many sentences to return
* @param bool $asText if true the sentences are returned as one string
* @return array|string
*/
public static function sentences($nb = 3, $asText = false)
{
$sentences = array();
for ($i = 0; $i < $nb; $i++) {
$sentences [] = static::sentence();
}
return $asText ? implode(' ', $sentences) : $sentences;
}
/**
* Generate a single paragraph
*
* @example 'Sapiente sunt omnis. Ut pariatur ad autem ducimus et. Voluptas rem voluptas sint modi dolorem amet.'
* @param integer $nbSentences around how many sentences the paragraph should contain
* @param boolean $variableNbSentences set to false if you want exactly $nbSentences returned,
* otherwise $nbSentences may vary by +/-40% with a minimum of 1
* @return string
*/
public static function paragraph($nbSentences = 3, $variableNbSentences = true)
{
if ($nbSentences <= 0) {
return '';
}
if ($variableNbSentences) {
$nbSentences = self::randomizeNbElements($nbSentences);
}
return implode(' ', static::sentences($nbSentences));
}
/**
* Generate an array of paragraphs
*
* @example array($paragraph1, $paragraph2, $paragraph3)
* @param integer $nb how many paragraphs to return
* @param bool $asText if true the paragraphs are returned as one string, separated by two newlines
* @return array|string
*/
public static function paragraphs($nb = 3, $asText = false)
{
$paragraphs = array();
for ($i = 0; $i < $nb; $i++) {
$paragraphs [] = static::paragraph();
}
return $asText ? implode("\n\n", $paragraphs) : $paragraphs;
}
/**
* Generate a text string.
* Depending on the $maxNbChars, returns a string made of words, sentences, or paragraphs.
*
* @example 'Sapiente sunt omnis. Ut pariatur ad autem ducimus et. Voluptas rem voluptas sint modi dolorem amet.'
*
* @param integer $maxNbChars Maximum number of characters the text should contain (minimum 5)
*
* @return string
*/
public static function text($maxNbChars = 200)
{
if ($maxNbChars < 5) {
throw new \InvalidArgumentException('text() can only generate text of at least 5 characters');
}
$type = $maxNbChars < 25 ? 'word' : ($maxNbChars < 100 ? 'sentence' : 'paragraph');
$text = array();
while (empty($text)) {
$size = 0;
// until $maxNbChars is reached
while ($size < $maxNbChars) {
$word = ($size ? ' ' : '') . static::$type();
$text[] = $word;
$size += strlen($word);
}
array_pop($text);
}
if ($type === 'word') {
// capitalize first letter
$text[0] = ucwords($text[0]);
// end sentence with full stop
$text[count($text) - 1] .= '.';
}
return implode('', $text);
}
protected static function randomizeNbElements($nbElements)
{
return (int) ($nbElements * mt_rand(60, 140) / 100) + 1;
}
}

View File

@@ -0,0 +1,324 @@
<?php
namespace Siteworx\Faker\Provider;
class Miscellaneous extends Base
{
/**
* @link https://en.wikipedia.org/wiki/Emoji#Unicode_blocks
* On date of 2017-03-26
*
* U+1F600 - U+1F637 as their UTF-8 Pairings
*/
protected static $emoji = array(
'\uD83D\uDE00', '\uD83D\uDE01', '\uD83D\uDE02', '\uD83D\uDE03',
'\uD83D\uDE04', '\uD83D\uDE05', '\uD83D\uDE06', '\uD83D\uDE07',
'\uD83D\uDE08', '\uD83D\uDE09', '\uD83D\uDE0A', '\uD83D\uDE0B',
'\uD83D\uDE0C', '\uD83D\uDE0D', '\uD83D\uDE0E', '\uD83D\uDE0F',
'\uD83D\uDE10', '\uD83D\uDE11', '\uD83D\uDE12', '\uD83D\uDE13',
'\uD83D\uDE14', '\uD83D\uDE15', '\uD83D\uDE16', '\uD83D\uDE17',
'\uD83D\uDE18', '\uD83D\uDE19', '\uD83D\uDE1A', '\uD83D\uDE1B',
'\uD83D\uDE1C', '\uD83D\uDE1D', '\uD83D\uDE1E', '\uD83D\uDE1F',
'\uD83D\uDE20', '\uD83D\uDE21', '\uD83D\uDE22', '\uD83D\uDE23',
'\uD83D\uDE24', '\uD83D\uDE25', '\uD83D\uDE26', '\uD83D\uDE27',
'\uD83D\uDE28', '\uD83D\uDE29', '\uD83D\uDE2A', '\uD83D\uDE2B',
'\uD83D\uDE2C', '\uD83D\uDE2D', '\uD83D\uDE2E', '\uD83D\uDE2F',
'\uD83D\uDE30', '\uD83D\uDE31', '\uD83D\uDE32', '\uD83D\uDE33',
'\uD83D\uDE34', '\uD83D\uDE35', '\uD83D\uDE36', '\uD83D\uDE37',
);
/**
* @link https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
* On date of 2016-04-22
*/
protected static $languageCode = array(
'aa', 'ab', 'ae', 'af', 'ak', 'am', 'an', 'ar', 'as', 'av',
'ay', 'az', 'ba', 'be', 'bg', 'bh', 'bi', 'bm', 'bn', 'bo',
'br', 'bs', 'ca', 'ce', 'ch', 'co', 'cr', 'cs', 'cu', 'cv',
'cy', 'da', 'de', 'dv', 'dz', 'ee', 'el', 'en', 'eo', 'es',
'et', 'eu', 'fa', 'ff', 'fi', 'fj', 'fo', 'fr', 'fy', 'ga',
'gd', 'gl', 'gn', 'gu', 'gv', 'ha', 'he', 'hi', 'ho', 'hr',
'ht', 'hu', 'hy', 'hz', 'ia', 'id', 'ie', 'ig', 'ii', 'ik',
'io', 'is', 'it', 'iu', 'ja', 'jv', 'ka', 'kg', 'ki', 'kj',
'kk', 'kl', 'km', 'kn', 'ko', 'kr', 'ks', 'ku', 'kv', 'kw',
'ky', 'la', 'lb', 'lg', 'li', 'ln', 'lo', 'lt', 'lu', 'lv',
'mg', 'mh', 'mi', 'mk', 'ml', 'mn', 'mr', 'ms', 'mt', 'my',
'na', 'nb', 'nd', 'ne', 'ng', 'nl', 'nn', 'no', 'nr', 'nv',
'ny', 'oc', 'oj', 'om', 'or', 'os', 'pa', 'pi', 'pl', 'ps',
'pt', 'qu', 'rm', 'rn', 'ro', 'ru', 'rw', 'sa', 'sc', 'sd',
'se', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sq', 'sr',
'ss', 'st', 'su', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'ti',
'tk', 'tl', 'tn', 'to', 'tr', 'ts', 'tt', 'tw', 'ty', 'ug',
'uk', 'ur', 'uz', 've', 'vi', 'vo', 'wa', 'wo', 'xh', 'yi',
'yo', 'za', 'zh', 'zu',
);
/**
* @link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
* On date of 2014-10-19
*/
protected static $countryCode = array(
'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AQ', 'AR',
'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE',
'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ',
'BR', 'BS', 'BT', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF',
'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU',
'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO',
'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ',
'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG',
'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT',
'GU', 'GW', 'GY', 'HK', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE',
'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JE', 'JM',
'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR',
'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS',
'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG',
'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS',
'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE',
'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM',
'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR',
'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW',
'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK',
'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV', 'SX', 'SY',
'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM',
'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM',
'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU',
'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW',
);
/**
* @link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
* On date of 2014-10-19
*/
protected static $countryISOAlpha3 = array(
'ABW', 'AFG', 'AGO', 'AIA', 'ALA', 'ALB', 'AND', 'ARE', 'ARG', 'ARM',
'ASM', 'ATA', 'ATF', 'ATG', 'AUS', 'AUT', 'AZE', 'BDI', 'BEL', 'BEN',
'BES', 'BFA', 'BGD', 'BGR', 'BHR', 'BHS', 'BIH', 'BLM', 'BLR', 'BLZ',
'BMU', 'BOL', 'BRA', 'BRB', 'BRN', 'BTN', 'BVT', 'BWA', 'CAF', 'CAN',
'CCK', 'CHE', 'CHL', 'CHN', 'CIV', 'CMR', 'COD', 'COG', 'COK', 'COL',
'COM', 'CPV', 'CRI', 'CUB', 'CUW', 'CXR', 'CYM', 'CYP', 'CZE', 'DEU',
'DJI', 'DMA', 'DNK', 'DOM', 'DZA', 'ECU', 'EGY', 'ERI', 'ESH', 'ESP',
'EST', 'ETH', 'FIN', 'FJI', 'FLK', 'FRA', 'FRO', 'FSM', 'GAB', 'GBR',
'GEO', 'GGY', 'GHA', 'GIB', 'GIN', 'GLP', 'GMB', 'GNB', 'GNQ', 'GRC',
'GRD', 'GRL', 'GTM', 'GUF', 'GUM', 'GUY', 'HKG', 'HMD', 'HND', 'HRV',
'HTI', 'HUN', 'IDN', 'IMN', 'IND', 'IOT', 'IRL', 'IRN', 'IRQ', 'ISL',
'ISR', 'ITA', 'JAM', 'JEY', 'JOR', 'JPN', 'KAZ', 'KEN', 'KGZ', 'KHM',
'KIR', 'KNA', 'KOR', 'KWT', 'LAO', 'LBN', 'LBR', 'LBY', 'LCA', 'LIE',
'LKA', 'LSO', 'LTU', 'LUX', 'LVA', 'MAC', 'MAF', 'MAR', 'MCO', 'MDA',
'MDG', 'MDV', 'MEX', 'MHL', 'MKD', 'MLI', 'MLT', 'MMR', 'MNE', 'MNG',
'MNP', 'MOZ', 'MRT', 'MSR', 'MTQ', 'MUS', 'MWI', 'MYS', 'MYT', 'NAM',
'NCL', 'NER', 'NFK', 'NGA', 'NIC', 'NIU', 'NLD', 'NOR', 'NPL', 'NRU',
'NZL', 'OMN', 'PAK', 'PAN', 'PCN', 'PER', 'PHL', 'PLW', 'PNG', 'POL',
'PRI', 'PRK', 'PRT', 'PRY', 'PSE', 'PYF', 'QAT', 'REU', 'ROU', 'RUS',
'RWA', 'SAU', 'SDN', 'SEN', 'SGP', 'SGS', 'SHN', 'SJM', 'SLB', 'SLE',
'SLV', 'SMR', 'SOM', 'SPM', 'SRB', 'SSD', 'STP', 'SUR', 'SVK', 'SVN',
'SWE', 'SWZ', 'SXM', 'SYC', 'SYR', 'TCA', 'TCD', 'TGO', 'THA', 'TJK',
'TKL', 'TKM', 'TLS', 'TON', 'TTO', 'TUN', 'TUR', 'TUV', 'TWN', 'TZA',
'UGA', 'UKR', 'UMI', 'URY', 'USA', 'UZB', 'VAT', 'VCT', 'VEN', 'VGB',
'VIR', 'VNM', 'VUT', 'WLF', 'WSM', 'YEM', 'ZAF', 'ZMB', 'ZWE',
);
protected static $localeData = array(
'aa_DJ', 'aa_ER', 'aa_ET',
'af_NA', 'af_ZA', 'ak_GH',
'am_ET', 'ar_AE', 'ar_BH', 'ar_DZ',
'ar_EG', 'ar_IQ', 'ar_JO', 'ar_KW', 'ar_LB',
'ar_LY', 'ar_MA', 'ar_OM', 'ar_QA', 'ar_SA',
'ar_SD', 'ar_SY', 'ar_TN', 'ar_YE',
'as_IN', 'az_AZ', 'be_BY',
'bg_BG', 'bn_BD', 'bn_IN',
'bo_CN', 'bo_IN', 'bs_BA',
'byn_ER', 'ca_ES',
'cch_NG', 'cs_CZ',
'cy_GB', 'da_DK', 'de_AT',
'de_BE', 'de_CH', 'de_DE', 'de_LI', 'de_LU',
'dv_MV', 'dz_BT',
'ee_GH', 'ee_TG', 'el_CY', 'el_GR',
'en_AS', 'en_AU', 'en_BE', 'en_BW',
'en_BZ', 'en_CA', 'en_GB', 'en_GU', 'en_HK',
'en_IE', 'en_IN', 'en_JM', 'en_MH', 'en_MP',
'en_MT', 'en_NA', 'en_NZ', 'en_PH', 'en_PK',
'en_SG', 'en_TT', 'en_UM', 'en_US', 'en_VI',
'en_ZA', 'en_ZW', 'es_AR',
'es_BO', 'es_CL', 'es_CO', 'es_CR', 'es_DO',
'es_EC', 'es_ES', 'es_GT', 'es_HN', 'es_MX',
'es_NI', 'es_PA', 'es_PE', 'es_PR', 'es_PY',
'es_SV', 'es_US', 'es_UY', 'es_VE',
'et_EE', 'eu_ES', 'fa_AF',
'fa_IR', 'fi_FI', 'fil_PH',
'fo_FO', 'fr_BE', 'fr_CA',
'fr_CH', 'fr_FR', 'fr_LU', 'fr_MC', 'fr_SN',
'fur_IT', 'ga_IE',
'gaa_GH', 'gez_ER', 'gez_ET',
'gl_ES', 'gsw_CH', 'gu_IN',
'gv_GB', 'ha_GH', 'ha_NE',
'ha_NG', 'ha_SD', 'haw_US',
'he_IL', 'hi_IN', 'hr_HR',
'hu_HU', 'hy_AM',
'id_ID', 'ig_NG',
'ii_CN', 'is_IS',
'it_CH', 'it_IT',
'ja_JP', 'ka_GE', 'kaj_NG',
'kam_KE', 'kcg_NG',
'kfo_CI', 'kk_KZ', 'kl_GL',
'km_KH', 'kn_IN',
'ko_KR', 'kok_IN', 'kpe_GN',
'kpe_LR', 'ku_IQ', 'ku_IR', 'ku_SY',
'ku_TR', 'kw_GB', 'ky_KG',
'ln_CD', 'ln_CG', 'lo_LA',
'lt_LT', 'lv_LV',
'mk_MK', 'ml_IN', 'mn_CN',
'mn_MN', 'mr_IN',
'ms_BN', 'ms_MY', 'mt_MT',
'my_MM', 'nb_NO', 'nds_DE',
'ne_IN', 'ne_NP', 'nl_BE',
'nl_NL', 'nn_NO',
'nr_ZA', 'nso_ZA', 'ny_MW',
'oc_FR', 'om_ET', 'om_KE',
'or_IN', 'pa_IN', 'pa_PK',
'pl_PL', 'ps_AF',
'pt_BR', 'pt_PT', 'ro_MD', 'ro_RO',
'ru_RU', 'ru_UA', 'rw_RW',
'sa_IN', 'se_FI', 'se_NO',
'sh_BA', 'sh_CS', 'sh_YU',
'si_LK', 'sid_ET', 'sk_SK',
'sl_SI', 'so_DJ', 'so_ET',
'so_KE', 'so_SO', 'sq_AL',
'sr_BA', 'sr_CS', 'sr_ME', 'sr_RS', 'sr_YU',
'ss_SZ', 'ss_ZA', 'st_LS',
'st_ZA', 'sv_FI', 'sv_SE',
'sw_KE', 'sw_TZ', 'syr_SY',
'ta_IN', 'te_IN', 'tg_TJ',
'th_TH', 'ti_ER', 'ti_ET',
'tig_ER', 'tn_ZA',
'to_TO', 'tr_TR',
'trv_TW', 'ts_ZA', 'tt_RU',
'ug_CN', 'uk_UA',
'ur_IN', 'ur_PK', 'uz_AF', 'uz_UZ',
've_ZA', 'vi_VN',
'wal_ET', 'wo_SN', 'xh_ZA',
'yo_NG', 'zh_CN', 'zh_HK',
'zh_MO', 'zh_SG', 'zh_TW', 'zu_ZA',
);
/**
* @link https://en.wikipedia.org/wiki/ISO_4217
* On date of 2019-09-27
*
* With the following exceptions:
* SVC has been replaced by the USD in 2001: https://en.wikipedia.org/wiki/Salvadoran_col%C3%B3n
* ZWL has been suspended since 2009: https://en.wikipedia.org/wiki/Zimbabwean_dollar
*/
protected static $currencyCode = array(
'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AWG', 'AZN',
'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL',
'BSD', 'BTN', 'BWP', 'BYN', 'BZD', 'CAD', 'CDF', 'CHF', 'CLP', 'CNY',
'COP', 'CRC', 'CUC', 'CUP', 'CVE', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD',
'EGP', 'ERN', 'ETB', 'EUR', 'FJD', 'FKP', 'GBP', 'GEL', 'GHS', 'GIP',
'GMD', 'GNF', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR',
'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS',
'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR',
'LRD', 'LSL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP',
'MRU', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZN', 'NAD', 'NGN', 'NIO',
'NOK', 'NPR', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN',
'PYG', 'QAR', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SBD', 'SCR', 'SDG',
'SEK', 'SGD', 'SHP', 'SLL', 'SOS', 'SRD', 'SSP', 'STN', 'SYP', 'SZL',
'THB', 'TJS', 'TMT', 'TND', 'TOP', 'TRY', 'TTD', 'TWD', 'TZS', 'UAH',
'UGX', 'USD', 'UYU', 'UZS', 'VES', 'VND', 'VUV', 'WST', 'XAF', 'XCD',
'XOF', 'XPF', 'YER', 'ZAR', 'ZMW',
);
/**
* Return a boolean, true or false.
*
* @param int $chanceOfGettingTrue Between 0 (always get false) and 100 (always get true)
*
* @return bool
*
* @example true
*/
public static function boolean($chanceOfGettingTrue = 50)
{
return mt_rand(1, 100) <= $chanceOfGettingTrue;
}
/**
* @example 'cfcd208495d565ef66e7dff9f98764da'
*/
public static function md5()
{
return md5(mt_rand());
}
/**
* @example 'b5d86317c2a144cd04d0d7c03b2b02666fafadf2'
*/
public static function sha1()
{
return sha1(mt_rand());
}
/**
* @example '85086017559ccc40638fcde2fecaf295e0de7ca51b7517b6aebeaaf75b4d4654'
*/
public static function sha256()
{
return hash('sha256', mt_rand());
}
/**
* @example 'fr_FR'
*/
public static function locale()
{
return static::randomElement(static::$localeData);
}
/**
* @example 'FR'
*
* @link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
*/
public static function countryCode()
{
return static::randomElement(static::$countryCode);
}
/**
* @example 'FRA'
*
* @link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
*/
public static function countryISOAlpha3()
{
return static::randomElement(static::$countryISOAlpha3);
}
/**
* @example 'fr'
*/
public static function languageCode()
{
return static::randomElement(static::$languageCode);
}
/**
* @example 'EUR'
*
* @link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
*/
public static function currencyCode()
{
return static::randomElement(static::$currencyCode);
}
/**
* Returns an encoded Unicode Character between U+1F600 and U+1F637.
*
* @link https://en.wikipedia.org/wiki/Emoji#Unicode_blocks
*/
public static function emoji()
{
return json_decode('"' . static::randomElement(static::$emoji) . '"');
}
}

View File

@@ -0,0 +1,287 @@
<?php
namespace Siteworx\Faker\Provider;
use Siteworx\Faker\Calculator\Iban;
use Siteworx\Faker\Calculator\Luhn;
class Payment extends Base
{
public static $expirationDateFormat = "m/y";
protected static $cardVendors = array(
'Visa', 'Visa', 'Visa', 'Visa', 'Visa',
'MasterCard', 'MasterCard', 'MasterCard', 'MasterCard', 'MasterCard',
'American Express', 'Discover Card', 'Visa Retired'
);
/**
* @var array List of card brand masks for generating valid credit card numbers
* @see https://en.wikipedia.org/wiki/Payment_card_number Reference for existing prefixes
* @see https://www.mastercard.us/en-us/issuers/get-support/2-series-bin-expansion.html MasterCard 2017 2-Series BIN Expansion
*/
protected static $cardParams = array(
'Visa' => array(
"4539###########",
"4556###########",
"4916###########",
"4532###########",
"4929###########",
"40240071#######",
"4485###########",
"4716###########",
"4##############"
),
'Visa Retired' => array(
"4539########",
"4556########",
"4916########",
"4532########",
"4929########",
"40240071####",
"4485########",
"4716########",
"4###########",
),
'MasterCard' => array(
"2221###########",
"23#############",
"24#############",
"25#############",
"26#############",
"2720###########",
"51#############",
"52#############",
"53#############",
"54#############",
"55#############"
),
'American Express' => array(
"34############",
"37############"
),
'Discover Card' => array(
"6011###########"
),
);
/**
* @var array list of IBAN formats, source: @link https://www.swift.com/standards/data-standards/iban
*/
protected static $ibanFormats = array(
'AD' => array(array('n', 4), array('n', 4), array('c', 12)),
'AE' => array(array('n', 3), array('n', 16)),
'AL' => array(array('n', 8), array('c', 16)),
'AT' => array(array('n', 5), array('n', 11)),
'AZ' => array(array('a', 4), array('c', 20)),
'BA' => array(array('n', 3), array('n', 3), array('n', 8), array('n', 2)),
'BE' => array(array('n', 3), array('n', 7), array('n', 2)),
'BG' => array(array('a', 4), array('n', 4), array('n', 2), array('c', 8)),
'BH' => array(array('a', 4), array('c', 14)),
'BR' => array(array('n', 8), array('n', 5), array('n', 10), array('a', 1), array('c', 1)),
'CH' => array(array('n', 5), array('c', 12)),
'CR' => array(array('n', 4), array('n', 14)),
'CY' => array(array('n', 3), array('n', 5), array('c', 16)),
'CZ' => array(array('n', 4), array('n', 6), array('n', 10)),
'DE' => array(array('n', 8), array('n', 10)),
'DK' => array(array('n', 4), array('n', 9), array('n', 1)),
'DO' => array(array('c', 4), array('n', 20)),
'EE' => array(array('n', 2), array('n', 2), array('n', 11), array('n', 1)),
'ES' => array(array('n', 4), array('n', 4), array('n', 1), array('n', 1), array('n', 10)),
'FI' => array(array('n', 6), array('n', 7), array('n', 1)),
'FR' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)),
'GB' => array(array('a', 4), array('n', 6), array('n', 8)),
'GE' => array(array('a', 2), array('n', 16)),
'GI' => array(array('a', 4), array('c', 15)),
'GR' => array(array('n', 3), array('n', 4), array('c', 16)),
'GT' => array(array('c', 4), array('c', 20)),
'HR' => array(array('n', 7), array('n', 10)),
'HU' => array(array('n', 3), array('n', 4), array('n', 1), array('n', 15), array('n', 1)),
'IE' => array(array('a', 4), array('n', 6), array('n', 8)),
'IL' => array(array('n', 3), array('n', 3), array('n', 13)),
'IS' => array(array('n', 4), array('n', 2), array('n', 6), array('n', 10)),
'IT' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)),
'KW' => array(array('a', 4), array('n', 22)),
'KZ' => array(array('n', 3), array('c', 13)),
'LB' => array(array('n', 4), array('c', 20)),
'LI' => array(array('n', 5), array('c', 12)),
'LT' => array(array('n', 5), array('n', 11)),
'LU' => array(array('n', 3), array('c', 13)),
'LV' => array(array('a', 4), array('c', 13)),
'MC' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)),
'MD' => array(array('c', 2), array('c', 18)),
'ME' => array(array('n', 3), array('n', 13), array('n', 2)),
'MK' => array(array('n', 3), array('c', 10), array('n', 2)),
'MR' => array(array('n', 5), array('n', 5), array('n', 11), array('n', 2)),
'MT' => array(array('a', 4), array('n', 5), array('c', 18)),
'MU' => array(array('a', 4), array('n', 2), array('n', 2), array('n', 12), array('n', 3), array('a', 3)),
'NL' => array(array('a', 4), array('n', 10)),
'NO' => array(array('n', 4), array('n', 6), array('n', 1)),
'PK' => array(array('a', 4), array('c', 16)),
'PL' => array(array('n', 8), array('n', 16)),
'PS' => array(array('a', 4), array('c', 21)),
'PT' => array(array('n', 4), array('n', 4), array('n', 11), array('n', 2)),
'RO' => array(array('a', 4), array('c', 16)),
'RS' => array(array('n', 3), array('n', 13), array('n', 2)),
'SA' => array(array('n', 2), array('c', 18)),
'SE' => array(array('n', 3), array('n', 16), array('n', 1)),
'SI' => array(array('n', 5), array('n', 8), array('n', 2)),
'SK' => array(array('n', 4), array('n', 6), array('n', 10)),
'SM' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)),
'TN' => array(array('n', 2), array('n', 3), array('n', 13), array('n', 2)),
'TR' => array(array('n', 5), array('n', 1), array('c', 16)),
'VG' => array(array('a', 4), array('n', 16)),
);
/**
* @return string Returns a credit card vendor name
*
* @example 'MasterCard'
*/
public static function creditCardType()
{
return static::randomElement(static::$cardVendors);
}
/**
* Returns the String of a credit card number.
*
* @param string $type Supporting any of 'Visa', 'MasterCard', 'American Express', and 'Discover'
* @param boolean $formatted Set to true if the output string should contain one separator every 4 digits
* @param string $separator Separator string for formatting card number. Defaults to dash (-).
* @return string
*
* @example '4485480221084675'
*/
public static function creditCardNumber($type = null, $formatted = false, $separator = '-')
{
if (is_null($type)) {
$type = static::creditCardType();
}
$mask = static::randomElement(static::$cardParams[$type]);
$number = static::numerify($mask);
$number .= Luhn::computeCheckDigit($number);
if ($formatted) {
$p1 = substr($number, 0, 4);
$p2 = substr($number, 4, 4);
$p3 = substr($number, 8, 4);
$p4 = substr($number, 12);
$number = $p1 . $separator . $p2 . $separator . $p3 . $separator . $p4;
}
return $number;
}
/**
* @param boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date
* @return \DateTime
* @example 04/13
*/
public function creditCardExpirationDate($valid = true)
{
if ($valid) {
return $this->generator->dateTimeBetween('now', '36 months');
}
return $this->generator->dateTimeBetween('-36 months', '36 months');
}
/**
* @param boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date
* @param string $expirationDateFormat
* @return string
* @example '04/13'
*/
public function creditCardExpirationDateString($valid = true, $expirationDateFormat = null)
{
return $this->creditCardExpirationDate($valid)->format(is_null($expirationDateFormat) ? static::$expirationDateFormat : $expirationDateFormat);
}
/**
* @param boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date
* @return array
*/
public function creditCardDetails($valid = true)
{
$type = static::creditCardType();
return array(
'type' => $type,
'number' => static::creditCardNumber($type),
'name' => $this->generator->name(),
'expirationDate' => $this->creditCardExpirationDateString($valid)
);
}
/**
* International Bank Account Number (IBAN)
*
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param string $prefix for generating bank account number of a specific bank
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function iban($countryCode = null, $prefix = '', $length = null)
{
$countryCode = is_null($countryCode) ? self::randomKey(self::$ibanFormats) : strtoupper($countryCode);
$format = !isset(static::$ibanFormats[$countryCode]) ? null : static::$ibanFormats[$countryCode];
if ($length === null) {
if ($format === null) {
$length = 24;
} else {
$length = 0;
foreach ($format as $part) {
list($class, $groupCount) = $part;
$length += $groupCount;
}
}
}
if ($format === null) {
$format = array(array('n', $length));
}
$expandedFormat = '';
foreach ($format as $item) {
list($class, $length) = $item;
$expandedFormat .= str_repeat($class, $length);
}
$result = $prefix;
$expandedFormat = substr($expandedFormat, strlen($result));
foreach (str_split($expandedFormat) as $class) {
switch ($class) {
default:
case 'c':
$result .= mt_rand(0, 100) <= 50 ? static::randomDigit() : strtoupper(static::randomLetter());
break;
case 'a':
$result .= strtoupper(static::randomLetter());
break;
case 'n':
$result .= static::randomDigit();
break;
}
}
$checksum = Iban::checksum($countryCode . '00' . $result);
return $countryCode . $checksum . $result;
}
/**
* Return the String of a SWIFT/BIC number
*
* @example 'RZTIAT22263'
* @link http://en.wikipedia.org/wiki/ISO_9362
* @return string Swift/Bic number
*/
public static function swiftBicNumber()
{
return self::regexify("^([A-Z]){4}([A-Z]){2}([0-9A-Z]){2}([0-9A-Z]{3})?$");
}
}

View File

@@ -0,0 +1,130 @@
<?php
namespace Siteworx\Faker\Provider;
class Person extends Base
{
public const GENDER_MALE = 'male';
public const GENDER_FEMALE = 'female';
protected static array $titleFormat = [
'{{titleMale}}',
'{{titleFemale}}',
];
protected static array $firstNameFormat = [
'{{firstNameMale}}',
'{{firstNameFemale}}',
];
protected static array $maleNameFormats = [
'{{firstNameMale}} {{lastName}}',
];
protected static array $femaleNameFormats = [
'{{firstNameFemale}} {{lastName}}',
];
protected static array $firstNameMale = [
'John',
];
protected static array $firstNameFemale = [
'Jane',
];
protected static array $lastName = ['Doe'];
protected static array $titleMale = ['Mr.', 'Dr.', 'Prof.'];
protected static array $titleFemale = ['Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.'];
/**
* @param string|null $gender 'male', 'female' or null for any
* @return string
* @example 'John Doe'
*/
public function name(string $gender = null): string
{
if ($gender === static::GENDER_MALE) {
$format = static::randomElement(static::$maleNameFormats);
} elseif ($gender === static::GENDER_FEMALE) {
$format = static::randomElement(static::$femaleNameFormats);
} else {
$format = static::randomElement(array_merge(static::$maleNameFormats, static::$femaleNameFormats));
}
return $this->generator->parse($format);
}
/**
* @param string|null $gender 'male', 'female' or null for any
* @return string
* @example 'John'
*/
public function firstName(string $gender = null): string
{
if ($gender === static::GENDER_MALE) {
return static::firstNameMale();
}
if ($gender === static::GENDER_FEMALE) {
return static::firstNameFemale();
}
return $this->generator->parse(static::randomElement(static::$firstNameFormat));
}
public static function firstNameMale()
{
return static::randomElement(static::$firstNameMale);
}
public static function firstNameFemale()
{
return static::randomElement(static::$firstNameFemale);
}
/**
* @example 'Doe'
* @return string
*/
public function lastName(): string
{
return static::randomElement(static::$lastName);
}
/**
* @param string|null $gender 'male', 'female' or null for any
* @return string
*@example 'Mrs.'
*/
public function title(string $gender = null): string
{
if ($gender === static::GENDER_MALE) {
return static::titleMale();
}
if ($gender === static::GENDER_FEMALE) {
return static::titleFemale();
}
return $this->generator->parse(static::randomElement(static::$titleFormat));
}
/**
* @example 'Mr.'
*/
public static function titleMale()
{
return static::randomElement(static::$titleMale);
}
/**
* @example 'Mrs.'
*/
public static function titleFemale()
{
return static::randomElement(static::$titleFemale);
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Siteworx\Faker\Provider;
use Siteworx\Faker\Calculator\Luhn;
class PhoneNumber extends Base
{
protected static $formats = array('###-###-###');
/**
* @example '555-123-546'
*/
public function phoneNumber()
{
return static::numerify($this->generator->parse(static::randomElement(static::$formats)));
}
/**
* @example +27113456789
* @return string
*/
public function e164PhoneNumber()
{
$formats = array('+%############');
return static::numerify($this->generator->parse(static::randomElement($formats)));
}
/**
* International Mobile Equipment Identity (IMEI)
*
* @link http://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity
* @link http://imei-number.com/imei-validation-check/
* @example '720084494799532'
* @return int $imei
*/
public function imei()
{
$imei = (string) static::numerify('##############');
$imei .= Luhn::computeCheckDigit($imei);
return $imei;
}
}

147
src/Faker/Provider/Text.php Normal file
View File

@@ -0,0 +1,147 @@
<?php
namespace Siteworx\Faker\Provider;
abstract class Text extends Base
{
protected static $baseText = '';
protected static $separator = ' ';
protected static $separatorLen = 1;
protected $explodedText;
protected $consecutiveWords = array();
protected static $textStartsWithUppercase = true;
/**
* Generate a text string by the Markov chain algorithm.
*
* Depending on the $maxNbChars, returns a random valid looking text. The algorithm
* generates a weighted table with the specified number of words as the index and the
* possible following words as the value.
*
* @example 'Alice, swallowing down her flamingo, and began by taking the little golden key'
* @param integer $maxNbChars Maximum number of characters the text should contain (minimum: 10)
* @param integer $indexSize Determines how many words are considered for the generation of the next word.
* The minimum is 1, and it produces a higher level of randomness, although the
* generated text usually doesn't make sense. Higher index sizes (up to 5)
* produce more correct text, at the price of less randomness.
* @return string
*/
public function realText($maxNbChars = 200, $indexSize = 2)
{
if ($maxNbChars < 10) {
throw new \InvalidArgumentException('maxNbChars must be at least 10');
}
if ($indexSize < 1) {
throw new \InvalidArgumentException('indexSize must be at least 1');
}
if ($indexSize > 5) {
throw new \InvalidArgumentException('indexSize must be at most 5');
}
$words = $this->getConsecutiveWords($indexSize);
$result = array();
$resultLength = 0;
// take a random starting point
$next = static::randomKey($words);
while ($resultLength < $maxNbChars && isset($words[$next])) {
// fetch a random word to append
$word = static::randomElement($words[$next]);
// calculate next index
$currentWords = static::explode($next);
$currentWords[] = $word;
array_shift($currentWords);
$next = static::implode($currentWords);
// ensure text starts with an uppercase letter
if ($resultLength == 0 && !static::validStart($word)) {
continue;
}
// append the element
$result[] = $word;
$resultLength += static::strlen($word) + static::$separatorLen;
}
// remove the element that caused the text to overflow
array_pop($result);
// build result
$result = static::implode($result);
return static::appendEnd($result);
}
protected function getConsecutiveWords($indexSize)
{
if (!isset($this->consecutiveWords[$indexSize])) {
$parts = $this->getExplodedText();
$words = array();
$index = array();
for ($i = 0; $i < $indexSize; $i++) {
$index[] = array_shift($parts);
}
for ($i = 0, $count = count($parts); $i < $count; $i++) {
$stringIndex = static::implode($index);
if (!isset($words[$stringIndex])) {
$words[$stringIndex] = array();
}
$word = $parts[$i];
$words[$stringIndex][] = $word;
array_shift($index);
$index[] = $word;
}
// cache look up words for performance
$this->consecutiveWords[$indexSize] = $words;
}
return $this->consecutiveWords[$indexSize];
}
protected function getExplodedText()
{
if ($this->explodedText === null) {
$this->explodedText = static::explode(preg_replace('/\s+/u', ' ', static::$baseText));
}
return $this->explodedText;
}
protected static function explode($text)
{
return explode(static::$separator, $text);
}
protected static function implode($words)
{
return implode(static::$separator, $words);
}
protected static function strlen($text)
{
return function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen($text);
}
protected static function validStart($word)
{
$isValid = true;
if (static::$textStartsWithUppercase) {
$isValid = preg_match('/^\p{Lu}/u', $word);
}
return $isValid;
}
protected static function appendEnd($text)
{
return preg_replace("/([ ,-:;\x{2013}\x{2014}]+$)/us", '', $text) . '.';
}
}

View File

@@ -0,0 +1,166 @@
<?php
namespace Siteworx\Faker\Provider;
class UserAgent extends Base
{
protected static $userAgents = array('firefox', 'chrome', 'internetExplorer', 'opera', 'safari');
protected static $windowsPlatformTokens = array(
'Windows NT 6.2', 'Windows NT 6.1', 'Windows NT 6.0', 'Windows NT 5.2', 'Windows NT 5.1',
'Windows NT 5.01', 'Windows NT 5.0', 'Windows NT 4.0', 'Windows 98; Win 9x 4.90', 'Windows 98',
'Windows 95', 'Windows CE'
);
/**
* Possible processors on Linux
*/
protected static $linuxProcessor = array('i686', 'x86_64');
/**
* Mac processors (it also added U;)
*/
protected static $macProcessor = array('Intel', 'PPC', 'U; Intel', 'U; PPC');
/**
* Add as many languages as you like.
*/
protected static $lang = array('en-US', 'sl-SI');
/**
* Generate mac processor
*
* @return string
*/
public static function macProcessor()
{
return static::randomElement(static::$macProcessor);
}
/**
* Generate linux processor
*
* @return string
*/
public static function linuxProcessor()
{
return static::randomElement(static::$linuxProcessor);
}
/**
* Generate a random user agent
*
* @example 'Mozilla/5.0 (Windows CE) AppleWebKit/5350 (KHTML, like Gecko) Chrome/13.0.888.0 Safari/5350'
*/
public static function userAgent()
{
$userAgentName = static::randomElement(static::$userAgents);
return static::$userAgentName();
}
/**
* Generate Chrome user agent
*
* @example 'Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_5) AppleWebKit/5312 (KHTML, like Gecko) Chrome/14.0.894.0 Safari/5312'
*/
public static function chrome()
{
$saf = mt_rand(531, 536) . mt_rand(0, 2);
$platforms = array(
'(' . static::linuxPlatformToken() . ") AppleWebKit/$saf (KHTML, like Gecko) Chrome/" . mt_rand(36, 40) . '.0.' . mt_rand(800, 899) . ".0 Mobile Safari/$saf",
'(' . static::windowsPlatformToken() . ") AppleWebKit/$saf (KHTML, like Gecko) Chrome/" . mt_rand(36, 40) . '.0.' . mt_rand(800, 899) . ".0 Mobile Safari/$saf",
'(' . static::macPlatformToken() . ") AppleWebKit/$saf (KHTML, like Gecko) Chrome/" . mt_rand(36, 40) . '.0.' . mt_rand(800, 899) . ".0 Mobile Safari/$saf"
);
return 'Mozilla/5.0 ' . static::randomElement($platforms);
}
/**
* Generate Firefox user agent
*
* @example 'Mozilla/5.0 (X11; Linuxi686; rv:7.0) Gecko/20101231 Firefox/3.6'
*/
public static function firefox()
{
$ver = 'Gecko/' . date('Ymd', mt_rand(strtotime('2010-1-1'), time())) . ' Firefox/' . mt_rand(35, 37) . '.0';
$platforms = array(
'(' . static::windowsPlatformToken() . '; ' . static::randomElement(static::$lang) . '; rv:1.9.' . mt_rand(0, 2) . '.20) ' . $ver,
'(' . static::linuxPlatformToken() . '; rv:' . mt_rand(5, 7) . '.0) ' . $ver,
'(' . static::macPlatformToken() . ' rv:' . mt_rand(2, 6) . '.0) ' . $ver
);
return "Mozilla/5.0 " . static::randomElement($platforms);
}
/**
* Generate Safari user agent
*
* @example 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_7_1 rv:3.0; en-US) AppleWebKit/534.11.3 (KHTML, like Gecko) Version/4.0 Safari/534.11.3'
*/
public static function safari()
{
$saf = mt_rand(531, 535) . '.' . mt_rand(1, 50) . '.' . mt_rand(1, 7);
if (mt_rand(0, 1) == 0) {
$ver = mt_rand(4, 5) . '.' . mt_rand(0, 1);
} else {
$ver = mt_rand(4, 5) . '.0.' . mt_rand(1, 5);
}
$mobileDevices = array(
'iPhone; CPU iPhone OS',
'iPad; CPU OS'
);
$platforms = array(
'(Windows; U; ' . static::windowsPlatformToken() . ") AppleWebKit/$saf (KHTML, like Gecko) Version/$ver Safari/$saf",
'(' . static::macPlatformToken() . ' rv:' . mt_rand(2, 6) . '.0; ' . static::randomElement(static::$lang) . ") AppleWebKit/$saf (KHTML, like Gecko) Version/$ver Safari/$saf",
'(' . static::randomElement($mobileDevices) . ' ' . mt_rand(7, 8) . '_' . mt_rand(0, 2) . '_' . mt_rand(1, 2) . ' like Mac OS X; ' . static::randomElement(static::$lang) . ") AppleWebKit/$saf (KHTML, like Gecko) Version/" . mt_rand(3, 4) . ".0.5 Mobile/8B" . mt_rand(111, 119) . " Safari/6$saf",
);
return "Mozilla/5.0 " . static::randomElement($platforms);
}
/**
* Generate Opera user agent
*
* @example 'Opera/8.25 (Windows NT 5.1; en-US) Presto/2.9.188 Version/10.00'
*/
public static function opera()
{
$platforms = array(
'(' . static::linuxPlatformToken() . '; ' . static::randomElement(static::$lang) . ') Presto/2.' . mt_rand(8, 12) . '.' . mt_rand(160, 355) . ' Version/' . mt_rand(10, 12) . '.00',
'(' . static::windowsPlatformToken() . '; ' . static::randomElement(static::$lang) . ') Presto/2.' . mt_rand(8, 12) . '.' . mt_rand(160, 355) . ' Version/' . mt_rand(10, 12) . '.00'
);
return "Opera/" . mt_rand(8, 9) . '.' . mt_rand(10, 99) . ' ' . static::randomElement($platforms);
}
/**
* Generate Internet Explorer user agent
*
* @example 'Mozilla/5.0 (compatible; MSIE 7.0; Windows 98; Win 9x 4.90; Trident/3.0)'
*/
public static function internetExplorer()
{
return 'Mozilla/5.0 (compatible; MSIE ' . mt_rand(5, 11) . '.0; ' . static::windowsPlatformToken() . '; Trident/' . mt_rand(3, 5) . '.' . mt_rand(0, 1) . ')';
}
public static function windowsPlatformToken()
{
return static::randomElement(static::$windowsPlatformTokens);
}
public static function macPlatformToken()
{
return 'Macintosh; ' . static::randomElement(static::$macProcessor) . ' Mac OS X 10_' . mt_rand(5, 8) . '_' . mt_rand(0, 9);
}
public static function linuxPlatformToken()
{
return 'X11; Linux ' . static::randomElement(static::$linuxProcessor);
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace Siteworx\Faker\Provider;
class Uuid extends Base
{
/**
* Generate name based md5 UUID (version 3).
* @example '7e57d004-2b97-0e7a-b45f-5387367791cd'
*/
public static function uuid()
{
// fix for compatibility with 32bit architecture; each mt_rand call is restricted to 32bit
// two such calls will cause 64bits of randomness regardless of architecture
$seed = mt_rand(0, 2147483647) . '#' . mt_rand(0, 2147483647);
// Hash the seed and convert to a byte array
$val = md5($seed, true);
$byte = array_values(unpack('C16', $val));
// extract fields from byte array
$tLo = ($byte[0] << 24) | ($byte[1] << 16) | ($byte[2] << 8) | $byte[3];
$tMi = ($byte[4] << 8) | $byte[5];
$tHi = ($byte[6] << 8) | $byte[7];
$csLo = $byte[9];
$csHi = $byte[8] & 0x3f | (1 << 7);
// correct byte order for big edian architecture
if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) {
$tLo = (($tLo & 0x000000ff) << 24) | (($tLo & 0x0000ff00) << 8)
| (($tLo & 0x00ff0000) >> 8) | (($tLo & 0xff000000) >> 24);
$tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8);
$tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8);
}
// apply version number
$tHi &= 0x0fff;
$tHi |= (3 << 12);
// cast to string
return sprintf(
'%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x',
$tLo,
$tMi,
$tHi,
$csHi,
$csLo,
$byte[10],
$byte[11],
$byte[12],
$byte[13],
$byte[14],
$byte[15]
);
}
}

View File

@@ -0,0 +1,110 @@
<?php
namespace Siteworx\Faker\Provider\en_US;
class Address extends \Siteworx\Faker\Provider\Address
{
protected static $cityPrefix = array('North', 'East', 'West', 'South', 'New', 'Lake', 'Port');
protected static $citySuffix = array('town', 'ton', 'land', 'ville', 'berg', 'burgh', 'borough', 'bury', 'view', 'port', 'mouth', 'stad', 'furt', 'chester', 'mouth', 'fort', 'haven', 'side', 'shire');
protected static $buildingNumber = array('%####', '%###', '%##');
protected static $streetSuffix = array(
'Alley', 'Avenue', 'Branch', 'Bridge', 'Brook', 'Brooks', 'Burg', 'Burgs', 'Bypass', 'Camp', 'Canyon', 'Cape', 'Causeway', 'Center', 'Centers', 'Circle', 'Circles', 'Cliff', 'Cliffs', 'Club', 'Common', 'Corner', 'Corners', 'Course', 'Court', 'Courts', 'Cove', 'Coves', 'Creek', 'Crescent', 'Crest', 'Crossing', 'Crossroad', 'Curve', 'Dale', 'Dam', 'Divide', 'Drive', 'Drive', 'Drives', 'Estate', 'Estates', 'Expressway', 'Extension', 'Extensions', 'Fall', 'Falls', 'Ferry', 'Field', 'Fields', 'Flat', 'Flats', 'Ford', 'Fords', 'Forest', 'Forge', 'Forges', 'Fork', 'Forks', 'Fort', 'Freeway', 'Garden', 'Gardens', 'Gateway', 'Glen', 'Glens', 'Green', 'Greens', 'Grove', 'Groves', 'Harbor', 'Harbors', 'Haven', 'Heights', 'Highway', 'Hill', 'Hills', 'Hollow', 'Inlet', 'Inlet', 'Island', 'Island', 'Islands', 'Islands', 'Isle', 'Isle', 'Junction', 'Junctions', 'Key', 'Keys', 'Knoll', 'Knolls', 'Lake', 'Lakes', 'Land', 'Landing', 'Lane', 'Light', 'Lights', 'Loaf', 'Lock', 'Locks', 'Locks', 'Lodge', 'Lodge', 'Loop', 'Mall', 'Manor', 'Manors', 'Meadow', 'Meadows', 'Mews', 'Mill', 'Mills', 'Mission', 'Mission', 'Motorway', 'Mount', 'Mountain', 'Mountain', 'Mountains', 'Mountains', 'Neck', 'Orchard', 'Oval', 'Overpass', 'Park', 'Parks', 'Parkway', 'Parkways', 'Pass', 'Passage', 'Path', 'Pike', 'Pine', 'Pines', 'Place', 'Plain', 'Plains', 'Plains', 'Plaza', 'Plaza', 'Point', 'Points', 'Port', 'Port', 'Ports', 'Ports', 'Prairie', 'Prairie', 'Radial', 'Ramp', 'Ranch', 'Rapid', 'Rapids', 'Rest', 'Ridge', 'Ridges', 'River', 'Road', 'Road', 'Roads', 'Roads', 'Route', 'Row', 'Rue', 'Run', 'Shoal', 'Shoals', 'Shore', 'Shores', 'Skyway', 'Spring', 'Springs', 'Springs', 'Spur', 'Spurs', 'Square', 'Square', 'Squares', 'Squares', 'Station', 'Station', 'Stravenue', 'Stravenue', 'Stream', 'Stream', 'Street', 'Street', 'Streets', 'Summit', 'Summit', 'Terrace', 'Throughway', 'Trace', 'Track', 'Trafficway', 'Trail', 'Trail', 'Tunnel', 'Tunnel', 'Turnpike', 'Turnpike', 'Underpass', 'Union', 'Unions', 'Valley', 'Valleys', 'Via', 'Viaduct', 'View', 'Views', 'Village', 'Village', 'Villages', 'Ville', 'Vista', 'Vista', 'Walk', 'Walks', 'Wall', 'Way', 'Ways', 'Well', 'Wells'
);
protected static $postcode = array('#####', '#####-####');
protected static $state = array(
'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'
);
protected static $stateAbbr = array(
'AK', 'AL', 'AR', 'AZ', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'GA', 'HI', 'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA', 'MA', 'MD', 'ME', 'MI', 'MN', 'MO', 'MS', 'MT', 'NC', 'ND', 'NE', 'NH', 'NJ', 'NM', 'NV', 'NY', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VA', 'VT', 'WA', 'WI', 'WV', 'WY'
);
protected static $country = array(
'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antarctica (the territory South of 60 deg S)', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Australia', 'Austria', 'Azerbaijan',
'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Bouvet Island (Bouvetoya)', 'Brazil', 'British Indian Ocean Territory (Chagos Archipelago)', 'British Virgin Islands', 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso', 'Burundi',
'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands', 'Central African Republic', 'Chad', 'Chile', 'China', 'Christmas Island', 'Cocos (Keeling) Islands', 'Colombia', 'Comoros', 'Congo', 'Cook Islands', 'Costa Rica', 'Cote d\'Ivoire', 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic',
'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic',
'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia',
'Faroe Islands', 'Falkland Islands (Malvinas)', 'Fiji', 'Finland', 'France', 'French Guiana', 'French Polynesia', 'French Southern Territories',
'Gabon', 'Gambia', 'Georgia', 'Germany', 'Ghana', 'Gibraltar', 'Greece', 'Greenland', 'Grenada', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana',
'Haiti', 'Heard Island and McDonald Islands', 'Holy See (Vatican City State)', 'Honduras', 'Hong Kong', 'Hungary',
'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Isle of Man', 'Israel', 'Italy',
'Jamaica', 'Japan', 'Jersey', 'Jordan',
'Kazakhstan', 'Kenya', 'Kiribati', 'Korea', 'Korea', 'Kuwait', 'Kyrgyz Republic',
'Lao People\'s Democratic Republic', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 'Libyan Arab Jamahiriya', 'Liechtenstein', 'Lithuania', 'Luxembourg',
'Macao', 'Macedonia', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Martinique', 'Mauritania', 'Mauritius', 'Mayotte', 'Mexico', 'Micronesia', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Montserrat', 'Morocco', 'Mozambique', 'Myanmar',
'Namibia', 'Nauru', 'Nepal', 'Netherlands Antilles', 'Netherlands', 'New Caledonia', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norfolk Island', 'Northern Mariana Islands', 'Norway',
'Oman',
'Pakistan', 'Palau', 'Palestinian Territories', 'Panama', 'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines', 'Pitcairn Islands', 'Poland', 'Portugal', 'Puerto Rico',
'Qatar',
'Reunion', 'Romania', 'Russian Federation', 'Rwanda',
'Saint Barthelemy', 'Saint Helena', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Martin', 'Saint Pierre and Miquelon', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia (Slovak Republic)', 'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', 'South Georgia and the South Sandwich Islands', 'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Svalbard & Jan Mayen Islands', 'Swaziland', 'Sweden', 'Switzerland', 'Syrian Arab Republic',
'Taiwan', 'Tajikistan', 'Tanzania', 'Thailand', 'Timor-Leste', 'Togo', 'Tokelau', 'Tonga', 'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Turkmenistan', 'Turks and Caicos Islands', 'Tuvalu',
'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States of America', 'United States Minor Outlying Islands', 'United States Virgin Islands', 'Uruguay', 'Uzbekistan',
'Vanuatu', 'Venezuela', 'Vietnam',
'Wallis and Futuna', 'Western Sahara',
'Yemen',
'Zambia', 'Zimbabwe'
);
protected static $cityFormats = array(
'{{cityPrefix}} {{firstName}}{{citySuffix}}',
'{{cityPrefix}} {{firstName}}',
'{{firstName}}{{citySuffix}}',
'{{lastName}}{{citySuffix}}',
);
protected static $streetNameFormats = array(
'{{firstName}} {{streetSuffix}}',
'{{lastName}} {{streetSuffix}}'
);
protected static $streetAddressFormats = array(
'{{buildingNumber}} {{streetName}}',
'{{buildingNumber}} {{streetName}} {{secondaryAddress}}',
);
protected static $addressFormats = array(
"{{streetAddress}}\n{{city}}, {{stateAbbr}} {{postcode}}",
);
protected static $secondaryAddressFormats = array('Apt. ###', 'Suite ###');
/**
* @example 'East'
*/
public static function cityPrefix()
{
return static::randomElement(static::$cityPrefix);
}
/**
* @example 'Appt. 350'
*/
public static function secondaryAddress()
{
return static::numerify(static::randomElement(static::$secondaryAddressFormats));
}
/**
* @example 'California'
*/
public static function state()
{
return static::randomElement(static::$state);
}
/**
* @example 'CA'
*/
public static function stateAbbr()
{
return static::randomElement(static::$stateAbbr);
}
}

View File

@@ -0,0 +1,117 @@
<?php
namespace Siteworx\Faker\Provider\en_US;
class Company extends \Siteworx\Faker\Provider\Company
{
protected static $formats = array(
'{{lastName}} {{companySuffix}}',
'{{lastName}}-{{lastName}}',
'{{lastName}}, {{lastName}} and {{lastName}}',
);
protected static $catchPhraseWords = array(
array(
'Adaptive', 'Advanced', 'Ameliorated', 'Assimilated', 'Automated', 'Balanced', 'Business-focused', 'Centralized', 'Cloned', 'Compatible', 'Configurable', 'Cross-group', 'Cross-platform', 'Customer-focused', 'Customizable', 'Decentralized', 'De-engineered', 'Devolved', 'Digitized', 'Distributed', 'Diverse', 'Down-sized', 'Enhanced', 'Enterprise-wide', 'Ergonomic', 'Exclusive', 'Expanded', 'Extended', 'Facetoface', 'Focused', 'Front-line', 'Fully-configurable', 'Function-based', 'Fundamental', 'Future-proofed', 'Grass-roots', 'Horizontal', 'Implemented', 'Innovative', 'Integrated', 'Intuitive', 'Inverse', 'Managed', 'Mandatory', 'Monitored', 'Multi-channelled', 'Multi-lateral', 'Multi-layered', 'Multi-tiered', 'Networked', 'Object-based', 'Open-architected', 'Open-source', 'Operative', 'Optimized', 'Optional', 'Organic', 'Organized', 'Persevering', 'Persistent', 'Phased', 'Polarised', 'Pre-emptive', 'Proactive', 'Profit-focused', 'Profound', 'Programmable', 'Progressive', 'Public-key', 'Quality-focused', 'Reactive', 'Realigned', 'Re-contextualized', 'Re-engineered', 'Reduced', 'Reverse-engineered', 'Right-sized', 'Robust', 'Seamless', 'Secured', 'Self-enabling', 'Sharable', 'Stand-alone', 'Streamlined', 'Switchable', 'Synchronised', 'Synergistic', 'Synergized', 'Team-oriented', 'Total', 'Triple-buffered', 'Universal', 'Up-sized', 'Upgradable', 'User-centric', 'User-friendly', 'Versatile', 'Virtual', 'Visionary', 'Vision-oriented',
),
array(
'24hour', '24/7', '3rdgeneration', '4thgeneration', '5thgeneration', '6thgeneration', 'actuating', 'analyzing', 'assymetric', 'asynchronous', 'attitude-oriented', 'background', 'bandwidth-monitored', 'bi-directional', 'bifurcated', 'bottom-line', 'clear-thinking', 'client-driven', 'client-server', 'coherent', 'cohesive', 'composite', 'context-sensitive', 'contextually-based', 'content-based', 'dedicated', 'demand-driven', 'didactic', 'directional', 'discrete', 'disintermediate', 'dynamic', 'eco-centric', 'empowering', 'encompassing', 'even-keeled', 'executive', 'explicit', 'exuding', 'fault-tolerant', 'foreground', 'fresh-thinking', 'full-range', 'global', 'grid-enabled', 'heuristic', 'high-level', 'holistic', 'homogeneous', 'human-resource', 'hybrid', 'impactful', 'incremental', 'intangible', 'interactive', 'intermediate', 'leadingedge', 'local', 'logistical', 'maximized', 'methodical', 'mission-critical', 'mobile', 'modular', 'motivating', 'multimedia', 'multi-state', 'multi-tasking', 'national', 'needs-based', 'neutral', 'nextgeneration', 'non-volatile', 'object-oriented', 'optimal', 'optimizing', 'radical', 'real-time', 'reciprocal', 'regional', 'responsive', 'scalable', 'secondary', 'solution-oriented', 'stable', 'static', 'systematic', 'systemic', 'system-worthy', 'tangible', 'tertiary', 'transitional', 'uniform', 'upward-trending', 'user-facing', 'value-added', 'web-enabled', 'well-modulated', 'zeroadministration', 'zerodefect', 'zerotolerance',
),
array(
'ability', 'access', 'adapter', 'algorithm', 'alliance', 'analyzer', 'application', 'approach', 'architecture', 'archive', 'artificialintelligence', 'array', 'attitude', 'benchmark', 'blockchain', 'budgetarymanagement', 'capability', 'capacity', 'challenge', 'circuit', 'collaboration', 'complexity', 'concept', 'conglomeration', 'contingency', 'core', 'customerloyalty', 'database', 'data-warehouse', 'definition', 'emulation', 'encoding', 'encryption', 'extranet', 'firmware', 'flexibility', 'focusgroup', 'forecast', 'frame', 'framework', 'function', 'functionalities', 'GraphicInterface', 'groupware', 'GraphicalUserInterface', 'hardware', 'help-desk', 'hierarchy', 'hub', 'implementation', 'info-mediaries', 'infrastructure', 'initiative', 'installation', 'instructionset', 'interface', 'internetsolution', 'intranet', 'knowledgeuser', 'knowledgebase', 'localareanetwork', 'leverage', 'matrices', 'matrix', 'methodology', 'middleware', 'migration', 'model', 'moderator', 'monitoring', 'moratorium', 'neural-net', 'openarchitecture', 'opensystem', 'orchestration', 'paradigm', 'parallelism', 'policy', 'portal', 'pricingstructure', 'processimprovement', 'product', 'productivity', 'project', 'projection', 'protocol', 'securedline', 'service-desk', 'software', 'solution', 'standardization', 'strategy', 'structure', 'success', 'superstructure', 'support', 'synergy', 'systemengine', 'task-force', 'throughput', 'time-frame', 'toolset', 'utilisation', 'website', 'workforce',
),
);
protected static $bsWords = array(
array(
'implement', 'utilize', 'integrate', 'streamline', 'optimize', 'evolve', 'transform', 'embrace', 'enable', 'orchestrate', 'leverage', 'reinvent', 'aggregate', 'architect', 'enhance', 'incentivize', 'morph', 'empower', 'envisioneer', 'monetize', 'harness', 'facilitate', 'seize', 'disintermediate', 'synergize', 'strategize', 'deploy', 'brand', 'grow', 'target', 'syndicate', 'synthesize', 'deliver', 'mesh', 'incubate', 'engage', 'maximize', 'benchmark', 'expedite', 'reintermediate', 'whiteboard', 'visualize', 'repurpose', 'innovate', 'scale', 'unleash', 'drive', 'extend', 'engineer', 'revolutionize', 'generate', 'exploit', 'transition', 'e-enable', 'iterate', 'cultivate', 'matrix', 'productize', 'redefine', 'recontextualize',
),
array(
'clicks-and-mortar', 'value-added', 'vertical', 'proactive', 'robust', 'revolutionary', 'scalable', 'leading-edge', 'innovative', 'intuitive', 'strategic', 'e-business', 'mission-critical', 'sticky', 'one-to-one', '24/7', 'end-to-end', 'global', 'B2B', 'B2C', 'granular', 'frictionless', 'virtual', 'viral', 'dynamic', '24/365', 'best-of-breed', 'killer', 'magnetic', 'bleeding-edge', 'web-enabled', 'interactive', 'dot-com', 'sexy', 'back-end', 'real-time', 'efficient', 'front-end', 'distributed', 'seamless', 'extensible', 'turn-key', 'world-class', 'open-source', 'cross-platform', 'cross-media', 'synergistic', 'bricks-and-clicks', 'out-of-the-box', 'enterprise', 'integrated', 'impactful', 'wireless', 'transparent', 'next-generation', 'cutting-edge', 'user-centric', 'visionary', 'customized', 'ubiquitous', 'plug-and-play', 'collaborative', 'compelling', 'holistic', 'rich',
),
array(
'synergies', 'web-readiness', 'paradigms', 'markets', 'partnerships', 'infrastructures', 'platforms', 'initiatives', 'channels', 'eyeballs', 'communities', 'ROI', 'solutions', 'e-tailers', 'e-services', 'action-items', 'portals', 'niches', 'technologies', 'content', 'vortals', 'supply-chains', 'convergence', 'relationships', 'architectures', 'interfaces', 'e-markets', 'e-commerce', 'systems', 'bandwidth', 'infomediaries', 'models', 'mindshare', 'deliverables', 'users', 'schemas', 'networks', 'applications', 'metrics', 'e-business', 'functionalities', 'experiences', 'webservices', 'methodologies',
),
);
/**
* Source - http://www.careerplanner.com/ListOfJobs.cfm
*/
protected static $jobTitleFormat = array(
'Able Seamen', 'Account Manager', 'Accountant', 'Actor', 'Actuary', 'Adjustment Clerk', 'Admin', 'Administrative Law Judge', 'Administrative Services Manager', 'Administrative Support Supervisors', 'Advertising Manager OR Promotions Manager', 'Advertising Sales Agent', 'Aerospace Engineer', 'Agricultural Crop Farm Manager', 'Agricultural Crop Worker', 'Agricultural Engineer', 'Agricultural Equipment Operator', 'Agricultural Inspector', 'Agricultural Manager', 'Agricultural Product Grader Sorter', 'Agricultural Sales Representative', 'Agricultural Science Technician', 'Agricultural Sciences Teacher', 'Agricultural Technician', 'Agricultural Worker', 'Air Crew Member', 'Air Crew Officer', 'Air Traffic Controller', 'Aircraft Assembler', 'Aircraft Body Repairer', 'Aircraft Cargo Handling Supervisor', 'Aircraft Engine Specialist', 'Aircraft Launch and Recovery Officer', 'Aircraft Launch Specialist', 'Aircraft Mechanics OR Aircraft Service Technician', 'Aircraft Rigging Assembler', 'Aircraft Structure Assemblers', 'Airfield Operations Specialist', 'Airframe Mechanic', 'Airline Pilot OR Copilot OR Flight Engineer', 'Algorithm Developer', 'Alteration Tailor', 'Ambulance Driver', 'Amusement Attendant', 'Anesthesiologist', 'Animal Breeder', 'Animal Care Workers', 'Animal Control Worker', 'Animal Husbandry Worker', 'Animal Scientist', 'Animal Trainer', 'Annealing Machine Operator', 'Announcer', 'Answering Service', 'Anthropologist', 'Anthropologist OR Archeologist', 'Anthropology Teacher', 'Appliance Repairer', 'Arbitrator', 'Archeologist', 'Architect', 'Architectural Drafter', 'Architectural Drafter OR Civil Drafter', 'Architecture Teacher', 'Archivist', 'Armored Assault Vehicle Crew Member', 'Armored Assault Vehicle Officer', 'Art Director', 'Art Teacher', 'Artillery Officer', 'Artillery Crew Member', 'Artist', 'Assembler', 'Assessor', 'Astronomer', 'Athletes and Sports Competitor', 'Athletic Trainer', 'Atmospheric and Space Scientist', 'Audio and Video Equipment Technician', 'Audiologist', 'Audio-Visual Collections Specialist', 'Auditor', 'Auditor', 'Automatic Teller Machine Servicer', 'Automotive Body Repairer', 'Automotive Glass Installers', 'Automotive Master Mechanic', 'Automotive Mechanic', 'Automotive Specialty Technician', 'Automotive Technician', 'Auxiliary Equipment Operator', 'Aviation Inspector', 'Avionics Technician',
'Bailiff', 'Baker', 'Barber', 'Bartender', 'Bartender Helper', 'Battery Repairer', 'Bellhop', 'Bench Jeweler', 'Benefits Specialist', 'Bicycle Repairer', 'Bill and Account Collector', 'Bindery Machine Operator', 'Bindery Worker', 'Biochemist', 'Biochemist or Biophysicist', 'Biological Science Teacher', 'Biological Scientist', 'Biological Technician', 'Biologist', 'Biomedical Engineer', 'Biophysicist', 'Board Of Directors', 'Boat Builder and Shipwright', 'Boiler Operator', 'Boilermaker', 'Bookbinder', 'Bookkeeper', 'Brake Machine Setter', 'Brattice Builder', 'Brazer', 'Brazing Machine Operator', 'Brickmason', 'Bridge Tender OR Lock Tender', 'Broadcast News Analyst', 'Broadcast Technician', 'Brokerage Clerk', 'Budget Analyst', 'Buffing and Polishing Operator', 'Building Cleaning Worker', 'Building Inspector', 'Bulldozer Operator', 'Bus Driver', 'Business Development Manager', 'Business Manager', 'Business Operations Specialist', 'Business Teacher', 'Butcher', 'Buyer',
'Cabinetmaker', 'Cafeteria Cook', 'Calibration Technician OR Instrumentation Technician', 'Camera Operator', 'Camera Repairer', 'Captain', 'Caption Writer', 'Cardiovascular Technologist', 'Career Counselor', 'Carpenter', 'Carpenter Assembler and Repairer', 'Carpet Installer', 'Cartographer', 'Cartoonist', 'Carver', 'Cashier', 'Casting Machine Operator', 'Casting Machine Set-Up Operator', 'ccc', 'Ceiling Tile Installer', 'Cement Mason and Concrete Finisher', 'Central Office', 'Central Office and PBX Installers', 'Central Office Operator', 'CEO', 'CFO', 'Chef', 'Chemical Engineer', 'Chemical Equipment Controller', 'Chemical Equipment Operator', 'Chemical Equipment Tender', 'Chemical Plant Operator', 'Chemical Technician', 'Chemist', 'Chemistry Teacher', 'Child Care', 'Child Care Worker', 'Chiropractor', 'Choreographer', 'City', 'City Planning Aide', 'Civil Drafter', 'Civil Engineer', 'Civil Engineering Technician', 'Claims Adjuster', 'Claims Examiner', 'Claims Taker', 'Cleaners of Vehicles', 'Clergy', 'Clerk', 'Clinical Laboratory Technician', 'Clinical Psychologist', 'Clinical School Psychologist', 'Coaches and Scout', 'Coating Machine Operator', 'Coil Winders', 'Command Control Center Officer', 'Command Control Center Specialist', 'Commercial and Industrial Designer', 'Commercial Diver', 'Commercial Pilot', 'Communication Equipment Repairer', 'Communication Equipment Worker', 'Communications Equipment Operator', 'Communications Teacher', 'Community Service Manager', 'Compacting Machine Operator', 'Compensation and Benefits Manager', 'Compliance Officers', 'Composer', 'Computer', 'Computer Hardware Engineer', 'Computer Operator', 'Computer Programmer', 'Computer Repairer', 'Computer Science Teacher', 'Computer Scientist', 'Computer Security Specialist', 'Computer Software Engineer', 'Computer Specialist', 'Computer Support Specialist', 'Computer Systems Analyst', 'Computer-Controlled Machine Tool Operator', 'Concierge', 'Conservation Scientist', 'Construction', 'Construction Carpenter', 'Construction Driller', 'Construction Equipment Operator', 'Construction Laborer', 'Construction Manager', 'Continuous Mining Machine Operator', 'Control Valve Installer', 'Conveyor Operator', 'Cook', 'Cooling and Freezing Equipment Operator', 'Copy Machine Operator', 'Copy Writer', 'Coremaking Machine Operator', 'Coroner', 'Corporate Trainer', 'Correctional Officer', 'Correspondence Clerk', 'Cost Estimator', 'Costume Attendant', 'Counseling Psychologist', 'Counselor', 'Council', 'Courier', 'Court Clerk', 'Court Reporter', 'Craft Artist', 'Crane and Tower Operator', 'Creative Writer', 'Credit Checkers Clerk', 'Credit Analyst', 'Credit Authorizer', 'Credit Checker', 'Criminal Investigator', 'Crossing Guard', 'Crushing Grinding Machine Operator', 'CSI', 'CTO', 'Cultural Studies Teacher', 'Curator', 'Custom Tailor', 'Customer Service Representative', 'Cutting Machine Operator', 'Cutting Machine Operator',
'Dancer', 'Data Entry Operator', 'Data Processing Equipment Repairer', 'Database Administrator', 'Database Manager', 'Deburring Machine Operator', 'Decorator', 'Dental Assistant', 'Dental Hygienist', 'Dental Laboratory Technician', 'Dentist', 'Designer', 'Desktop Publisher', 'Detective', 'Diagnostic Medical Sonographer', 'Diamond Worker', 'Diesel Engine Specialist', 'Dietetic Technician', 'Director Of Business Development', 'Director Of Marketing', 'Director Of Social Media Marketing', 'Director Of Talent Acquisition', 'Director Religious Activities', 'Directory Assistance Operator', 'Dishwasher', 'Dispatcher', 'Distribution Manager', 'Door To Door Sales', 'Dot Etcher', 'Drafter', 'Dragline Operator', 'Dredge Operator', 'Drilling and Boring Machine Tool Setter', 'Driver-Sales Worker', 'Drycleaning Machine Operator', 'Drywall Ceiling Tile Installer', 'Drywall Installer',
'Earth Driller', 'Economics Teacher', 'Economist', 'Editor', 'Education Administrator', 'Education Teacher', 'Educational Counselor OR Vocationall Counselor', 'Educational Psychologist', 'Electric Meter Installer', 'Electric Motor Repairer', 'Electrical and Electronic Inspector and Tester', 'Electrical and Electronics Drafter', 'Electrical Drafter', 'Electrical Engineer', 'Electrical Engineering Technician', 'Electrical Parts Reconditioner', 'Electrical Power-Line Installer', 'Electrical Sales Representative', 'Electrician', 'Electrician', 'Electrolytic Plating Machine Operator', 'Electromechanical Equipment Assembler', 'Electro-Mechanical Technician', 'Electronic Drafter', 'Electronic Engineering Technician', 'Electronic Equipment Assembler', 'Electronic Masking System Operator', 'Electronics Engineer', 'Electronics Engineering Technician', 'Electrotyper', 'Elementary and Secondary School Administrators', 'Elementary School Teacher', 'Elevator Installer and Repairer', 'Eligibility Interviewer', 'Embalmer', 'Embossing Machine Operator', 'Emergency Management Specialist', 'Emergency Medical Technician and Paramedic', 'Employment Interviewer', 'Engine Assembler', 'Engineer', 'Engineering', 'Engineering Manager', 'Engineering Teacher', 'Engineering Technician', 'English Language Teacher', 'Engraver', 'Entertainer and Performer', 'Entertainment Attendant', 'Environmental Compliance Inspector', 'Environmental Engineer', 'Environmental Engineering Technician', 'Environmental Science Teacher', 'Environmental Science Technician', 'Environmental Scientist', 'Epidemiologist', 'Equal Opportunity Representative', 'Etcher', 'Etcher and Engraver', 'Event Planner', 'Excavating Machine Operator', 'Executive Secretary', 'Exhibit Designer', 'Explosives Expert', 'Extraction Worker', 'Extruding and Drawing Machine Operator', 'Extruding Machine Operator',
'Fabric Mender', 'Fabric Pressers', 'Farm and Home Management Advisor', 'Farm Equipment Mechanic', 'Farm Labor Contractor', 'Farmer', 'Farmworker', 'Fashion Designer', 'Fashion Model', 'Fast Food Cook', 'Fence Erector', 'Fiber Product Cutting Machine Operator', 'Fiberglass Laminator and Fabricator', 'File Clerk', 'Film Laboratory Technician', 'Financial Analyst', 'Financial Examiner', 'Financial Manager', 'Financial Services Sales Agent', 'Financial Specialist', 'Fire Fighter', 'Fire Inspector', 'Fire Investigator', 'Fire-Prevention Engineer', 'First-Line Supervisor-Manager of Landscaping, Lawn Service, and Groundskeeping Worker', 'Fish Game Warden', 'Fish Hatchery Manager', 'Fishery Worker', 'Fishing OR Forestry Supervisor', 'Fitness Trainer', 'Fitter', 'Flight Attendant', 'Floor Finisher', 'Floor Layer', 'Floral Designer', 'Food Batchmaker', 'Food Cooking Machine Operators', 'Food Preparation', 'Food Preparation and Serving Worker', 'Food Preparation Worker', 'Food Science Technician', 'Food Scientists and Technologist', 'Food Servers', 'Food Service Manager', 'Food Tobacco Roasting', 'Foreign Language Teacher', 'Forensic Investigator', 'Forensic Science Technician', 'Forest and Conservation Technician', 'Forest and Conservation Worker', 'Forest Fire Fighter', 'Forest Fire Fighting Supervisor', 'Forest Fire Inspector', 'Forester', 'Forestry Conservation Science Teacher', 'Forging Machine Setter', 'Forming Machine Operator', 'Forming Machine Operator', 'Foundry Mold and Coremaker', 'Fraud Investigator', 'Freight Agent', 'Freight and Material Mover', 'Freight Inspector', 'Funeral Attendant', 'Funeral Director', 'Furnace Operator', 'Furniture Finisher',
'Gaming Cage Worker', 'Gaming Dealer', 'Gaming Manager', 'Gaming Service Worker', 'Gaming Supervisor', 'Gaming Surveillance Officer', 'Garment', 'Gas Appliance Repairer', 'Gas Compressor Operator', 'Gas Distribution Plant Operator', 'Gas Plant Operator', 'Gas Processing Plant Operator', 'Gas Pumping Station Operator', 'Gas Pumping Station Operator', 'Gauger', 'GED Teacher', 'General Farmworker', 'General Manager', 'General Practitioner', 'Geographer', 'Geography Teacher', 'Geological Data Technician', 'Geological Sample Test Technician', 'Geologist', 'Geoscientists', 'Glass Blower', 'Glass Cutting Machine Operator', 'Glazier', 'Gluing Machine Operator', 'Government', 'Government Property Inspector', 'Government Service Executive', 'Graduate Teaching Assistant', 'Graphic Designer', 'Grinder OR Polisher', 'Grinding Machine Operator', 'Grips', 'Grounds Maintenance Worker',
'Hairdresser OR Cosmetologist', 'Hand Trimmer', 'Hand Presser', 'Hand Sewer', 'Hazardous Materials Removal Worker', 'Head Nurse', 'Health Educator', 'Health Practitioner', 'Health Services Manager', 'Health Specialties Teacher', 'Health Technologist', 'Healthcare', 'Healthcare Practitioner', 'Healthcare Support Worker', 'Heat Treating Equipment Operator', 'Heaters', 'Heating and Air Conditioning Mechanic', 'Heating Equipment Operator', 'Heavy Equipment Mechanic', 'Highway Maintenance Worker', 'Highway Patrol Pilot', 'Historian', 'History Teacher', 'Hoist and Winch Operator', 'Home', 'Home Appliance Installer', 'Home Appliance Repairer', 'Home Economics Teacher', 'Home Entertainment Equipment Installer', 'Home Health Aide', 'Homeland Security', 'Horticultural Worker', 'Host and Hostess', 'Hotel Desk Clerk', 'House Cleaner', 'Housekeeper', 'Housekeeping Supervisor', 'HR Manager', 'HR Specialist', 'Human Resource Director', 'Human Resource Manager', 'Human Resources Assistant', 'Human Resources Manager', 'Human Resources Specialist', 'Hunter and Trapper', 'HVAC Mechanic', 'Hydrologist',
'Illustrator', 'Immigration Inspector OR Customs Inspector', 'Industrial Engineer', 'Industrial Engineering Technician', 'Industrial Equipment Maintenance', 'Industrial Machinery Mechanic', 'Industrial Production Manager', 'Industrial Safety Engineer', 'Industrial-Organizational Psychologist', 'Infantry', 'Infantry Officer', 'Information Systems Manager', 'Inspector', 'Installation and Repair Technician', 'Instructional Coordinator', 'Instrument Sales Representative', 'Insulation Installer', 'Insulation Worker', 'Insurance Investigator', 'Insurance Appraiser', 'Insurance Claims Clerk', 'Insurance Policy Processing Clerk', 'Insurance Sales Agent', 'Insurance Underwriter', 'Interaction Designer', 'Interior Designer', 'Internist', 'Interpreter OR Translator', 'Interviewer', 'Irradiated-Fuel Handler',
'Janitor', 'Janitorial Supervisor', 'Jeweler', 'Jewelry Model OR Mold Makers', 'Job Printer', 'Judge',
'Keyboard Instrument Repairer and Tuner', 'Kindergarten Teacher',
'Landscape Architect', 'Landscape Artist', 'Landscaper', 'Landscaping', 'Lathe Operator', 'Laundry OR Dry-Cleaning Worker', 'Law Clerk', 'Law Enforcement Teacher', 'Law Teacher', 'Lawn Service Manager', 'Lawyer', 'Lay-Out Worker', 'Legal Secretary', 'Legal Support Worker', 'Legislator', 'Letterpress Setters Operator', 'Librarian', 'Library Assistant', 'Library Science Teacher', 'Library Technician', 'Library Worker', 'License Clerk', 'Licensed Practical Nurse', 'Licensing Examiner and Inspector', 'Life Science Technician', 'Life Scientists', 'Lifeguard', 'Loading Machine Operator', 'Loan Counselor', 'Loan Interviewer', 'Loan Officer', 'Locker Room Attendant', 'Locksmith', 'Locomotive Engineer', 'Locomotive Firer', 'Lodging Manager', 'Log Grader and Scaler', 'Logging Equipment Operator', 'Logging Supervisor', 'Logging Tractor Operator', 'Logging Worker', 'Logistician',
'Machine Feeder', 'Machine Operator', 'Machine Tool Operator', 'Machinery Maintenance', 'Machinist', 'Maid', 'Mail Clerk', 'Mail Machine Operator', 'Maintenance and Repair Worker', 'Maintenance Equipment Operator', 'Maintenance Supervisor', 'Maintenance Worker', 'Makeup Artists', 'Management Analyst', 'Manager', 'Manager of Air Crew', 'Manager of Food Preparation', 'Manager of Weapons Specialists', 'Manager Tactical Operations', 'Manicurists', 'Manufactured Building Installer', 'Manufacturing Sales Representative', 'Mapping Technician', 'MARCOM Director', 'MARCOM Manager', 'Marine Architect', 'Marine Cargo Inspector', 'Marine Engineer', 'Marine Oiler', 'Market Research Analyst', 'Marketing Manager', 'Marketing VP', 'Marking Clerk', 'Marking Machine Operator', 'Marriage and Family Therapist', 'Massage Therapist', 'Material Movers', 'Material Moving Worker', 'Materials Engineer', 'Materials Inspector', 'Materials Scientist', 'Mathematical Science Teacher', 'Mathematical Scientist', 'Mathematical Technician', 'Mathematician', 'Meat Packer', 'Mechanical Door Repairer', 'Mechanical Drafter', 'Mechanical Engineer', 'Mechanical Engineering Technician', 'Mechanical Equipment Sales Representative', 'Mechanical Inspector', 'Media and Communication Worker', 'Medical Appliance Technician', 'Medical Assistant', 'Medical Equipment Preparer', 'Medical Equipment Repairer', 'Medical Laboratory Technologist', 'Medical Records Technician', 'Medical Sales Representative', 'Medical Scientists', 'Medical Secretary', 'Medical Technician', 'Medical Transcriptionist', 'Mental Health Counselor', 'Merchandise Displayer OR Window Trimmer', 'Metal Fabricator', 'Metal Molding Operator', 'Metal Pourer and Caster', 'Metal Worker', 'Metal-Refining Furnace Operator', 'Meter Mechanic', 'Microbiologist', 'Middle School Teacher', 'Military Officer', 'Milling Machine Operator', 'Millwright', 'Mine Cutting Machine Operator', 'Mining Engineer OR Geological Engineer', 'Mining Machine Operator', 'Mixing and Blending Machine Operator', 'Model Maker', 'Mold Maker', 'Molder', 'Molding and Casting Worker', 'Molding Machine Operator', 'Motion Picture Projectionist', 'Motor Vehicle Inspector', 'Motor Vehicle Operator', 'Motorboat Mechanic', 'Motorboat Operator', 'Motorcycle Mechanic', 'Movers', 'Movie Director oR Theatre Director', 'Multi-Media Artist', 'Multiple Machine Tool Setter', 'Municipal Clerk', 'Municipal Court Clerk', 'Municipal Fire Fighter', 'Municipal Fire Fighting Supervisor', 'Museum Conservator', 'Music Arranger and Orchestrator', 'Music Composer', 'Music Director', 'Musical Instrument Tuner', 'Musician', 'Musician OR Singer',
'Natural Sciences Manager', 'Naval Architects', 'Network Admin OR Computer Systems Administrator', 'Network Systems Analyst', 'New Accounts Clerk', 'Night Security Guard', 'Night Shift', 'Nonfarm Animal Caretaker', 'Nuclear Engineer', 'Nuclear Equipment Operation Technician', 'Nuclear Medicine Technologist', 'Nuclear Monitoring Technician', 'Nuclear Power Reactor Operator', 'Nuclear Technician', 'Numerical Control Machine Tool Operator', 'Numerical Tool Programmer OR Process Control Programmer', 'Nursery Manager', 'Nursery Worker', 'Nursing Aide', 'Nursing Instructor', 'Nutritionist',
'Obstetrician', 'Occupational Health Safety Specialist', 'Occupational Health Safety Technician', 'Occupational Therapist', 'Occupational Therapist Aide', 'Occupational Therapist Assistant', 'Office and Administrative Support Worker', 'Office Clerk', 'Office Machine and Cash Register Servicer', 'Office Machine Operator', 'Offset Lithographic Press Operator', 'Oil and gas Operator', 'Oil Service Unit Operator', 'Online Marketing Analyst', 'Operating Engineer', 'Operations Research Analyst', 'Ophthalmic Laboratory Technician', 'Optical Instrument Assembler', 'Opticians', 'Optometrist', 'Oral Surgeon', 'Order Clerk', 'Order Filler', 'Order Filler OR Stock Clerk', 'Organizational Development Manager', 'Orthodontist', 'Orthotist OR Prosthetist', 'Outdoor Power Equipment Mechanic',
'Packaging Machine Operator', 'Packer and Packager', 'Painter', 'Painter and Illustrator', 'Painting Machine Operator', 'Pantograph Engraver', 'Paper Goods Machine Operator', 'Paperhanger', 'Paralegal', 'Park Naturalist', 'Parking Enforcement Worker', 'Parking Lot Attendant', 'Parts Salesperson', 'Paste-Up Worker', 'Pastry Chef', 'Patrol Officer', 'Patternmaker', 'Paving Equipment Operator', 'Payroll Clerk', 'Pediatricians', 'Percussion Instrument Repairer', 'Personal Care Worker', 'Personal Financial Advisor', 'Personal Home Care Aide', 'Personal Service Worker', 'Personal Trainer', 'Personnel Recruiter', 'Pest Control Worker', 'Pesticide Sprayer', 'Petroleum Engineer', 'Petroleum Pump Operator', 'Petroleum Pump System Operator', 'Petroleum Technician', 'Pewter Caster', 'Pharmaceutical Sales Representative', 'Pharmacist', 'Pharmacy Aide', 'Pharmacy Technician', 'Philosophy and Religion Teacher', 'Photoengraver', 'Photoengraving Machine Operator', 'Photographer', 'Photographic Restorer', 'Photographic Developer', 'Photographic Process Worker', 'Photographic Processing Machine Operator', 'Photographic Reproduction Technician', 'Physical Scientist', 'Physical Therapist', 'Physical Therapist Aide', 'Physical Therapist Assistant', 'Physician', 'Physician Assistant', 'Physicist', 'Physics Teacher', 'Pile-Driver Operator', 'Pipe Fitter', 'Pipefitter', 'Pipelayer', 'Pipelaying Fitter', 'Plant and System Operator', 'Plant Scientist', 'Plasterer OR Stucco Mason', 'Plastic Molding Machine Operator', 'Plate Finisher', 'Platemaker', 'Plating Machine Operator', 'Plating Operator', 'Plating Operator OR Coating Machine Operator', 'Plumber', 'Plumber OR Pipefitter OR Steamfitter', 'Podiatrist', 'Poet OR Lyricist', 'Police and Sheriffs Patrol Officer', 'Police Detective', 'Police Identification OR Records Officer', 'Political Science Teacher', 'Political Scientist', 'Portable Power Tool Repairer', 'Postal Clerk', 'Postal Service Clerk', 'Postal Service Mail Carrier', 'Postal Service Mail Sorter', 'Postmasters', 'Postsecondary Education Administrators', 'Postsecondary Teacher', 'Potter', 'Poultry Cutter', 'Power Distributors OR Dispatcher', 'Power Generating Plant Operator', 'Power Plant Operator', 'PR Manager', 'Precious Stone Worker', 'Precision Aircraft Systems Assemblers', 'Precision Devices Inspector', 'Precision Dyer', 'Precision Etcher and Engraver', 'Precision Instrument Repairer', 'Precision Lens Grinders and Polisher', 'Precision Mold and Pattern Caster', 'Precision Pattern and Die Caster', 'Precision Printing Worker', 'Prepress Technician', 'Preschool Education Administrators', 'Preschool Teacher', 'Press Machine Setter, Operator', 'Pressing Machine Operator', 'Pressure Vessel Inspector', 'Printing Machine Operator', 'Printing Press Machine Operator', 'Private Detective and Investigator', 'Private Household Cook', 'Private Sector Executive', 'Probation Officers and Correctional Treatment Specialist', 'Procurement Clerk', 'Producer', 'Producers and Director', 'Product Management Leader', 'Product Promoter', 'Product Safety Engineer', 'Product Specialist', 'Production Control Manager', 'Production Helper', 'Production Inspector', 'Production Laborer', 'Production Manager', 'Production Planner', 'Production Planning', 'Production Worker', 'Professional Photographer', 'Professor', 'Program Director', 'Project Manager', 'Proofreaders and Copy Marker', 'Prosthodontist', 'Protective Service Worker', 'Protective Service Worker', 'Psychiatric Aide', 'Psychiatric Technician', 'Psychiatrist', 'Psychologist', 'Psychology Teacher', 'Public Health Social Worker', 'Public Relations Manager', 'Public Relations Specialist', 'Public Transportation Inspector', 'Pump Operators', 'Punching Machine Setters', 'Purchasing Agent', 'Purchasing Manager',
'Radar Technician', 'Radiation Therapist', 'Radio and Television Announcer', 'Radio Mechanic', 'Radio Operator', 'Radiologic Technician', 'Radiologic Technologist', 'Radiologic Technologist and Technician', 'Rail Car Repairer', 'Rail Transportation Worker', 'Rail Yard Engineer', 'Railroad Conductors', 'Railroad Inspector', 'Railroad Switch Operator', 'Railroad Yard Worker', 'Range Manager', 'Real Estate Appraiser', 'Real Estate Association Manager', 'Real Estate Broker', 'Real Estate Sales Agent', 'Receptionist and Information Clerk', 'Record Clerk', 'Recordkeeping Clerk', 'Recreation and Fitness Studies Teacher', 'Recreation Worker', 'Recreational Therapist', 'Recreational Vehicle Service Technician', 'Recruiter', 'Recyclable Material Collector', 'Refinery Operator', 'Refractory Materials Repairer', 'Refrigeration Mechanic', 'Registered Nurse', 'Rehabilitation Counselor', 'Religious Worker', 'Rental Clerk', 'Reporters OR Correspondent', 'Reservation Agent OR Transportation Ticket Agent', 'Residential Advisor', 'Respiratory Therapist', 'Respiratory Therapy Technician', 'Restaurant Cook', 'Retail Sales person', 'Retail Salesperson', 'Rigger', 'RN', 'Rock Splitter', 'Rolling Machine Setter', 'Roof Bolters Mining', 'Roofer', 'Rotary Drill Operator', 'Rough Carpenter', 'Roustabouts',
'Safety Engineer', 'Sailor', 'Sales and Related Workers', 'Sales Engineer', 'Sales Manager', 'Sales Person', 'Sales Representative', 'Sawing Machine Operator', 'Sawing Machine Setter', 'Sawing Machine Tool Setter', 'Scanner Operator', 'School Bus Driver', 'School Social Worker', 'Scientific Photographer', 'Screen Printing Machine Operator', 'Sculptor', 'Secondary School Teacher', 'Secretary', 'Securities Sales Agent', 'Security Guard', 'Security Systems Installer OR Fire Alarm Systems Installer', 'Segmental Paver', 'Self-Enrichment Education Teacher', 'Semiconductor Processor', 'Separating Machine Operators', 'Septic Tank Servicer', 'Service Station Attendant', 'Set and Exhibit Designer', 'Set Designer', 'Sewing Machine Operator', 'Shampooer', 'Shear Machine Set-Up Operator', 'Sheet Metal Worker', 'Sheriff', 'Ship Captain', 'Ship Carpenter and Joiner', 'Ship Engineer', 'Ship Mates', 'Ship Pilot', 'Shipping and Receiving Clerk', 'Shoe and Leather Repairer', 'Shoe Machine Operators', 'Short Order Cook', 'Shuttle Car Operator', 'Signal Repairer OR Track Switch Repairer', 'Silversmith', 'Singer', 'Sketch Artist', 'Skin Care Specialist', 'Slot Key Person', 'Social and Human Service Assistant', 'Social Media Marketing Manager', 'Social Science Research Assistant', 'Social Sciences Teacher', 'Social Scientists', 'Social Service Specialists', 'Social Work Teacher', 'Social Worker', 'Sociologist', 'Sociology Teacher', 'Software Engineer', 'Soil Conservationist', 'Soil Scientist', 'Soil Scientist OR Plant Scientist', 'Solderer', 'Soldering Machine Setter', 'Sound Engineering Technician', 'Space Sciences Teacher', 'Special Education Teacher', 'Special Force', 'Special Forces Officer', 'Speech-Language Pathologist', 'Sports Book Writer', 'Spotters', 'Spraying Machine Operator', 'Staff Psychologist', 'State', 'Statement Clerk', 'Stationary Engineer', 'Stationary Engineer OR Boiler Operator', 'Statistical Assistant', 'Statistician', 'Steel Worker', 'Stevedore', 'Stock Broker', 'Stock Clerk', 'Stone Cutter', 'Stone Sawyer', 'Stonemason', 'Stonemason', 'Storage Manager OR Distribution Manager', 'Streetcar Operator', 'Stringed Instrument Repairer and Tuner', 'Structural Iron and Steel Worker', 'Structural Metal Fabricator', 'Substance Abuse Counselor', 'Substance Abuse Social Worker', 'Substation Maintenance', 'Supervisor Correctional Officer', 'Supervisor Fire Fighting Worker', 'Supervisor of Customer Service', 'Supervisor of Police', 'Surgeon', 'Surgical Technologist', 'Survey Researcher', 'Surveying and Mapping Technician', 'Surveying Technician', 'Surveyor', 'Sys Admin', 'System Administrator',
'Tailor', 'Talent Acquisition Manager', 'Talent Director', 'Tank Car', 'Taper', 'Tax Examiner', 'Tax Preparer', 'Taxi Drivers and Chauffeur', 'Teacher', 'Teacher Assistant', 'Team Assembler', 'Technical Director', 'Technical Program Manager', 'Technical Specialist', 'Technical Writer', 'Telecommunications Equipment Installer', 'Telecommunications Facility Examiner', 'Telecommunications Line Installer', 'Telemarketer', 'Telephone Operator', 'Telephone Station Installer and Repairer', 'Teller', 'Terrazzo Workes and Finisher', 'Textile Cutting Machine Operator', 'Textile Dyeing Machine Operator', 'Textile Knitting Machine Operator', 'Textile Machine Operator', 'Textile Worker', 'Therapist', 'Ticket Agent', 'Tile Setter OR Marble Setter', 'Timing Device Assemblers', 'Tire Builder', 'Tire Changer', 'Title Abstractor', 'Title Examiner', 'Title Searcher', 'Tool and Die Maker', 'Tool Set-Up Operator', 'Tool Sharpener', 'Tour Guide', 'Tractor Operator', 'Tractor-Trailer Truck Driver', 'Traffic Technician', 'Train Crew', 'Trainer', 'Training Manager OR Development Manager', 'Transformer Repairer', 'Transit Police OR Railroad Police', 'Transportation and Material-Moving', 'Transportation Attendant', 'Transportation Equipment Maintenance', 'Transportation Equipment Painters', 'Transportation Inspector', 'Transportation Manager', 'Transportation Worker', 'Travel Agent', 'Travel Clerk', 'Travel Guide', 'Tree Trimmer', 'Truck Driver', 'TSA', 'Typesetter', 'Typesetting Machine Operator',
'Umpire and Referee', 'Underground Mining', 'University', 'Upholsterer', 'Urban Planner', 'User Experience Manager', 'User Experience Researcher', 'Usher', 'Utility Meter Reader',
'Valve Repairer OR Regulator Repairer', 'Vending Machine Servicer', 'Veterinarian', 'Veterinary Assistant OR Laboratory Animal Caretaker', 'Veterinary Technician', 'Vice President Of Human Resources', 'Vice President Of Marketing', 'Video Editor', 'Visual Designer', 'Vocational Education Teacher',
'Waiter', 'Waitress', 'Warehouse', 'Washing Equipment Operator', 'Waste Treatment Plant Operator', 'Watch Repairer', 'Weapons Specialists', 'Web Developer', 'Webmaster', 'Welder', 'Welder', 'Welder and Cutter', 'Welder-Fitter', 'Welding Machine Tender', 'Welding Machine Operator', 'Welding Machine Setter', 'Welfare Eligibility Clerk', 'Well and Core Drill Operator', 'Wellhead Pumper', 'Wholesale Buyer', 'Wind Instrument Repairer', 'Woodworker', 'Woodworking Machine Operator', 'Woodworking Machine Setter', 'Word Processors and Typist', 'Writer OR Author',
'Zoologists OR Wildlife Biologist',
);
protected static $companySuffix = array('Inc', 'and Sons', 'LLC', 'Group', 'PLC', 'Ltd');
/**
* @link https://www.irs.gov/businesses/small-businesses-self-employed/how-eins-are-assigned-and-valid-ein-prefixes
*/
protected static $einPrefixes = array(
01, 02, 03, 04, 05, 06, 10, 11, 12, 13, 14, 15, 16, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 98, 99
);
/**
* @example 'Robust full-range hub'
*/
public function catchPhrase()
{
$result = array();
foreach (static::$catchPhraseWords as &$word) {
$result[] = static::randomElement($word);
}
return join(' ', $result);
}
/**
* @example 'integrate extensible convergence'
*/
public function bs()
{
$result = array();
foreach (static::$bsWords as &$word) {
$result[] = static::randomElement($word);
}
return join(' ', $result);
}
/**
* Employer Identification Number (EIN)
*
* @link https://en.wikipedia.org/wiki/Employer_Identification_Number
* @example '12-3456789'
*/
public static function ein()
{
$prefix = static::randomElement(static::$einPrefixes);
$suffix = static::numberBetween(0, 9999999);
return sprintf("%02d-%07d", $prefix, $suffix);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace Siteworx\Faker\Provider\en_US;
class Payment extends \Siteworx\Faker\Provider\Payment
{
public function bankAccountNumber()
{
// Length between 5 and 17, biased towards center
$length = self::numberBetween(0, 3) + self::numberBetween(0, 3) + self::numberBetween(0, 3) + self::numberBetween(0, 3) + 5;
return self::numerify(str_repeat('#', $length));
}
public function bankRoutingNumber()
{
$district = self::numberBetween(1, 12);
$type = self::randomElement(array(0, 0, 0, 0, 20, 20, 60));
$clearingCenter = self::randomDigitNotNull();
$state = self::randomDigit();
$institution = self::randomNumber(4, true);
$result = sprintf('%02d%01d%01d%04d', $district + $type, $clearingCenter, $state, $institution);
return $result . self::calculateRoutingNumberChecksum($result);
}
public static function calculateRoutingNumberChecksum($routing)
{
return (
7 * ($routing[0] + $routing[3] + $routing[6]) +
3 * ($routing[1] + $routing[4] + $routing[7]) +
9 * ($routing[2] + $routing[5])
) % 10;
}
}

View File

@@ -0,0 +1,133 @@
<?php
namespace Siteworx\Faker\Provider\en_US;
class Person extends \Siteworx\Faker\Provider\Person
{
protected static array $maleNameFormats = [
'{{firstNameMale}} {{lastName}}',
'{{firstNameMale}} {{lastName}}',
'{{firstNameMale}} {{lastName}}',
'{{firstNameMale}} {{lastName}}',
'{{titleMale}} {{firstNameMale}} {{lastName}}',
'{{firstNameMale}} {{lastName}} {{suffix}}',
'{{titleMale}} {{firstNameMale}} {{lastName}} {{suffix}}',
];
protected static array $femaleNameFormats = [
'{{firstNameFemale}} {{lastName}}',
'{{firstNameFemale}} {{lastName}}',
'{{firstNameFemale}} {{lastName}}',
'{{firstNameFemale}} {{lastName}}',
'{{titleFemale}} {{firstNameFemale}} {{lastName}}',
'{{firstNameFemale}} {{lastName}} {{suffix}}',
'{{titleFemale}} {{firstNameFemale}} {{lastName}} {{suffix}}',
];
protected static array $firstNameMale = [
'Aaron', 'Abdiel', 'Abdul', 'Abdullah', 'Abe', 'Abel', 'Abelardo', 'Abner', 'Abraham', 'Adalberto', 'Adam', 'Adan', 'Adelbert', 'Adolf', 'Adolfo', 'Adolph', 'Adolphus', 'Adonis', 'Adrain', 'Adrian', 'Adriel', 'Adrien', 'Afton', 'Agustin', 'Ahmad', 'Ahmed', 'Aidan', 'Aiden', 'Akeem', 'Al', 'Alan', 'Albert', 'Alberto', 'Albin', 'Alden', 'Alec', 'Alejandrin', 'Alek', 'Alessandro', 'Alex', 'Alexander', 'Alexandre', 'Alexandro', 'Alexie', 'Alexis', 'Alexys', 'Alexzander', 'Alf', 'Alfonso', 'Alfonzo', 'Alford', 'Alfred', 'Alfredo', 'Ali', 'Allan', 'Allen', 'Alphonso', 'Alvah', 'Alvis', 'Amani', 'Amari', 'Ambrose', 'Americo', 'Amir', 'Amos', 'Amparo', 'Anastacio', 'Anderson', 'Andre', 'Andres', 'Andrew', 'Andy', 'Angel', 'Angelo', 'Angus', 'Anibal', 'Ansel', 'Ansley', 'Anthony', 'Antone', 'Antonio', 'Antwan', 'Antwon', 'Arch', 'Archibald', 'Arden', 'Arely', 'Ari', 'Aric', 'Ariel', 'Arjun', 'Arlo', 'Armand', 'Armando', 'Armani', 'Arnaldo', 'Arne', 'Arno', 'Arnold', 'Arnoldo', 'Arnulfo', 'Aron', 'Art', 'Arthur', 'Arturo', 'Arvel', 'Arvid', 'Ashton', 'August', 'Augustus', 'Aurelio', 'Austen', 'Austin', 'Austyn', 'Avery', 'Axel', 'Ayden',
'Bailey', 'Barney', 'Baron', 'Barrett', 'Barry', 'Bart', 'Bartholome', 'Barton', 'Baylee', 'Beau', 'Bell', 'Ben', 'Benedict', 'Benjamin', 'Bennett', 'Bennie', 'Benny', 'Benton', 'Bernard', 'Bernardo', 'Bernhard', 'Bernie', 'Berry', 'Berta', 'Bertha', 'Bertram', 'Bertrand', 'Bill', 'Billy', 'Blair', 'Blaise', 'Blake', 'Blaze', 'Bo', 'Bobbie', 'Bobby', 'Boris', 'Boyd', 'Brad', 'Braden', 'Bradford', 'Bradley', 'Bradly', 'Brady', 'Braeden', 'Brain', 'Brando', 'Brandon', 'Brandt', 'Brannon', 'Branson', 'Brant', 'Braulio', 'Braxton', 'Brayan', 'Brendan', 'Brenden', 'Brendon', 'Brennan', 'Brennon', 'Brent', 'Bret', 'Brett', 'Brian', 'Brice', 'Brock', 'Broderick', 'Brody', 'Brook', 'Brooks', 'Brown', 'Bruce', 'Bryce', 'Brycen', 'Bryon', 'Buck', 'Bud', 'Buddy', 'Buford', 'Burley', 'Buster',
'Cade', 'Caden', 'Caesar', 'Cale', 'Caleb', 'Camden', 'Cameron', 'Camren', 'Camron', 'Camryn', 'Candelario', 'Candido', 'Carey', 'Carleton', 'Carlo', 'Carlos', 'Carmel', 'Carmelo', 'Carmine', 'Carol', 'Carroll', 'Carson', 'Carter', 'Cary', 'Casey', 'Casimer', 'Casimir', 'Casper', 'Ceasar', 'Cecil', 'Cedrick', 'Celestino', 'Cesar', 'Chad', 'Chadd', 'Chadrick', 'Chaim', 'Chance', 'Chandler', 'Charles', 'Charley', 'Charlie', 'Chase', 'Chauncey', 'Chaz', 'Chelsey', 'Chesley', 'Chester', 'Chet', 'Chris', 'Christ', 'Christian', 'Christop', 'Christophe', 'Christopher', 'Cicero', 'Cielo', 'Clair', 'Clark', 'Claud', 'Claude', 'Clay', 'Clemens', 'Clement', 'Cleo', 'Cletus', 'Cleve', 'Cleveland', 'Clifford', 'Clifton', 'Clint', 'Clinton', 'Clovis', 'Cloyd', 'Clyde', 'Coby', 'Cody', 'Colby', 'Cole', 'Coleman', 'Colin', 'Collin', 'Colt', 'Colten', 'Colton', 'Columbus', 'Conner', 'Connor', 'Conor', 'Conrad', 'Constantin', 'Consuelo', 'Cooper', 'Corbin', 'Cordelia', 'Cordell', 'Cornelius', 'Cornell', 'Cortez', 'Cory', 'Coty', 'Coy', 'Craig', 'Crawford', 'Cristian', 'Cristina', 'Cristobal', 'Cristopher', 'Cruz', 'Cullen', 'Curt', 'Curtis', 'Cyril', 'Cyrus',
'Dagmar', 'Dale', 'Dallas', 'Dallin', 'Dalton', 'Dameon', 'Damian', 'Damien', 'Damion', 'Damon', 'Dan', 'Dane', 'D\'angelo', 'Dangelo', 'Danial', 'Danny', 'Dante', 'Daren', 'Darian', 'Darien', 'Dario', 'Darion', 'Darius', 'Daron', 'Darrel', 'Darrell', 'Darren', 'Darrick', 'Darrin', 'Darrion', 'Darron', 'Darryl', 'Darwin', 'Daryl', 'Dashawn', 'Dave', 'David', 'Davin', 'Davion', 'Davon', 'Davonte', 'Dawson', 'Dax', 'Dayne', 'Dayton', 'Dean', 'Deangelo', 'Declan', 'Dedric', 'Dedrick', 'Dee', 'Deion', 'Dejon', 'Dejuan', 'Delaney', 'Delbert', 'Dell','Delmer', 'Demarco', 'Demarcus', 'Demario', 'Demetrius', 'Demond', 'Denis', 'Dennis', 'Deon', 'Deondre', 'Deontae', 'Deonte', 'Dereck', 'Derek', 'Derick', 'Deron', 'Derrick', 'Deshaun', 'Deshawn', 'Desmond', 'Destin', 'Devan', 'Devante', 'Deven', 'Devin', 'Devon', 'Devonte', 'Devyn', 'Dewayne', 'Dewitt', 'Dexter', 'Diamond', 'Diego', 'Dillan', 'Dillon', 'Dimitri', 'Dino', 'Dion', 'Dock','Domenic', 'Domenick', 'Domenico', 'Domingo', 'Dominic', 'Don', 'Donald', 'Donato', 'Donavon', 'Donnell', 'Donnie', 'Donny', 'Dorcas', 'Dorian', 'Doris', 'Dorthy', 'Doug', 'Douglas', 'Doyle', 'Drake', 'Dudley', 'Duncan', 'Durward', 'Dustin', 'Dusty', 'Dwight', 'Dylan',
'Earl', 'Earnest', 'Easter', 'Easton', 'Ed', 'Edd', 'Eddie', 'Edgar', 'Edgardo', 'Edison', 'Edmond', 'Edmund', 'Eduardo', 'Edward', 'Edwardo', 'Edwin', 'Efrain', 'Efren', 'Einar', 'Eino', 'Eladio', 'Elbert', 'Eldon', 'Eldred', 'Eleazar', 'Eli', 'Elian', 'Elias', 'Eliezer', 'Elijah', 'Eliseo', 'Elliot', 'Elliott', 'Ellis', 'Ellsworth', 'Elmer', 'Elmo', 'Elmore', 'Eloy', 'Elroy', 'Elton', 'Elvis', 'Elwin', 'Elwyn', 'Emanuel', 'Emerald', 'Emerson', 'Emery', 'Emil', 'Emile', 'Emiliano', 'Emilio', 'Emmanuel', 'Emmet', 'Emmett', 'Emmitt', 'Emory', 'Enid', 'Enoch', 'Enos', 'Enrico', 'Enrique', 'Ephraim', 'Eriberto', 'Eric', 'Erich', 'Erick', 'Erik', 'Erin', 'Erling', 'Ernest', 'Ernesto', 'Ernie', 'Ervin', 'Erwin', 'Esteban', 'Estevan', 'Ethan', 'Ethel', 'Eugene', 'Eusebio', 'Evan', 'Evans', 'Everardo', 'Everett', 'Evert', 'Ewald', 'Ewell', 'Ezekiel', 'Ezequiel', 'Ezra',
'Fabian', 'Faustino', 'Fausto', 'Favian', 'Federico', 'Felipe', 'Felix', 'Felton', 'Fermin', 'Fern', 'Fernando', 'Ferne', 'Fidel', 'Filiberto', 'Finn', 'Flavio','Fletcher', 'Florencio', 'Florian', 'Floy', 'Floyd', 'Ford', 'Forest', 'Forrest', 'Foster', 'Francesco', 'Francis', 'Francisco', 'Franco', 'Frank', 'Frankie', 'Franz', 'Fred', 'Freddie', 'Freddy', 'Frederic', 'Frederick', 'Frederik', 'Fredrick', 'Fredy', 'Freeman', 'Friedrich', 'Fritz', 'Furman',
'Gabe', 'Gabriel', 'Gaetano', 'Gage', 'Gardner', 'Garett', 'Garfield', 'Garland', 'Garnet', 'Garnett', 'Garret', 'Garrett', 'Garrick', 'Garrison', 'Garry', 'Garth', 'Gaston', 'Gavin', 'Gay', 'Gayle', 'Gaylord', 'Gene', 'General', 'Gennaro', 'Geo', 'Geoffrey', 'George', 'Geovanni', 'Geovanny', 'Geovany', 'Gerald', 'Gerard', 'Gerardo', 'Gerhard', 'German', 'Gerson', 'Gianni', 'Gideon', 'Gilbert', 'Gilberto', 'Giles', 'Gillian', 'Gino', 'Giovani', 'Giovanni', 'Giovanny','Giuseppe', 'Glen', 'Glennie', 'Godfrey', 'Golden', 'Gonzalo', 'Gordon', 'Grady', 'Graham', 'Grant', 'Granville', 'Grayce', 'Grayson', 'Green', 'Greg', 'Gregg', 'Gregorio', 'Gregory', 'Greyson', 'Griffin', 'Grover', 'Guido', 'Guillermo', 'Guiseppe', 'Gunnar', 'Gunner', 'Gus', 'Gussie', 'Gust', 'Gustave', 'Guy',
'Hadley', 'Hailey', 'Hal', 'Haleigh', 'Haley', 'Halle', 'Hank', 'Hans', 'Hardy', 'Harley', 'Harmon', 'Harold', 'Harrison', 'Harry', 'Harvey', 'Haskell', 'Hassan', 'Hayden', 'Hayley', 'Hazel', 'Hazle', 'Heber', 'Hector', 'Helmer', 'Henderson', 'Henri', 'Henry', 'Herbert', 'Herman', 'Hermann', 'Herminio', 'Hershel', 'Hester', 'Hilario', 'Hilbert', 'Hillard', 'Hilton', 'Hipolito', 'Hiram', 'Hobart', 'Holden', 'Hollis', 'Horace', 'Horacio', 'Houston', 'Howard', 'Howell', 'Hoyt', 'Hubert', 'Hudson', 'Hugh', 'Humberto', 'Hunter', 'Hyman',
'Ian', 'Ibrahim', 'Ignacio', 'Ignatius', 'Ike', 'Imani', 'Immanuel', 'Irving', 'Irwin', 'Isaac', 'Isac', 'Isadore', 'Isai', 'Isaiah', 'Isaias', 'Isidro', 'Ismael', 'Isom', 'Israel', 'Issac', 'Izaiah',
'Jabari', 'Jace', 'Jacey', 'Jacinto', 'Jack', 'Jackson', 'Jacques', 'Jaden', 'Jadon', 'Jaeden', 'Jaiden', 'Jaime', 'Jairo', 'Jake', 'Jakob', 'Jaleel', 'Jalen', 'Jalon', 'Jamaal', 'Jamal', 'Jamar', 'Jamarcus', 'Jamel', 'Jameson', 'Jamey', 'Jamie', 'Jamil', 'Jamir', 'Jamison', 'Jan', 'Janick', 'Jaquan', 'Jared', 'Jaren', 'Jarod', 'Jaron', 'Jarred', 'Jarrell', 'Jarret', 'Jarrett', 'Jarrod', 'Jarvis', 'Jasen', 'Jasmin', 'Jason', 'Jasper', 'Javier', 'Javon', 'Javonte', 'Jay', 'Jayce', 'Jaycee', 'Jayde', 'Jayden', 'Jaydon', 'Jaylan', 'Jaylen', 'Jaylin', 'Jaylon', 'Jayme', 'Jayson', 'Jean', 'Jed', 'Jedediah', 'Jedidiah', 'Jeff', 'Jefferey', 'Jeffery', 'Jeffrey', 'Jeffry', 'Jennings', 'Jensen', 'Jerad', 'Jerald', 'Jeramie', 'Jeramy', 'Jerel', 'Jeremie', 'Jeremy', 'Jermain', 'Jermey', 'Jerod', 'Jerome', 'Jeromy', 'Jerrell', 'Jerrod', 'Jerrold', 'Jerry', 'Jess', 'Jesse', 'Jessie', 'Jessy', 'Jesus', 'Jett', 'Jettie', 'Jevon', 'Jillian', 'Jimmie', 'Jimmy', 'Jo', 'Joan', 'Joany', 'Joaquin', 'Jocelyn', 'Joe', 'Joel', 'Joesph', 'Joey', 'Johan', 'Johann', 'Johathan', 'John', 'Johnathan', 'Johnathon', 'Johnnie', 'Johnny', 'Johnpaul', 'Johnson', 'Jon', 'Jonas', 'Jonatan', 'Jonathan', 'Jonathon', 'Jordan', 'Jordi', 'Jordon', 'Jordy', 'Jordyn', 'Jorge', 'Jose', 'Joseph', 'Josh', 'Joshua', 'Joshuah', 'Josiah', 'Josue', 'Jovan', 'Jovani', 'Jovanny', 'Jovany', 'Judah', 'Judd', 'Judge', 'Judson', 'Jules', 'Julian', 'Julien', 'Julio', 'Julius', 'Junior', 'Junius', 'Justen', 'Justice', 'Juston', 'Justus', 'Justyn', 'Juvenal', 'Juwan',
'Kacey', 'Kade', 'Kaden', 'Kadin', 'Kale', 'Kaleb', 'Kaleigh', 'Kaley', 'Kameron', 'Kamren', 'Kamron', 'Kamryn', 'Kane', 'Kareem', 'Karl', 'Karley', 'Karson', 'Kay', 'Kayden', 'Kayleigh', 'Kayley', 'Keagan', 'Keanu', 'Keaton', 'Keegan', 'Keeley', 'Keenan', 'Keith', 'Kellen', 'Kelley', 'Kelton', 'Kelvin', 'Ken', 'Kendall', 'Kendrick', 'Kennedi', 'Kennedy', 'Kenneth', 'Kennith', 'Kenny', 'Kenton', 'Kenyon', 'Keon', 'Keshaun', 'Keshawn', 'Keven', 'Kevin', 'Kevon', 'Keyon', 'Keyshawn', 'Khalid', 'Khalil', 'Kian', 'Kiel', 'Kieran', 'Kiley', 'Kim', 'King', 'Kip', 'Kirk', 'Kobe', 'Koby', 'Kody', 'Kolby', 'Kole', 'Korbin', 'Korey', 'Kory', 'Kraig', 'Kris', 'Kristian', 'Kristofer', 'Kristoffer', 'Kristopher', 'Kurt', 'Kurtis', 'Kyle', 'Kyleigh', 'Kyler',
'Ladarius', 'Lafayette', 'Lamar', 'Lambert', 'Lamont', 'Lance', 'Landen', 'Lane', 'Laron', 'Larry', 'Larue', 'Laurel', 'Lavern', 'Laverna', 'Laverne', 'Lavon', 'Lawrence', 'Lawson', 'Layne', 'Lazaro', 'Lee', 'Leif', 'Leland', 'Lemuel', 'Lennie', 'Lenny', 'Leo', 'Leon', 'Leonard', 'Leonardo', 'Leone', 'Leonel', 'Leopold', 'Leopoldo', 'Lesley', 'Lester', 'Levi', 'Lew', 'Lewis', 'Lexus', 'Liam', 'Lincoln', 'Lindsey', 'Linwood', 'Lionel', 'Lisandro', 'Llewellyn', 'Lloyd', 'Logan', 'Lon', 'London', 'Lonnie', 'Lonny', 'Lonzo', 'Lorenz', 'Lorenza', 'Lorenzo', 'Louie', 'Louisa', 'Lourdes', 'Louvenia', 'Lowell', 'Loy', 'Loyal', 'Lucas', 'Luciano', 'Lucio', 'Lucious', 'Lucius', 'Ludwig', 'Luigi', 'Luis', 'Lukas', 'Lula', 'Luther', 'Lyric',
'Mac', 'Macey', 'Mack', 'Mackenzie', 'Madisen', 'Madison', 'Madyson', 'Magnus', 'Major', 'Makenna', 'Malachi', 'Malcolm', 'Mallory', 'Manley', 'Manuel', 'Manuela', 'Marc', 'Marcel', 'Marcelino', 'Marcellus', 'Marcelo', 'Marco', 'Marcos', 'Marcus', 'Mariano', 'Mario', 'Mark', 'Markus', 'Marley', 'Marlin', 'Marlon', 'Marques', 'Marquis', 'Marshall', 'Martin', 'Marty', 'Marvin', 'Mason', 'Mateo', 'Mathew', 'Mathias', 'Matt', 'Matteo', 'Maurice', 'Mauricio', 'Maverick', 'Mavis', 'Max', 'Maxime', 'Maximilian', 'Maximillian', 'Maximo', 'Maximus', 'Maxine', 'Maxwell', 'Maynard', 'Mckenna', 'Mckenzie', 'Mekhi', 'Melany', 'Melvin', 'Melvina', 'Merl', 'Merle', 'Merlin', 'Merritt', 'Mervin', 'Micah', 'Michael', 'Michale', 'Micheal', 'Michel', 'Miguel', 'Mike', 'Mikel', 'Milan', 'Miles', 'Milford', 'Miller', 'Milo', 'Milton', 'Misael', 'Mitchel', 'Mitchell', 'Modesto', 'Mohamed', 'Mohammad', 'Mohammed', 'Moises', 'Monroe', 'Monserrat', 'Monserrate', 'Montana', 'Monte', 'Monty', 'Morgan', 'Moriah', 'Morris', 'Mortimer', 'Morton', 'Mose', 'Moses', 'Moshe', 'Muhammad', 'Murl', 'Murphy', 'Murray', 'Mustafa', 'Myles', 'Myrl', 'Myron',
'Napoleon', 'Narciso', 'Nash', 'Nasir', 'Nat', 'Nathan', 'Nathanael', 'Nathanial', 'Nathaniel', 'Nathen', 'Neal', 'Ned', 'Neil', 'Nels', 'Nelson', 'Nestor', 'Newell', 'Newton', 'Nicholas', 'Nicholaus', 'Nick', 'Nicklaus', 'Nickolas', 'Nico', 'Nicola', 'Nicolas', 'Nigel', 'Nikko', 'Niko', 'Nikolas', 'Nils', 'Noah', 'Noble', 'Noe', 'Noel', 'Nolan', 'Norbert', 'Norberto', 'Norris', 'Norval', 'Norwood',
'Obie', 'Oda', 'Odell', 'Okey', 'Ola', 'Olaf', 'Ole', 'Olen', 'Olin', 'Oliver', 'Omari', 'Omer', 'Oral', 'Oran', 'Oren', 'Orin', 'Orion', 'Orland', 'Orlando', 'Orlo', 'Orrin', 'Orval', 'Orville', 'Osbaldo', 'Osborne', 'Oscar', 'Osvaldo', 'Oswald', 'Oswaldo', 'Otho', 'Otis', 'Ottis', 'Otto', 'Owen',
'Pablo', 'Paolo', 'Paris', 'Parker', 'Patrick', 'Paul', 'Paxton', 'Payton', 'Pedro', 'Percival', 'Percy', 'Perry', 'Pete', 'Peter', 'Peyton', 'Philip', 'Pierce', 'Pierre', 'Pietro', 'Porter', 'Presley', 'Preston', 'Price', 'Prince',
'Quentin', 'Quincy', 'Quinn', 'Quinten', 'Quinton',
'Rafael', 'Raheem', 'Rahul', 'Raleigh', 'Ralph', 'Ramiro', 'Ramon', 'Randal', 'Randall', 'Randi', 'Randy', 'Ransom', 'Raoul', 'Raphael', 'Rashad', 'Rashawn', 'Rasheed', 'Raul', 'Raven', 'Ray', 'Raymond', 'Raymundo', 'Reagan', 'Reece', 'Reed', 'Reese', 'Regan', 'Reggie', 'Reginald', 'Reid', 'Reilly','Reinhold', 'Remington', 'Rene', 'Reuben', 'Rex', 'Rey', 'Reyes', 'Reymundo', 'Reynold', 'Rhett', 'Rhiannon', 'Ricardo', 'Richard', 'Richie', 'Richmond', 'Rick', 'Rickey', 'Rickie', 'Ricky', 'Rico', 'Rigoberto', 'Riley', 'Robb', 'Robbie', 'Robert', 'Roberto', 'Robin', 'Rocio', 'Rocky', 'Rod', 'Roderick', 'Rodger', 'Rodolfo', 'Rodrick', 'Rodrigo', 'Roel', 'Rogelio', 'Roger', 'Rogers', 'Rolando', 'Rollin', 'Roman', 'Ron', 'Ronaldo', 'Ronny', 'Roosevelt', 'Rory', 'Rosario', 'Roscoe', 'Rosendo', 'Ross', 'Rowan', 'Rowland', 'Roy', 'Royal', 'Royce', 'Ruben', 'Rudolph', 'Rudy', 'Rupert', 'Russ', 'Russel', 'Russell', 'Rusty', 'Ryan', 'Ryann', 'Ryder', 'Rylan', 'Ryleigh', 'Ryley',
'Sage', 'Saige', 'Salvador', 'Salvatore', 'Sam', 'Samir', 'Sammie', 'Sammy', 'Samson', 'Sanford', 'Santa', 'Santiago', 'Santino', 'Santos', 'Saul', 'Savion', 'Schuyler', 'Scot', 'Scottie', 'Scotty', 'Seamus', 'Sean', 'Sebastian', 'Sedrick', 'Selmer', 'Seth', 'Shad', 'Shane', 'Shaun', 'Shawn', 'Shayne', 'Sheldon', 'Sheridan', 'Sherman', 'Sherwood', 'Sid', 'Sidney', 'Sigmund', 'Sigrid', 'Sigurd', 'Silas', 'Sim', 'Simeon', 'Skye', 'Skylar', 'Sofia', 'Soledad', 'Solon', 'Sonny', 'Spencer', 'Stan', 'Stanford', 'Stanley', 'Stanton', 'Stefan', 'Stephan', 'Stephen', 'Stephon', 'Sterling', 'Steve', 'Stevie', 'Stewart', 'Stone', 'Stuart', 'Sven', 'Sydney', 'Sylvan', 'Sylvester',
'Tad', 'Talon', 'Tanner', 'Tate', 'Tatum', 'Taurean', 'Tavares', 'Taylor', 'Ted', 'Terence', 'Terrance', 'Terrell', 'Terrence', 'Terrill', 'Terry', 'Tevin', 'Thad', 'Thaddeus', 'Theo', 'Theodore', 'Theron', 'Thomas', 'Thurman', 'Tillman', 'Timmothy', 'Timmy', 'Timothy', 'Tito', 'Titus', 'Tobin', 'Toby', 'Tod', 'Tom', 'Tomas', 'Tommie', 'Toney', 'Toni', 'Tony', 'Torey', 'Torrance', 'Torrey', 'Toy', 'Trace', 'Tracey', 'Travis', 'Travon', 'Tre', 'Tremaine', 'Tremayne', 'Trent', 'Trenton', 'Trever', 'Trevion', 'Trevor', 'Trey', 'Tristian', 'Tristin', 'Triston', 'Troy', 'Trystan', 'Turner','Tyler', 'Tyree', 'Tyreek', 'Tyrel', 'Tyrell', 'Tyrese', 'Tyrique', 'Tyshawn', 'Tyson',
'Ubaldo', 'Ulices', 'Ulises', 'Unique', 'Urban', 'Uriah', 'Uriel',
'Valentin', 'Van', 'Vance', 'Vaughn', 'Vern', 'Verner', 'Vernon', 'Vicente', 'Victor', 'Vidal', 'Vince', 'Vincent', 'Vincenzo', 'Vinnie', 'Virgil', 'Vito', 'Vladimir',
'Wade', 'Waino', 'Waldo', 'Walker', 'Wallace', 'Walter', 'Walton', 'Ward', 'Warren', 'Watson', 'Waylon', 'Wayne', 'Webster', 'Weldon', 'Wellington', 'Wendell', 'Werner', 'Westley', 'Weston', 'Wilber', 'Wilbert', 'Wilburn', 'Wiley', 'Wilford', 'Wilfred', 'Wilfredo', 'Wilfrid', 'Wilhelm', 'Will', 'Willard', 'William', 'Willis', 'Willy', 'Wilmer', 'Wilson', 'Wilton', 'Winfield', 'Winston', 'Woodrow', 'Wyatt', 'Wyman',
'Xavier', 'Xzavier', 'Xander',
'Zachariah', 'Zachary', 'Zachery', 'Zack', 'Zackary', 'Zackery', 'Zakary', 'Zander', 'Zane', 'Zechariah', 'Zion',
];
protected static array $firstNameFemale = [
'Aaliyah', 'Abagail', 'Abbey', 'Abbie', 'Abbigail', 'Abby', 'Abigail', 'Abigale', 'Abigayle', 'Ada', 'Adah', 'Adaline', 'Addie', 'Addison', 'Adela', 'Adele', 'Adelia', 'Adeline', 'Adell', 'Adella', 'Adelle', 'Aditya', 'Adriana', 'Adrianna', 'Adrienne', 'Aglae', 'Agnes', 'Agustina', 'Aida', 'Aileen', 'Aimee', 'Aisha', 'Aiyana', 'Alaina', 'Alana', 'Alanis', 'Alanna', 'Alayna', 'Alba', 'Alberta', 'Albertha', 'Albina', 'Alda', 'Aleen', 'Alejandra', 'Alena', 'Alene', 'Alessandra', 'Alessia', 'Aletha', 'Alexa', 'Alexandra', 'Alexandrea', 'Alexandria', 'Alexandrine', 'Alexane', 'Alexanne', 'Alfreda', 'Alia', 'Alice', 'Alicia', 'Alisa', 'Alisha', 'Alison', 'Alivia', 'Aliya', 'Aliyah', 'Aliza', 'Alize', 'Allene', 'Allie', 'Allison', 'Ally', 'Alta', 'Althea', 'Alva', 'Alvena', 'Alvera', 'Alverta', 'Alvina', 'Alyce', 'Alycia', 'Alysa', 'Alysha', 'Alyson', 'Alysson', 'Amalia', 'Amanda', 'Amara', 'Amaya', 'Amber', 'Amelia', 'Amelie', 'Amely', 'America', 'Amie', 'Amina', 'Amira', 'Amiya', 'Amy', 'Amya', 'Ana', 'Anabel', 'Anabelle', 'Anahi', 'Anais', 'Anastasia', 'Andreane', 'Andreanne', 'Angela', 'Angelica', 'Angelina', 'Angeline', 'Angelita', 'Angie', 'Anika', 'Anissa', 'Anita', 'Aniya', 'Aniyah', 'Anjali', 'Anna', 'Annabel', 'Annabell', 'Annabelle', 'Annalise', 'Annamae', 'Annamarie', 'Anne', 'Annetta', 'Annette', 'Annie', 'Antoinette', 'Antonetta', 'Antonette', 'Antonia', 'Antonietta', 'Antonina', 'Anya', 'April', 'Ara', 'Araceli', 'Aracely', 'Ardella', 'Ardith', 'Ariane', 'Arianna', 'Arielle', 'Arlene', 'Arlie', 'Arvilla', 'Aryanna', 'Asa', 'Asha', 'Ashlee', 'Ashleigh', 'Ashley', 'Ashly', 'Ashlynn', 'Ashtyn', 'Asia', 'Assunta', 'Astrid', 'Athena', 'Aubree', 'Aubrey', 'Audie', 'Audra', 'Audreanne', 'Audrey', 'Augusta', 'Augustine', 'Aurelia', 'Aurelie', 'Aurore', 'Autumn', 'Ava', 'Avis', 'Ayana', 'Ayla', 'Aylin',
'Baby', 'Bailee', 'Barbara', 'Beatrice', 'Beaulah', 'Bella', 'Belle', 'Berenice', 'Bernadette', 'Bernadine', 'Berneice', 'Bernice', 'Berniece', 'Bernita', 'Bert', 'Beryl', 'Bessie', 'Beth', 'Bethany', 'Bethel', 'Betsy', 'Bette', 'Bettie', 'Betty', 'Bettye', 'Beulah', 'Beverly', 'Bianka', 'Billie', 'Birdie', 'Blanca', 'Blanche', 'Bonita', 'Bonnie', 'Brandi', 'Brandy', 'Brandyn', 'Breana', 'Breanna', 'Breanne', 'Brenda', 'Brenna', 'Bria', 'Briana', 'Brianne', 'Bridget', 'Bridgette', 'Bridie', 'Brielle', 'Brigitte', 'Brionna', 'Brisa', 'Britney', 'Brittany', 'Brooke', 'Brooklyn', 'Bryana', 'Bulah', 'Burdette', 'Burnice',
'Caitlyn', 'Caleigh', 'Cali', 'Calista', 'Callie', 'Camila', 'Camilla', 'Camille', 'Camylle', 'Candace', 'Candice', 'Candida', 'Cara', 'Carissa', 'Carlee', 'Carley', 'Carli', 'Carlie', 'Carlotta', 'Carmela', 'Carmella', 'Carmen', 'Carolanne', 'Carole', 'Carolina', 'Caroline', 'Carolyn', 'Carolyne', 'Carrie', 'Casandra', 'Cassandra', 'Cassandre', 'Cassidy', 'Cassie', 'Catalina', 'Caterina', 'Catharine', 'Catherine', 'Cathrine', 'Cathryn', 'Cathy', 'Cayla', 'Cecelia', 'Cecile', 'Cecilia', 'Celestine', 'Celia', 'Celine', 'Chanel', 'Chanelle', 'Charity', 'Charlene', 'Charlotte', 'Chasity', 'Chaya', 'Chelsea', 'Chelsie', 'Cheyanne', 'Cheyenne', 'Chloe', 'Christa', 'Christelle', 'Christiana', 'Christina', 'Christine', 'Christy', 'Chyna', 'Ciara', 'Cierra', 'Cindy', 'Citlalli', 'Claire', 'Clara', 'Clarabelle', 'Clare', 'Clarissa', 'Claudia', 'Claudie', 'Claudine', 'Clementina', 'Clementine', 'Clemmie', 'Cleora', 'Cleta', 'Clotilde', 'Colleen', 'Concepcion', 'Connie', 'Constance', 'Cora', 'Coralie', 'Cordia', 'Cordie', 'Corene', 'Corine', 'Corrine', 'Cortney', 'Courtney', 'Creola', 'Cristal', 'Crystal', 'Crystel', 'Cydney', 'Cynthia',
'Dahlia', 'Daija', 'Daisha', 'Daisy', 'Dakota', 'Damaris', 'Dana', 'Dandre', 'Daniela', 'Daniella', 'Danielle', 'Danika', 'Dannie', 'Danyka', 'Daphne', 'Daphnee', 'Daphney', 'Darby', 'Dariana', 'Darlene', 'Dasia', 'Dawn', 'Dayana', 'Dayna', 'Deanna', 'Deborah', 'Deja', 'Dejah', 'Delfina', 'Delia', 'Delilah', 'Della', 'Delores', 'Delpha', 'Delphia', 'Delphine', 'Delta', 'Demetris', 'Dena', 'Desiree', 'Dessie', 'Destany', 'Destinee', 'Destiney', 'Destini', 'Destiny', 'Diana', 'Dianna', 'Dina', 'Dixie', 'Dolly', 'Dolores', 'Domenica', 'Dominique', 'Donna', 'Dora', 'Dorothea', 'Dorothy', 'Dorris', 'Dortha', 'Dovie', 'Drew', 'Duane', 'Dulce',
'Earlene', 'Earline', 'Earnestine', 'Ebba', 'Ebony', 'Eda', 'Eden', 'Edna', 'Edwina', 'Edyth', 'Edythe', 'Effie', 'Eileen', 'Elaina', 'Elda', 'Eldora', 'Eldridge', 'Eleanora', 'Eleanore', 'Electa', 'Elena', 'Elenor', 'Elenora', 'Eleonore', 'Elfrieda', 'Eliane', 'Elinor', 'Elinore', 'Elisa', 'Elisabeth', 'Elise', 'Elisha', 'Elissa', 'Eliza', 'Elizabeth', 'Ella', 'Ellen', 'Ellie', 'Elmira', 'Elna', 'Elnora', 'Elody', 'Eloisa', 'Eloise', 'Elouise', 'Elsa', 'Else', 'Elsie', 'Elta', 'Elva', 'Elvera', 'Elvie', 'Elyse', 'Elyssa', 'Elza', 'Emelia', 'Emelie', 'Emely', 'Emie', 'Emilia', 'Emilie', 'Emily', 'Emma', 'Emmalee', 'Emmanuelle', 'Emmie', 'Emmy', 'Ena', 'Enola', 'Era', 'Erica', 'Ericka', 'Erika', 'Erna', 'Ernestina', 'Ernestine', 'Eryn', 'Esmeralda', 'Esperanza', 'Esta', 'Estefania', 'Estel', 'Estell', 'Estella', 'Estelle', 'Esther', 'Estrella', 'Etha', 'Ethelyn', 'Ethyl', 'Ettie', 'Eudora', 'Eugenia', 'Eula', 'Eulah', 'Eulalia', 'Euna', 'Eunice', 'Eva', 'Evalyn', 'Evangeline', 'Eve', 'Eveline', 'Evelyn', 'Everette', 'Evie',
'Fabiola', 'Fae', 'Fannie', 'Fanny', 'Fatima', 'Fay', 'Faye', 'Felicia', 'Felicita', 'Felicity', 'Felipa', 'Filomena', 'Fiona', 'Flavie', 'Fleta', 'Flo', 'Florence', 'Florida', 'Florine', 'Flossie', 'Frances', 'Francesca', 'Francisca', 'Freda', 'Frederique', 'Freeda', 'Freida', 'Frida', 'Frieda',
'Gabriella', 'Gabrielle', 'Gail', 'Genesis', 'Genevieve', 'Genoveva', 'Georgette', 'Georgiana', 'Georgianna', 'Geraldine', 'Gerda', 'Germaine', 'Gerry', 'Gertrude', 'Gia', 'Gilda', 'Gina', 'Giovanna', 'Gisselle', 'Gladyce', 'Gladys', 'Glenda', 'Glenna', 'Gloria', 'Golda', 'Grace', 'Gracie', 'Graciela', 'Gregoria', 'Greta', 'Gretchen', 'Guadalupe', 'Gudrun', 'Gwen', 'Gwendolyn',
'Hailee', 'Hailie', 'Halie', 'Hallie', 'Hanna', 'Hannah', 'Harmony', 'Hassie', 'Hattie', 'Haven', 'Haylee', 'Haylie', 'Heath', 'Heather', 'Heaven', 'Heidi', 'Helen', 'Helena', 'Helene', 'Helga', 'Hellen', 'Heloise', 'Henriette', 'Hermina', 'Herminia', 'Herta', 'Hertha', 'Hettie', 'Hilda', 'Hildegard', 'Hillary', 'Hilma', 'Hollie', 'Holly', 'Hope', 'Hortense', 'Hosea', 'Hulda',
'Icie', 'Ida', 'Idell', 'Idella', 'Ila', 'Ilene', 'Iliana', 'Ima', 'Imelda', 'Imogene', 'Ines', 'Irma', 'Isabel', 'Isabell', 'Isabella', 'Isabelle', 'Isobel', 'Itzel', 'Iva', 'Ivah', 'Ivory', 'Ivy', 'Izabella',
'Jacinthe', 'Jackeline', 'Jackie', 'Jacklyn', 'Jacky', 'Jaclyn', 'Jacquelyn', 'Jacynthe', 'Jada', 'Jade', 'Jadyn', 'Jaida', 'Jailyn', 'Jakayla', 'Jalyn', 'Jammie', 'Jana', 'Janae', 'Jane', 'Janelle', 'Janessa', 'Janet', 'Janice', 'Janie', 'Janis', 'Janiya', 'Jannie', 'Jany', 'Jaquelin', 'Jaqueline', 'Jaunita', 'Jayda', 'Jayne', 'Jazlyn', 'Jazmin', 'Jazmyn', 'Jazmyne', 'Jeanette', 'Jeanie', 'Jeanne', 'Jena', 'Jenifer', 'Jennie', 'Jennifer', 'Jennyfer', 'Jermaine', 'Jessica', 'Jessika', 'Jessyca', 'Jewel', 'Jewell', 'Joana', 'Joanie', 'Joanne', 'Joannie', 'Joanny', 'Jodie', 'Jody', 'Joelle', 'Johanna', 'Jolie', 'Jordane', 'Josefa', 'Josefina', 'Josephine', 'Josiane', 'Josianne', 'Josie', 'Joy', 'Joyce', 'Juana', 'Juanita', 'Jude', 'Judy', 'Julia', 'Juliana', 'Julianne', 'Julie', 'Juliet', 'June', 'Justina', 'Justine',
'Kaci', 'Kacie', 'Kaela', 'Kaelyn', 'Kaia', 'Kailee', 'Kailey', 'Kailyn', 'Kaitlin', 'Kaitlyn', 'Kali', 'Kallie', 'Kamille', 'Kara', 'Karelle', 'Karen', 'Kari', 'Kariane', 'Karianne', 'Karina', 'Karine', 'Karlee', 'Karli', 'Karlie', 'Karolann', 'Kasandra', 'Kasey', 'Kassandra', 'Katarina', 'Katelin', 'Katelyn', 'Katelynn', 'Katharina', 'Katherine', 'Katheryn', 'Kathleen', 'Kathlyn', 'Kathryn', 'Kathryne', 'Katlyn', 'Katlynn', 'Katrina', 'Katrine', 'Kattie', 'Kavon', 'Kaya', 'Kaycee', 'Kayla', 'Kaylah', 'Kaylee', 'Kayli', 'Kaylie', 'Kaylin', 'Keara', 'Keely', 'Keira', 'Kelli', 'Kellie', 'Kelly', 'Kelsi', 'Kelsie', 'Kendra', 'Kenna', 'Kenya', 'Kenyatta', 'Kiana', 'Kianna', 'Kiara', 'Kiarra', 'Kiera', 'Kimberly', 'Kira', 'Kirsten', 'Kirstin', 'Kitty', 'Krista', 'Kristin', 'Kristina', 'Kristy', 'Krystal', 'Krystel', 'Krystina', 'Kyla', 'Kylee', 'Kylie', 'Kyra',
'Lacey', 'Lacy', 'Laila', 'Laisha', 'Laney', 'Larissa', 'Laura', 'Lauren', 'Laurence', 'Lauretta', 'Lauriane', 'Laurianne', 'Laurie', 'Laurine', 'Laury', 'Lauryn', 'Lavada', 'Lavina', 'Lavinia', 'Lavonne', 'Layla', 'Lea', 'Leann', 'Leanna', 'Leanne', 'Leatha', 'Leda', 'Leila', 'Leilani', 'Lela', 'Lelah', 'Lelia', 'Lempi', 'Lenna', 'Lenora', 'Lenore', 'Leola', 'Leonie', 'Leonor', 'Leonora', 'Leora', 'Lera', 'Leslie', 'Lesly', 'Lessie', 'Leta', 'Letha', 'Letitia', 'Lexi', 'Lexie', 'Lia', 'Liana', 'Libbie', 'Libby', 'Lila', 'Lilian', 'Liliana', 'Liliane', 'Lilla', 'Lillian', 'Lilliana', 'Lillie', 'Lilly', 'Lily', 'Lilyan', 'Lina', 'Linda', 'Lindsay', 'Linnea', 'Linnie', 'Lisa', 'Lisette', 'Litzy', 'Liza', 'Lizeth', 'Lizzie', 'Lois', 'Lola', 'Lolita', 'Loma', 'Lonie', 'Lora', 'Loraine', 'Loren', 'Lorena', 'Lori', 'Lorine', 'Lorna', 'Lottie', 'Lou', 'Loyce', 'Lucie', 'Lucienne', 'Lucile', 'Lucinda', 'Lucy', 'Ludie', 'Lue', 'Luella', 'Luisa', 'Lulu', 'Luna', 'Lupe', 'Lura', 'Lurline', 'Luz', 'Lyda', 'Lydia', 'Lyla', 'Lynn', 'Lysanne',
'Mabel', 'Mabelle', 'Mable', 'Maci', 'Macie', 'Macy', 'Madaline', 'Madalyn', 'Maddison', 'Madeline', 'Madelyn', 'Madelynn', 'Madge', 'Madie', 'Madilyn', 'Madisyn', 'Madonna', 'Mae', 'Maegan', 'Maeve', 'Mafalda', 'Magali', 'Magdalen', 'Magdalena', 'Maggie', 'Magnolia', 'Maia', 'Maida', 'Maiya', 'Makayla', 'Makenzie', 'Malika', 'Malinda', 'Mallie', 'Malvina', 'Mandy', 'Mara', 'Marcelina', 'Marcella', 'Marcelle', 'Marcia', 'Margaret', 'Margarete', 'Margarett', 'Margaretta', 'Margarette', 'Margarita', 'Marge', 'Margie', 'Margot', 'Margret', 'Marguerite', 'Maria', 'Mariah', 'Mariam', 'Marian', 'Mariana', 'Mariane', 'Marianna', 'Marianne', 'Maribel', 'Marie', 'Mariela', 'Marielle', 'Marietta', 'Marilie', 'Marilou', 'Marilyne', 'Marina', 'Marion', 'Marisa', 'Marisol', 'Maritza', 'Marjolaine', 'Marjorie', 'Marjory', 'Marlee', 'Marlen', 'Marlene', 'Marquise', 'Marta', 'Martina', 'Martine', 'Mary', 'Maryam', 'Maryjane', 'Maryse', 'Mathilde', 'Matilda', 'Matilde', 'Mattie', 'Maud', 'Maude', 'Maudie', 'Maureen', 'Maurine', 'Maxie', 'Maximillia', 'May', 'Maya', 'Maybell', 'Maybelle', 'Maye', 'Maymie', 'Mayra', 'Mazie', 'Mckayla', 'Meagan', 'Meaghan', 'Meda', 'Megane', 'Meggie', 'Meghan', 'Melba', 'Melisa', 'Melissa', 'Mellie', 'Melody', 'Melyna', 'Melyssa', 'Mercedes', 'Meredith', 'Mertie', 'Meta', 'Mia', 'Micaela', 'Michaela', 'Michele', 'Michelle', 'Mikayla', 'Millie', 'Mina', 'Minerva', 'Minnie', 'Miracle', 'Mireille', 'Mireya', 'Missouri', 'Misty', 'Mittie', 'Modesta', 'Mollie', 'Molly', 'Mona', 'Monica', 'Monique', 'Mossie', 'Mozell', 'Mozelle', 'Muriel', 'Mya', 'Myah', 'Mylene', 'Myra', 'Myriam', 'Myrna', 'Myrtice', 'Myrtie', 'Myrtis', 'Myrtle',
'Nadia', 'Nakia', 'Name', 'Nannie', 'Naomi', 'Naomie', 'Natalia', 'Natalie', 'Natasha', 'Nayeli', 'Nedra', 'Neha', 'Nelda', 'Nella', 'Nelle', 'Nellie', 'Neoma', 'Nettie', 'Neva', 'Nia', 'Nichole', 'Nicole', 'Nicolette', 'Nikita', 'Nikki', 'Nina', 'Noelia', 'Noemi', 'Noemie', 'Noemy', 'Nola', 'Nona', 'Nora', 'Norene', 'Norma', 'Nova', 'Novella', 'Nya', 'Nyah', 'Nyasia',
'Oceane', 'Ocie', 'Octavia', 'Odessa', 'Odie', 'Ofelia', 'Oleta', 'Olga', 'Ollie', 'Oma', 'Ona', 'Onie', 'Opal', 'Ophelia', 'Ora', 'Orie', 'Orpha', 'Otha', 'Otilia', 'Ottilie', 'Ova', 'Ozella',
'Paige', 'Palma', 'Pamela', 'Pansy', 'Pascale', 'Pasquale', 'Pat', 'Patience', 'Patricia', 'Patsy', 'Pattie', 'Paula', 'Pauline', 'Pearl', 'Pearlie', 'Pearline', 'Peggie', 'Penelope', 'Petra', 'Phoebe', 'Phyllis', 'Pink', 'Pinkie', 'Piper', 'Polly', 'Precious', 'Princess', 'Priscilla', 'Providenci', 'Prudence',
'Queen', 'Queenie',
'Rachael', 'Rachel', 'Rachelle', 'Rae', 'Raegan', 'Rafaela', 'Rahsaan', 'Raina', 'Ramona', 'Raphaelle', 'Raquel', 'Reanna', 'Reba', 'Rebeca', 'Rebecca', 'Rebeka', 'Rebekah', 'Reina', 'Renee', 'Ressie', 'Reta', 'Retha', 'Retta', 'Reva', 'Reyna', 'Rhea', 'Rhianna', 'Rhoda', 'Rita', 'River', 'Roberta', 'Robyn', 'Roma', 'Romaine', 'Rosa', 'Rosalee', 'Rosalia', 'Rosalind', 'Rosalinda', 'Rosalyn', 'Rosamond', 'Rosanna', 'Rose', 'Rosella', 'Roselyn', 'Rosemarie', 'Rosemary', 'Rosetta', 'Rosie', 'Rosina', 'Roslyn', 'Rossie', 'Rowena', 'Roxane', 'Roxanne', 'Rozella', 'Rubie', 'Ruby', 'Rubye', 'Ruth', 'Ruthe', 'Ruthie', 'Rylee',
'Sabina', 'Sabrina', 'Sabryna', 'Sadie', 'Sadye', 'Sallie', 'Sally', 'Salma', 'Samanta', 'Samantha', 'Samara', 'Sandra', 'Sandrine', 'Sandy', 'Santina', 'Sarah', 'Sarai', 'Sarina', 'Sasha', 'Savanah', 'Savanna', 'Savannah', 'Scarlett', 'Selena', 'Selina', 'Serena', 'Serenity', 'Shaina', 'Shakira', 'Shana', 'Shanel', 'Shanelle', 'Shania', 'Shanie', 'Shaniya', 'Shanna', 'Shannon', 'Shanny', 'Shanon', 'Shany', 'Sharon', 'Shawna', 'Shaylee', 'Shayna', 'Shea', 'Sheila', 'Shemar', 'Shirley', 'Shyann', 'Shyanne', 'Sibyl', 'Sienna', 'Sierra', 'Simone', 'Sincere', 'Sister', 'Skyla', 'Sonia', 'Sonya', 'Sophia', 'Sophie', 'Stacey', 'Stacy', 'Stefanie', 'Stella', 'Stephania', 'Stephanie', 'Stephany', 'Summer', 'Sunny', 'Susan', 'Susana', 'Susanna', 'Susie', 'Suzanne', 'Syble', 'Sydnee', 'Sydni', 'Sydnie', 'Sylvia',
'Tabitha', 'Talia', 'Tamara', 'Tamia', 'Tania', 'Tanya', 'Tara', 'Taryn', 'Tatyana', 'Taya', 'Teagan', 'Telly', 'Teresa', 'Tess', 'Tessie', 'Thalia', 'Thea', 'Thelma', 'Theodora', 'Theresa', 'Therese', 'Theresia', 'Thora', 'Tia', 'Tiana', 'Tianna', 'Tiara', 'Tierra', 'Tiffany', 'Tina', 'Tomasa', 'Tracy', 'Tressa', 'Tressie', 'Treva', 'Trinity', 'Trisha', 'Trudie', 'Trycia', 'Twila', 'Tyra',
'Una', 'Ursula',
'Vada', 'Valentina', 'Valentine', 'Valerie', 'Vallie', 'Vanessa', 'Veda', 'Velda', 'Vella', 'Velma', 'Velva', 'Vena', 'Verda', 'Verdie', 'Vergie', 'Verla', 'Verlie', 'Verna', 'Vernice', 'Vernie', 'Verona', 'Veronica', 'Vesta', 'Vicenta', 'Vickie', 'Vicky', 'Victoria', 'Vida', 'Vilma', 'Vincenza', 'Viola', 'Violet', 'Violette', 'Virgie', 'Virginia', 'Virginie', 'Vita', 'Viva', 'Vivian', 'Viviane', 'Vivianne', 'Vivien', 'Vivienne',
'Wanda', 'Wava', 'Wendy', 'Whitney', 'Wilhelmine', 'Willa', 'Willie', 'Willow', 'Wilma', 'Winifred', 'Winnifred', 'Winona',
'Yadira', 'Yasmeen', 'Yasmin', 'Yasmine', 'Yazmin', 'Yesenia', 'Yessenia', 'Yolanda', 'Yoshiko', 'Yvette', 'Yvonne',
'Zaria', 'Zelda', 'Zella', 'Zelma', 'Zena', 'Zetta', 'Zita', 'Zoe', 'Zoey', 'Zoie', 'Zoila', 'Zola', 'Zora', 'Zula'
];
protected static array $lastName = [
'Abbott', 'Abernathy', 'Abshire', 'Adams', 'Altenwerth', 'Anderson', 'Ankunding', 'Armstrong', 'Auer', 'Aufderhar',
'Bahringer', 'Bailey', 'Balistreri', 'Barrows', 'Bartell', 'Bartoletti', 'Barton', 'Bashirian', 'Batz', 'Bauch', 'Baumbach', 'Bayer', 'Beahan', 'Beatty', 'Bechtelar', 'Becker', 'Bednar', 'Beer', 'Beier', 'Berge', 'Bergnaum', 'Bergstrom', 'Bernhard', 'Bernier', 'Bins', 'Blanda', 'Blick', 'Block', 'Bode', 'Boehm', 'Bogan', 'Bogisich', 'Borer', 'Bosco', 'Botsford', 'Boyer', 'Boyle', 'Bradtke', 'Brakus', 'Braun', 'Breitenberg', 'Brekke', 'Brown', 'Bruen', 'Buckridge',
'Carroll', 'Carter', 'Cartwright', 'Casper', 'Cassin', 'Champlin', 'Christiansen', 'Cole', 'Collier', 'Collins', 'Conn', 'Connelly', 'Conroy', 'Considine', 'Corkery', 'Cormier', 'Corwin', 'Cremin', 'Crist', 'Crona', 'Cronin', 'Crooks', 'Cruickshank', 'Cummerata', 'Cummings',
'Dach', 'D\'Amore', 'Daniel', 'Dare', 'Daugherty', 'Davis', 'Deckow', 'Denesik', 'Dibbert', 'Dickens', 'Dicki', 'Dickinson', 'Dietrich', 'Donnelly', 'Dooley', 'Douglas', 'Doyle', 'DuBuque', 'Durgan',
'Ebert', 'Effertz', 'Eichmann', 'Emard', 'Emmerich', 'Erdman', 'Ernser',
'Fadel', 'Fahey', 'Farrell', 'Fay', 'Feeney', 'Feest', 'Feil', 'Ferry', 'Fisher', 'Flatley', 'Frami', 'Franecki', 'Friesen', 'Fritsch', 'Funk',
'Gaylord', 'Gerhold', 'Gerlach', 'Gibson', 'Gislason', 'Gleason', 'Gleichner', 'Glover', 'Goldner', 'Goodwin', 'Gorczany', 'Gottlieb', 'Goyette', 'Grady', 'Graham', 'Grant', 'Green', 'Greenfelder', 'Greenholt', 'Grimes', 'Gulgowski', 'Gusikowski', 'Gutkowski', 'Gutmann',
'Haag', 'Hackett', 'Hagenes', 'Hahn', 'Haley', 'Halvorson', 'Hamill', 'Hammes', 'Hand', 'Hane', 'Hansen', 'Harber', 'Harris', 'Hartmann', 'Harvey', 'Hauck', 'Hayes', 'Heaney', 'Heathcote', 'Hegmann', 'Heidenreich', 'Heller', 'Herman', 'Hermann', 'Hermiston', 'Herzog', 'Hessel', 'Hettinger', 'Hickle', 'Hill', 'Hills', 'Hilpert', 'Hintz', 'Hirthe', 'Hodkiewicz', 'Hoeger', 'Homenick', 'Hoppe', 'Howe', 'Howell', 'Hudson', 'Huel', 'Huels', 'Hyatt',
'Jacobi', 'Jacobs', 'Jacobson', 'Jakubowski', 'Jaskolski', 'Jast', 'Jenkins', 'Jerde', 'Johns', 'Johnson', 'Johnston', 'Jones',
'Kassulke', 'Kautzer', 'Keebler', 'Keeling', 'Kemmer', 'Kerluke', 'Kertzmann', 'Kessler', 'Kiehn', 'Kihn', 'Kilback', 'King', 'Kirlin', 'Klein', 'Kling', 'Klocko', 'Koch', 'Koelpin', 'Koepp', 'Kohler', 'Konopelski', 'Koss', 'Kovacek', 'Kozey', 'Krajcik', 'Kreiger', 'Kris', 'Kshlerin', 'Kub', 'Kuhic', 'Kuhlman', 'Kuhn', 'Kulas', 'Kunde', 'Kunze', 'Kuphal', 'Kutch', 'Kuvalis',
'Labadie', 'Lakin', 'Lang', 'Langosh', 'Langworth', 'Larkin', 'Larson', 'Leannon', 'Lebsack', 'Ledner', 'Leffler', 'Legros', 'Lehner', 'Lemke', 'Lesch', 'Leuschke', 'Lind', 'Lindgren', 'Littel', 'Little', 'Lockman', 'Lowe', 'Lubowitz', 'Lueilwitz', 'Luettgen', 'Lynch',
'Macejkovic', 'Maggio', 'Mann', 'Mante', 'Marks', 'Marquardt', 'Marvin', 'Mayer', 'Mayert', 'McClure', 'McCullough', 'McDermott', 'McGlynn', 'McKenzie', 'McLaughlin', 'Medhurst', 'Mertz', 'Metz', 'Miller', 'Mills', 'Mitchell', 'Moen', 'Mohr', 'Monahan', 'Moore', 'Morar', 'Morissette', 'Mosciski', 'Mraz', 'Mueller', 'Muller', 'Murazik', 'Murphy', 'Murray',
'Nader', 'Nicolas', 'Nienow', 'Nikolaus', 'Nitzsche', 'Nolan',
'Oberbrunner', 'O\'Connell', 'O\'Conner', 'O\'Hara', 'O\'Keefe', 'O\'Kon', 'Okuneva', 'Olson', 'Ondricka', 'O\'Reilly', 'Orn', 'Ortiz', 'Osinski',
'Pacocha', 'Padberg', 'Pagac', 'Parisian', 'Parker', 'Paucek', 'Pfannerstill', 'Pfeffer', 'Pollich', 'Pouros', 'Powlowski', 'Predovic', 'Price', 'Prohaska', 'Prosacco', 'Purdy',
'Quigley', 'Quitzon',
'Rath', 'Ratke', 'Rau', 'Raynor', 'Reichel', 'Reichert', 'Reilly', 'Reinger', 'Rempel', 'Renner', 'Reynolds', 'Rice', 'Rippin', 'Ritchie', 'Robel', 'Roberts', 'Rodriguez', 'Rogahn', 'Rohan', 'Rolfson', 'Romaguera', 'Roob', 'Rosenbaum', 'Rowe', 'Ruecker', 'Runolfsdottir', 'Runolfsson', 'Runte', 'Russel', 'Rutherford', 'Ryan',
'Sanford', 'Satterfield', 'Sauer', 'Sawayn', 'Schaden', 'Schaefer', 'Schamberger', 'Schiller', 'Schimmel', 'Schinner', 'Schmeler', 'Schmidt', 'Schmitt', 'Schneider', 'Schoen', 'Schowalter', 'Schroeder', 'Schulist', 'Schultz', 'Schumm', 'Schuppe', 'Schuster', 'Senger', 'Shanahan', 'Shields', 'Simonis', 'Sipes', 'Skiles', 'Smith', 'Smitham', 'Spencer', 'Spinka', 'Sporer', 'Stamm', 'Stanton', 'Stark', 'Stehr', 'Steuber', 'Stiedemann', 'Stokes', 'Stoltenberg', 'Stracke', 'Streich', 'Stroman', 'Strosin', 'Swaniawski', 'Swift',
'Terry', 'Thiel', 'Thompson', 'Tillman', 'Torp', 'Torphy', 'Towne', 'Toy', 'Trantow', 'Tremblay', 'Treutel', 'Tromp', 'Turcotte', 'Turner',
'Ullrich', 'Upton',
'Vandervort', 'Veum', 'Volkman', 'Von', 'VonRueden',
'Waelchi', 'Walker', 'Walsh', 'Walter', 'Ward', 'Waters', 'Watsica', 'Weber', 'Wehner', 'Weimann', 'Weissnat', 'Welch', 'West', 'White', 'Wiegand', 'Wilderman', 'Wilkinson', 'Will', 'Williamson', 'Willms', 'Windler', 'Wintheiser', 'Wisoky', 'Wisozk', 'Witting', 'Wiza', 'Wolf', 'Wolff', 'Wuckert', 'Wunsch', 'Wyman',
'Yost', 'Yundt',
'Zboncak', 'Zemlak', 'Ziemann', 'Zieme', 'Zulauf'
];
protected static array $suffix = ['Jr.', 'Sr.', 'I', 'II', 'III', 'IV', 'V', 'MD', 'DDS', 'PhD', 'DVM'];
/**
* @example 'PhD'
*/
public static function suffix()
{
return static::randomElement(static::$suffix);
}
/**
* @throws \Exception
* @example '123-45-6789'
*/
public static function ssn(): string
{
$area = random_int(0, 1) ? static::numberBetween(1, 665) : static::numberBetween(667, 899);
$group = static::numberBetween(1, 99);
$serial = static::numberBetween(1, 9999);
return sprintf("%03d-%02d-%04d", $area, $group, $serial);
}
}

View File

@@ -0,0 +1,112 @@
<?php
namespace Siteworx\Faker\Provider\en_US;
class PhoneNumber extends \Siteworx\Faker\Provider\PhoneNumber
{
/**
* @see https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#United_States.2C_Canada.2C_and_other_NANP_countries
*/
protected static $formats = array(
// International format
'+1-{{areaCode}}-{{exchangeCode}}-####',
'+1 ({{areaCode}}) {{exchangeCode}}-####',
'+1-{{areaCode}}-{{exchangeCode}}-####',
'+1.{{areaCode}}.{{exchangeCode}}.####',
'+1{{areaCode}}{{exchangeCode}}####',
// Standard formats
'{{areaCode}}-{{exchangeCode}}-####',
'({{areaCode}}) {{exchangeCode}}-####',
'1-{{areaCode}}-{{exchangeCode}}-####',
'{{areaCode}}.{{exchangeCode}}.####',
'{{areaCode}}-{{exchangeCode}}-####',
'({{areaCode}}) {{exchangeCode}}-####',
'1-{{areaCode}}-{{exchangeCode}}-####',
'{{areaCode}}.{{exchangeCode}}.####',
// Extensions
'{{areaCode}}-{{exchangeCode}}-#### x###',
'({{areaCode}}) {{exchangeCode}}-#### x###',
'1-{{areaCode}}-{{exchangeCode}}-#### x###',
'{{areaCode}}.{{exchangeCode}}.#### x###',
'{{areaCode}}-{{exchangeCode}}-#### x####',
'({{areaCode}}) {{exchangeCode}}-#### x####',
'1-{{areaCode}}-{{exchangeCode}}-#### x####',
'{{areaCode}}.{{exchangeCode}}.#### x####',
'{{areaCode}}-{{exchangeCode}}-#### x#####',
'({{areaCode}}) {{exchangeCode}}-#### x#####',
'1-{{areaCode}}-{{exchangeCode}}-#### x#####',
'{{areaCode}}.{{exchangeCode}}.#### x#####'
);
/**
* @see https://en.wikipedia.org/wiki/Toll-free_telephone_number#United_States
*/
protected static $tollFreeAreaCodes = array(
800, 844, 855, 866, 877, 888
);
protected static $tollFreeFormats = array(
// Standard formats
'{{tollFreeAreaCode}}-{{exchangeCode}}-####',
'({{tollFreeAreaCode}}) {{exchangeCode}}-####',
'1-{{tollFreeAreaCode}}-{{exchangeCode}}-####',
'{{tollFreeAreaCode}}.{{exchangeCode}}.####',
);
public function tollFreeAreaCode()
{
return self::randomElement(static::$tollFreeAreaCodes);
}
public function tollFreePhoneNumber()
{
$format = self::randomElement(static::$tollFreeFormats);
return self::numerify($this->generator->parse($format));
}
/**
* NPA-format area code
*
* @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system
*
* @return string
*/
public static function areaCode()
{
$digits = [];
$digits[] = self::numberBetween(2, 9);
$digits[] = self::randomDigit();
$digits[] = self::randomDigitNot($digits[1]);
return join('', $digits);
}
/**
* NXX-format central office exchange code
*
* @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system
*
* @return string
*/
public static function exchangeCode()
{
$digits = [];
$digits[] = self::numberBetween(2, 9);
$digits[] = self::randomDigit();
if ($digits[1] === 1) {
$digits[] = self::randomDigitNot(1);
} else {
$digits[] = self::randomDigit();
}
return implode('', $digits);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
<?php
namespace Siteworx\Faker;
/**
* Proxy for other generators, to return only unique values. Works with
* Faker\Generator\Base->unique()
*/
class UniqueGenerator
{
protected Generator $generator;
protected int $maxRetries;
protected array $uniques = [];
/**
* @param Generator $generator
* @param integer $maxRetries
*/
public function __construct(Generator $generator, int $maxRetries = 10000)
{
$this->generator = $generator;
$this->maxRetries = $maxRetries;
}
/**
* Catch and proxy all generator calls but return only unique values
* @param string $attribute
* @return mixed
*/
public function __get(string $attribute)
{
return $this->__call($attribute, array());
}
public function __isset($name)
{
}
public function __set(string $key, $value)
{
throw new \RuntimeException('Faker is immutable');
}
/**
* Catch and proxy all generator calls with arguments but return only unique values
* @param string $name
* @param array $arguments
* @return mixed
*/
public function __call(string $name, array $arguments)
{
if (!isset($this->uniques[$name])) {
$this->uniques[$name] = array();
}
$i = 0;
do {
$res = call_user_func_array(array($this->generator, $name), $arguments);
$i++;
if ($i > $this->maxRetries) {
throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a unique value', $this->maxRetries));
}
} while (array_key_exists(serialize($res), $this->uniques[$name]));
$this->uniques[$name][serialize($res)] = null;
return $res;
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace Siteworx\Faker;
/**
* Proxy for other generators, to return only valid values. Works with
* Faker\Generator\Base->valid()
*/
class ValidGenerator
{
protected Generator $generator;
protected $validator;
protected int $maxRetries;
/**
* @param Generator $generator
* @param callable|null $validator
* @param integer $maxRetries
*/
public function __construct(Generator $generator, callable $validator = null, int $maxRetries = 10000)
{
if (is_null($validator)) {
$validator = static function () {
return true;
};
} elseif (!is_callable($validator)) {
throw new \InvalidArgumentException('valid() only accepts callables as first argument');
}
$this->generator = $generator;
$this->validator = $validator;
$this->maxRetries = $maxRetries;
}
/**
* Catch and proxy all generator calls but return only valid values
* @param string $attribute
*
* @return mixed
*/
public function __get(string $attribute)
{
return $this->__call($attribute, array());
}
public function __isset($name)
{
}
public function __set($name, $value)
{
throw new \RuntimeException('Faker is immutable');
}
/**
* Catch and proxy all generator calls with arguments but return only valid values
* @param string $name
* @param array $arguments
*
* @return mixed
*/
public function __call(string $name, array $arguments)
{
$i = 0;
do {
$res = call_user_func_array(array($this->generator, $name), $arguments);
$i++;
if ($i > $this->maxRetries) {
throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a valid value', $this->maxRetries));
}
} while (!call_user_func($this->validator, $res));
return $res;
}
}