Completed
Branch v2.0.0 (e47d62)
by Alexander
03:40
created

DomainClientService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Core\Domain;
4
5
use Phalcon\Di\AbstractInjectionAware;
6
use Symfony\Component\Serializer\Encoder\JsonEncoder;
7
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
8
use Symfony\Component\Serializer\Serializer;
9
10 View Code Duplication
class DomainClientService extends AbstractInjectionAware
11
{
12
    public function __construct($di)
13
    {
14
        $this->setDI($di);
15
    }
16
17
    protected function toJsonObject($object)
18
    {
19
        $serializer = new Serializer([new ObjectNormalizer()], [new JsonEncoder()]);
20
21
        return json_decode($serializer->serialize($object, 'json'));
22
    }
23
}
24