Completed
Pull Request — master (#80)
by John
03:04
created

JmsSerializerFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A factory() 0 6 1
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\SwaggerBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
namespace KleijnWeb\SwaggerBundle\Serialize\Serializer\Factory;
9
10
use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy;
11
use JMS\Serializer\Naming\SerializedNameAnnotationStrategy;
12
use JMS\Serializer\Serializer;
13
use JMS\Serializer\SerializerBuilder;
14
15
/**
16
 * Creates a JMS Serializer with defaults
17
 *
18
 * @author John Kleijn <[email protected]>
19
 */
20
class JmsSerializerFactory
21
{
22
    /**
23
     * @return Serializer
24
     */
25
    public static function factory(): Serializer
26
    {
27
        return SerializerBuilder::create()
28
            ->setPropertyNamingStrategy(new SerializedNameAnnotationStrategy(new IdenticalPropertyNamingStrategy()))
29
            ->build();
30
    }
31
}
32