Completed
Push — master ( 156e79...007c06 )
by Pascal
02:10
created

Endpoint::getEndpointUrl()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 2
1
<?php namespace Atog\Api;
2
3
/**
4
 * Abstract Class Endpoint
5
 * @package Atog\Api
6
 */
7
abstract class Endpoint
8
{
9
    /**
10
     * @var \Atog\Api\Client
11
     */
12
    protected $client;
13
    
14
    /**
15
     * @var \Atog\Api\Model
16
     */
17
    protected $model;
18
    
19
    /**
20
     * @var string
21
     */
22
    protected $endpoint;
23
    
24
    /**
25
     * Endpoint constructor.
26
     * @param \Atog\Api\Client $client
27
     * @param \Atog\Api\Model  $model
28
     */
29
    public function __construct(Client $client, Model $model)
30
    {
31
        $this->client = $client;
32
        $this->model = $model;
33
    }
34
    
35
    /**
36
     * Get the endpoint url for the request
37
     * @param string $path
38
     * @param bool   $withTrailingSlash
39
     * @return string
40
     */
41
    protected function getEndpointUrl($path, $withTrailingSlash)
42
    {
43
        $url = $this->endpoint . '/' . $path;
44
        
45
        if ($withTrailingSlash) {
46
            $url = $url . '/';
47
        }
48
        
49
        return $url;
50
    }
51
}
52