Completed
Push — master ( 8c4272...ef6d68 )
by Thomas Mauro
11s
created

StackTraceFactory::__invoke()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 19
ccs 11
cts 11
cp 1
rs 9.4285
cc 3
eloc 11
nc 4
nop 1
crap 3
1
<?php
2
declare(strict_types=1);
3
4
namespace Facile\SentryModule\Service;
5
6
use Facile\Sentry\Common\StackTrace\StackTrace;
7
use Facile\Sentry\Common\StackTrace\StackTraceInterface;
8
use Facile\SentryModule\Options\ConfigurationInterface;
9
use Interop\Container\ContainerInterface;
10
use Raven_Client;
11
12
class StackTraceFactory
13
{
14 1
    public function __invoke(ContainerInterface $container): StackTraceInterface
15
    {
16
        /** @var Raven_Client $client */
17 1
        $client = $container->get(Raven_Client::class);
18
        /** @var ConfigurationInterface $configuration */
19 1
        $configuration = $container->get(ConfigurationInterface::class);
20
21 1
        $serializer = $container->has(\Raven_Serializer::class) ? $container->get(\Raven_Serializer::class) : null;
22 1
        $reprSerializer = $container->has(\Raven_ReprSerializer::class) ? $container->get(\Raven_ReprSerializer::class) : null;
23
24 1
        $stackTrace = new StackTrace(
25 1
            $client,
26 1
            $serializer,
27 1
            $reprSerializer,
28 1
            $configuration->getStackTraceOptions()->getIgnoreBacktraceNamespaces()
29
        );
30
31 1
        return $stackTrace;
32
    }
33
}
34