Completed
Push — master ( 111bcd...99ca87 )
by Andrey
26:30
created

JsonDeserializationVisitorFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/jms-serializer-module
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\JmsSerializerModule\Visitor;
7
8
use JMS\Serializer\JsonDeserializationVisitor;
9
use Zend\ServiceManager\FactoryInterface;
10
use Zend\ServiceManager\MutableCreationOptionsInterface;
11
use Zend\ServiceManager\MutableCreationOptionsTrait;
12
use Zend\ServiceManager\ServiceLocatorInterface;
13
14
/**
15
 * Class JsonDeserializationVisitorFactory
16
 *
17
 * @package Nnx\JmsSerializerModule\Visitor
18
 */
19
class JsonDeserializationVisitorFactory implements FactoryInterface, MutableCreationOptionsInterface
20
{
21
    use MutableCreationOptionsTrait, NamingStrategyTrait;
22
23
    /**
24
     * @param ServiceLocatorInterface $serviceLocator
25
     *
26
     * @return JsonDeserializationVisitor
27
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
28
     * @throws \Nnx\JmsSerializerModule\Visitor\Exception\RuntimeException
29
     */
30
    public function createService(ServiceLocatorInterface $serviceLocator)
31
    {
32
        $namingStrategy = $this->getNamingStrategyFromContainer($serviceLocator);
33
34
        return new JsonDeserializationVisitor($namingStrategy);
35
    }
36
}
37