Passed
Pull Request — master (#10)
by Alex
03:42 queued 01:35
created

BuildServiceStdClassFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArpTest\LaminasFactory\TestDouble;
6
7
use Arp\LaminasFactory\AbstractFactory;
8
use Laminas\ServiceManager\ServiceLocatorInterface;
9
use Psr\Container\ContainerExceptionInterface;
10
use Psr\Container\ContainerInterface;
11
12
class BuildServiceStdClassFactory extends AbstractFactory
13
{
14
    /**
15
     * @param array<mixed>|null $factoryOptions
16
     */
17
    public function __construct(private readonly mixed $dependency, array $factoryOptions = null)
18
    {
19
        parent::__construct($factoryOptions);
20
    }
21
22
    /**
23
     * @param ContainerInterface&ServiceLocatorInterface $container
24
     *
25
     * @throws ContainerExceptionInterface
26
     */
27
    public function __invoke(ContainerInterface $container, string $requestedName, array $options = null): \StdClass
28
    {
29
        $dependency = $this->buildService($container, $this->dependency, $options, $requestedName);
30
31
        $service = new \stdClass();
32
        $service->dependency = $dependency;
33
34
        return $service;
35
    }
36
}
37