orisai / clock
提供运行时当前时间以及可控的测试时间
1.2.1
2024-06-21 08:10 UTC
Requires
- php: 7.4 - 8.3
- orisai/exceptions: ^1.0.0
- psr/clock: ^1.0.0
Requires (Dev)
- brianium/paratest: ^6.3.0
- infection/infection: ^0.26.0|^0.27.0|^0.28.0|^0.29.0
- orisai/coding-standard: ^3.0.0
- phpstan/extension-installer: ^1.0.0
- phpstan/phpstan: ^1.0.0
- phpstan/phpstan-deprecation-rules: ^1.0.0
- phpstan/phpstan-nette: ^1.0.0
- phpstan/phpstan-phpunit: ^1.0.0
- phpstan/phpstan-strict-rules: ^1.0.0
- phpunit/phpunit: ^9.5.0
- staabm/annotate-pull-request-from-checkstyle: ^1.7.0
Provides
README
时钟
运行时当前时间提供者以及测试时可控时间提供者
兼容PSR-20
📄 请查看我们的文档。
💸 如果您喜欢Orisai,请捐款。谢谢!
use Orisai\Clock\Clock; use function Orisai\Clock\now; class ExampleService { private Clock $clock; public function __construct(Clock $clock) { $this->clock = $clock; } public function doSomething(): void { $currentTime = $this->clock->now(); // Or $currentTime = now(); } }