Event::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
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
/**
19
 * Class Event
20
 * @package Betfair\BettingApi\Event
21
 */
22
class Event extends BetfairMarketFilterObject
23
{
24
    /**
25
     * The API METHOD NAME
26
     */
27
    const API_METHOD_NAME = "listEvents";
28
29
    /**
30
     * @param BetfairClientInterface $betfairClient
31
     * @param AdapterInterface $adapter
32
     * @param ParamFactoryInterface $paramFactory
33
     * @param MarketFilterFactoryInterface $marketFilterFactory
34
     */
35
    public function __construct(
36
        BetfairClientInterface $betfairClient,
37
        AdapterInterface $adapter,
38
        ParamFactoryInterface $paramFactory,
39
        MarketFilterFactoryInterface $marketFilterFactory
40
    ) {
41
        parent::__construct($betfairClient, $adapter, $paramFactory, $marketFilterFactory);
42
    }
43
44
    /**
45
     * @return mixed
46
     */
47
    public function listEvents()
48
    {
49
        $response = $this->apiNgRequest(
50
            self::API_METHOD_NAME,
51
            $this->createParam($this->createMarketFilter())
52
        );
53
54
        return $this->adapter->adaptResponse($response);
55
    }
56
57
    /**
58
     * @param array $eventTypeIds
59
     * @return mixed
60
     */
61
    public function getAllEventFilteredByEventTypeIds(array $eventTypeIds)
62
    {
63
        $marketFilter = $this->createMarketFilter();
64
        $marketFilter->setEventTypeIds($eventTypeIds);
65
        $param = $this->createParam($marketFilter);
66
67
        return $this->adapter->adaptResponse(
68
            $this->apiNgRequest(self::API_METHOD_NAME, $param)
69
        );
70
    }
71
72
    /**
73
     * @param array $competitionIds
74
     * @internal param array $eventTypeIds
75
     * @return mixed
76
     */
77
    public function getAllEventsFilteredByCompetition(array $competitionIds)
78
    {
79
        $marketFilter = $this->createMarketFilter();
80
        $marketFilter->setCompetitionIds($competitionIds);
81
82
        $param = $this->createParam($marketFilter);
83
84
        return $this->adapter->adaptResponse(
85
            $this->apiNgRequest(self::API_METHOD_NAME, $param)
86
        );
87
    }
88
}
89