Passed
Push — master ( dbf047...1b561f )
by Daniel
02:26
created

UuidRamseyServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 5
c 1
b 0
f 1
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A registerUuidGenerator() 0 7 1
A register() 0 3 1
1
<?php
2
3
namespace Jellyfish\UuidRamsey;
4
5
use Jellyfish\Uuid\UuidConstants;
6
use Pimple\Container;
7
use Pimple\ServiceProviderInterface;
8
use Ramsey\Uuid\UuidFactory;
9
10
class UuidRamseyServiceProvider implements ServiceProviderInterface
11
{
12
    /**
13
     * @param \Pimple\Container $container
14
     *
15
     * @return void
16
     */
17
    public function register(Container $container): void
18
    {
19
        $this->registerUuidGenerator($container);
20
    }
21
22
    /**
23
     * @param \Pimple\Container $container
24
     *
25
     * @return \Jellyfish\UuidRamsey\UuidRamseyServiceProvider
26
     */
27
    protected function registerUuidGenerator(Container $container): UuidRamseyServiceProvider
28
    {
29
        $container->offsetSet(UuidConstants::CONTAINER_KEY_UUID_GENERATOR, static function () {
30
            return new UuidGenerator(new UuidFactory());
31
        });
32
33
        return $this;
34
    }
35
}
36