Completed
Push — master ( 9b68ef...a4ed0c )
by Alex
17s queued 13s
created

BuildServiceStdClassFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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