Debian Codegraph @

vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php

raw
1 <?php
2 /**
3 * This file is part of the ramsey/uuid library
4 *
5 * For the full copyright and license information, please view the LICENSE
6 * file that was distributed with this source code.
7 *
8 * @copyright Copyright (c) Ben Ramsey <[email protected]>
9 * @license http://opensource.org/licenses/MIT MIT
10 * @link https://benramsey.com/projects/ramsey-uuid/ Documentation
11 * @link https://packagist.org/packages/ramsey/uuid Packagist
12 * @link https://github.com/ramsey/uuid GitHub
13 */
14
15 namespace Ramsey\Uuid\Builder;
16
17 use Ramsey\Uuid\Codec\CodecInterface;
18 use Ramsey\Uuid\Converter\NumberConverterInterface;
19 use Ramsey\Uuid\DegradedUuid;
20
21 /**
22 * DegradedUuidBuilder builds instances of DegradedUuid
23 */
24 class DegradedUuidBuilder implements UuidBuilderInterface
25 {
26 /**
27 * @var NumberConverterInterface
28 */
29 private $converter;
30
31 /**
32 * Constructs the DegradedUuidBuilder
33 *
34 * @param NumberConverterInterface $converter The number converter to use when constructing the DegradedUuid
35 */
36 public function __construct(NumberConverterInterface $converter)
37 {
38 $this->converter = $converter;
39 }
40
41 /**
42 * Builds a DegradedUuid
43 *
44 * @param CodecInterface $codec The codec to use for building this DegradedUuid
45 * @param array $fields An array of fields from which to construct the DegradedUuid;
46 * see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
47 * @return DegradedUuid
48 */
49 public function build(CodecInterface $codec, array $fields)
50 {
51 return new DegradedUuid($fields, $this->converter, $codec);
52 }
53 }