ThrowableStreamFactoryFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * This file is part of coisa/error-handler.
5
 *
6
 * (c) Felipe Sayão Lobato Abreu <[email protected]>
7
 *
8
 * This source file is subject to the license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
declare(strict_types=1);
13
14
namespace CoiSA\ErrorHandler\Container\Factory;
15
16
use CoiSA\ErrorHandler\Handler\ThrowableHandlerInterface;
17
use CoiSA\ErrorHandler\Http\Message\ThrowableStreamFactory;
18
use Psr\Container\ContainerInterface;
19
use Psr\Http\Message\StreamFactoryInterface;
20
21
/**
22
 * Class ThrowableStreamFactoryFactory
23
 *
24
 * @package CoiSA\ErrorHandler\Container\Factory
25
 */
26
final class ThrowableStreamFactoryFactory
27
{
28
    /**
29
     * @param ContainerInterface $container
30
     *
31
     * @return ThrowableStreamFactory
32
     */
33 19
    public function __invoke(ContainerInterface $container): ThrowableStreamFactory
34
    {
35 19
        $streamFactory    = $container->get(StreamFactoryInterface::class);
36 19
        $throwableHandler = $container->get(ThrowableHandlerInterface::class);
37
38 19
        return new ThrowableStreamFactory($streamFactory, $throwableHandler);
39
    }
40
}
41