Completed
Push — master ( 5e0db9...54b4c7 )
by Matthew
02:18
created

AbstractResource   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 40
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A endpoint() 0 4 2
A api() 0 4 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
    private $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
46
    /**
47
     * @return Api
48
     */
49
    protected function api()
50
    {
51
        return $this->api;
52
    }
53
}