Completed
Push — master ( d0dba3...b098fd )
by Sergey
02:42
created

Endpoint::getResourceUri()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
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 5
rs 9.4286
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace seregazhuk\HeadHunterApi\EndPoints;
4
5
use seregazhuk\HeadHunterApi\Contracts\RequestInterface;
6
7
abstract class Endpoint
8
{
9
    const RESOURCE = '/resource';
10
11
    /**
12
     * @var RequestInterface
13
     */
14
    protected $request;
15
16
    public function __construct(RequestInterface $request)
17
    {
18
        $this->request = $request;
19
    }
20
21
    /**
22
     * @param string $uri
23
     * @return string
24
     */
25
    protected function getResourceUri($uri = '')
26
    {
27
        $resource = static::RESOURCE;
28
        return empty($uri) ? $resource : $resource . sprintf('/%s', $uri);
29
    }
30
31
    /**
32
     * @param string $verb
33
     * @return array
34
     */
35
    protected function getResource($verb)
36
    {
37
        return $this->request->get($this->getResourceUri($verb));
38
    }
39
}