Completed
Push — master ( dfec85...be4840 )
by Peter
02:18
created

Betting::prepare()   B

Complexity

Conditions 6
Paths 8

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
rs 8.8571
cc 6
eloc 8
nc 8
nop 1
1
<?php
2
3
namespace PeterColes\Betfair\Api;
4
5
use PeterColes\Betfair\Api\BaseApi;
6
7
class Betting extends BaseApi
8
{
9
    const ENDPOINT = 'https://api.betfair.com/exchange/betting/rest/v1.0/';
10
11
    public function prepare($params)
12
    {
13
        $params = !empty($params) ? $params[ 0 ] : [ ];
14
15
        $lists = [ 'listCompetitions', 'listCountries', 'listEvents', 'listEventTypes', 'listMarketTypes', 'listVenues', 'listMarketCatalogue' ];
16
        if (in_array($this->method, $lists) && empty($params[ 'filter' ])) {
17
            $params['filter'] = new \stdClass;
18
        }
19
20
        if ($this->method == 'listMarketCatalogue' && empty($params[ 'maxResults' ])) {
21
            $params[ 'maxResults' ] = 1000;
22
        }
23
24
        return $params;
25
    }
26
}
27