Major refactoring cleanup: - Add new controller architecture (class-controller-*.php) - Add new settings-v2 UI (views/settings-v2/) - Add new CSS architecture (agentic-sidebar.css, tokens) - Add esbuild build pipeline (scripts/build.js, package.json) - Add composer dependencies (vendor/) - Add frontend src directory (assets/js/src/index.jsx) - Add documentation files - Remove old/obsolete files (class-settings.php, old CSS) This commits all pending changes from previous refactoring efforts.
58 lines
1.3 KiB
Markdown
58 lines
1.3 KiB
Markdown
Clock Component
|
|
===============
|
|
|
|
Symfony Clock decouples applications from the system clock.
|
|
|
|
Getting Started
|
|
---------------
|
|
|
|
```bash
|
|
composer require symfony/clock
|
|
```
|
|
|
|
```php
|
|
use Symfony\Component\Clock\NativeClock;
|
|
use Symfony\Component\Clock\ClockInterface;
|
|
|
|
class MyClockSensitiveClass
|
|
{
|
|
public function __construct(
|
|
private ClockInterface $clock,
|
|
) {
|
|
// Only if you need to force a timezone:
|
|
//$this->clock = $clock->withTimeZone('UTC');
|
|
}
|
|
|
|
public function doSomething()
|
|
{
|
|
$now = $this->clock->now();
|
|
// [...] do something with $now, which is a \DateTimeImmutable object
|
|
|
|
$this->clock->sleep(2.5); // Pause execution for 2.5 seconds
|
|
}
|
|
}
|
|
|
|
$clock = new NativeClock();
|
|
$service = new MyClockSensitiveClass($clock);
|
|
$service->doSomething();
|
|
```
|
|
|
|
Sponsor
|
|
-------
|
|
|
|
This package is looking for a [backer][1].
|
|
|
|
Help Symfony by [sponsoring][3] its development!
|
|
|
|
Resources
|
|
---------
|
|
|
|
* [Documentation](https://symfony.com/doc/current/components/clock.html)
|
|
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
|
|
* [Report issues](https://github.com/symfony/symfony/issues) and
|
|
[send Pull Requests](https://github.com/symfony/symfony/pulls)
|
|
in the [main Symfony repository](https://github.com/symfony/symfony)
|
|
|
|
[1]: https://symfony.com/backers
|
|
[3]: https://symfony.com/sponsor
|