@param $webspaceKey

@return WebspaceSitemap
970896
private function getWebspaceSitemap($webspaceKey)
    {
        $webspace = $this->webspaceManager->findWebspaceByKey($webspaceKey);

        $webspaceSitemap = new WebspaceSitemap();
        $webspaceSitemap->setWebspaceKey($webspace->getKey());

        $defaultLocalization = $webspace->getDefaultLocalization();
        if ($defaultLocalization) {
            $webspaceSitemap->setDefaultLocalization($defaultLocalization->getLocale());
        }
        foreach ($webspace->getAllLocalizations() as $localization) {
            $webspaceSitemap->addLocalization($localization->getLocale());
        }

        return $webspaceSitemap;
    }
99443
protected function getRootRouteNode($webspaceKey, $locale, $segment)
    {
        return $this->documentManager->find(
            $this->sessionManager->getRoutePath($webspaceKey, $locale, $segment)
        );
    }
1202809
public function postAction($webspace, Request $request)
    {
        $document = $this->get('sulu_custom_urls.manager')->create(
            $webspace,
            $request->request->all(),
            $this->getRequestParameter($request, 'targetLocale', true)
        );
        $this->get('sulu_document_manager.document_manager')->flush();

        $context = new Context();
        $context->setGroups(['defaultCustomUrl', 'fullRoute']);

        return $this->handleView($this->view($document)->setContext($context));
    }
274764
private function prepareNodesTree(
        $nodes,
        $webspaceKey,
        $languageCode,
        $complete = true,
        $excludeGhosts = false,
        $maxDepth = 1,
        $currentDepth = 0
    ) {
        ++$currentDepth;

        $results = [];
        foreach ($nodes as $node) {
            $result = $this->prepareNode($node, $webspaceKey, $languageCode, 1, $complete, $excludeGhosts);
            if (null !== $maxDepth &&
                $currentDepth < $maxDepth &&
                $node->getHasChildren() &&
                null != $node->getChildren()
            ) {
                $result['_embedded']['nodes'] = $this->prepareNodesTree(
                    $node->getChildren(),
                    $webspaceKey,
                    $languageCode,
                    $complete,
                    $excludeGhosts,
                    $maxDepth,
                    $currentDepth
                );
            }
            $results[] = $result;
        }

        return $results;
    }
213317
private function getContentDocument($webspaceKey, $locale, array $options = [])
    {
        return $this->documentManager->find(
            $this->sessionManager->getContentPath($webspaceKey),
            $locale,
            $options
        );
    }
1031181
private function upgradeWebspace(Webspace $webspace)
    {
        $sessionManager = $this->container->get('sulu.phpcr.session');
        $node = $sessionManager->getContentNode($webspace->getKey());

        foreach ($webspace->getAllLocalizations() as $localization) {
            $locale = $localization->getLocale();
            $propertyName = $this->getPropertyName(self::SHADOW_ON_PROPERTY, $locale);

            $this->upgradeNode($node, $propertyName, $locale);
        }
    }
428214
public function postAction(Request $request, $webspace)
    {
        $data = $request->request->all();
        $data['content'] = $this->buildContent($data);

        $entity = $this->get('sulu_website.analytics.manager')->create($webspace, $data);
        $this->get('doctrine.orm.entity_manager')->flush();
        $this->get('sulu_website.http_cache.clearer')->clear();

        return $this->handleView($this->view($entity, 200));
    }
967996
public function generateSitePackage($packageKey, $siteName)
    {
        $this->packageManager->createPackage($packageKey, [
            'type' => 'neos-site',
            "require" => [
                "neos/neos" => "*",
                "neos/nodetypes" => "*"
            ],
            "suggest" => [
                "neos/seo" => "*"
            ]
        ]);

        $this->generateSitesXml($packageKey, $siteName);
        $this->generateSitesRootFusion($packageKey, $siteName);
        $this->generateSitesPageFusion($packageKey, $siteName);
        $this->generateDefaultTemplate($packageKey, $siteName);
        $this->generateNodeTypesConfiguration($packageKey);
        $this->generateAdditionalFolders($packageKey);

        return $this->generatedFiles;
    }
