JsonApiSerializer::serializeObject()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 2
eloc 3
nc 2
nop 1
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
32
        return ($value !== $serialized) ? $serialized : parent::serializeObject($value);
33
    }
34
}
35