Passed
Push — master ( 0b6641...e38024 )
by Steven
02:14
created

PreviousDayPrice::getFullEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Digitonic\IexCloudSdk\Stocks;
4
5
use Digitonic\IexCloudSdk\Contracts\IEXCloud;
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9 View Code Duplication
class PreviousDayPrice extends BaseRequest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    const ENDPOINT = 'stock/{symbol}/previous';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18 4
    public function __construct(IEXCloud $api)
19
    {
20 4
        parent::__construct($api);
21 4
    }
22
23
    /**
24
     * @return string
25
     */
26 2
    protected function getFullEndpoint(): string
27
    {
28 2
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     * @throws WrongData
34
     */
35 3
    protected function validateParams(): void
36
    {
37 3
        if (empty($this->symbol)) {
38 1
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
39
        }
40 2
    }
41
}
42