Completed
Branch master (8beae6)
by
unknown
08:59
created

EncodingParameters::getIncludePaths()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Neomerx\JsonApi\Encoder;
2
3
/**
4
 * Copyright 2015 [email protected] (www.neomerx.com)
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
use \Neomerx\JsonApi\Factories\Exceptions;
20
use \Neomerx\JsonApi\Contracts\Encoder\EncodingParametersInterface;
21
22
/**
23
 * @package Neomerx\JsonApi
24
 */
25
class EncodingParameters implements EncodingParametersInterface
26
{
27
    /**
28
     * @var array|null
29
     */
30
    private $includePaths;
31
32
    /**
33
     * @var array|null
34
     */
35
    private $fieldSets;
36
37
    /**
38
     * @param array|null $includePaths
39
     * @param array|null $fieldSets
40
     */
41 88
    public function __construct(array $includePaths = null, array $fieldSets = null)
42
    {
43 88
        $this->fieldSets    = $fieldSets;
44 88
        $this->includePaths = $includePaths;
45 88
    }
46
47
    /**
48
     * @inheritdoc
49
     */
50 72
    public function getIncludePaths()
51
    {
52 72
        return $this->includePaths;
53
    }
54
55
    /**
56
     * @inheritdoc
57
     */
58 19
    public function getFieldSets()
59
    {
60 19
        return $this->fieldSets;
61
    }
62
63
    /**
64
     * @inheritdoc
65
     */
66 52
    public function getFieldSet($type)
67
    {
68 52
        is_string($type) === true ?: Exceptions::throwInvalidArgument('type', $type);
69
70 52
        return (isset($this->fieldSets[$type]) === true ? $this->fieldSets[$type] : null);
71
    }
72
}
73