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

Betting   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 11
Bugs 0 Features 3
Metric Value
wmc 6
c 11
b 0
f 3
lcom 1
cbo 1
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B prepare() 0 15 6
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