Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
/**
4
 * This file is part of the ramsey/uuid library
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
10
 * @license http://opensource.org/licenses/MIT MIT
11
 */
12
 
13
declare(strict_types=1);
14
 
15
namespace Ramsey\Uuid\Provider\Time;
16
 
17
use Ramsey\Uuid\Provider\TimeProviderInterface;
18
use Ramsey\Uuid\Type\Integer as IntegerObject;
19
use Ramsey\Uuid\Type\Time;
20
 
21
/**
22
 * FixedTimeProvider uses a known time to provide the time
23
 *
24
 * This provider allows the use of a previously-generated, or known, time
25
 * when generating time-based UUIDs.
26
 */
27
class FixedTimeProvider implements TimeProviderInterface
28
{
29
    public function __construct(private Time $time)
30
    {
31
    }
32
 
33
    /**
34
     * Sets the `usec` component of the time
35
     *
36
     * @param int|string|IntegerObject $value The `usec` value to set
37
     */
38
    public function setUsec($value): void
39
    {
40
        $this->time = new Time($this->time->getSeconds(), $value);
41
    }
42
 
43
    /**
44
     * Sets the `sec` component of the time
45
     *
46
     * @param int|string|IntegerObject $value The `sec` value to set
47
     */
48
    public function setSec($value): void
49
    {
50
        $this->time = new Time($value, $this->time->getMicroseconds());
51
    }
52
 
53
    public function getTime(): Time
54
    {
55
        return $this->time;
56
    }
57
}