public function getProject($id, $host = null, $refresh = null)
    {
        // Find the project in the user's main project list. This uses a
        // separate cache.
        $projects = $this->getProjects($refresh);
        if (isset($projects[$id])) {
            return $projects[$id];
        }

        // Find the project directly.
        $cacheKey = sprintf('%s:project:%s:%s', $this->sessionId, $id, $host);
        $cached = $this->cache->fetch($cacheKey);
        if ($refresh || !$cached) {
            $scheme = 'https';
            if ($host !== null && (($pos = strpos($host, '//')) !== false)) {
                $scheme = parse_url($host, PHP_URL_SCHEME);
                $host = substr($host, $pos + 2);
            }
            $project = $this->getClient()
                ->getProject($id, $host, $scheme !== 'http');
            if ($project) {
                $toCache = $project->getData();
                $toCache['_endpoint'] = $project->getUri(true);
                $this->cache->save($cacheKey, $toCache, $this->config->get('api.projects_ttl'));
            }
        } else {
            $guzzleClient = $this->getHttpClient();
            $baseUrl = $cached['_endpoint'];
            unset($cached['_endpoint']);
            $project = new Project($cached, $baseUrl, $guzzleClient);
        }

        return $project;
    }
public function getProject($id, $host = null, $refresh = null)
    {
        // Find the project in the user's main project list. This uses a
        // separate cache.
        $projects = $this->getProjects($refresh);
        if (isset($projects[$id])) {
            return $projects[$id];
        }

        // Find the project directly.
        $cacheKey = sprintf('%s:project:%s:%s', $this->sessionId, $id, $host);
        $cached = $this->cache->fetch($cacheKey);
        if ($refresh || !$cached) {
            $scheme = 'https';
            if ($host !== null && (($pos = strpos($host, '//')) !== false)) {
                $scheme = parse_url($host, PHP_URL_SCHEME);
                $host = substr($host, $pos + 2);
            }
            $project = $this->getClient()
                ->getProject($id, $host, $scheme !== 'http');
            if ($project) {
                $toCache = $project->getData();
                $toCache['_endpoint'] = $project->getUri(true);
                $this->cache->save($cacheKey, $toCache, $this->config->get('api.projects_ttl'));
            }
        } else {
            $guzzleClient = $this->getHttpClient();
            $baseUrl = $cached['_endpoint'];
            unset($cached['_endpoint']);
            $project = new Project($cached, $baseUrl, $guzzleClient);
        }

        return $project;
    }
public function getProject ( $ id , $ host = null , $ refresh = null ) { // Find the project in the user's main project list. This uses a // separate cache. $ projects = $ this -> getProjects ( $ refresh ) ; if ( isset ( $ projects [ $ id ] ) ) { return $ projects [ $ id ] ; } // Find the project directly. $ cacheKey = sprintf ( '%s:project:%s:%s' , $ this -> sessionId , $ id , $ host ) ; $ cached = $ this -> cache -> fetch ( $ cacheKey ) ; if ( $ refresh || ! $ cached ) { $ scheme = 'https' ; if ( $ host !== null && ( ( $ pos = strpos ( $ host , '//' ) ) !== false ) ) { $ scheme = parse_url ( $ host , PHP_URL_SCHEME ) ; $ host = substr ( $ host , $ pos + 2 ) ; } $ project = $ this -> getClient ( ) -> getProject ( $ id , $ host , $ scheme !== 'http' ) ; if ( $ project ) { $ toCache = $ project -> getData ( ) ; $ toCache [ '_endpoint' ] = $ project -> getUri ( true ) ; $ this -> cache -> save ( $ cacheKey , $ toCache , $ this -> config -> get ( 'api.projects_ttl' ) ) ; } } else { $ guzzleClient = $ this -> getHttpClient ( ) ; $ baseUrl = $ cached [ '_endpoint' ] ; unset ( $ cached [ '_endpoint' ] ) ; $ project = new Project ( $ cached , $ baseUrl , $ guzzleClient ) ; } return $ project ; }
Return the user's project with the given ID.

@param string      $id      The project ID.
@param string|null $host    The project's hostname.
@param bool|null   $refresh Whether to bypass the cache.

@return Project|false
Return the user s project with the given ID .