Skip to content

jaroslavlibal/datetime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DateTime

Installation

Install package jaroslavlibal/datetime with Composer and register the parts you need as the services.

composer require jaroslavlibal/datetime

Factory

Retrieve the DateTime and DateTimeImmutable objects from the mockable and testable factory instead of direct new \DateTime() creation.

Usage

class Foo
{

   use JaroslavLibal\DateTime\Factory\DateTimeFactory;  
   use JaroslavLibal\DateTime\Factory\DateTimeFactory;  

   private DateTimeFactory;
   private DateTimeImmutableFactory;

   public function __construct(DateTimeFactory $dateTimeFactory, DateTimeImmutableFactory $dateTimeImmutableFactory)

   private function bar() {
      $dateTimeFactory->create();
      $dateTimeImmutableFactory->create();
   }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages