public static function create($route, $apiUrl, $id = null) {
        Str::assert($route, 'route');
        Str::assert($apiUrl, 'apiUrl');
        MaybeString::assert($id, 'id');

        $idPath = empty($id) ? '' : '/' . $id;

        if (!self::is($route))               return $apiUrl . '/' . $route . $idPath;
        if (!preg_match('/\{id\}/', $route)) return $route . $idPath;
        if (!empty($id))                     return str_replace('{id}', $id, $route);

        return str_replace('/{id}', '', $route);
    }
public static function create($route, $apiUrl, $id = null) {
        Str::assert($route, 'route');
        Str::assert($apiUrl, 'apiUrl');
        MaybeString::assert($id, 'id');

        $idPath = empty($id) ? '' : '/' . $id;

        if (!self::is($route))               return $apiUrl . '/' . $route . $idPath;
        if (!preg_match('/\{id\}/', $route)) return $route . $idPath;
        if (!empty($id))                     return str_replace('{id}', $id, $route);

        return str_replace('/{id}', '', $route);
    }
public static function create ( $ route , $ apiUrl , $ id = null ) { Str :: assert ( $ route , 'route' ) ; Str :: assert ( $ apiUrl , 'apiUrl' ) ; MaybeString :: assert ( $ id , 'id' ) ; $ idPath = empty ( $ id ) ? '' : '/' . $ id ; if ( ! self :: is ( $ route ) ) return $ apiUrl . '/' . $ route . $ idPath ; if ( ! preg_match ( '/\{id\}/' , $ route ) ) return $ route . $ idPath ; if ( ! empty ( $ id ) ) return str_replace ( '{id}' , $ id , $ route ) ; return str_replace ( '/{id}' , '' , $ route ) ; }
returns an url depending on the given route, apiUrl
and id

@param  string      $route
@param  string      $apiUrl
@param  string|null $id
@return string

@SuppressWarnings("PHPMD.StaticAccess")
returns an url depending on the given route apiUrl and id