From 1534ae7673b08e85a01c03d8f3706256cde0caba Mon Sep 17 00:00:00 2001 From: Gere Lajos Date: Sat, 20 Apr 2024 21:45:41 +0200 Subject: [PATCH] feat: add phone number, company, job title --- README.md | 4 ++++ src/Enums/MiscType.php | 3 +++ src/Meow.php | 24 ++++++++++++++++++++++-- src/dictionary/misc.csv | 3 +++ src/playground.php | 5 ++++- tests/MiscTest.php | 15 +++++++++++++++ 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b358abc..2b06d71 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,10 @@ $fullFemaleName = $meow->fullFemaleName(); // "Luna Furbridge" ```php $email = $meow->email(); // "agile.chester.461@acrobaticcats.net" $emails = $meow->emails(3); // ["agile.chester.461@acrobaticcats.net, leaping.phoebe.763@dociledome.com, soft.ruby.261@agilealley.io"] + +$phone = $meow->phone(); // "+61423832405" +$company = $meow->company(); // "Velvet Ventures S.E." +$jobTitle = $meow->jobTitle(); // "Soft Paws Therapist" ``` ### Generate words, sentences and paragraphs diff --git a/src/Enums/MiscType.php b/src/Enums/MiscType.php index 028366c..80457ad 100644 --- a/src/Enums/MiscType.php +++ b/src/Enums/MiscType.php @@ -6,6 +6,9 @@ enum MiscType: string { + case COMPANY = 'company'; + case COMPANY_SUFFIX = 'company_suffix'; case DOMAIN = 'domain'; + case JOBTITLE = 'jobtitle'; case LASTNAME = 'lastname'; } diff --git a/src/Meow.php b/src/Meow.php index 78afba7..25aa4b4 100644 --- a/src/Meow.php +++ b/src/Meow.php @@ -60,7 +60,7 @@ public function fullName(NameType $type = NameType::FULL): Item $firstName = $this->name($type); $lastName = $this->lastName(); - return new Item($firstName.' '.$lastName); + return new Item("$firstName $lastName"); } public function maleFullName(): Item @@ -78,13 +78,33 @@ public function fullNames(int $count = 1): Items return Randomizer::pickToArray(fn () => $this->fullName(), $count); } + public function phone(): Item + { + $phone = '+'.mt_rand(1, 9).mt_rand(100, 999).mt_rand(100, 999).mt_rand(1000, 9999); + + return new Item($phone); + } + + public function company(): Item + { + $company = Randomizer::pick($this->dictionary->misc(MiscType::COMPANY)); + $company_suffix = Randomizer::pick($this->dictionary->misc(MiscType::COMPANY_SUFFIX)); + + return new Item("$company $company_suffix"); + } + + public function jobTitle(): Item + { + return Randomizer::pick($this->dictionary->misc(MiscType::JOBTITLE)); + } + public function email(): Item { $adjective = Randomizer::pick($this->dictionary->words(WordType::ADJECTIVE)); $name = $this->name(); $number = mt_rand(1, 999); $domain = Randomizer::pick($this->dictionary->misc(MiscType::DOMAIN)); - $email = strtolower($adjective.'.'.$name.'.'.$number.'@'.$domain); + $email = strtolower("$adjective.$name.$number@$domain"); return new Item($email); } diff --git a/src/dictionary/misc.csv b/src/dictionary/misc.csv index 34c7490..1ef8022 100644 --- a/src/dictionary/misc.csv +++ b/src/dictionary/misc.csv @@ -1,2 +1,5 @@ +company:Whisker Widgets,Tabby Tech,Purrfect Products,Feline Finances,Claw Crafts,Mittens Media,Fluffy Fashions,Silky Supplies,Stripe Solutions,Spotlight Snacks,Furrow Foods,Snuggle Softwares,Tailor Textiles,Meow Marketing,Nimble Networks,Paw Print Publishing,Whisper Web,Velvet Ventures,Kitten Kits,Leap Logistics,Purrley Pharmaceuticals,Slinky Services,Blinkwell Beauty,Softpounce Spa,Tufted Textiles,Tiger Tools,Lynx Logistics,Manx Machines,Siamese Systems,Calico Creatives,Tortie Textures,Furbridge Furnishings,Furrish Furnitures,Vanish Valley Vines,Groom Grove Goods,Silkyrun Studios,Whisker Works,Napnest Naturals,Hissington Hardware,Fuzzy Fabrics,Pawprint Paper,Hairholt Hospitality,Catnip Consulting,Stretchstrand Sports,Snuggleshire Sweets,Springpaw Spirits,Purrplace Properties,Quickcliff Quilts,Mewmount Media,Scratchspring Supplies +company_suffix:Inc.,LLC,Ltd.,Co.,Corp.,GmbH,AG,Pty Ltd,S.A.,Oy,AB,AS,B.V.,S.P.A.,S.A.R.L.,Pvt. Ltd.,K.K.,A.S.,Zrt.,T.O.V.,Sdn Bhd,JSC,PLC,C.A.,S.L.,S.A.U.,S.r.l.,OÜ,N.V.,Ltda.,Kft.,A.G.,S.C.A.,e.V.,e.K.,A.E.,G.P.,L.P.,S.E.,S. en C.,C.C.,S.C.S.,K.D.,K.D.A.,G.I.E.,EEIG,Sp.z o.o.,T:mi,A.M.b.A.,R.L. domain:felinefun.com,purringpet.io,whiskerworld.net,tabbytales.com,fluffyfriends.io,slinkycat.net,curiouscats.com,nimbleneko.io,sleepysiamese.net,playfulpaws.com,stealthystalker.io,silkysoft.net,friskyfelines.com,sprysprings.io,plushpurr.net,alertwhiskers.com,agilealley.io,softsnuggles.net,velvetyvibes.com,gracefulgait.io,mysteriousmeows.net,glossycoat.com,stripedsaga.io,spottedsphynx.net,manxmanner.com,siamesesystem.io,calicocorner.net,tortietalk.com,shaggyshedders.io,bushytails.net,paddedpaws.com,feistyfurballs.io,acrobaticcats.net,elusiveears.com,inquisitiveinstincts.io,snugglysoft.net,dociledome.com,lithelynx.io,cunningcats.net,climbingclaws.com,hairyhackles.io,tuftedtails.net,freckledfur.com,rustlingragdolls.io,twitchingtails.net,blinkingbeauties.com,meowingmavens.io,crouchingcats.net,prowlingpet.com,leapinglynx.io +jobtitle:Chief Purring Officer,Cat Behavior Analyst,Feline Nutritionist,Whisker Consultant,Claw Management Specialist,Meow Marketing Director,Tabby Technician,Siamese Strategist,Fur Quality Inspector,Paw Product Manager,Litter Logistics Coordinator,Tail Talent Scout,Kitten Care Coordinator,Purr Publicist,Feline Fitness Trainer,Catnip Cultivation Expert,Scratching Post Designer,Naptime Network Engineer,Furry Friend Facilitator,Laser Pointer Specialist,Treat Tester,Whisker Welfare Worker,Soft Paws Therapist,Cat Cafe Manager,Agility Trainer for Cats,Rescue Relations Representative,Cat Show Judge,Meow Mixologist,Fluffy Fashion Advisor,Cat Toy Developer,Litter Box Innovator,Scratch Space Architect,Meow Meditation Instructor,Purr Programming Expert,Kitten Kindergarten Teacher,Catography Expert,Veterinary Visionary,Cat Content Curator,Feline Event Planner,Pawsitive Psychologist,Mew-sic Therapist,Cat Grooming Guru,Kitty Yoga Instructor,Paw-pularity Analyst,Furball Forecasting Analyst,Cat Whisperer,Feline Linguist,Scratching Strategist,Cat Community Organizer,Tuft Tactical Advisor lastname:Whiskerton,Tabbyfield,Purrington,Felinegrove,Clawson,Mittensworth,Fluffmoor,Silkytail,Stripeson,Spottymane,Furrow,Snuggleford,Tailor,Meowman,Nimblewick,Pawster,Whisperwill,Velvetvale,Kittenhall,Leapwood,Purrley,Slinkystreet,Blinkwell,Softpounce,Tuftcorner,Tigerton,Lynxley,Manxmont,Siameseplace,Calicocliff,Tortietown,Furbridge,Furrish,Vanishvale,Groomgrove,Silkyrun,Whiskerwind,Napnest,Hissington,Fuzzyfield,Pawprintpath,Hairholt,Catnipcorner,Stretchstrand,Snuggleshire,Springpaw,Purrplace,Quickcliff,Mewmount,Scratchspring diff --git a/src/playground.php b/src/playground.php index d01c658..6160b1c 100644 --- a/src/playground.php +++ b/src/playground.php @@ -16,9 +16,12 @@ echo 'More names: ' . implode(', ', $meow->names(5)->toArray()) . PHP_EOL; echo $separator . PHP_EOL; -// Generate an email +// Generate misc items echo 'An email: ' . $meow->email() . PHP_EOL; echo 'More emails: ' . implode(', ', $meow->emails(3)->toArray()) . PHP_EOL; +echo 'A phone number: ' . $meow->phone() . PHP_EOL; +echo 'A company: ' . $meow->company() . PHP_EOL; +echo 'A job title: ' . $meow->jobTitle() . PHP_EOL; // Generate a word echo 'A word: ' . $meow->word() . PHP_EOL; diff --git a/tests/MiscTest.php b/tests/MiscTest.php index 44f81aa..1d0c779 100644 --- a/tests/MiscTest.php +++ b/tests/MiscTest.php @@ -4,6 +4,7 @@ namespace GereLajos\MeowMaker\Tests; +use GereLajos\MeowMaker\Enums\MiscType; use GereLajos\MeowMaker\Meow; use GereLajos\MeowMaker\Structures\Item; use GereLajos\MeowMaker\Structures\Items; @@ -30,4 +31,18 @@ public function testItCanGenerateMoreEmails(): void $this->assertInstanceOf(Items::class, $this->meow->emails(10)); $this->assertCount(10, $this->meow->emails(10)); } + + public function testItCanGenerateCompany(): void + { + $company = $this->meow->company(); + $this->assertInstanceOf(Item::class, $company); + $this->assertIsString((string) $company); + } + + public function testItCangenerateJobTitle(): void + { + $jobTitle = $this->meow->jobTitle(); + $this->assertInstanceOf(Item::class, $jobTitle); + $this->assertContains((string) $jobTitle, $this->meow->dictionary->misc(MiscType::JOBTITLE)); + } }