Pantheon\Terminus\Collections\Sites::get PHP Method

get() public method

Retrieves the site of the given UUID or name
public get ( string $id ) : Site
$id string UUID or name of desired site
return Site
    public function get($id)
    {
        $models = $this->models;
        $list = $this->listing('name', 'id');
        $site = null;
        if (isset($models[$id])) {
            $site = $models[$id];
        } elseif (isset($list[$id])) {
            $site = $models[$list[$id]];
        } else {
            try {
                $uuid = $this->findUuidByName($id)->id;
            } catch (\Exception $e) {
                throw new TerminusException('Could not locate a site your user may access identified by {id}.', compact('id'), 1);
            }
            $site = $this->getContainer()->get($this->collected_class, [(object) ['id' => $uuid], ['id' => $uuid, 'collection' => $this]]);
            $site->fetch();
            $this->models[$uuid] = $site;
        }
        return $site;
    }