EventType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 50
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getAllEventType() 0 9 1
A getAllEventFilterByIds() 0 11 1
1
<?php
2
/**
3
 * This file is part of the Betfair library.
4
 *
5
 * (c) Daniele D'Angeli <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Betfair\BettingApi\Event;
11
12
use Betfair\Adapter\AdapterInterface;
13
use Betfair\BettingApi\BetfairMarketFilterObject;
14
use Betfair\Client\BetfairClientInterface;
15
use Betfair\Factory\MarketFilterFactoryInterface;
16
use Betfair\Factory\ParamFactoryInterface;
17
18
class EventType extends BetfairMarketFilterObject
19
{
20
    const API_METHOD_NAME = "listEventTypes";
21
22
    const EVENT_TYPE_IDS_FILTER = "eventTypeIds";
23
24
    /**
25
     * @param BetfairClientInterface $betfairClient
26
     * @param AdapterInterface $adapter
27
     * @param \Betfair\Factory\ParamFactory|\Betfair\Factory\ParamFactoryInterface $paramFactory
28
     * @param \Betfair\Factory\MarketFilterFactory|\Betfair\Factory\MarketFilterFactoryInterface $marketFilterFactory
29
     */
30
    public function __construct(
31
        BetfairClientInterface $betfairClient,
32
        AdapterInterface $adapter,
33
        ParamFactoryInterface $paramFactory,
34
        MarketFilterFactoryInterface $marketFilterFactory
35
    ) {
36
        parent::__construct($betfairClient, $adapter, $paramFactory, $marketFilterFactory);
37
    }
38
39
    /**
40
     * @return mixed
41
     */
42
    public function getAllEventType()
43
    {
44
        $response = $this->apiNgRequest(
45
            self::API_METHOD_NAME,
46
            $this->createParam($this->createMarketFilter())
47
        );
48
49
        return $this->adapter->adaptResponse($response);
50
    }
51
52
    /**
53
     * @param $eventTypeIds
54
     * @return mixed
55
     */
56
    public function getAllEventFilterByIds($eventTypeIds)
57
    {
58
        $marketFilter = $this->createMarketFilter();
59
        $marketFilter->setEventTypeIds($eventTypeIds);
60
61
        $param = $this->createParam($marketFilter);
62
63
        return $this->adapter->adaptResponse(
64
            $this->apiNgRequest(self::API_METHOD_NAME, $param)
65
        );
66
    }
67
}
68