@param string $site

@return \Acquia\Cloud\Api\Response\Tasks

@throws \Guzzle\Http\Exception\ClientErrorResponseException

@see http://cloudapi.acquia.com/#GET__sites__site_tasks-instance_route
196277
public function tasks($site)
    {
        $variables = array(
            'site' => $site,
        );
        $request = $this->get(array('{+base_path}/sites/{site}/tasks.json', $variables));
        return new Response\Tasks($request);
    }
840791
public function transform($site, array $params = array())
    {
        if (!$site instanceof SiteInterface) {
            throw new TransformerParameterTypeException();
        }

        $facade = $this->newFacade();

        $facade->id = $site->getId();
        $facade->siteId = $site->getSiteId();
        $facade->name = $site->getName();

        if ($this->hasGroup(CMSGroupContext::SITE_MAIN_ALIAS)) {
            $facade->mainAlias = $this->getContext()->transform('site_alias', $site->getMainAlias());
        }

        foreach ($site->getLanguages() as $language) {
            $facade->addLanguage($language);
        }

        if ($this->hasGroup(CMSGroupContext::BLOCKS)) {
            foreach ($site->getBlocks() as $value) {
                $facade->addBlocks($value);
            }
        }

        return $facade;
    }
878451
public function environments($site)
    {
        $variables = array('site' => $site);
        $request = $this->get(array('{+base_path}/sites/{site}/envs.json', $variables));
        return new Response\Environments($request);
    }
886478
public function getSiteDomain(Site $site)
    {
        $domain = $site->getDomain();

        if (empty($domain)) {
            return $this->domainService->getDefaultDomainName();
        }

        $domainName = $domain->getDomainName();

        if (empty($domainName)) {
            return $this->domainService->getDefaultDomainName();
        }

        return $domainName;
    }
1354922
public function getSiteThemePagesTemplateConfig(Site $site)
    {
        $theme = $site->getTheme();

        $rcmThemesConfig = $this->getThemeConfig($theme);

        if (empty($rcmThemesConfig['pages'])) {
            throw new RuntimeException(
                'No theme config found for site and no default theme found'
            );
        }

        return $rcmThemesConfig['pages'];
    }
752264
public function setSite($site)
    {
        if (empty($site)) return $this;

        $this->checkSite($site);

        return $this->addMeta('site', $site);
    }
798129
public function getRoot(Site $site)
    {
        try {
            $query = $this->createQueryBuilder('s')
                    ->andWhere('s._site = :site')
                    ->andWhere('s._parent is null')
                    ->setMaxResults(1)
                    ->setParameters([
                        'site' => $site,
                    ]);

            return $query->getQuery()->getSingleResult();
        } catch (NoResultException $e) {
            return;
        } catch (\Exception $e) {
            return;
        }
    }
779004
public static function action($task)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();

        //====================================================================//
        // Initial Response
        $response = self::getEmptyResponse($task);

        //====================================================================//
        // Safety Check - Minimal Parameters
        //====================================================================//
        $inputs = self::validateInputs($task);
        if (!$inputs) {
            return $response;
        }

        //====================================================================//
        // Execute Action
        switch ($task->name) {
            //====================================================================//
            //  READING A FILE INFORMATIONS
            case SPL_F_ISFILE:
                $response->data = Splash::file()->isFile($inputs['path'], $inputs['md5']);

                break;
            //====================================================================//
            //  READING A FILE CONTENTS
            case SPL_F_GETFILE:
                $response->data = Splash::file()->readFile($inputs['path'], $inputs['md5']);

                break;
            default:
                Splash::log()->err('File - Requested task not found => '.$task->name);

                break;
        }

        //====================================================================//
        // Task results prot treatment
        if (false != $response->data) {
            $response->result = true;
        }

        return $response;
    }
128795
public function andSiteIs(Site $site)
    {
        $suffix = $this->getSuffix();

        return $this->andWhere($this->getSectionAlias().'._site = :site'.$suffix)
                        ->setParameter('site'.$suffix, $site);
    }
1103972
protected function fillSite($site, array $params)
    {
        if ($site) {
            $params['site'] = $site;
        } elseif ($this->siteCode) {
            $params['site'] = $this->siteCode;
        }

        return $params;
    }
119268
public static function action($task)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();
        Splash::log()->deb("Admin => ".$task->name." (".$task->desc.")");

        //====================================================================//
        // Initial Response
        $response = self::getEmptyResponse($task);

        switch ($task->name) {
            //====================================================================//
            //  READING OF SERVER OBJECT LIST
            case SPL_F_GET_OBJECTS:
                $response->data = Splash::objects();
                if (false != $response->data) {
                    $response->result = true;
                }

                break;
            //====================================================================//
            //  READING OF SERVER WIDGETS LIST
            case SPL_F_GET_WIDGETS:
                $response->data = Splash::widgets();
                if (false != $response->data) {
                    $response->result = true;
                }

                break;
            //====================================================================//
            //  READING OF SERVER SELFTEST RESULTS
            case SPL_F_GET_SELFTEST:
                $response->result = Splash::selfTest();
                $response->data = $response->result;

                break;
            //====================================================================//
            //  READING OF SERVER INFORMATIONS
            case SPL_F_GET_INFOS:
                $response->data = Splash::informations();
                if (false != $response->data) {
                    $response->result = true;
                }

                break;
            default:
                Splash::log()->err("Admin - Requested task not found => ".$task->name);

                break;
        }

        return $response;
    }
1271371
public function setActiveSite(SiteInterface $site = null)
    {
        $this->site = $site;
        $this->app->instance(SiteModel::class, $site);

        return $this;
    }
580608
static function SitemapCacheFile(Site $site)
    {
        $cacheFolder = Path::Combine(PHINE_PATH, 'App/Phine/Cache/Sitemap');
        $filename = Path::AddExtension($site->GetID(), 'xml');
        return Path::Combine($cacheFolder, $filename);
    }
1130663
protected function prepareDefaultValues(Site $site)
    {
        $defaults = $this->getDefaultSiteValues();

        foreach ($defaults as $key => $value) {
            $getMethod = 'get' . ucfirst($key);
            $setMethod = 'set' . ucfirst($key);

            $currentValue = $site->$getMethod();

            if (empty($currentValue)) {
                $site->$setMethod($value);
            }
        }

        return $site;
    }
1280390
public function svnUsers($site)
    {
        $variables = array('site' => $site);
        $request = $this->get(array('{+base_path}/sites/{site}/svnusers.json', $variables));
        return new Response\SvnUsers($request);
    }
1318195
private function SiteFolderCondition(Site $site)
    {
        $siteUrl = $site->GetUrl();       
        $siteFolder = parse_url($siteUrl, PHP_URL_PATH);
        if ($siteFolder != '' && $siteFolder != '/')
        {
            return new RewriteCondition(new Variable(ServerVariable::RequestUri()), '^' . rtrim($siteFolder, '/') . '/');
        }
        else
        {
            return new RewriteCondition(new Variable(ServerVariable::RequestUri()), '^/');
        } 
        return null;
    }
552207
private static function getEmptyResponse($task)
    {
        //====================================================================//
        // Initial Tasks results ArrayObject
        $response = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);

        //====================================================================//
        // Set Default Result to False
        $response->result = false;
        $response->data = null;

        //====================================================================//
        // Insert Task Description Informations
        $response->name = $task->name;
        $response->desc = $task->desc;

        return $response;
    }