Generate a new endpoint url.

@param  string  $prefix
@param  bool  $includeId
@return string
424204
public function endpointUrl($prefix = null, $includeId = true)
    {
        $url = self::API_URL;

        // push company id
        if ($includeId) {
            $url = $url .'/'. $this->getCompanyId();
        }

        // push prefix
        if ($prefix = trim($prefix, '/')) {
            $url = $url .'/'. $prefix;
        }

        return $url;
    }
558622
private function getSource(int $startID, int $endID): string
    {
        $result = '';
        for ($tokenID = $startID; $tokenID <= $endID; ++$tokenID) {
            //Collecting function usage src
            $result .= $this->tokens[$tokenID][self::TOKEN_CODE];
        }

        return $result;
    }
367285
public function getStopPoint($coverageId, $stopPointId)
    {
        $pathFilter = 'stop_points/'.$stopPointId;

        $query = array(
            'api' => 'coverage',
            'parameters' => array(
                'region' => $coverageId,
                'path_filter' => $pathFilter,
                'parameters' => '?depth=0',
            ),
        );

        return $this->navitia_component->call($query);
    }
936071
public function createEndpoint($uri, $mode = self::MODE_PRODUCE)
    {
        if (array_key_exists($uri, $this->endpointsCache)) {
            return $this->endpointsCache[$uri];
        }

        $router = $this->getEndpointsRouter();

        try {
            $routeOptions = $router->match($uri);
        } catch (InternalRouterResourceNotFound $exception) {
            throw new InternalRouterResourceNotFound(
                "Endpoint not found for URI: $uri",
                $exception->getCode(),
                $exception
            );
        }

        // Get and remove _protocol from the options
        if (!array_key_exists(Protocol::OPTION_PROTOCOL, $routeOptions)) {
            $protocol = $this->basicProtocol;
        } else {
            $protocol = $routeOptions[Protocol::OPTION_PROTOCOL];
            unset($routeOptions[Protocol::OPTION_PROTOCOL]);
        }

        if (!$protocol instanceof ProtocolInterface) {
            throw new \InvalidArgumentException("Error trying to create Endpoint for URI: $uri. Expected protocol to be instance of ProtocolInterface.");
        }

        // Resolve options
        $optionsResolver = $this->getOptionsResolver($uri, $routeOptions, $protocol, $mode);

        try {
            $options = $optionsResolver->resolve($routeOptions);
        } catch (\Exception $ex) {
            throw new \RuntimeException(
                "EndpointFactory failed to resolve options while trying to create endpoint for URI: $uri. "
                .'Original error: '.$ex->getMessage(),
                $ex->getCode(),
                $ex
            );
        }

        // Get Consumer, Producer and Handler and remove them from the resolved options

        $consumer = null;
        $producer = null;
        $handler = null;

        if (array_key_exists(Protocol::OPTION_CONSUMER, $options)) {
            $consumer = $options[Protocol::OPTION_CONSUMER];
            unset($options[Protocol::OPTION_CONSUMER]);
        }

        if (array_key_exists(Protocol::OPTION_PRODUCER, $options)) {
            $producer = $options[Protocol::OPTION_PRODUCER];
            unset($options[Protocol::OPTION_PRODUCER]);
        }

        if (array_key_exists(Protocol::OPTION_HANDLER, $options)) {
            $handler = $options[Protocol::OPTION_HANDLER];
            unset($options[Protocol::OPTION_HANDLER]);
        }

        // Create
        $endpoint = new Endpoint($uri, $options, $protocol, $producer, $consumer, $handler);

        // Cache
        $this->endpointsCache[$uri] = $endpoint;

        return $endpoint;
    }
522373
protected static function createRouteUrl(
        ContainerInterface $container,
        string $routeName,
        array $placeholders = [],
        array $queryParams = []
    ): string {
        /** @var RouterInterface $router */
        $router = $container->get(RouterInterface::class);

        $hostUri = static::getHostUri($container);
        $url     = $router->get($hostUri, $routeName, $placeholders, $queryParams);

        return $url;
    }
705801
public function definePath($id, $title, $extension, $prefix = '', $suffix = '')
    {
        $path = '';

        if ($suffix) {
            $path = sprintf(
                '%s/%s-%s%s-%s.%s',
                $this->getCurrentDirectory(),
                (new \DateTime())->format('His'),
                $prefix,
                Canonicalizer::slug($title),
                $suffix,
                $extension
            );
        } else {
            $path = sprintf(
                '%s/%s-%s%s.%s',
                $this->getCurrentDirectory(),
                (new \DateTime())->format('His'),
                $prefix,
                Canonicalizer::slug($title),
                $extension
            );
        }

        if (file_exists(sprintf('%s/%s', $this->rootDir, $path))) {
            return $this->definePath($id, $title, $extension, $prefix, intval($suffix) + 1);
        }

        return $path;
    }
