src/mock/MockResponse.php
public static function getResourceTypeFromUrl($url)
    {
        $matchFound = preg_match('/\/v[23]\/(\w+)[\/?]?/', $url, $matches);
        if( ! $matchFound || ! is_array($matches) || ! isset($matches[1])) {
            throw new \Exception('Unable to find resource type in url', 1462733277);
        }

        if ($matches[1] == 'getReport') {
            return 'report';
        } elseif ($matches[1] == 'price') {
            return 'prices';
        }

        return $matches[1];
    }
public static function getResourceTypeFromUrl($url)
    {
        $matchFound = preg_match('/\/v[23]\/(\w+)[\/?]?/', $url, $matches);
        if( ! $matchFound || ! is_array($matches) || ! isset($matches[1])) {
            throw new \Exception('Unable to find resource type in url', 1462733277);
        }

        if ($matches[1] == 'getReport') {
            return 'report';
        } elseif ($matches[1] == 'price') {
            return 'prices';
        }

        return $matches[1];
    }
public static function getResourceTypeFromUrl ( $ url ) { $ matchFound = preg_match ( '/\/v[23]\/(\w+)[\/?]?/' , $ url , $ matches ) ; if ( ! $ matchFound || ! is_array ( $ matches ) || ! isset ( $ matches [ 1 ] ) ) { throw new \ Exception ( 'Unable to find resource type in url' , 1462733277 ) ; } if ( $ matches [ 1 ] == 'getReport' ) { return 'report' ; } elseif ( $ matches [ 1 ] == 'price' ) { return 'prices' ; } return $ matches [ 1 ] ; }
Parse resource type out of url
@param string $url
@return string
@throws \Exception
Parse resource type out of url