Creates a new FlexModel instance.

@param string $identifier
@param string $resource
@param string $cachePath

@return FlexModel
966945
public static function createFlexModel($identifier, $resource, $cachePath)
    {
        $domDocument = new DOMDocument('1.0', 'UTF-8');
        $domDocument->load($resource);
        $domDocument->xinclude();

        $flexModel = new FlexModel($identifier);
        $flexModel->load($domDocument, $cachePath);

        return $flexModel;
    }
211396
protected function addExistingNodeVariantInformationToResponse($identifier, ContentContext $context)
    {
        $nodeVariants = $context->getNodeVariantsByIdentifier($identifier);
        if (count($nodeVariants) > 0) {
            $this->response->setHeader('X-Neos-Node-Exists-In-Other-Dimensions', true);

            // If the node exists in another dimension, we want to know how many nodes in the rootline are also missing for the target
            // dimension. This is needed in the UI to tell the user if nodes will be materialized recursively upwards in the rootline.
            // To find the node path for the given identifier, we just use the first result. This is a safe assumption at least for
            // "Document" nodes (aggregate=true), because they are always moved in-sync.
            $node = reset($nodeVariants);
            /** @var NodeInterface $node */
            if ($node->getNodeType()->isAggregate()) {
                $pathSegmentsToSites = NodePaths::getPathDepth(SiteService::SITES_ROOT_PATH);
                $pathSegmentsToNodeVariant = NodePaths::getPathDepth($node->getPath());
                // Segments between the sites root "/sites" and the node variant (minimum 1)
                $pathSegments = $pathSegmentsToNodeVariant - $pathSegmentsToSites;
                // Nodes between (and including) the site root node and the node variant (minimum 1)
                $siteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $context->getCurrentSite()->getNodeName());
                $nodes = $context->getNodesOnPath($siteNodePath, $node->getPath());
                $missingNodesOnRootline = $pathSegments - count($nodes);
                if ($missingNodesOnRootline > 0) {
                    $this->response->setHeader('X-Neos-Nodes-Missing-On-Rootline', $missingNodesOnRootline);
                }
            }
        }
    }
483748
public function create($providerClass, IDictionary $shared) {
        $provider = $this->container->get($providerClass, ['shared' => $shared]);
        $this->container->set($providerClass, $provider);

        return $provider;
    }
1193935
public static function getAddonByIdentifier(string $identifier)
    {
        foreach (self::getAddons() as $addon) {
            if ($addon->getIdentifier() == $identifier) {
                return $addon;
            }
        }
        
        return null;
    }
72483
public function init(string $templatesPath, string $cachePath = null) : TemplateLoaderInterface
    {
        $loader = new \Twig_Loader_Filesystem($templatesPath);
        if (null !== $cachePath) {
            $this->env = new \Twig_Environment($loader, [
                'cache' => $cachePath,
            ]);
        } else {
            $this->env = new \Twig_Environment($loader);
        }
        return $this;
    }
333453
public static function icon($identifier, $icon) {
		$result=new HtmlButton($identifier);
		$result->asIcon($icon);
		return $result;
	}
378436
public function instantiate($identifier, $config = array())
    {
        //Get the filter(s) we need to create
        $filters = (array) $identifier;

        //Create the filter chain
        $filter = array_shift($filters);
        $filter = $this->_createFilter($filter, $config);

        foreach ($filters as $name) {
            $filter->addFilter(self::_createFilter($name, $config));
        }

        return $filter;
    }
766901
public function htmlLabel($identifier, $content="", $icon=NULL,$tagName="div") {
		return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$icon, $tagName));
	}
670285
public function loadIdentifier($identifier)
    {
        $result = false;

        $identifier = AnService::getIdentifier($identifier);

        //Get the path
        $path = $identifier->filepath;

        if ($path !== false) {
            $result = self::loadFile($path);
        }

        return $result;
    }
675770
public function htmlModal($identifier, $header="", $content="", $actions=array()) {
		return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions));
	}