1183927
public static function currentUrl( $includeQuery = true, $includePath = true )
    {
        //	Are we SSL? Check for load balancer protocol as well...
        $_port = intval( Option::get( $_SERVER, 'HTTP_X_FORWARDED_PORT', Option::get( $_SERVER, 'SERVER_PORT', 80 ) ) );
        $_protocol = Option::get( $_SERVER, 'HTTP_X_FORWARDED_PROTO', 'http' . ( Option::getBool( $_SERVER, 'HTTPS' ) ? 's' : null ) ) . '://';
        $_host = Option::get( $_SERVER, 'HTTP_X_FORWARDED_HOST', Option::get( $_SERVER, 'HTTP_HOST', gethostname() ) );
        $_parts = parse_url( $_protocol . $_host . Option::get( $_SERVER, 'REQUEST_URI' ) );

        if ( ( empty( $_port ) || !is_numeric( $_port ) ) && null !== ( $_parsePort = Option::get( $_parts, 'port' ) ) )
        {
            $_port = @intval( $_parsePort );
        }

        if ( null !== ( $_query = Option::get( $_parts, 'query' ) ) )
        {
            $_query = static::urlSeparator( $_query ) . http_build_query( explode( '&', $_query ) );
        }

        if ( false !== strpos( $_host, ':' ) || ( $_protocol == 'https://' && $_port == 443 ) || ( $_protocol == 'http://' && $_port == 80 ) )
        {
            $_port = null;
        }
        else
        {
            $_port = ':' . $_port;
        }

        if ( false !== strpos( $_host, ':' ) )
        {
            $_port = null;
        }

        $_currentUrl =
            $_protocol .
            $_host .
            $_port .
            ( true === $includePath ? Option::get( $_parts, 'path' ) : null ) .
            ( true === $includeQuery ? $_query : null );

        if ( \Kisma::get( 'debug.curl.current_url' ) )
        {
            Log::debug( 'Parsed current URL to be: ' . $_currentUrl, $_parts );
        }

        return $_currentUrl;
    }
793097
public static function create($ip, $prefix = ''): IPBlock
    {
        try {
            return new IPv4Block($ip, $prefix);
        } catch (\InvalidArgumentException $e) {
            // do nothing
        }

        try {
            return new IPv6Block($ip, $prefix);
        } catch (\InvalidArgumentException $e) {
            // do nothing
        }

        throw new \InvalidArgumentException("$ip does not appear to be an IPv4 or IPv6 block");
    }
32423
def _build_url(self, endpoint):
        
        if not issubclass(type(self), ChatApiBase) and not self.subdomain:
            raise ZenpyException("subdomain is required when accessing the Zendesk API!")

        if self.subdomain:
            endpoint.netloc = '{}.{}'.format(self.subdomain, self.domain)
        else:
            endpoint.netloc = self.domain

        endpoint.prefix_path(self.api_prefix)
        return endpoint.build()
791927
protected function createBaseUrl(RequestInterface $request)
    {
        $url = $this->getUrl();

        if ($request instanceof ContextualizedRequestInterface) {
            $url .= '/'.$request->buildContext();
        }

        return $url;
    }
856034
public function url($include_host = false)
    {
        if ($include_host) {
            return $this->url;
        }

        $url = str_replace($this->base, '', rtrim($this->url, '/'));

        return $url ?: '/';
    }
444936
static public function generateUniqidString($prefix = '', $length = 20)
    {
        $key = '';
        $keys = array_merge(range(0, 9), range('a', 'z'));

        for ($i = 0; $i < $length; $i++) {
            $key .= $keys[array_rand($keys)];
        }

        return uniqid($prefix) . $key;
    }
395220
protected function url(string $endpoint, ...$replacements): string
    {
        return $this->client->baseUrl.vsprintf($endpoint, $replacements);
    }
1232583
public function getSurvey($surveyId, $includePages = false)
	{
		if ($includePages) {
			return $this->sendRequest(
				$this->createRequest('GET', sprintf('surveys/%d/details', $surveyId))
			);
		} else {
			return $this->sendRequest(
				$this->createRequest('GET', sprintf('surveys/%d', $surveyId))
			);
		}
	}
1116201
public function getRequestUri($includeParameters = false)
    {
        $uri = $this->uri;

        if (!$includeParameters) {
            $sepIdx = strpos($uri, '?');

            if ($sepIdx !== false) {
                $uri = substr($uri, 0, $sepIdx);
            }
        }

        return $uri;
    }
980177
public static function crud($prefix, $name = null)
    {
        return self::factory($prefix, $name)
            ->endpoint(ApiEndpoint::all())
            ->endpoint(ApiEndpoint::find())
            ->endpoint(ApiEndpoint::create())
            ->endpoint(ApiEndpoint::update())
            ->endpoint(ApiEndpoint::remove());
    }
399421
public static function url($endpoint = null, $suffix = '')
    {
        $base = Phramework::getSetting('base');

        if ($endpoint) {
            $suffix = $endpoint . '/' . $suffix;

            $suffix = str_replace('//', '/', $suffix);
        }
        return $base . $suffix;
    }