AbstractDataType::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Netdudes\DataSourceryBundle\DataType;
4
5
abstract class AbstractDataType implements DataTypeInterface
6
{
7
    /**
8
     * (PHP 5 &gt;= 5.4.0)<br/>
9
     * Specify data which should be serialized to JSON
10
     *
11
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
12
     * @return mixed data which can be serialized by <b>json_encode</b>,
13
     *               which is a value of any type other than a resource.
14
     */
15
    public function jsonSerialize()
16
    {
17
        return [
18
            'default' => $this->getDefaultFilterMethod(),
19
            'available' => $this->getAvailableFilterMethods(),
20
            'name' => $this->getName(),
0 ignored issues
show
Bug introduced by
Consider using $this->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
21
        ];
22
    }
23
24
    public function supports($method)
25
    {
26
        return in_array($method, $this->getAvailableFilterMethods(), true);
27
    }
28
}
29