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

OrdersTransformer::getAlias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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\Orders;
15
16
/**
17
 * Class OrdersTransformer.
18
 */
19
class OrdersTransformer 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 Orders::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 'order';
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
    }
51
52
    /**
53
     * List of properties in the class that will be ignored by the mapping.
54
     *
55
     * @return array
56
     */
57
    public function getHideProperties()
58
    {
59
        return [
60
        ];
61
    }
62
63
    /**
64
     * Returns an array of properties that are used as an ID value.
65
     *
66
     * @return array
67
     */
68
    public function getIdProperties()
69
    {
70
        return ['id'];
71
    }
72
73
    /**
74
     * Returns a list of URLs. This urls must have placeholders to be replaced with the getIdProperties() values.
75
     *
76
     * @return array
77
     */
78
    public function getUrls()
79
    {
80
        return [
81
            'self' => ['name' => 'orders.get'],
82
            'employee' => ['name' => 'employees.get', 'as_id' => 'employee_id'],
83
        ];
84
    }
85
86
    /**
87
     * Returns an array containing the relationship mappings as an array.
88
     * Key for each relationship defined must match a property of the mapped class.
89
     *
90
     * @return array
91
     */
92
    public function getRelationships()
93
    {
94
        return [];
95
    }
96
}
97