484363
public function getSubresource(string $resourceClass, array $identifiers, array $context, string $operationName = null)
    {
        $manager = $this->managerRegistry->getManagerForClass($resourceClass);
        if (null === $manager) {
            throw new ResourceClassNotSupportedException(sprintf('The object manager associated with the "%s" resource class cannot be retrieved.', $resourceClass));
        }

        $repository = $manager->getRepository($resourceClass);
        if (!method_exists($repository, 'createQueryBuilder')) {
            throw new RuntimeException('The repository class must have a "createQueryBuilder" method.');
        }

        if (!isset($context['identifiers'], $context['property'])) {
            throw new ResourceClassNotSupportedException('The given resource class is not a subresource.');
        }

        $queryNameGenerator = new QueryNameGenerator();

        /*
         * The following recursively translates to this pseudo-dql:
         *
         * SELECT thirdLevel WHERE thirdLevel IN (
         *   SELECT thirdLevel FROM relatedDummies WHERE relatedDummies = ? AND relatedDummies IN (
         *     SELECT relatedDummies FROM Dummy WHERE Dummy = ?
         *   )
         * )
         *
         * By using subqueries, we're forcing the SQL execution plan to go through indexes on doctrine identifiers.
         */
        $queryBuilder = $this->buildQuery($identifiers, $context, $queryNameGenerator, $repository->createQueryBuilder($alias = 'o'), $alias, \count($context['identifiers']));

        if (true === $context['collection']) {
            foreach ($this->collectionExtensions as $extension) {
                // We don't need this anymore because we already made sub queries to ensure correct results
                if ($extension instanceof FilterEagerLoadingExtension) {
                    continue;
                }

                $extension->applyToCollection($queryBuilder, $queryNameGenerator, $resourceClass, $operationName, $context);
                if ($extension instanceof QueryResultCollectionExtensionInterface && $extension->supportsResult($resourceClass, $operationName, $context)) {
                    return $extension->getResult($queryBuilder, $resourceClass, $operationName, $context);
                }
            }
        } else {
            foreach ($this->itemExtensions as $extension) {
                $extension->applyToItem($queryBuilder, $queryNameGenerator, $resourceClass, $identifiers, $operationName, $context);
                if ($extension instanceof QueryResultItemExtensionInterface && $extension->supportsResult($resourceClass, $operationName, $context)) {
                    return $extension->getResult($queryBuilder, $resourceClass, $operationName, $context);
                }
            }
        }

        $query = $queryBuilder->getQuery();

        return $context['collection'] ? $query->getResult() : $query->getOneOrNullResult();
    }
965124
public function getClassTemplates(ObjectIdentifier $identifier)
    {
        $templates = array();

        //Identifier
        $component = $this->getObject('object.bootstrapper')
            ->getComponentIdentifier($identifier->package, $identifier->domain);

        //Fallback
        if($namespaces = $this->getIdentifierNamespaces($component))
        {
            foreach($namespaces as $namespace)
            {
                //Handle class prefix vs class namespace
                if(strpos($namespace, '\\')) {
                    $namespace .= '\\';
                }

                $templates[] = $namespace.'<Class>';
                $templates[] = $namespace.'<Package><Path><File>';
            }
        }

        $templates = array_merge($templates, parent::getClassTemplates($identifier));

        return $templates;
    }
798792
private function createCustomClient($identifier)
    {
        try {
            $refl = new \ReflectionClass($identifier);

            if (!$refl->implementsInterface('\PommProject\Foundation\Client\ClientInterface')) {
                throw new FoundationException(
                    sprintf(
                        "Class '%s' must implement '\PommProject\Foundation\Client\ClientInterface'.",
                        $identifier
                    )
                );
            }
        } catch (\ReflectionException $e) {
            throw new FoundationException(
                sprintf(
                    "Cannot find inspector class '%s'.",
                    $identifier
                ),
                null,
                $e
            );
        }

        return new $identifier;
    }
619494
public static function getInstance($identifier = self::PRIMARY)
    {
        $serviceClassName = get_called_class();


        return self::findOrCreateInstance($serviceClassName, $identifier);
    }
523140
public function createTranslationUnit(string $identifier, string $sourceValue = null): XmlElement
    {
        if (null === $body = $this->getXPathFirstItem('/xlf:xliff/xlf:file/xlf:body')) {
            throw new \InvalidArgumentException('Could not find the xliff body element');
        }

        /** @var XmlElement $transUnit */
        $transUnit = $this->createElementNS(self::XLIFF_NS, 'trans-unit');

        $body->appendChild($transUnit);

        $transUnit->setAttributeNS(self::XLIFF_NS, 'id', $identifier);
        $source = $transUnit->appendChild($this->createElementNS(self::XLIFF_NS, 'source'));
        if (null !== $sourceValue) {
            $source->appendChild($this->createTextNode($sourceValue));
        }

        return $transUnit;
    }
813589
public function getClient($identifier)
    {
        $client = $this->getClientFromPool($identifier);

        if ($client === null) {
            $client = $this->createClient($identifier);
            $this->getSession()->registerClient($client);
        }

        return $client;
    }
999705
public function fetch($identifier)
    {
        [$config, $key] = $this->configSplit($identifier);

        return CakeCache::read(static::CACHE_PREFIX . $key, $config);
    }