public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/web/inc/lib/vendor/psr/clock/README.md
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
# PSR Clock
3
This repository holds the interface for [PSR-20][psr-url].
5
Note that this is not a clock of its own. It is merely an interface that
6
describes a clock. See the specification for more details.
8
## Installation
10
```bash
11
composer require psr/clock
12
```
14
## Usage
16
If you need a clock, you can use the interface like this:
18
```php
19
<?php
21
use Psr\Clock\ClockInterface;
23
class Foo
24
{
25
private ClockInterface $clock;
27
public function __construct(ClockInterface $clock)
28
{
29
$this->clock = $clock;
30
}
32
public function doSomething()
33
{
34
/** @var DateTimeImmutable $currentDateAndTime */
35
$currentDateAndTime = $this->clock->now();
36
// do something useful with that information
37
}
38
}
39
```
41
You can then pick one of the [implementations][implementation-url] of the interface to get a clock.
43
If you want to implement the interface, you can require this package and
44
implement `Psr\Clock\ClockInterface` in your code.
46
Don't forget to add `psr/clock-implementation` to your `composer.json`s `provides`-section like this:
48
```json
49
{
50
"provides": {
51
"psr/clock-implementation": "1.0"
52
}
53
}
54
```
56
And please read the [specification text][specification-url] for details on the interface.
58
[psr-url]: https://www.php-fig.org/psr/psr-20
59
[package-url]: https://packagist.org/packages/psr/clock
60
[implementation-url]: https://packagist.org/providers/psr/clock-implementation
61
[specification-url]: https://github.com/php-fig/fig-standards/blob/master/proposed/clock.md