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

BuildServiceStdClassFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
eloc 1
nc 1
nop 2
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