dev-master
9999999-dev
beerware
The Requires
- php ~7.0
The Development Requires
by Marcin Czarnecki
Did you ever wonder how to control your time? This library is created for you!
It provides a Clock
interface that allows you to create current datetime in a controlled way!, (*1)
composer require scyzoryck/clock
The provided implementations of Clock
are:
- RealTimeClock
- always returns the real time.
- StoppedClock
- it always returns times that you have provided in constructor! Useful for tests.
- RunningClock
- as the previous one it use the time from constructor, but this time is running.
- TransactionalClock
- wrapper, that allows you to stop the time for some long running operations., (*2)
The method Clock::now()
returns an instance of \DateTimeImmutable
. You can use adapters if you need some others DateTime objects.
- MutableDateTimeClock
- creates an instance of \DateTime
, (*3)
composer install php vendor/bin/phpunit
beerware