319284
public function doCall($serverKey, $request) {
    $client = $this->getClient($serverKey);
    if ($client) {
      $response = $client->call($request);
      return $response;
    }
    return ObjectFactory::getNewInstance('response');
  }
588935
private function getAlternate($url, $webspaceKey, $locale, $default = false)
    {
        $url = $this->contentPath->getContentPath($url, $webspaceKey, $locale);

        return sprintf(
            '<link rel="alternate" href="%s" hreflang="%s" />',
            $url,
            !$default ? str_replace('_', '-', $locale) : 'x-default'
        );
    }
1094940
protected function generateTemplates(Webspace $webspace)
    {
        foreach ($this->xpath->query('/x:webspace/x:templates/x:template') as $templateNode) {
            /* @var \DOMNode $templateNode */
            $template = $templateNode->nodeValue;
            $type = $templateNode->attributes->getNamedItem('type')->nodeValue;
            $webspace->addTemplate($type, $template);
        }

        return $webspace;
    }
17918
private static function getNamespace(int $key, array $tokens): ?string
    {
        $namespace  = null;
        $tokenCount = \count($tokens);

        for ($i = $key; $i < $tokenCount; $i++) {
            if (self::isPartOfNamespace($tokens[$i])) {
                $namespace .= $tokens[$i][1];
            } elseif ($tokens[$i] === ';') {
                return $namespace;
            }
        }

        return null;
    }
1193036
public function putAction($webspace, $id, Request $request)
    {
        $manager = $this->get('sulu_custom_urls.manager');

        $document = $manager->save($id, $request->request->all());
        $this->get('sulu_document_manager.document_manager')->flush();

        $context = new Context();
        $context->setGroups(['defaultCustomUrl', 'fullRoute']);

        return $this->handleView($this->view($document)->setContext($context));
    }
395363
protected function generateSitesXml($packageKey, $siteName)
    {
        $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Content/Sites.xml';

        $contextVariables = [
            'packageKey' => $packageKey,
            'siteName' => htmlspecialchars($siteName),
            'siteNodeName' => $this->generateSiteNodeName($packageKey),
            'dimensions' => $this->contentDimensionRepository->findAll()
        ];

        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);

        $sitesXmlPathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Content/Sites.xml';
        $this->generateFile($sitesXmlPathAndFilename, $fileContent);
    }
1134239
protected function transformKey($key)
    {
        list($namespace, $group, $item) = $this->repository->parseKey($key);
        if (!$namespace) {
            $namespace = $this->default_namespace;
        }

        $collection = "{$namespace}::{$group}";
        if ($item) {
            $collection .= ".{$item}";
        }

        return $collection;
    }
1307205
protected function generateWebspaceLocalizations()
    {
        foreach ($this->xpath->query('/x:webspace/x:localizations/x:localization') as $localizationNode) {
            $localization = $this->generateLocalizationFromNode($localizationNode);

            $this->webspace->addLocalization($localization);
        }
    }
181736
public function create($serviceKey, $requestKey, array $parameters = [])
    {
        $config       = $this->getParamOrFail($this->config, $serviceKey);
        $service      = $this->getServiceParams($config);
        $request      = $this->getRequestParams($config, $requestKey, $service);
        $uri          = $this->buildUri($service['endpoint'], $request['path'], $request['query']);

        list($optionalParameters, $placeholders) = $this->separateParameters($request['body'], $parameters);

        $values       = array_values($parameters);
        $body         = $this->buildBody($request['body'], $request['headers'], $placeholders, $values, $optionalParameters);

        return $this->buildRequest(
            $request['method'],
            $this->replace($uri, $placeholders, $values),
            $this->replaceAll($request['headers'], $placeholders, $values),
            $body,
            $request['version'],
            $request['retries'],
            $request['options'],
            $serviceKey,
            $requestKey
        );
    }