Code Duplication    Length = 32-35 lines in 17 locations

src/AlternativeData/CeoComp.php 1 location

@@ 9-40 (lines=32) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class CeoComp extends BaseRequest
10
{
11
    const ENDPOINT = 'stock/{symbol}/ceo-compensation';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     */
34
    protected function validateParams(): void
35
    {
36
        if (empty($this->symbol)) {
37
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
38
        }
39
    }
40
}
41

src/AlternativeData/Crypto/Book.php 1 location

@@ 9-40 (lines=32) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class Book extends BaseRequest
10
{
11
    const ENDPOINT = 'crypto/{symbol}/book';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     */
34
    protected function validateParams(): void
35
    {
36
        if (empty($this->symbol)) {
37
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
38
        }
39
    }
40
}
41

src/AlternativeData/Crypto/Price.php 1 location

@@ 9-40 (lines=32) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class Price extends BaseRequest
10
{
11
    const ENDPOINT = 'crypto/{symbol}/price';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     */
34
    protected function validateParams(): void
35
    {
36
        if (empty($this->symbol)) {
37
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
38
        }
39
    }
40
}
41

src/AlternativeData/Crypto/Quote.php 1 location

@@ 9-40 (lines=32) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class Quote extends BaseRequest
10
{
11
    const ENDPOINT = 'crypto/{symbol}/quote';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     */
34
    protected function validateParams(): void
35
    {
36
        if (empty($this->symbol)) {
37
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
38
        }
39
    }
40
}
41

src/InvestorsExchangeData/Deep.php 1 location

@@ 9-40 (lines=32) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class Deep extends BaseRequest
10
{
11
    const ENDPOINT = 'deep?symbols={symbol}';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     */
34
    protected function validateParams(): void
35
    {
36
        if (empty($this->symbol)) {
37
            throw WrongData::invalidValuesProvided('Please provide symbol to query!');
38
        }
39
    }
40
}
41

src/InvestorsExchangeData/Deep/Auction.php 1 location

@@ 9-40 (lines=32) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class Auction extends BaseRequest
10
{
11
    const ENDPOINT = 'deep/auction?symbols={symbol}';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     */
34
    protected function validateParams(): void
35
    {
36
        if (empty($this->symbol)) {
37
            throw WrongData::invalidValuesProvided('Please provide symbol to query!');
38
        }
39
    }
40
}
41

src/InvestorsExchangeData/Deep/Book.php 1 location

@@ 9-40 (lines=32) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class Book extends BaseRequest
10
{
11
    const ENDPOINT = 'deep/book?symbols={symbol}';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     */
34
    protected function validateParams(): void
35
    {
36
        if (empty($this->symbol)) {
37
            throw WrongData::invalidValuesProvided('Please provide symbol to query!');
38
        }
39
    }
40
}
41

src/InvestorsExchangeData/Deep/SecurityEvent.php 1 location

@@ 9-40 (lines=32) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class SecurityEvent extends BaseRequest
10
{
11
    const ENDPOINT = 'deep/security-event?symbols={symbol}';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     */
34
    protected function validateParams(): void
35
    {
36
        if (empty($this->symbol)) {
37
            throw WrongData::invalidValuesProvided('Please provide symbol to query!');
38
        }
39
    }
40
}
41

src/Stocks/AdvancedStats.php 1 location

@@ 9-41 (lines=33) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class AdvancedStats extends BaseRequest
10
{
11
    const ENDPOINT = 'stock/{symbol}/advanced-stats';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     * @throws WrongData
34
     */
35
    protected function validateParams(): void
36
    {
37
        if (empty($this->symbol)) {
38
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
39
        }
40
    }
41
}
42

src/Stocks/BalanceSheet.php 1 location

@@ 9-41 (lines=33) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class BalanceSheet extends BaseRequest
10
{
11
    const ENDPOINT = 'stock/{symbol}/balance-sheet';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     * @throws WrongData
34
     */
35
    protected function validateParams(): void
36
    {
37
        if (empty($this->symbol)) {
38
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
39
        }
40
    }
41
}
42

