private function _parseUrl(string $method, array $params = [])
    {
        $params = [
                'module' => 'API',
                'method' => $method,
                'token_auth' => $this->_token,
                'idSite' => $this->_siteId,
                'period' => $this->_period,
                'format' => $this->_format,
                'language' => $this->_language,
                'filter_limit' => $this->_filter_limit
            ] + $params;

        foreach ($params as $key => $value) {
            $params[$key] = urlencode($value);
        }

        if (!empty($this->_rangeStart) && !empty($this->_rangeEnd)) {
            $params = $params + [
                    'date' => $this->_rangeStart . ',' . $this->_rangeEnd,
                ];
        } elseif (!empty($this->_date)) {
            $params = $params + [
                    'date' => $this->_date,
                ];
        } else {
            throw new InvalidArgumentException('Specify a date or a date range!');
        }

        $url = $this->_site;

        $i = 0;
        foreach ($params as $param => $val) {
            if (!empty($val)) {
                $i++;
                if ($i > 1) {
                    $url .= '&';
                } else {
                    $url .= '?';
                }

                if (is_array($val)) {
                    $val = implode(',', $val);
                }
                $url .= $param . '=' . $val;
            }
        }

        return $url;
    }
private function _parseUrl(string $method, array $params = [])
    {
        $params = [
                'module' => 'API',
                'method' => $method,
                'token_auth' => $this->_token,
                'idSite' => $this->_siteId,
                'period' => $this->_period,
                'format' => $this->_format,
                'language' => $this->_language,
                'filter_limit' => $this->_filter_limit
            ] + $params;

        foreach ($params as $key => $value) {
            $params[$key] = urlencode($value);
        }

        if (!empty($this->_rangeStart) && !empty($this->_rangeEnd)) {
            $params = $params + [
                    'date' => $this->_rangeStart . ',' . $this->_rangeEnd,
                ];
        } elseif (!empty($this->_date)) {
            $params = $params + [
                    'date' => $this->_date,
                ];
        } else {
            throw new InvalidArgumentException('Specify a date or a date range!');
        }

        $url = $this->_site;

        $i = 0;
        foreach ($params as $param => $val) {
            if (!empty($val)) {
                $i++;
                if ($i > 1) {
                    $url .= '&';
                } else {
                    $url .= '?';
                }

                if (is_array($val)) {
                    $val = implode(',', $val);
                }
                $url .= $param . '=' . $val;
            }
        }

        return $url;
    }
private function _parseUrl ( string $ method , array $ params = [ ] ) { $ params = [ 'module' => 'API' , 'method' => $ method , 'token_auth' => $ this -> _token , 'idSite' => $ this -> _siteId , 'period' => $ this -> _period , 'format' => $ this -> _format , 'language' => $ this -> _language , 'filter_limit' => $ this -> _filter_limit ] + $ params ; foreach ( $ params as $ key => $ value ) { $ params [ $ key ] = urlencode ( $ value ) ; } if ( ! empty ( $ this -> _rangeStart ) && ! empty ( $ this -> _rangeEnd ) ) { $ params = $ params + [ 'date' => $ this -> _rangeStart . ',' . $ this -> _rangeEnd , ] ; } elseif ( ! empty ( $ this -> _date ) ) { $ params = $ params + [ 'date' => $ this -> _date , ] ; } else { throw new InvalidArgumentException ( 'Specify a date or a date range!' ) ; } $ url = $ this -> _site ; $ i = 0 ; foreach ( $ params as $ param => $ val ) { if ( ! empty ( $ val ) ) { $ i ++ ; if ( $ i > 1 ) { $ url .= '&' ; } else { $ url .= '?' ; } if ( is_array ( $ val ) ) { $ val = implode ( ',' , $ val ) ; } $ url .= $ param . '=' . $ val ; } } return $ url ; }
Create request url with parameters

@param string $method The request method
@param array $params Request params
@return string|false
@throws \InvalidArgumentException
Create request url with parameters