Get a temporary URL for the file at the given path.

@param  \League\Flysystem\Rackspace\RackspaceAdapter  $adapter
@param  string  $path
@param  \DateTimeInterface  $expiration
@param  array  $options
@return string
548769
public function getRackspaceTemporaryUrl($adapter, $path, $expiration, $options)
    {
        return $adapter->getContainer()->getObject($path)->getTemporaryUrl(
            Carbon::now()->diffInSeconds($expiration),
            $options['method'] ?? 'GET',
            $options['forcePublicUrl'] ?? true
        );
    }
381268
public static function getDataPointer($path, $isURIFragmentId = false)
    {
        $items = explode('->', $path);
        unset($items[0]);
        $result = $isURIFragmentId ? '#' : '';
        foreach ($items as $item) {
            $parts = explode(':', $item);
            if (isset($parts[1])) {
                $result .= '/' . JsonPointer::escapeSegment($parts[1], $isURIFragmentId);
            }
        }
        if ($result === '') {
            return '/';
        }
        return $result;
    }
267818
public static function getFileUrl($filePath, $addTimestamp = FALSE) {

		if (!file_exists($filePath)) {
			throw new \Exception('File not found at path ' . $filePath);
		}
		
		// check if valid path
		if (FALSE === strpos($filePath, APPLICATION_PATH)) {
			throw new \Exception('File path doesn’t match the application root folder ' . APPLICATION_PATH);
		}
		
		// BASE_HREF has trailing slash
		$url = BASE_HREF . substr($filePath, strlen(APPLICATION_PATH)+1);
			
		if ($addTimestamp) {
			$timestamp = filemtime($filePath);
			// check if valid timestamp
			if (FALSE == $timestamp) {
				throw new \Exception('File last change timestamp failed for ' . $filePath);
			}
			$url .= '?' . $timestamp;
		}
		
		return $url;

	}
286671
public function locate(string $path, array $options = []): array
    {
        $query = '';

        // split URI and query string, the route resolver should not worry
        // about provided query string.
        if (strpos($path, '?') !== false) {
            list($path, $query) = explode('?', $path, 2);
        }

        list($package, $route, $item) = with(new NamespacedItemResolver())->parseKey($path);

        $route = $this->prepareValidRoute($route, $item, $query, $options);

        // If package is empty, we should consider that the route is using
        // app (or root path), it doesn't matter at this stage if app is
        // an extension or simply handling root path.
        empty($package) && $package = 'app';

        return [$package, $route];
    }
178008
public function getFirstTemporaryUrl(DateTimeInterface $expiration, string $collectionName = 'default', string $conversionName = ''): string
    {
        $media = $this->getFirstMedia($collectionName);

        if (! $media) {
            return '';
        }

        return $media->getTemporaryUrl($expiration, $conversionName);
    }
609594
public function getUrl($path, array $params = [])
    {
        $parts = parse_url($this->baseUrl.'/'.trim($path, '/'));

        if ($parts === false) {
            throw new InvalidArgumentException('Not a valid path.');
        }

        $parts['path'] = '/'.trim($parts['path'], '/');

        if ($this->signature) {
            $params = $this->signature->addSignature($parts['path'], $params);
        }

        return $this->buildUrl($parts, $params);
    }
611836
public function create( $Path, $expire = 0, $fullUrl = ''){
        $Path_b64   = base64_encode( $Path);
        $expire     = $expire ?: (time() + (60*60*24)); // If expire is not defined, default is 24h
        $rest = $this->getService( self::API_SHARE_LINK);
        $rest->POST([
            'path'      => $Path_b64,
            'expire'    => $expire,
            'fullurl'   => $fullUrl,
        ]);

        return $rest->getResult( models\FileSystem\ShareLink::class);
    }
275781
public function getUrl($path): string
    {
        \assert('is_string($path)');
        if (strpos($path, ':') === 0) {
            $key = substr($path, 0, strpos($path, '/') ?: \strlen($path));
            $path = $key === $path ? '' : (string)substr($path, \strlen($key));
        } else {
            $key = ':dist';
        }
        if (!isset($this->map[$key])) {
            throw new \InvalidArgumentException(sprintf('No path "%s" for subpackage "%s".', $path, $key));
        }
        return parent::getUrl(substr($key, 1) . $path);
    }
