Completed
Push — master ( 1a65d7...018a8e )
by Nil
03:48
created

EmployeesTransformer::getHideProperties()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * Author: Nil Portugués Calderó <[email protected]>
4
 * Date: 11/14/15
5
 * Time: 12:24 AM.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace NilPortugues\Tests\App\Transformers;
12
13
use NilPortugues\Api\Mappings\JsonApiMapping;
14
use NilPortugues\Tests\App\Models\Employees;
15
16
/**
17
 * Class EmployeesTransformer.
18
 */
19
class EmployeesTransformer implements JsonApiMapping
20
{
21
    /**
22
     * Returns a string with the full class name, including namespace.
23
     *
24
     * @return string
25
     */
26
    public function getClass()
27
    {
28
        return Employees::class;
29
    }
30
31
    /**
32
     * Returns a string representing the resource name as it will be shown after the mapping.
33
     *
34
     * @return string
35
     */
36
    public function getAlias()
37
    {
38
        return 'employee';
39
    }
40
41
    /**
42
     * Returns an array of properties that will be renamed.
43
     * Key is current property from the class. Value is the property's alias name.
44
     *
45
     * @return array
46
     */
47
    public function getAliasedProperties()
48
    {
49
        return [
50
            'last_name' => 'surname',
51
52
        ];
53
    }
54
55
    /**
56
     * List of properties in the class that will be ignored by the mapping.
57
     *
58
     * @return array
59
     */
60
    public function getHideProperties()
61
    {
62
        return [
63
            'attachments',
64
        ];
65
    }
66
67
    /**
68
     * Returns an array of properties that are used as an ID value.
69
     *
70
     * @return array
71
     */
72
    public function getIdProperties()
73
    {
74
        return ['id'];
75
    }
76
77
    /**
78
     * Returns a list of URLs. This urls must have placeholders to be replaced with the getIdProperties() values.
79
     *
80
     * @return array
81
     */
82
    public function getUrls()
83
    {
84
        return [
85
            'self' => ['name' => 'employees.get'],
86
            'employees' => ['name' => 'employees.list'],
87
            'employee_orders' => ['name' => 'employees.orders', 'as_id' => 'id'],
88
        ];
89
    }
90
91
    /**
92
     * Returns an array containing the relationship mappings as an array.
93
     * Key for each relationship defined must match a property of the mapped class.
94
     *
95
     * @return array
96
     */
97
    public function getRelationships()
98
    {
99
        return [];
100
    }
101
}
102