Completed
Push — master ( 08635e...dd4786 )
by Nil
10:03
created

JsonApiSerializer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A serializeObject() 0 9 2
1
<?php
2
3
/**
4
 * Author: Nil Portugués Calderó <[email protected]>
5
 * Date: 8/16/15
6
 * Time: 4:43 AM.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace NilPortugues\Laravel5\JsonApi;
13
14
use NilPortugues\Serializer\Drivers\Eloquent\EloquentDriver;
15
16
/**
17
 * Class JsonApiSerializer.
18
 */
19
class JsonApiSerializer extends \NilPortugues\Api\JsonApi\JsonApiSerializer
20
{
21
    /**
22
     * Extract the data from an object.
23
     *
24
     * @param mixed $value
25
     *
26
     * @return array
27
     */
28
    protected function serializeObject($value)
29
    {
30
        $serialized = EloquentDriver::serialize($value);
31
        if ($value !== $serialized) {
32
            return $serialized;
33
        }
34
35
        return parent::serializeObject($value);
36
    }
37
}
38