170229
private function run($path, $options)
    {
        $method  = $options['method'];
        $data    = isset($options['data'])    ? $options['data']    : null;
        $params  = isset($options['params'])  ? $options['params']  : null;
        $headers = isset($options['headers']) ? $options['headers'] : array();
        $body    = !empty($data)              ? json_encode($data)  : null;

        // Arrays in constants are in PHP 5.6+
        $allowedHeaders = array(
            'If-None-Match',    // Pairs with `ETag` response header.
            'If-Modified-Since' // Pairs with `Last-Modified` response header.
        );

        $headers = $this->filterOptions($headers, $allowedHeaders);
        $headers['User-Agent']   = $this->userAgent;
        $headers['Content-Type'] = 'application/json';

        if (!empty($headers['If-Modified-Since']) && $headers['If-Modified-Since'] instanceof DateTime) {
            $headers['If-Modified-Since'] = gmdate('D, d M Y H:i:s \G\M\T', $headers['If-Modified-Since']->getTimestamp());
        }

        $response = $this->requester->run(array(
            'url'     => self::URL . $this->slug . $path,
            'method'  => $method,
            'params'  => $params,
            'body'    => $body,
            'userpwd' => "$this->email:$this->apiKey",
            'headers' => $headers
        ));

        return $response;
    }
1313895
public function get($path, array $options = array())
    {
        $client = $this->createGuzzleClient($this->consumerKey, $this->consumerSecret);

        $options['auth'] = 'oauth';

        try {
            return json_decode($client->get('/1.1'.$path, $options)->getBody(), true);
        } catch (GuzzleRequestException $e) {
            $message = $e->getMessage();

            if ($e->hasResponse()) {
                $responseData = json_decode($e->getResponse()->getBody(), true);

                $messageParts = array();

                foreach ($responseData['errors'] as $error) {
                    $messageParts[] = $error['message'];
                }

                $message = implode($messageParts, "\n");
            }

            throw new RequestException($message);
        }
    }
611751
public function get($path = '', $options = array())
    {
        return $this->client->get(
            $this->addDataToPathURI($path, $options),
            $this->addDataToRequest($options),
            $this->requestHeader
        );
    }
78005
protected function signUrl(UrlImmutable $url, $expiration, $signature)
    {
        $query = $url->getQuery();

        $query->modify([
            $this->expiresParameter   => $expiration,
            $this->signatureParameter => $signature,
        ]);

        $urlSigner = $url->setQuery($query);

        return $urlSigner;
    }
841516
public function handles_acl($path, array $options = [])
    {
        $url = $this->app->make('url');
        if ($url->isValidUrl($path)) {
            return $path;
        }
        @list($component, $action) = explode('/', $path);
        if (is_null($component) or is_null($action)) {
            return $this->handles($path, $options);
        }
//        $resourceMap = app('antares.resource.repository')->findOneByAttributes(['component' => $component, 'action' => $action]);
//        if (is_null($resourceMap)) {
//            return $this->handles($path, $options);
//        }
//        $resource  = $resourceMap->resource;
//        $component = str_replace('::', '/', $component);
//        if (!app('antares.acl')->make($component)->can($resource)) {
//            return '';
//        }

        return $this->handles($path, $options);
    }
482081
public function get($path, array $options = array())
    {
        $client = $this->createGuzzleClient($this->apiKey);

        $options = $this->applyDefaultClientQuery($client, $options);

        try {
            return json_decode($client->get('/youtube/v3' . $path, $options)->getBody(), true);
        } catch (GuzzleRequestException $e) {
            $message = $e->getMessage();
            throw new RequestException($message);
        }
    }
1201317
public function putLifecycleQuery($expires, $options=array())
    {
        $req = $this->putLifecycleRequest($options);
        return $req->query_sign($expires);
    }
1212619
protected function getUrl(ServerRequestInterface $request, array $options)
    {
        $url = $options['url'];
        if ($options['queryParam'] !== null && $request->getMethod() === 'GET') {
            $query = urlencode($options['queryParam']) . '=' . urlencode($request->getRequestTarget());
            if (strpos($url, '?') !== false) {
                $query = '&' . $query;
            } else {
                $query = '?' . $query;
            }

            $url .= $query;
        }

        return $url;
    }
1353036
public function create($path, $expire = 0, $fullUrl = '')
    {
        $Path_b64 = base64_encode($path);
        $expire   = $expire ?: (time() + (60 * 60 * 24)); // If expire is not defined, default is 24h
        $result     = $this->callService('POST', self::API_SHARE_LINK, [
            'path'    => $Path_b64,
            'expire'  => $expire,
            'fullurl' => $fullUrl,
        ]);

        return $result->getModel(models\FileSystem\ShareLink::class);
    }