Completed
Push — master ( 7f6918...fb7822 )
by Matthew
02:21
created

AbstractResource::__construct()   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 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Matthew
5
 * Date: 21/04/2016
6
 * Time: 8:20 AM
7
 */
8
9
namespace Freshdesk\Resources;
10
11
12
use Freshdesk\Api;
13
14
abstract class AbstractResource
15
{
16
17
    /**
18
     * @var Api
19
     */
20
    protected $api;
21
22
    /**
23
     * @var String
24
     */
25
    protected $endpoint;
26
27
    /**
28
     * CompanyApi constructor.
29
     * @param Api $api
30
     */
31
    public function __construct(Api $api)
32
    {
33
        $this->api = $api;
34
    }
35
36
    /**
37
     * Creates the endpoint
38
     * @param null $id
39
     * @return string
40
     */
41
    protected function endpoint($id = null)
42
    {
43
        return $id == null ? $this->endpoint : $this->endpoint.'/'.$id;
44
    }
45
}