src/Stocks/Company.php 1 location

@@ 9-41 (lines=33) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class Company extends BaseRequest
10
{
11
    const ENDPOINT = 'stock/{symbol}/company';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     * @throws WrongData
34
     */
35
    protected function validateParams(): void
36
    {
37
        if (empty($this->symbol)) {
38
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
39
        }
40
    }
41
}
42

src/Stocks/IntradayPrices.php 1 location

@@ 14-48 (lines=35) @@
11
 * @package Digitonic\IexCloudSdk\Stocks
12
 * todo - Currently there is no mechanism for optional fields to be passed.
13
 */
14
class IntradayPrices extends BaseRequest
15
{
16
    const ENDPOINT = 'stock/{symbol}/intraday-prices';
17
18
    /**
19
     * Create constructor.
20
     *
21
     * @param  IEXCloud  $api
22
     */
23
    public function __construct(IEXCloud $api)
24
    {
25
        parent::__construct($api);
26
    }
27
28
    /**
29
     * If the oddLot property is set, add it to the end of the endpoint string.
30
     *
31
     * @return string
32
     */
33
    protected function getFullEndpoint(): string
34
    {
35
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
36
    }
37
38
    /**
39
     * @return bool|void
40
     * @throws WrongData
41
     */
42
    protected function validateParams(): void
43
    {
44
        if (empty($this->symbol)) {
45
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
46
        }
47
    }
48
}
49

src/Stocks/Logo.php 1 location

@@ 9-41 (lines=33) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class Logo extends BaseRequest
10
{
11
    const ENDPOINT = 'stock/{symbol}/logo';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     * @throws WrongData
34
     */
35
    protected function validateParams(): void
36
    {
37
        if (empty($this->symbol)) {
38
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
39
        }
40
    }
41
}
42

src/Stocks/PreviousDayPrice.php 1 location

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

src/Stocks/Price.php 1 location

@@ 9-41 (lines=33) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class Price extends BaseRequest
10
{
11
    const ENDPOINT = 'stock/{symbol}/price';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     * @throws WrongData
34
     */
35
    protected function validateParams(): void
36
    {
37
        if (empty($this->symbol)) {
38
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
39
        }
40
    }
41
}
42

src/Stocks/PriceTarget.php 1 location

@@ 9-41 (lines=33) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class PriceTarget extends BaseRequest
10
{
11
    const ENDPOINT = 'stock/{symbol}/price-target';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getFullEndpoint(): string
27
    {
28
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
29
    }
30
31
    /**
32
     * @return bool|void
33
     * @throws WrongData
34
     */
35
    protected function validateParams(): void
36
    {
37
        if (empty($this->symbol)) {
38
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
39
        }
40
    }
41
}
42

src/Stocks/VolumeByVenue.php 1 location

@@ 9-43 (lines=35) @@
6
use Digitonic\IexCloudSdk\Exceptions\WrongData;
7
use Digitonic\IexCloudSdk\Requests\BaseRequest;
8
9
class VolumeByVenue extends BaseRequest
10
{
11
    const ENDPOINT = 'stock/{symbol}/volume-by-venue';
12
13
    /**
14
     * Create constructor.
15
     *
16
     * @param  IEXCloud  $api
17
     */
18
    public function __construct(IEXCloud $api)
19
    {
20
        parent::__construct($api);
21
    }
22
23
    /**
24
     * If the field property is set, add it to the end of the endpoint string.
25
     *
26
     * @return string
27
     */
28
    protected function getFullEndpoint(): string
29
    {
30
        return str_replace('{symbol}', $this->symbol, self::ENDPOINT);
31
    }
32
33
    /**
34
     * @return bool|void
35
     * @throws WrongData
36
     */
37
    protected function validateParams(): void
38
    {
39
        if (empty($this->symbol)) {
40
            throw WrongData::invalidValuesProvided('Please provide a symbol to query!');
41
        }
42
    }
43
}
44