XmlSerializationVisitorFactory::createService()   A
last analyzed

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\XmlSerializationVisitor;
9
use Zend\ServiceManager\FactoryInterface;
10
use Zend\ServiceManager\MutableCreationOptionsInterface;
11
use Zend\ServiceManager\MutableCreationOptionsTrait;
12
use Zend\ServiceManager\ServiceLocatorInterface;
13
14
15
/**
16
 * Class XmlSerializationVisitorFactory
17
 *
18
 * @package Nnx\JmsSerializerModule\Visitor
19
 */
20
class XmlSerializationVisitorFactory implements FactoryInterface, MutableCreationOptionsInterface
21
{
22
    use MutableCreationOptionsTrait, NamingStrategyTrait;
23
24
    /**
25
     * @param ServiceLocatorInterface $serviceLocator
26
     *
27
     * @return XmlSerializationVisitor
28
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
29
     * @throws \Nnx\JmsSerializerModule\Visitor\Exception\RuntimeException
30
     */
31
    public function createService(ServiceLocatorInterface $serviceLocator)
32
    {
33
        $namingStrategy = $this->getNamingStrategyFromContainer($serviceLocator);
34
35
        return new XmlSerializationVisitor($namingStrategy);
36
    }
37
}
38