Passed
Pull Request — master (#9)
by Alex
04:50 queued 02:14
created

GetServiceStdClassFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

2 Methods

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