repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
neos/neos-development-collection
Neos.SiteKickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateSitesPageFusion
protected function generateSitesPageFusion($packageKey, $siteName) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Fusion/NodeTypes/Pages/Page.fusion'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['siteName'] = $siteName; $packageKeyDomainPart = substr(strrchr($packageKey, '.'), 1) ?: $packageKey; $contextVariables['siteNodeName'] = $packageKeyDomainPart; $fileContent = $this->renderSimpleTemplate($templatePathAndFilename, $contextVariables); $sitesPageFusionPathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Fusion/NodeTypes/Page.fusion'; $this->generateFile($sitesPageFusionPathAndFilename, $fileContent); }
php
protected function generateSitesPageFusion($packageKey, $siteName) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Fusion/NodeTypes/Pages/Page.fusion'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['siteName'] = $siteName; $packageKeyDomainPart = substr(strrchr($packageKey, '.'), 1) ?: $packageKey; $contextVariables['siteNodeName'] = $packageKeyDomainPart; $fileContent = $this->renderSimpleTemplate($templatePathAndFilename, $contextVariables); $sitesPageFusionPathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Fusion/NodeTypes/Page.fusion'; $this->generateFile($sitesPageFusionPathAndFilename, $fileContent); }
[ "protected", "function", "generateSitesPageFusion", "(", "$", "packageKey", ",", "$", "siteName", ")", "{", "$", "templatePathAndFilename", "=", "'resource://Neos.SiteKickstarter/Private/Generator/Fusion/NodeTypes/Pages/Page.fusion'", ";", "$", "contextVariables", "=", "[", "...
Generate basic Fusion documentNode file. @param string $packageKey @param string $siteName @return void
[ "Generate", "basic", "Fusion", "documentNode", "file", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.SiteKickstarter/Classes/Service/GeneratorService.php#L121-L135
train
neos/neos-development-collection
Neos.SiteKickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateDefaultTemplate
protected function generateDefaultTemplate($packageKey, $siteName) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Template/SiteTemplate.html'; $contextVariables = [ 'siteName' => $siteName, 'neosViewHelper' => '{namespace neos=Neos\Neos\ViewHelpers}', 'fusionViewHelper' => '{namespace fusion=Neos\Fusion\ViewHelpers}', 'siteNodeName' => $this->generateSiteNodeName($packageKey) ]; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $defaultTemplatePathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Templates/Page/Default.html'; $this->generateFile($defaultTemplatePathAndFilename, $fileContent); }
php
protected function generateDefaultTemplate($packageKey, $siteName) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Template/SiteTemplate.html'; $contextVariables = [ 'siteName' => $siteName, 'neosViewHelper' => '{namespace neos=Neos\Neos\ViewHelpers}', 'fusionViewHelper' => '{namespace fusion=Neos\Fusion\ViewHelpers}', 'siteNodeName' => $this->generateSiteNodeName($packageKey) ]; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $defaultTemplatePathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Templates/Page/Default.html'; $this->generateFile($defaultTemplatePathAndFilename, $fileContent); }
[ "protected", "function", "generateDefaultTemplate", "(", "$", "packageKey", ",", "$", "siteName", ")", "{", "$", "templatePathAndFilename", "=", "'resource://Neos.SiteKickstarter/Private/Generator/Template/SiteTemplate.html'", ";", "$", "contextVariables", "=", "[", "'siteNam...
Generate basic template file. @param string $packageKey @param string $siteName @return void
[ "Generate", "basic", "template", "file", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.SiteKickstarter/Classes/Service/GeneratorService.php#L144-L159
train
neos/neos-development-collection
Neos.SiteKickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateNodeTypesConfiguration
protected function generateNodeTypesConfiguration($packageKey) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Configuration/NodeTypes.Document.Page.yaml'; $contextVariables = [ 'packageKey' => $packageKey ]; $fileContent = $this->renderSimpleTemplate($templatePathAndFilename, $contextVariables); $sitesNodeTypesPathAndFilename = $this->packageManager->getPackage($packageKey)->getConfigurationPath() . 'NodeTypes.Document.Page.yaml'; $this->generateFile($sitesNodeTypesPathAndFilename, $fileContent); }
php
protected function generateNodeTypesConfiguration($packageKey) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Configuration/NodeTypes.Document.Page.yaml'; $contextVariables = [ 'packageKey' => $packageKey ]; $fileContent = $this->renderSimpleTemplate($templatePathAndFilename, $contextVariables); $sitesNodeTypesPathAndFilename = $this->packageManager->getPackage($packageKey)->getConfigurationPath() . 'NodeTypes.Document.Page.yaml'; $this->generateFile($sitesNodeTypesPathAndFilename, $fileContent); }
[ "protected", "function", "generateNodeTypesConfiguration", "(", "$", "packageKey", ")", "{", "$", "templatePathAndFilename", "=", "'resource://Neos.SiteKickstarter/Private/Generator/Configuration/NodeTypes.Document.Page.yaml'", ";", "$", "contextVariables", "=", "[", "'packageKey'"...
Generate a example NodeTypes.yaml @param string $packageKey @throws \Neos\FluidAdaptor\Core\Exception
[ "Generate", "a", "example", "NodeTypes", ".", "yaml" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.SiteKickstarter/Classes/Service/GeneratorService.php#L178-L190
train
neos/neos-development-collection
Neos.SiteKickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateAdditionalFolders
protected function generateAdditionalFolders($packageKey) { $resourcesPath = $this->packageManager->getPackage($packageKey)->getResourcesPath(); $publicResourcesPath = Files::concatenatePaths([$resourcesPath, 'Public']); foreach (['Images', 'JavaScript', 'Styles'] as $publicResourceFolder) { Files::createDirectoryRecursively(Files::concatenatePaths([$publicResourcesPath, $publicResourceFolder])); } }
php
protected function generateAdditionalFolders($packageKey) { $resourcesPath = $this->packageManager->getPackage($packageKey)->getResourcesPath(); $publicResourcesPath = Files::concatenatePaths([$resourcesPath, 'Public']); foreach (['Images', 'JavaScript', 'Styles'] as $publicResourceFolder) { Files::createDirectoryRecursively(Files::concatenatePaths([$publicResourcesPath, $publicResourceFolder])); } }
[ "protected", "function", "generateAdditionalFolders", "(", "$", "packageKey", ")", "{", "$", "resourcesPath", "=", "$", "this", "->", "packageManager", "->", "getPackage", "(", "$", "packageKey", ")", "->", "getResourcesPath", "(", ")", ";", "$", "publicResource...
Generate additional folders for site packages. @param string $packageKey
[ "Generate", "additional", "folders", "for", "site", "packages", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.SiteKickstarter/Classes/Service/GeneratorService.php#L197-L205
train
neos/neos-development-collection
Neos.SiteKickstarter/Classes/Service/GeneratorService.php
GeneratorService.renderSimpleTemplate
protected function renderSimpleTemplate($templatePathAndFilename, array $contextVariables) { $content = file_get_contents($templatePathAndFilename); foreach ($contextVariables as $key => $value) { $content = str_replace('{' . $key . '}', $value, $content); } return $content; }
php
protected function renderSimpleTemplate($templatePathAndFilename, array $contextVariables) { $content = file_get_contents($templatePathAndFilename); foreach ($contextVariables as $key => $value) { $content = str_replace('{' . $key . '}', $value, $content); } return $content; }
[ "protected", "function", "renderSimpleTemplate", "(", "$", "templatePathAndFilename", ",", "array", "$", "contextVariables", ")", "{", "$", "content", "=", "file_get_contents", "(", "$", "templatePathAndFilename", ")", ";", "foreach", "(", "$", "contextVariables", "...
Simplified template rendering @param string $templatePathAndFilename @param array $contextVariables @return string
[ "Simplified", "template", "rendering" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.SiteKickstarter/Classes/Service/GeneratorService.php#L214-L221
train
neos/neos-development-collection
Neos.Neos/Classes/ViewHelpers/Backend/JavascriptConfigurationViewHelper.php
JavascriptConfigurationViewHelper.renderMaximumFileUploadSize
protected function renderMaximumFileUploadSize() { $maximumFileUploadSizeInBytes = min(Files::sizeStringToBytes(ini_get('post_max_size')), Files::sizeStringToBytes(ini_get('upload_max_filesize'))); return sprintf('"%d"; // %s, as configured in php.ini', $maximumFileUploadSizeInBytes, Files::bytesToSizeString($maximumFileUploadSizeInBytes)); }
php
protected function renderMaximumFileUploadSize() { $maximumFileUploadSizeInBytes = min(Files::sizeStringToBytes(ini_get('post_max_size')), Files::sizeStringToBytes(ini_get('upload_max_filesize'))); return sprintf('"%d"; // %s, as configured in php.ini', $maximumFileUploadSizeInBytes, Files::bytesToSizeString($maximumFileUploadSizeInBytes)); }
[ "protected", "function", "renderMaximumFileUploadSize", "(", ")", "{", "$", "maximumFileUploadSizeInBytes", "=", "min", "(", "Files", "::", "sizeStringToBytes", "(", "ini_get", "(", "'post_max_size'", ")", ")", ",", "Files", "::", "sizeStringToBytes", "(", "ini_get"...
Returns the lowest configured maximum upload file size @return string
[ "Returns", "the", "lowest", "configured", "maximum", "upload", "file", "size" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/ViewHelpers/Backend/JavascriptConfigurationViewHelper.php#L228-L232
train
neos/neos-development-collection
Neos.Media/Classes/Command/MediaCommandController.php
MediaCommandController.importResourcesCommand
public function importResourcesCommand($simulate = false) { $this->initializeConnection(); $sql = ' SELECT r.persistence_object_identifier, r.filename, r.mediatype FROM neos_flow_resourcemanagement_persistentresource r LEFT JOIN neos_media_domain_model_asset a ON a.resource = r.persistence_object_identifier LEFT JOIN neos_media_domain_model_thumbnail t ON t.resource = r.persistence_object_identifier WHERE a.persistence_object_identifier IS NULL AND t.persistence_object_identifier IS NULL '; $statement = $this->dbalConnection->prepare($sql); $statement->execute(); $resourceInfos = $statement->fetchAll(); if ($resourceInfos === []) { $this->outputLine('Found no resources which need to be imported.'); $this->quit(); } foreach ($resourceInfos as $resourceInfo) { $resource = $this->persistenceManager->getObjectByIdentifier($resourceInfo['persistence_object_identifier'], PersistentResource::class); if ($resource === null) { $this->outputLine('Warning: PersistentResource for file "%s" seems to be corrupt. No resource object with identifier %s could be retrieved from the Persistence Manager.', [$resourceInfo['filename'], $resourceInfo['persistence_object_identifier']]); continue; } if (!$resource->getStream()) { $this->outputLine('Warning: PersistentResource for file "%s" seems to be corrupt. The actual data of resource %s could not be found in the resource storage.', [$resourceInfo['filename'], $resourceInfo['persistence_object_identifier']]); continue; } $className = $this->mappingStrategy->map($resource, $resourceInfos); $resourceObj = new $className($resource); if ($simulate) { $this->outputLine('Simulate: Adding new resource "%s" (type: %s)', [$resourceObj->getResource()->getFilename(), $className]); } else { $this->assetRepository->add($resourceObj); $this->outputLine('Simulate: Adding new resource "%s" (type: %s)', [$resourceObj->getResource()->getFilename(), $className]); } } }
php
public function importResourcesCommand($simulate = false) { $this->initializeConnection(); $sql = ' SELECT r.persistence_object_identifier, r.filename, r.mediatype FROM neos_flow_resourcemanagement_persistentresource r LEFT JOIN neos_media_domain_model_asset a ON a.resource = r.persistence_object_identifier LEFT JOIN neos_media_domain_model_thumbnail t ON t.resource = r.persistence_object_identifier WHERE a.persistence_object_identifier IS NULL AND t.persistence_object_identifier IS NULL '; $statement = $this->dbalConnection->prepare($sql); $statement->execute(); $resourceInfos = $statement->fetchAll(); if ($resourceInfos === []) { $this->outputLine('Found no resources which need to be imported.'); $this->quit(); } foreach ($resourceInfos as $resourceInfo) { $resource = $this->persistenceManager->getObjectByIdentifier($resourceInfo['persistence_object_identifier'], PersistentResource::class); if ($resource === null) { $this->outputLine('Warning: PersistentResource for file "%s" seems to be corrupt. No resource object with identifier %s could be retrieved from the Persistence Manager.', [$resourceInfo['filename'], $resourceInfo['persistence_object_identifier']]); continue; } if (!$resource->getStream()) { $this->outputLine('Warning: PersistentResource for file "%s" seems to be corrupt. The actual data of resource %s could not be found in the resource storage.', [$resourceInfo['filename'], $resourceInfo['persistence_object_identifier']]); continue; } $className = $this->mappingStrategy->map($resource, $resourceInfos); $resourceObj = new $className($resource); if ($simulate) { $this->outputLine('Simulate: Adding new resource "%s" (type: %s)', [$resourceObj->getResource()->getFilename(), $className]); } else { $this->assetRepository->add($resourceObj); $this->outputLine('Simulate: Adding new resource "%s" (type: %s)', [$resourceObj->getResource()->getFilename(), $className]); } } }
[ "public", "function", "importResourcesCommand", "(", "$", "simulate", "=", "false", ")", "{", "$", "this", "->", "initializeConnection", "(", ")", ";", "$", "sql", "=", "'\n\t\t\tSELECT\n\t\t\t\tr.persistence_object_identifier, r.filename, r.mediatype\n\t\t\tFROM neos_flow_re...
Import resources to asset management This command detects Flow "PersistentResource"s which are not yet available as "Asset" objects and thus don't appear in the asset management. The type of the imported asset is determined by the file extension provided by the PersistentResource. @param boolean $simulate If set, this command will only tell what it would do instead of doing it right away @return void
[ "Import", "resources", "to", "asset", "management" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Command/MediaCommandController.php#L95-L140
train
neos/neos-development-collection
Neos.Media/Classes/Command/MediaCommandController.php
MediaCommandController.renderThumbnailsCommand
public function renderThumbnailsCommand($limit = null) { $thumbnailCount = $this->thumbnailRepository->countUngenerated(); $iterator = $this->thumbnailRepository->findUngeneratedIterator(); $this->output->progressStart($limit !== null && $thumbnailCount > $limit ? $limit : $thumbnailCount); $iteration = 0; foreach ($this->thumbnailRepository->iterate($iterator) as $thumbnail) { if ($thumbnail->getResource() === null) { $this->thumbnailService->refreshThumbnail($thumbnail); $this->persistenceManager->persistAll(); } $this->output->progressAdvance(1); $iteration++; if ($iteration === $limit) { break; } } }
php
public function renderThumbnailsCommand($limit = null) { $thumbnailCount = $this->thumbnailRepository->countUngenerated(); $iterator = $this->thumbnailRepository->findUngeneratedIterator(); $this->output->progressStart($limit !== null && $thumbnailCount > $limit ? $limit : $thumbnailCount); $iteration = 0; foreach ($this->thumbnailRepository->iterate($iterator) as $thumbnail) { if ($thumbnail->getResource() === null) { $this->thumbnailService->refreshThumbnail($thumbnail); $this->persistenceManager->persistAll(); } $this->output->progressAdvance(1); $iteration++; if ($iteration === $limit) { break; } } }
[ "public", "function", "renderThumbnailsCommand", "(", "$", "limit", "=", "null", ")", "{", "$", "thumbnailCount", "=", "$", "this", "->", "thumbnailRepository", "->", "countUngenerated", "(", ")", ";", "$", "iterator", "=", "$", "this", "->", "thumbnailReposit...
Render ungenerated thumbnails Loops over ungenerated thumbnails and renders them. Optional ``limit`` parameter to limit the amount of thumbnails to be rendered to avoid memory exhaustion. @param integer $limit Limit the amount of thumbnails to be rendered to avoid memory exhaustion @return void
[ "Render", "ungenerated", "thumbnails" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Command/MediaCommandController.php#L318-L335
train
neos/neos-development-collection
Neos.Media/Classes/Command/MediaCommandController.php
MediaCommandController.initializeConnection
protected function initializeConnection() { if (!$this->entityManager instanceof EntityManager) { $this->outputLine('This command only supports database connections provided by the Doctrine ORM Entity Manager. However, the current entity manager is an instance of %s.', [get_class($this->entityManager)]); $this->quit(1); } $this->dbalConnection = $this->entityManager->getConnection(); }
php
protected function initializeConnection() { if (!$this->entityManager instanceof EntityManager) { $this->outputLine('This command only supports database connections provided by the Doctrine ORM Entity Manager. However, the current entity manager is an instance of %s.', [get_class($this->entityManager)]); $this->quit(1); } $this->dbalConnection = $this->entityManager->getConnection(); }
[ "protected", "function", "initializeConnection", "(", ")", "{", "if", "(", "!", "$", "this", "->", "entityManager", "instanceof", "EntityManager", ")", "{", "$", "this", "->", "outputLine", "(", "'This command only supports database connections provided by the Doctrine OR...
Initializes the DBAL connection which is currently bound to the Doctrine Entity Manager @return void
[ "Initializes", "the", "DBAL", "connection", "which", "is", "currently", "bound", "to", "the", "Doctrine", "Entity", "Manager" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Command/MediaCommandController.php#L342-L351
train
neos/neos-development-collection
Neos.Fusion/Classes/FusionObjects/CaseImplementation.php
CaseImplementation.evaluate
public function evaluate() { $matcherKeys = $this->sortNestedFusionKeys(); foreach ($matcherKeys as $matcherName) { $renderedMatcher = $this->renderMatcher($matcherName); if ($this->matcherMatched($renderedMatcher)) { return $renderedMatcher; } } return null; }
php
public function evaluate() { $matcherKeys = $this->sortNestedFusionKeys(); foreach ($matcherKeys as $matcherName) { $renderedMatcher = $this->renderMatcher($matcherName); if ($this->matcherMatched($renderedMatcher)) { return $renderedMatcher; } } return null; }
[ "public", "function", "evaluate", "(", ")", "{", "$", "matcherKeys", "=", "$", "this", "->", "sortNestedFusionKeys", "(", ")", ";", "foreach", "(", "$", "matcherKeys", "as", "$", "matcherName", ")", "{", "$", "renderedMatcher", "=", "$", "this", "->", "r...
Execute each matcher until the first one matches @return mixed
[ "Execute", "each", "matcher", "until", "the", "first", "one", "matches" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/CaseImplementation.php#L41-L53
train
neos/neos-development-collection
Neos.Fusion/Classes/FusionObjects/CaseImplementation.php
CaseImplementation.renderMatcher
protected function renderMatcher($matcherKey) { $renderedMatcher = null; if (isset($this->properties[$matcherKey]['__objectType'])) { // object type already set, so no need to set it $renderedMatcher = $this->runtime->render( sprintf('%s/%s', $this->path, $matcherKey) ); return $renderedMatcher; } elseif (!is_array($this->properties[$matcherKey])) { throw new UnsupportedObjectTypeAtPathException('"Case" Fusion object only supports nested Fusion objects; no simple values.', 1372668062); } elseif (isset($this->properties[$matcherKey]['__eelExpression'])) { throw new UnsupportedObjectTypeAtPathException('"Case" Fusion object only supports nested Fusion objects; no Eel expressions.', 1372668077); } else { // No object type has been set, so we're using Neos.Fusion:Matcher as fallback $renderedMatcher = $this->runtime->render( sprintf('%s/%s<Neos.Fusion:Matcher>', $this->path, $matcherKey) ); return $renderedMatcher; } }
php
protected function renderMatcher($matcherKey) { $renderedMatcher = null; if (isset($this->properties[$matcherKey]['__objectType'])) { // object type already set, so no need to set it $renderedMatcher = $this->runtime->render( sprintf('%s/%s', $this->path, $matcherKey) ); return $renderedMatcher; } elseif (!is_array($this->properties[$matcherKey])) { throw new UnsupportedObjectTypeAtPathException('"Case" Fusion object only supports nested Fusion objects; no simple values.', 1372668062); } elseif (isset($this->properties[$matcherKey]['__eelExpression'])) { throw new UnsupportedObjectTypeAtPathException('"Case" Fusion object only supports nested Fusion objects; no Eel expressions.', 1372668077); } else { // No object type has been set, so we're using Neos.Fusion:Matcher as fallback $renderedMatcher = $this->runtime->render( sprintf('%s/%s<Neos.Fusion:Matcher>', $this->path, $matcherKey) ); return $renderedMatcher; } }
[ "protected", "function", "renderMatcher", "(", "$", "matcherKey", ")", "{", "$", "renderedMatcher", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "properties", "[", "$", "matcherKey", "]", "[", "'__objectType'", "]", ")", ")", "{", "// ob...
Render the given matcher A result value of MATCH_NORESULT means that the condition of the matcher did not match and the case should continue. @param string $matcherKey @return string @throws UnsupportedObjectTypeAtPathException
[ "Render", "the", "given", "matcher" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/CaseImplementation.php#L65-L86
train
neos/neos-development-collection
Neos.Fusion/Classes/FusionObjects/CaseImplementation.php
CaseImplementation.matcherMatched
protected function matcherMatched($renderedMatcher) { if ($this->runtime->isDebugMode()) { $renderedMatcher = preg_replace('/\s*<!--.*?-->\s*/', '', $renderedMatcher); } return $renderedMatcher !== self::MATCH_NORESULT; }
php
protected function matcherMatched($renderedMatcher) { if ($this->runtime->isDebugMode()) { $renderedMatcher = preg_replace('/\s*<!--.*?-->\s*/', '', $renderedMatcher); } return $renderedMatcher !== self::MATCH_NORESULT; }
[ "protected", "function", "matcherMatched", "(", "$", "renderedMatcher", ")", "{", "if", "(", "$", "this", "->", "runtime", "->", "isDebugMode", "(", ")", ")", "{", "$", "renderedMatcher", "=", "preg_replace", "(", "'/\\s*<!--.*?-->\\s*/'", ",", "''", ",", "$...
Test whether the output of the matcher does not equal the MATCH_NORESULT If the debug mode is enabled, we have to strip the debug output before comparing the rendered result. @param string $renderedMatcher @return boolean
[ "Test", "whether", "the", "output", "of", "the", "matcher", "does", "not", "equal", "the", "MATCH_NORESULT" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/CaseImplementation.php#L96-L102
train
neos/neos-development-collection
Neos.Neos/Classes/Service/PublishingService.php
PublishingService.publishNode
public function publishNode(NodeInterface $node, Workspace $targetWorkspace = null) { if ($targetWorkspace === null) { $targetWorkspace = $node->getWorkspace()->getBaseWorkspace(); } if (!$targetWorkspace instanceof Workspace) { return; } $nodes = [$node]; $nodeType = $node->getNodeType(); if ($nodeType->isOfType('Neos.Neos:Document') || $nodeType->hasConfiguration('childNodes')) { $nodes = array_merge($nodes, $this->collectAllContentChildNodes($node)); } $sourceWorkspace = $node->getWorkspace(); $sourceWorkspace->publishNodes($nodes, $targetWorkspace); $this->emitNodePublished($node, $targetWorkspace); }
php
public function publishNode(NodeInterface $node, Workspace $targetWorkspace = null) { if ($targetWorkspace === null) { $targetWorkspace = $node->getWorkspace()->getBaseWorkspace(); } if (!$targetWorkspace instanceof Workspace) { return; } $nodes = [$node]; $nodeType = $node->getNodeType(); if ($nodeType->isOfType('Neos.Neos:Document') || $nodeType->hasConfiguration('childNodes')) { $nodes = array_merge($nodes, $this->collectAllContentChildNodes($node)); } $sourceWorkspace = $node->getWorkspace(); $sourceWorkspace->publishNodes($nodes, $targetWorkspace); $this->emitNodePublished($node, $targetWorkspace); }
[ "public", "function", "publishNode", "(", "NodeInterface", "$", "node", ",", "Workspace", "$", "targetWorkspace", "=", "null", ")", "{", "if", "(", "$", "targetWorkspace", "===", "null", ")", "{", "$", "targetWorkspace", "=", "$", "node", "->", "getWorkspace...
Publishes the given node to the specified target workspace. If no workspace is specified, the base workspace is assumed. If the given node is a Document or has ContentCollection child nodes, these nodes are published as well. @param NodeInterface $node @param Workspace $targetWorkspace If not set the base workspace is assumed to be the publishing target @return void @api
[ "Publishes", "the", "given", "node", "to", "the", "specified", "target", "workspace", ".", "If", "no", "workspace", "is", "specified", "the", "base", "workspace", "is", "assumed", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/PublishingService.php#L38-L56
train
neos/neos-development-collection
Neos.Neos/Classes/Service/PublishingService.php
PublishingService.discardNode
public function discardNode(NodeInterface $node) { $nodes = [$node]; $nodeType = $node->getNodeType(); if ($nodeType->isOfType('Neos.Neos:Document') || $nodeType->hasConfiguration('childNodes')) { $nodes = array_filter( array_merge($nodes, $this->collectAllContentChildNodes($node)), function ($possiblyPublishableNode) use ($node) { return $possiblyPublishableNode->getWorkspace()->getName() === $node->getWorkspace()->getName(); } ); } $this->discardNodes($nodes); }
php
public function discardNode(NodeInterface $node) { $nodes = [$node]; $nodeType = $node->getNodeType(); if ($nodeType->isOfType('Neos.Neos:Document') || $nodeType->hasConfiguration('childNodes')) { $nodes = array_filter( array_merge($nodes, $this->collectAllContentChildNodes($node)), function ($possiblyPublishableNode) use ($node) { return $possiblyPublishableNode->getWorkspace()->getName() === $node->getWorkspace()->getName(); } ); } $this->discardNodes($nodes); }
[ "public", "function", "discardNode", "(", "NodeInterface", "$", "node", ")", "{", "$", "nodes", "=", "[", "$", "node", "]", ";", "$", "nodeType", "=", "$", "node", "->", "getNodeType", "(", ")", ";", "if", "(", "$", "nodeType", "->", "isOfType", "(",...
Discards the given node from its workspace. If the given node is a Document or has ContentCollection child nodes, these nodes are discarded as well. @param NodeInterface $node
[ "Discards", "the", "given", "node", "from", "its", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/PublishingService.php#L65-L80
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/NodeShortcutResolver.php
NodeShortcutResolver.resolveShortcutTarget
public function resolveShortcutTarget(NodeInterface $node) { $infiniteLoopPrevention = 0; while ($node->getNodeType()->isOfType('Neos.Neos:Shortcut') && $infiniteLoopPrevention < 50) { $infiniteLoopPrevention++; switch ($node->getProperty('targetMode')) { case 'selectedTarget': $target = $node->getProperty('target'); if ($this->linkingService->hasSupportedScheme($target)) { $targetObject = $this->linkingService->convertUriToObject($target, $node); if ($targetObject instanceof NodeInterface) { $node = $targetObject; } elseif ($targetObject instanceof AssetInterface) { return $this->linkingService->resolveAssetUri($target); } } else { return $target; } break; case 'parentNode': $node = $node->getParent(); break; case 'firstChildNode': default: $childNodes = $node->getChildNodes('Neos.Neos:Document'); if ($childNodes !== []) { $node = reset($childNodes); } else { return null; } } } return $node; }
php
public function resolveShortcutTarget(NodeInterface $node) { $infiniteLoopPrevention = 0; while ($node->getNodeType()->isOfType('Neos.Neos:Shortcut') && $infiniteLoopPrevention < 50) { $infiniteLoopPrevention++; switch ($node->getProperty('targetMode')) { case 'selectedTarget': $target = $node->getProperty('target'); if ($this->linkingService->hasSupportedScheme($target)) { $targetObject = $this->linkingService->convertUriToObject($target, $node); if ($targetObject instanceof NodeInterface) { $node = $targetObject; } elseif ($targetObject instanceof AssetInterface) { return $this->linkingService->resolveAssetUri($target); } } else { return $target; } break; case 'parentNode': $node = $node->getParent(); break; case 'firstChildNode': default: $childNodes = $node->getChildNodes('Neos.Neos:Document'); if ($childNodes !== []) { $node = reset($childNodes); } else { return null; } } } return $node; }
[ "public", "function", "resolveShortcutTarget", "(", "NodeInterface", "$", "node", ")", "{", "$", "infiniteLoopPrevention", "=", "0", ";", "while", "(", "$", "node", "->", "getNodeType", "(", ")", "->", "isOfType", "(", "'Neos.Neos:Shortcut'", ")", "&&", "$", ...
Resolves a shortcut node to the target. The return value can be * a NodeInterface instance if the target is a node or a node:// URI * a string (in case the target is a plain text URI or an asset:// URI) * NULL in case the shortcut cannot be resolved @param NodeInterface $node @return NodeInterface|string|NULL
[ "Resolves", "a", "shortcut", "node", "to", "the", "target", ".", "The", "return", "value", "can", "be" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/NodeShortcutResolver.php#L47-L81
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Service/AssetsController.php
AssetsController.showAction
public function showAction($identifier) { $asset = $this->assetRepository->findByIdentifier($identifier); if ($asset === null) { $this->throwStatus(404); } $this->view->assign('asset', $asset); }
php
public function showAction($identifier) { $asset = $this->assetRepository->findByIdentifier($identifier); if ($asset === null) { $this->throwStatus(404); } $this->view->assign('asset', $asset); }
[ "public", "function", "showAction", "(", "$", "identifier", ")", "{", "$", "asset", "=", "$", "this", "->", "assetRepository", "->", "findByIdentifier", "(", "$", "identifier", ")", ";", "if", "(", "$", "asset", "===", "null", ")", "{", "$", "this", "-...
Shows a specific asset @param string $identifier Specifies the asset to look up @return string @throws StopActionException @throws UnsupportedRequestTypeException
[ "Shows", "a", "specific", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Service/AssetsController.php#L104-L113
train
neos/neos-development-collection
Neos.Media/Classes/ViewHelpers/ImageViewHelper.php
ImageViewHelper.render
public function render(ImageInterface $image = null, $width = null, $maximumWidth = null, $height = null, $maximumHeight = null, $allowCropping = false, $allowUpScaling = false, $async = false, $preset = null, $quality = null, $format = null) { if ($image === null) { return ''; } if ($preset) { $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $async); } else { $thumbnailConfiguration = new ThumbnailConfiguration($width, $maximumWidth, $height, $maximumHeight, $allowCropping, $allowUpScaling, $async, $quality, $format); } $thumbnailData = $this->assetService->getThumbnailUriAndSizeForAsset($image, $thumbnailConfiguration, $this->controllerContext->getRequest()); if ($thumbnailData === null) { return ''; } $this->tag->addAttribute('src', $thumbnailData['src']); if ($thumbnailData['width'] > 0 && $thumbnailData['height'] > 0) { $this->tag->addAttributes([ 'width' => $thumbnailData['width'], 'height' => $thumbnailData['height'] ]); } // alt argument must be set because it is required (see $this->initializeArguments()) if ($this->arguments['alt'] === '') { // has to be added explicitly because empty strings won't be added as attributes in general (see parent::initialize()) $this->tag->addAttribute('alt', ''); } return $this->tag->render(); }
php
public function render(ImageInterface $image = null, $width = null, $maximumWidth = null, $height = null, $maximumHeight = null, $allowCropping = false, $allowUpScaling = false, $async = false, $preset = null, $quality = null, $format = null) { if ($image === null) { return ''; } if ($preset) { $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $async); } else { $thumbnailConfiguration = new ThumbnailConfiguration($width, $maximumWidth, $height, $maximumHeight, $allowCropping, $allowUpScaling, $async, $quality, $format); } $thumbnailData = $this->assetService->getThumbnailUriAndSizeForAsset($image, $thumbnailConfiguration, $this->controllerContext->getRequest()); if ($thumbnailData === null) { return ''; } $this->tag->addAttribute('src', $thumbnailData['src']); if ($thumbnailData['width'] > 0 && $thumbnailData['height'] > 0) { $this->tag->addAttributes([ 'width' => $thumbnailData['width'], 'height' => $thumbnailData['height'] ]); } // alt argument must be set because it is required (see $this->initializeArguments()) if ($this->arguments['alt'] === '') { // has to be added explicitly because empty strings won't be added as attributes in general (see parent::initialize()) $this->tag->addAttribute('alt', ''); } return $this->tag->render(); }
[ "public", "function", "render", "(", "ImageInterface", "$", "image", "=", "null", ",", "$", "width", "=", "null", ",", "$", "maximumWidth", "=", "null", ",", "$", "height", "=", "null", ",", "$", "maximumHeight", "=", "null", ",", "$", "allowCropping", ...
Renders an HTML img tag with a thumbnail image, created from a given image. @param ImageInterface $image The image to be rendered as an image @param integer $width Desired width of the image @param integer $maximumWidth Desired maximum width of the image @param integer $height Desired height of the image @param integer $maximumHeight Desired maximum height of the image @param boolean $allowCropping Whether the image should be cropped if the given sizes would hurt the aspect ratio @param boolean $allowUpScaling Whether the resulting image size might exceed the size of the original image @param boolean $async Return asynchronous image URI in case the requested image does not exist already @param string $preset Preset used to determine image configuration @param integer $quality Image quality, from 0 to 100 @param string $format Format for the image, jpg, jpeg, gif, png, wbmp, xbm, webp and bmp are supported @return string an <img...> html tag
[ "Renders", "an", "HTML", "img", "tag", "with", "a", "thumbnail", "image", "created", "from", "a", "given", "image", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/ViewHelpers/ImageViewHelper.php#L117-L150
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/LoginController.php
LoginController.indexAction
public function indexAction($username = null, $unauthorized = false) { if ($this->securityContext->getInterceptedRequest() || $unauthorized) { $this->response->setStatus(401); } if ($this->authenticationManager->isAuthenticated()) { $this->redirect('index', 'Backend\Backend'); } $currentDomain = $this->domainRepository->findOneByActiveRequest(); $currentSite = $currentDomain !== null ? $currentDomain->getSite() : $this->siteRepository->findDefault(); $this->view->assignMultiple([ 'styles' => array_filter($this->settings['userInterface']['backendLoginForm']['stylesheets']), 'username' => $username, 'site' => $currentSite ]); }
php
public function indexAction($username = null, $unauthorized = false) { if ($this->securityContext->getInterceptedRequest() || $unauthorized) { $this->response->setStatus(401); } if ($this->authenticationManager->isAuthenticated()) { $this->redirect('index', 'Backend\Backend'); } $currentDomain = $this->domainRepository->findOneByActiveRequest(); $currentSite = $currentDomain !== null ? $currentDomain->getSite() : $this->siteRepository->findDefault(); $this->view->assignMultiple([ 'styles' => array_filter($this->settings['userInterface']['backendLoginForm']['stylesheets']), 'username' => $username, 'site' => $currentSite ]); }
[ "public", "function", "indexAction", "(", "$", "username", "=", "null", ",", "$", "unauthorized", "=", "false", ")", "{", "if", "(", "$", "this", "->", "securityContext", "->", "getInterceptedRequest", "(", ")", "||", "$", "unauthorized", ")", "{", "$", ...
Default action, displays the login screen @param string $username Optional: A username to pre-fill into the username field @param boolean $unauthorized @return void
[ "Default", "action", "displays", "the", "login", "screen" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/LoginController.php#L113-L128
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/LoginController.php
LoginController.tokenLoginAction
public function tokenLoginAction($token) { $newSessionId = $this->loginTokenCache->get($token); $this->loginTokenCache->remove($token); if ($newSessionId === false) { $this->systemLogger->log(sprintf('Token-based login failed, non-existing or expired token %s', $token), LOG_WARNING); $this->redirect('index'); } $this->systemLogger->log(sprintf('Token-based login succeeded, token %s', $token), LOG_DEBUG); $newSession = $this->sessionManager->getSession($newSessionId); if ($newSession->canBeResumed()) { $newSession->resume(); } if ($newSession->isStarted()) { $newSession->putData('lastVisitedNode', null); } else { $this->systemLogger->log(sprintf('Failed resuming or starting session %s which was referred to in the login token %s.', $newSessionId, $token), LOG_ERR); } $this->replaceSessionCookie($newSessionId); $this->redirect('index', 'Backend\Backend'); }
php
public function tokenLoginAction($token) { $newSessionId = $this->loginTokenCache->get($token); $this->loginTokenCache->remove($token); if ($newSessionId === false) { $this->systemLogger->log(sprintf('Token-based login failed, non-existing or expired token %s', $token), LOG_WARNING); $this->redirect('index'); } $this->systemLogger->log(sprintf('Token-based login succeeded, token %s', $token), LOG_DEBUG); $newSession = $this->sessionManager->getSession($newSessionId); if ($newSession->canBeResumed()) { $newSession->resume(); } if ($newSession->isStarted()) { $newSession->putData('lastVisitedNode', null); } else { $this->systemLogger->log(sprintf('Failed resuming or starting session %s which was referred to in the login token %s.', $newSessionId, $token), LOG_ERR); } $this->replaceSessionCookie($newSessionId); $this->redirect('index', 'Backend\Backend'); }
[ "public", "function", "tokenLoginAction", "(", "$", "token", ")", "{", "$", "newSessionId", "=", "$", "this", "->", "loginTokenCache", "->", "get", "(", "$", "token", ")", ";", "$", "this", "->", "loginTokenCache", "->", "remove", "(", "$", "token", ")",...
Logs a user in if a session identifier is available under the given token in the token cache. @param string $token @return void
[ "Logs", "a", "user", "in", "if", "a", "session", "identifier", "is", "available", "under", "the", "given", "token", "in", "the", "token", "cache", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/LoginController.php#L136-L160
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/LoginController.php
LoginController.onAuthenticationSuccess
protected function onAuthenticationSuccess(ActionRequest $originalRequest = null) { if ($this->view instanceof JsonView) { $this->view->assign('value', ['success' => $this->authenticationManager->isAuthenticated(), 'csrfToken' => $this->securityContext->getCsrfProtectionToken()]); } else { if ($this->request->hasArgument('lastVisitedNode') && strlen($this->request->getArgument('lastVisitedNode')) > 0) { $this->session->putData('lastVisitedNode', $this->request->getArgument('lastVisitedNode')); } if ($originalRequest !== null) { // Redirect to the location that redirected to the login form because the user was nog logged in $this->redirectToRequest($originalRequest); } $this->redirect('index', 'Backend\Backend'); } }
php
protected function onAuthenticationSuccess(ActionRequest $originalRequest = null) { if ($this->view instanceof JsonView) { $this->view->assign('value', ['success' => $this->authenticationManager->isAuthenticated(), 'csrfToken' => $this->securityContext->getCsrfProtectionToken()]); } else { if ($this->request->hasArgument('lastVisitedNode') && strlen($this->request->getArgument('lastVisitedNode')) > 0) { $this->session->putData('lastVisitedNode', $this->request->getArgument('lastVisitedNode')); } if ($originalRequest !== null) { // Redirect to the location that redirected to the login form because the user was nog logged in $this->redirectToRequest($originalRequest); } $this->redirect('index', 'Backend\Backend'); } }
[ "protected", "function", "onAuthenticationSuccess", "(", "ActionRequest", "$", "originalRequest", "=", "null", ")", "{", "if", "(", "$", "this", "->", "view", "instanceof", "JsonView", ")", "{", "$", "this", "->", "view", "->", "assign", "(", "'value'", ",",...
Is called if authentication was successful. @param ActionRequest $originalRequest The request that was intercepted by the security framework, NULL if there was none @return void
[ "Is", "called", "if", "authentication", "was", "successful", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/LoginController.php#L183-L198
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/LoginController.php
LoginController.logoutAction
public function logoutAction() { $possibleRedirectionUri = $this->backendRedirectionService->getAfterLogoutRedirectionUri($this->request); parent::logoutAction(); switch ($this->request->getFormat()) { case 'json': $this->view->assign('value', ['success' => true]); break; default: if ($possibleRedirectionUri !== null) { $this->redirectToUri($possibleRedirectionUri); } $this->addFlashMessage('Successfully logged out', 'Logged out', Message::SEVERITY_NOTICE, [], 1318421560); $this->redirect('index'); } }
php
public function logoutAction() { $possibleRedirectionUri = $this->backendRedirectionService->getAfterLogoutRedirectionUri($this->request); parent::logoutAction(); switch ($this->request->getFormat()) { case 'json': $this->view->assign('value', ['success' => true]); break; default: if ($possibleRedirectionUri !== null) { $this->redirectToUri($possibleRedirectionUri); } $this->addFlashMessage('Successfully logged out', 'Logged out', Message::SEVERITY_NOTICE, [], 1318421560); $this->redirect('index'); } }
[ "public", "function", "logoutAction", "(", ")", "{", "$", "possibleRedirectionUri", "=", "$", "this", "->", "backendRedirectionService", "->", "getAfterLogoutRedirectionUri", "(", "$", "this", "->", "request", ")", ";", "parent", "::", "logoutAction", "(", ")", ...
Logs out a - possibly - currently logged in account. The possible redirection URI is queried from the redirection service at first, before the actual logout takes place, and the session gets destroyed. @Flow\SkipCsrfProtection @return void
[ "Logs", "out", "a", "-", "possibly", "-", "currently", "logged", "in", "account", ".", "The", "possible", "redirection", "URI", "is", "queried", "from", "the", "redirection", "service", "at", "first", "before", "the", "actual", "logout", "takes", "place", "a...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/LoginController.php#L209-L224
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/LoginController.php
LoginController.replaceSessionCookie
protected function replaceSessionCookie($sessionIdentifier) { $sessionCookie = new Cookie($this->sessionName, $sessionIdentifier); $this->response->setCookie($sessionCookie); }
php
protected function replaceSessionCookie($sessionIdentifier) { $sessionCookie = new Cookie($this->sessionName, $sessionIdentifier); $this->response->setCookie($sessionCookie); }
[ "protected", "function", "replaceSessionCookie", "(", "$", "sessionIdentifier", ")", "{", "$", "sessionCookie", "=", "new", "Cookie", "(", "$", "this", "->", "sessionName", ",", "$", "sessionIdentifier", ")", ";", "$", "this", "->", "response", "->", "setCooki...
Sets the session cookie to the given identifier, overriding an existing cookie. @param string $sessionIdentifier @return void
[ "Sets", "the", "session", "cookie", "to", "the", "given", "identifier", "overriding", "an", "existing", "cookie", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/LoginController.php#L242-L246
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.getUser
public function getUser($username, $authenticationProviderName = null) { $authenticationProviderName = $authenticationProviderName ?: $this->defaultAuthenticationProviderName; $cacheIdentifier = $authenticationProviderName . '~' . $username; if (array_key_exists($cacheIdentifier, $this->runtimeUserCache)) { $userIdentifier = $this->runtimeUserCache[$cacheIdentifier]; return $this->partyRepository->findByIdentifier($userIdentifier); } $user = $this->findUserForAccount($username, $authenticationProviderName); if ($user instanceof AbstractParty) { $userIdentifier = $this->persistenceManager->getIdentifierByObject($user); } if (isset($userIdentifier) && (string)$userIdentifier !== '') { $this->runtimeUserCache[$cacheIdentifier] = $userIdentifier; return $this->partyRepository->findByIdentifier($userIdentifier); } return null; }
php
public function getUser($username, $authenticationProviderName = null) { $authenticationProviderName = $authenticationProviderName ?: $this->defaultAuthenticationProviderName; $cacheIdentifier = $authenticationProviderName . '~' . $username; if (array_key_exists($cacheIdentifier, $this->runtimeUserCache)) { $userIdentifier = $this->runtimeUserCache[$cacheIdentifier]; return $this->partyRepository->findByIdentifier($userIdentifier); } $user = $this->findUserForAccount($username, $authenticationProviderName); if ($user instanceof AbstractParty) { $userIdentifier = $this->persistenceManager->getIdentifierByObject($user); } if (isset($userIdentifier) && (string)$userIdentifier !== '') { $this->runtimeUserCache[$cacheIdentifier] = $userIdentifier; return $this->partyRepository->findByIdentifier($userIdentifier); } return null; }
[ "public", "function", "getUser", "(", "$", "username", ",", "$", "authenticationProviderName", "=", "null", ")", "{", "$", "authenticationProviderName", "=", "$", "authenticationProviderName", "?", ":", "$", "this", "->", "defaultAuthenticationProviderName", ";", "$...
Retrieves an existing user by the given username @param string $username The username @param string $authenticationProviderName Name of the authentication provider to use. Example: "Neos.Neos:Backend" @return User The user, or null if the user does not exist @throws Exception @api
[ "Retrieves", "an", "existing", "user", "by", "the", "given", "username" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L167-L189
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.getUsername
public function getUsername(User $user, $authenticationProviderName = null) { $authenticationProviderName = $authenticationProviderName ?: $this->defaultAuthenticationProviderName; foreach ($user->getAccounts() as $account) { /** @var Account $account */ if ($account->getAuthenticationProviderName() === $authenticationProviderName) { return $account->getAccountIdentifier(); } } return null; }
php
public function getUsername(User $user, $authenticationProviderName = null) { $authenticationProviderName = $authenticationProviderName ?: $this->defaultAuthenticationProviderName; foreach ($user->getAccounts() as $account) { /** @var Account $account */ if ($account->getAuthenticationProviderName() === $authenticationProviderName) { return $account->getAccountIdentifier(); } } return null; }
[ "public", "function", "getUsername", "(", "User", "$", "user", ",", "$", "authenticationProviderName", "=", "null", ")", "{", "$", "authenticationProviderName", "=", "$", "authenticationProviderName", "?", ":", "$", "this", "->", "defaultAuthenticationProviderName", ...
Returns the username of the given user Technically, this method will look for the user's backend account (or, if authenticationProviderName is specified, for the account matching the given authentication provider) and return the account's identifier. @param User $user @param string $authenticationProviderName @return string The username or null if the given user does not have a backend account
[ "Returns", "the", "username", "of", "the", "given", "user" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L201-L211
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.getCurrentUser
public function getCurrentUser() { if ($this->securityContext->canBeInitialized() === true) { $account = $this->securityContext->getAccount(); if ($account !== null) { return $this->getUser($account->getAccountIdentifier()); } } return null; }
php
public function getCurrentUser() { if ($this->securityContext->canBeInitialized() === true) { $account = $this->securityContext->getAccount(); if ($account !== null) { return $this->getUser($account->getAccountIdentifier()); } } return null; }
[ "public", "function", "getCurrentUser", "(", ")", "{", "if", "(", "$", "this", "->", "securityContext", "->", "canBeInitialized", "(", ")", "===", "true", ")", "{", "$", "account", "=", "$", "this", "->", "securityContext", "->", "getAccount", "(", ")", ...
Returns the currently logged in user, if any @return User The currently logged in user, or null @api
[ "Returns", "the", "currently", "logged", "in", "user", "if", "any" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L219-L229
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.createUser
public function createUser($username, $password, $firstName, $lastName, array $roleIdentifiers = null, $authenticationProviderName = null) { $user = new User(); $name = new PersonName('', $firstName, '', $lastName, '', $username); $user->setName($name); return $this->addUser($username, $password, $user, $roleIdentifiers, $authenticationProviderName); }
php
public function createUser($username, $password, $firstName, $lastName, array $roleIdentifiers = null, $authenticationProviderName = null) { $user = new User(); $name = new PersonName('', $firstName, '', $lastName, '', $username); $user->setName($name); return $this->addUser($username, $password, $user, $roleIdentifiers, $authenticationProviderName); }
[ "public", "function", "createUser", "(", "$", "username", ",", "$", "password", ",", "$", "firstName", ",", "$", "lastName", ",", "array", "$", "roleIdentifiers", "=", "null", ",", "$", "authenticationProviderName", "=", "null", ")", "{", "$", "user", "=",...
Creates a user based on the given information The created user and account are automatically added to their respective repositories and thus be persisted. @param string $username The username of the user to be created. @param string $password Password of the user to be created @param string $firstName First name of the user to be created @param string $lastName Last name of the user to be created @param array $roleIdentifiers A list of role identifiers to assign @param string $authenticationProviderName Name of the authentication provider to use. Example: "Neos.Neos:Backend" @return User The created user instance @api
[ "Creates", "a", "user", "based", "on", "the", "given", "information" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L245-L252
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.addUser
public function addUser($username, $password, User $user, array $roleIdentifiers = null, $authenticationProviderName = null) { if ($roleIdentifiers === null) { $roleIdentifiers = ['Neos.Neos:Editor']; } $roleIdentifiers = $this->normalizeRoleIdentifiers($roleIdentifiers); $account = $this->accountFactory->createAccountWithPassword($username, $password, $roleIdentifiers, $authenticationProviderName ?: $this->defaultAuthenticationProviderName); $this->partyService->assignAccountToParty($account, $user); $this->partyRepository->add($user); $this->accountRepository->add($account); $this->createPersonalWorkspace($user, $account); $this->emitUserCreated($user); return $user; }
php
public function addUser($username, $password, User $user, array $roleIdentifiers = null, $authenticationProviderName = null) { if ($roleIdentifiers === null) { $roleIdentifiers = ['Neos.Neos:Editor']; } $roleIdentifiers = $this->normalizeRoleIdentifiers($roleIdentifiers); $account = $this->accountFactory->createAccountWithPassword($username, $password, $roleIdentifiers, $authenticationProviderName ?: $this->defaultAuthenticationProviderName); $this->partyService->assignAccountToParty($account, $user); $this->partyRepository->add($user); $this->accountRepository->add($account); $this->createPersonalWorkspace($user, $account); $this->emitUserCreated($user); return $user; }
[ "public", "function", "addUser", "(", "$", "username", ",", "$", "password", ",", "User", "$", "user", ",", "array", "$", "roleIdentifiers", "=", "null", ",", "$", "authenticationProviderName", "=", "null", ")", "{", "if", "(", "$", "roleIdentifiers", "===...
Adds a user whose User object has been created elsewhere This method basically "creates" a user like createUser() would, except that it does not create the User object itself. If you need to create the User object elsewhere, for example in your ActionController, make sure to call this method for registering the new user instead of adding it to the PartyRepository manually. This method also creates a new user workspace for the given user if no such workspace exist. @param string $username The username of the user to be created. @param string $password Password of the user to be created @param User $user The pre-built user object to start with @param array $roleIdentifiers A list of role identifiers to assign @param string $authenticationProviderName Name of the authentication provider to use. Example: "Neos.Neos:Backend" @return User The same user object @api
[ "Adds", "a", "user", "whose", "User", "object", "has", "been", "created", "elsewhere" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L271-L288
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.deleteUser
public function deleteUser(User $user) { foreach ($user->getAccounts() as $account) { $this->securityContext->withoutAuthorizationChecks(function () use ($account) { $this->deletePersonalWorkspace($account->getAccountIdentifier()); }); $this->accountRepository->remove($account); } $this->removeOwnerFromUsersWorkspaces($user); $this->partyRepository->remove($user); $this->emitUserDeleted($user); }
php
public function deleteUser(User $user) { foreach ($user->getAccounts() as $account) { $this->securityContext->withoutAuthorizationChecks(function () use ($account) { $this->deletePersonalWorkspace($account->getAccountIdentifier()); }); $this->accountRepository->remove($account); } $this->removeOwnerFromUsersWorkspaces($user); $this->partyRepository->remove($user); $this->emitUserDeleted($user); }
[ "public", "function", "deleteUser", "(", "User", "$", "user", ")", "{", "foreach", "(", "$", "user", "->", "getAccounts", "(", ")", "as", "$", "account", ")", "{", "$", "this", "->", "securityContext", "->", "withoutAuthorizationChecks", "(", "function", "...
Deletes the specified user and all remaining content in his personal workspaces @param User $user The user to delete @return void @throws Exception @api
[ "Deletes", "the", "specified", "user", "and", "all", "remaining", "content", "in", "his", "personal", "workspaces" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L310-L324
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.setUserPassword
public function setUserPassword(User $user, $password) { $tokens = $this->authenticationManager->getTokens(); $indexedTokens = []; foreach ($tokens as $token) { /** @var TokenInterface $token */ $indexedTokens[$token->getAuthenticationProviderName()] = $token; } foreach ($user->getAccounts() as $account) { /** @var Account $account */ $authenticationProviderName = $account->getAuthenticationProviderName(); if (isset($indexedTokens[$authenticationProviderName]) && $indexedTokens[$authenticationProviderName] instanceof UsernamePassword) { $account->setCredentialsSource($this->hashService->hashPassword($password)); $this->accountRepository->update($account); } } }
php
public function setUserPassword(User $user, $password) { $tokens = $this->authenticationManager->getTokens(); $indexedTokens = []; foreach ($tokens as $token) { /** @var TokenInterface $token */ $indexedTokens[$token->getAuthenticationProviderName()] = $token; } foreach ($user->getAccounts() as $account) { /** @var Account $account */ $authenticationProviderName = $account->getAuthenticationProviderName(); if (isset($indexedTokens[$authenticationProviderName]) && $indexedTokens[$authenticationProviderName] instanceof UsernamePassword) { $account->setCredentialsSource($this->hashService->hashPassword($password)); $this->accountRepository->update($account); } } }
[ "public", "function", "setUserPassword", "(", "User", "$", "user", ",", "$", "password", ")", "{", "$", "tokens", "=", "$", "this", "->", "authenticationManager", "->", "getTokens", "(", ")", ";", "$", "indexedTokens", "=", "[", "]", ";", "foreach", "(",...
Sets a new password for the given user This method will iterate over all accounts owned by the given user and, if the account uses a UsernamePasswordToken, sets a new password accordingly. @param User $user The user to set the password for @param string $password A new password @return void @api
[ "Sets", "a", "new", "password", "for", "the", "given", "user" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L349-L366
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.updateUser
public function updateUser(User $user) { $this->partyRepository->update($user); $this->emitUserUpdated($user); }
php
public function updateUser(User $user) { $this->partyRepository->update($user); $this->emitUserUpdated($user); }
[ "public", "function", "updateUser", "(", "User", "$", "user", ")", "{", "$", "this", "->", "partyRepository", "->", "update", "(", "$", "user", ")", ";", "$", "this", "->", "emitUserUpdated", "(", "$", "user", ")", ";", "}" ]
Updates the given user in the respective repository and potentially executes further actions depending on what has been changed. Note: changes to the user's account will not be committed for persistence. Please use addRoleToAccount(), removeRoleFromAccount(), setRolesForAccount() and setUserPassword() for changing account properties. @param User $user The modified user @return void @api
[ "Updates", "the", "given", "user", "in", "the", "respective", "repository", "and", "potentially", "executes", "further", "actions", "depending", "on", "what", "has", "been", "changed", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L379-L383
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.addRoleToUser
public function addRoleToUser(User $user, $roleIdentifier) { $counter = 0; foreach ($user->getAccounts() as $account) { $counter += $this->addRoleToAccount($account, $roleIdentifier); } return $counter; }
php
public function addRoleToUser(User $user, $roleIdentifier) { $counter = 0; foreach ($user->getAccounts() as $account) { $counter += $this->addRoleToAccount($account, $roleIdentifier); } return $counter; }
[ "public", "function", "addRoleToUser", "(", "User", "$", "user", ",", "$", "roleIdentifier", ")", "{", "$", "counter", "=", "0", ";", "foreach", "(", "$", "user", "->", "getAccounts", "(", ")", "as", "$", "account", ")", "{", "$", "counter", "+=", "$...
Adds the specified role to all accounts of the given user and potentially carries out further actions which are needed to properly reflect these changes. @param User $user The user to add roles to @param string $roleIdentifier A fully qualified role identifier, or a role identifier relative to the Neos.Neos namespace @return integer How often this role has been added to accounts owned by the user @api
[ "Adds", "the", "specified", "role", "to", "all", "accounts", "of", "the", "given", "user", "and", "potentially", "carries", "out", "further", "actions", "which", "are", "needed", "to", "properly", "reflect", "these", "changes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L394-L402
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.removeRoleFromUser
public function removeRoleFromUser(User $user, $roleIdentifier) { $counter = 0; foreach ($user->getAccounts() as $account) { $counter += $this->removeRoleFromAccount($account, $roleIdentifier); } return $counter; }
php
public function removeRoleFromUser(User $user, $roleIdentifier) { $counter = 0; foreach ($user->getAccounts() as $account) { $counter += $this->removeRoleFromAccount($account, $roleIdentifier); } return $counter; }
[ "public", "function", "removeRoleFromUser", "(", "User", "$", "user", ",", "$", "roleIdentifier", ")", "{", "$", "counter", "=", "0", ";", "foreach", "(", "$", "user", "->", "getAccounts", "(", ")", "as", "$", "account", ")", "{", "$", "counter", "+=",...
Removes the specified role from all accounts of the given user and potentially carries out further actions which are needed to properly reflect these changes. @param User $user The user to remove roles from @param string $roleIdentifier A fully qualified role identifier, or a role identifier relative to the Neos.Neos namespace @return integer How often this role has been removed from accounts owned by the user @api
[ "Removes", "the", "specified", "role", "from", "all", "accounts", "of", "the", "given", "user", "and", "potentially", "carries", "out", "further", "actions", "which", "are", "needed", "to", "properly", "reflect", "these", "changes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L413-L421
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.setRolesForAccount
public function setRolesForAccount(Account $account, array $newRoleIdentifiers) { $currentRoles = $account->getRoles(); foreach ($currentRoles as $roleIdentifier => $role) { $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier); if (!in_array($roleIdentifier, $newRoleIdentifiers)) { $this->removeRoleFromAccount($account, $roleIdentifier); } } foreach ($newRoleIdentifiers as $roleIdentifier) { if (!in_array($roleIdentifier, array_keys($currentRoles))) { $this->addRoleToAccount($account, $roleIdentifier); } } }
php
public function setRolesForAccount(Account $account, array $newRoleIdentifiers) { $currentRoles = $account->getRoles(); foreach ($currentRoles as $roleIdentifier => $role) { $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier); if (!in_array($roleIdentifier, $newRoleIdentifiers)) { $this->removeRoleFromAccount($account, $roleIdentifier); } } foreach ($newRoleIdentifiers as $roleIdentifier) { if (!in_array($roleIdentifier, array_keys($currentRoles))) { $this->addRoleToAccount($account, $roleIdentifier); } } }
[ "public", "function", "setRolesForAccount", "(", "Account", "$", "account", ",", "array", "$", "newRoleIdentifiers", ")", "{", "$", "currentRoles", "=", "$", "account", "->", "getRoles", "(", ")", ";", "foreach", "(", "$", "currentRoles", "as", "$", "roleIde...
Overrides any assigned roles of the given account and potentially carries out further actions which are needed to properly reflect these changes. @param Account $account The account to assign the roles to @param array $newRoleIdentifiers A list of fully qualified role identifiers, or role identifiers relative to the Neos.Neos namespace @return void @api
[ "Overrides", "any", "assigned", "roles", "of", "the", "given", "account", "and", "potentially", "carries", "out", "further", "actions", "which", "are", "needed", "to", "properly", "reflect", "these", "changes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L444-L460
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.addRoleToAccount
public function addRoleToAccount(Account $account, $roleIdentifier) { $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier); $role = $this->policyService->getRole($roleIdentifier); if (!$account->hasRole($role)) { $account->addRole($role); $this->accountRepository->update($account); $this->emitRolesAdded($account, [$role]); return 1; } return 0; }
php
public function addRoleToAccount(Account $account, $roleIdentifier) { $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier); $role = $this->policyService->getRole($roleIdentifier); if (!$account->hasRole($role)) { $account->addRole($role); $this->accountRepository->update($account); $this->emitRolesAdded($account, [$role]); return 1; } return 0; }
[ "public", "function", "addRoleToAccount", "(", "Account", "$", "account", ",", "$", "roleIdentifier", ")", "{", "$", "roleIdentifier", "=", "$", "this", "->", "normalizeRoleIdentifier", "(", "$", "roleIdentifier", ")", ";", "$", "role", "=", "$", "this", "->...
Adds the specified role to the given account and potentially carries out further actions which are needed to properly reflect these changes. @param Account $account The account to add roles to @param string $roleIdentifier A fully qualified role identifier, or a role identifier relative to the Neos.Neos namespace @return integer How often this role has been added to the given account (effectively can be 1 or 0) @api
[ "Adds", "the", "specified", "role", "to", "the", "given", "account", "and", "potentially", "carries", "out", "further", "actions", "which", "are", "needed", "to", "properly", "reflect", "these", "changes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L471-L485
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.removeRoleFromAccount
public function removeRoleFromAccount(Account $account, $roleIdentifier) { $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier); $role = $this->policyService->getRole($roleIdentifier); /** @var Account $account */ if ($account->hasRole($role)) { $account->removeRole($role); $this->accountRepository->update($account); $this->emitRolesRemoved($account, [$role]); return 1; } return 0; }
php
public function removeRoleFromAccount(Account $account, $roleIdentifier) { $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier); $role = $this->policyService->getRole($roleIdentifier); /** @var Account $account */ if ($account->hasRole($role)) { $account->removeRole($role); $this->accountRepository->update($account); $this->emitRolesRemoved($account, [$role]); return 1; } return 0; }
[ "public", "function", "removeRoleFromAccount", "(", "Account", "$", "account", ",", "$", "roleIdentifier", ")", "{", "$", "roleIdentifier", "=", "$", "this", "->", "normalizeRoleIdentifier", "(", "$", "roleIdentifier", ")", ";", "$", "role", "=", "$", "this", ...
Removes the specified role from the given account and potentially carries out further actions which are needed to properly reflect these changes. @param Account $account The account to remove roles from @param string $roleIdentifier A fully qualified role identifier, or a role identifier relative to the Neos.Neos namespace @return integer How often this role has been removed from the given account (effectively can be 1 or 0) @api
[ "Removes", "the", "specified", "role", "from", "the", "given", "account", "and", "potentially", "carries", "out", "further", "actions", "which", "are", "needed", "to", "properly", "reflect", "these", "changes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L509-L524
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.activateUser
public function activateUser(User $user) { foreach ($user->getAccounts() as $account) { /** @var Account $account */ $account->setExpirationDate(null); $this->accountRepository->update($account); } $this->emitUserActivated($user); }
php
public function activateUser(User $user) { foreach ($user->getAccounts() as $account) { /** @var Account $account */ $account->setExpirationDate(null); $this->accountRepository->update($account); } $this->emitUserActivated($user); }
[ "public", "function", "activateUser", "(", "User", "$", "user", ")", "{", "foreach", "(", "$", "user", "->", "getAccounts", "(", ")", "as", "$", "account", ")", "{", "/** @var Account $account */", "$", "account", "->", "setExpirationDate", "(", "null", ")",...
Reactivates the given user @param User $user The user to deactivate @return void @api
[ "Reactivates", "the", "given", "user" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L546-L554
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.deactivateUser
public function deactivateUser(User $user) { /** @var Account $account */ foreach ($user->getAccounts() as $account) { $account->setExpirationDate($this->now); $this->accountRepository->update($account); } $this->emitUserDeactivated($user); }
php
public function deactivateUser(User $user) { /** @var Account $account */ foreach ($user->getAccounts() as $account) { $account->setExpirationDate($this->now); $this->accountRepository->update($account); } $this->emitUserDeactivated($user); }
[ "public", "function", "deactivateUser", "(", "User", "$", "user", ")", "{", "/** @var Account $account */", "foreach", "(", "$", "user", "->", "getAccounts", "(", ")", "as", "$", "account", ")", "{", "$", "account", "->", "setExpirationDate", "(", "$", "this...
Deactivates the given user @param User $user The user to deactivate @return void @api
[ "Deactivates", "the", "given", "user" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L575-L583
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.currentUserCanPublishToWorkspace
public function currentUserCanPublishToWorkspace(Workspace $workspace) { if ($workspace->getName() === 'live') { return $this->securityContext->hasRole('Neos.Neos:LivePublisher'); } if ($workspace->getOwner() === $this->getCurrentUser() || $workspace->getOwner() === null) { return true; } return false; }
php
public function currentUserCanPublishToWorkspace(Workspace $workspace) { if ($workspace->getName() === 'live') { return $this->securityContext->hasRole('Neos.Neos:LivePublisher'); } if ($workspace->getOwner() === $this->getCurrentUser() || $workspace->getOwner() === null) { return true; } return false; }
[ "public", "function", "currentUserCanPublishToWorkspace", "(", "Workspace", "$", "workspace", ")", "{", "if", "(", "$", "workspace", "->", "getName", "(", ")", "===", "'live'", ")", "{", "return", "$", "this", "->", "securityContext", "->", "hasRole", "(", "...
Checks if the current user may publish to the given workspace according to one the roles of the user's accounts In future versions, this logic may be implemented in Neos in a more generic way (for example, by means of an ACL object), but for now, this method exists in order to at least centralize and encapsulate the required logic. @param Workspace $workspace The workspace @return boolean
[ "Checks", "if", "the", "current", "user", "may", "publish", "to", "the", "given", "workspace", "according", "to", "one", "the", "roles", "of", "the", "user", "s", "accounts" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L594-L605
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.currentUserCanReadWorkspace
public function currentUserCanReadWorkspace(Workspace $workspace) { if ($workspace->getName() === 'live') { return true; } if ($workspace->getOwner() === $this->getCurrentUser() || $workspace->getOwner() === null) { return true; } return false; }
php
public function currentUserCanReadWorkspace(Workspace $workspace) { if ($workspace->getName() === 'live') { return true; } if ($workspace->getOwner() === $this->getCurrentUser() || $workspace->getOwner() === null) { return true; } return false; }
[ "public", "function", "currentUserCanReadWorkspace", "(", "Workspace", "$", "workspace", ")", "{", "if", "(", "$", "workspace", "->", "getName", "(", ")", "===", "'live'", ")", "{", "return", "true", ";", "}", "if", "(", "$", "workspace", "->", "getOwner",...
Checks if the current user may read the given workspace according to one the roles of the user's accounts In future versions, this logic may be implemented in Neos in a more generic way (for example, by means of an ACL object), but for now, this method exists in order to at least centralize and encapsulate the required logic. @param Workspace $workspace The workspace @return boolean
[ "Checks", "if", "the", "current", "user", "may", "read", "the", "given", "workspace", "according", "to", "one", "the", "roles", "of", "the", "user", "s", "accounts" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L616-L627
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.currentUserCanManageWorkspace
public function currentUserCanManageWorkspace(Workspace $workspace) { if ($workspace->isPersonalWorkspace()) { return false; } if ($workspace->isInternalWorkspace()) { return $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.Module.Management.Workspaces.ManageInternalWorkspaces'); } if ($workspace->isPrivateWorkspace() && $workspace->getOwner() === $this->getCurrentUser()) { return $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.Module.Management.Workspaces.ManageOwnWorkspaces'); } if ($workspace->isPrivateWorkspace() && $workspace->getOwner() !== $this->getCurrentUser()) { return $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.Module.Management.Workspaces.ManageAllPrivateWorkspaces'); } return false; }
php
public function currentUserCanManageWorkspace(Workspace $workspace) { if ($workspace->isPersonalWorkspace()) { return false; } if ($workspace->isInternalWorkspace()) { return $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.Module.Management.Workspaces.ManageInternalWorkspaces'); } if ($workspace->isPrivateWorkspace() && $workspace->getOwner() === $this->getCurrentUser()) { return $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.Module.Management.Workspaces.ManageOwnWorkspaces'); } if ($workspace->isPrivateWorkspace() && $workspace->getOwner() !== $this->getCurrentUser()) { return $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.Module.Management.Workspaces.ManageAllPrivateWorkspaces'); } return false; }
[ "public", "function", "currentUserCanManageWorkspace", "(", "Workspace", "$", "workspace", ")", "{", "if", "(", "$", "workspace", "->", "isPersonalWorkspace", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "$", "workspace", "->", "isInternalWorksp...
Checks if the current user may manage the given workspace according to one the roles of the user's accounts In future versions, this logic may be implemented in Neos in a more generic way (for example, by means of an ACL object), but for now, this method exists in order to at least centralize and encapsulate the required logic. @param Workspace $workspace The workspace @return boolean
[ "Checks", "if", "the", "current", "user", "may", "manage", "the", "given", "workspace", "according", "to", "one", "the", "roles", "of", "the", "user", "s", "accounts" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L638-L657
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.normalizeRoleIdentifiers
protected function normalizeRoleIdentifiers(array $roleIdentifiers) { foreach ($roleIdentifiers as &$roleIdentifier) { $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier); } return $roleIdentifiers; }
php
protected function normalizeRoleIdentifiers(array $roleIdentifiers) { foreach ($roleIdentifiers as &$roleIdentifier) { $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier); } return $roleIdentifiers; }
[ "protected", "function", "normalizeRoleIdentifiers", "(", "array", "$", "roleIdentifiers", ")", "{", "foreach", "(", "$", "roleIdentifiers", "as", "&", "$", "roleIdentifier", ")", "{", "$", "roleIdentifier", "=", "$", "this", "->", "normalizeRoleIdentifier", "(", ...
Replaces role identifiers not containing a "." into fully qualified role identifiers from the Neos.Neos namespace. @param array $roleIdentifiers @return array
[ "Replaces", "role", "identifiers", "not", "containing", "a", ".", "into", "fully", "qualified", "role", "identifiers", "from", "the", "Neos", ".", "Neos", "namespace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L709-L716
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.normalizeRoleIdentifier
protected function normalizeRoleIdentifier($roleIdentifier) { if (strpos($roleIdentifier, ':') === false) { $roleIdentifier = 'Neos.Neos:' . $roleIdentifier; } if (!$this->policyService->hasRole($roleIdentifier)) { throw new NoSuchRoleException(sprintf('The role %s does not exist.', $roleIdentifier), 1422540184); } return $roleIdentifier; }
php
protected function normalizeRoleIdentifier($roleIdentifier) { if (strpos($roleIdentifier, ':') === false) { $roleIdentifier = 'Neos.Neos:' . $roleIdentifier; } if (!$this->policyService->hasRole($roleIdentifier)) { throw new NoSuchRoleException(sprintf('The role %s does not exist.', $roleIdentifier), 1422540184); } return $roleIdentifier; }
[ "protected", "function", "normalizeRoleIdentifier", "(", "$", "roleIdentifier", ")", "{", "if", "(", "strpos", "(", "$", "roleIdentifier", ",", "':'", ")", "===", "false", ")", "{", "$", "roleIdentifier", "=", "'Neos.Neos:'", ".", "$", "roleIdentifier", ";", ...
Replaces a role identifier not containing a "." into fully qualified role identifier from the Neos.Neos namespace. @param string $roleIdentifier @return string @throws NoSuchRoleException
[ "Replaces", "a", "role", "identifier", "not", "containing", "a", ".", "into", "fully", "qualified", "role", "identifier", "from", "the", "Neos", ".", "Neos", "namespace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L725-L735
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.getAllRoles
protected function getAllRoles(User $user) { $roles = [ 'Neos.Flow:Everybody' => $this->policyService->getRole('Neos.Flow:Everybody'), 'Neos.Flow:AuthenticatedUser' => $this->policyService->getRole('Neos.Flow:AuthenticatedUser') ]; /** @var Account $account */ foreach ($user->getAccounts() as $account) { $accountRoles = $account->getRoles(); /** @var $currentRole Role */ foreach ($accountRoles as $currentRole) { if (!in_array($currentRole, $roles)) { $roles[$currentRole->getIdentifier()] = $currentRole; } /** @var $currentParentRole Role */ foreach ($currentRole->getAllParentRoles() as $currentParentRole) { if (!in_array($currentParentRole, $roles)) { $roles[$currentParentRole->getIdentifier()] = $currentParentRole; } } } } return $roles; }
php
protected function getAllRoles(User $user) { $roles = [ 'Neos.Flow:Everybody' => $this->policyService->getRole('Neos.Flow:Everybody'), 'Neos.Flow:AuthenticatedUser' => $this->policyService->getRole('Neos.Flow:AuthenticatedUser') ]; /** @var Account $account */ foreach ($user->getAccounts() as $account) { $accountRoles = $account->getRoles(); /** @var $currentRole Role */ foreach ($accountRoles as $currentRole) { if (!in_array($currentRole, $roles)) { $roles[$currentRole->getIdentifier()] = $currentRole; } /** @var $currentParentRole Role */ foreach ($currentRole->getAllParentRoles() as $currentParentRole) { if (!in_array($currentParentRole, $roles)) { $roles[$currentParentRole->getIdentifier()] = $currentParentRole; } } } } return $roles; }
[ "protected", "function", "getAllRoles", "(", "User", "$", "user", ")", "{", "$", "roles", "=", "[", "'Neos.Flow:Everybody'", "=>", "$", "this", "->", "policyService", "->", "getRole", "(", "'Neos.Flow:Everybody'", ")", ",", "'Neos.Flow:AuthenticatedUser'", "=>", ...
Returns an array with all roles of a user's accounts, including parent roles, the "Everybody" role and the "AuthenticatedUser" role, assuming that the user is logged in. @param User $user The user @return array
[ "Returns", "an", "array", "with", "all", "roles", "of", "a", "user", "s", "accounts", "including", "parent", "roles", "the", "Everybody", "role", "and", "the", "AuthenticatedUser", "role", "assuming", "that", "the", "user", "is", "logged", "in", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L744-L769
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.createPersonalWorkspace
protected function createPersonalWorkspace(User $user, Account $account) { $userWorkspaceName = UserUtility::getPersonalWorkspaceNameForUsername($account->getAccountIdentifier()); $userWorkspace = $this->workspaceRepository->findByIdentifier($userWorkspaceName); if ($userWorkspace === null) { $liveWorkspace = $this->workspaceRepository->findByIdentifier('live'); if (!($liveWorkspace instanceof Workspace)) { $liveWorkspace = new Workspace('live'); $liveWorkspace->setTitle('Live'); $this->workspaceRepository->add($liveWorkspace); } $userWorkspace = new Workspace($userWorkspaceName, $liveWorkspace, $user); $userWorkspace->setTitle((string)$user->getName()); $this->workspaceRepository->add($userWorkspace); } }
php
protected function createPersonalWorkspace(User $user, Account $account) { $userWorkspaceName = UserUtility::getPersonalWorkspaceNameForUsername($account->getAccountIdentifier()); $userWorkspace = $this->workspaceRepository->findByIdentifier($userWorkspaceName); if ($userWorkspace === null) { $liveWorkspace = $this->workspaceRepository->findByIdentifier('live'); if (!($liveWorkspace instanceof Workspace)) { $liveWorkspace = new Workspace('live'); $liveWorkspace->setTitle('Live'); $this->workspaceRepository->add($liveWorkspace); } $userWorkspace = new Workspace($userWorkspaceName, $liveWorkspace, $user); $userWorkspace->setTitle((string)$user->getName()); $this->workspaceRepository->add($userWorkspace); } }
[ "protected", "function", "createPersonalWorkspace", "(", "User", "$", "user", ",", "Account", "$", "account", ")", "{", "$", "userWorkspaceName", "=", "UserUtility", "::", "getPersonalWorkspaceNameForUsername", "(", "$", "account", "->", "getAccountIdentifier", "(", ...
Creates a personal workspace for the given user's account if it does not exist already. @param User $user The new user to create a workspace for @param Account $account The user's backend account @throws IllegalObjectTypeException
[ "Creates", "a", "personal", "workspace", "for", "the", "given", "user", "s", "account", "if", "it", "does", "not", "exist", "already", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L778-L794
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.deletePersonalWorkspace
protected function deletePersonalWorkspace($accountIdentifier) { $userWorkspace = $this->workspaceRepository->findByIdentifier(UserUtility::getPersonalWorkspaceNameForUsername($accountIdentifier)); if ($userWorkspace instanceof Workspace) { $this->publishingService->discardAllNodes($userWorkspace); $this->workspaceRepository->remove($userWorkspace); } }
php
protected function deletePersonalWorkspace($accountIdentifier) { $userWorkspace = $this->workspaceRepository->findByIdentifier(UserUtility::getPersonalWorkspaceNameForUsername($accountIdentifier)); if ($userWorkspace instanceof Workspace) { $this->publishingService->discardAllNodes($userWorkspace); $this->workspaceRepository->remove($userWorkspace); } }
[ "protected", "function", "deletePersonalWorkspace", "(", "$", "accountIdentifier", ")", "{", "$", "userWorkspace", "=", "$", "this", "->", "workspaceRepository", "->", "findByIdentifier", "(", "UserUtility", "::", "getPersonalWorkspaceNameForUsername", "(", "$", "accoun...
Removes all personal workspaces of the given user's account if these workspaces exist. Also removes all possibly existing content of these workspaces. @param string $accountIdentifier Identifier of the user's account @return void
[ "Removes", "all", "personal", "workspaces", "of", "the", "given", "user", "s", "account", "if", "these", "workspaces", "exist", ".", "Also", "removes", "all", "possibly", "existing", "content", "of", "these", "workspaces", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L803-L810
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/UserService.php
UserService.removeOwnerFromUsersWorkspaces
protected function removeOwnerFromUsersWorkspaces(User $user) { /** @var Workspace $workspace */ foreach ($this->workspaceRepository->findByOwner($user) as $workspace) { $workspace->setOwner(null); $this->workspaceRepository->update($workspace); } }
php
protected function removeOwnerFromUsersWorkspaces(User $user) { /** @var Workspace $workspace */ foreach ($this->workspaceRepository->findByOwner($user) as $workspace) { $workspace->setOwner(null); $this->workspaceRepository->update($workspace); } }
[ "protected", "function", "removeOwnerFromUsersWorkspaces", "(", "User", "$", "user", ")", "{", "/** @var Workspace $workspace */", "foreach", "(", "$", "this", "->", "workspaceRepository", "->", "findByOwner", "(", "$", "user", ")", "as", "$", "workspace", ")", "{...
Removes ownership of all workspaces currently owned by the given user @param User $user The user currently owning workspaces @return void
[ "Removes", "ownership", "of", "all", "workspaces", "currently", "owned", "by", "the", "given", "user" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/UserService.php#L818-L825
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Filters/DimensionValues.php
DimensionValues.matches
public function matches(NodeData $node) { if ($this->filterForDefaultDimensionValues === true) { $configuredDimensions = $this->contentDimensionRepository->findAll(); foreach ($configuredDimensions as $dimension) { $this->dimensionValues[$dimension->getIdentifier()] = [$dimension->getDefault()]; } } return ($node->getDimensionValues() === $this->dimensionValues); }
php
public function matches(NodeData $node) { if ($this->filterForDefaultDimensionValues === true) { $configuredDimensions = $this->contentDimensionRepository->findAll(); foreach ($configuredDimensions as $dimension) { $this->dimensionValues[$dimension->getIdentifier()] = [$dimension->getDefault()]; } } return ($node->getDimensionValues() === $this->dimensionValues); }
[ "public", "function", "matches", "(", "NodeData", "$", "node", ")", "{", "if", "(", "$", "this", "->", "filterForDefaultDimensionValues", "===", "true", ")", "{", "$", "configuredDimensions", "=", "$", "this", "->", "contentDimensionRepository", "->", "findAll",...
Returns true if the given node has the default dimension values. @param NodeData $node @return boolean
[ "Returns", "true", "if", "the", "given", "node", "has", "the", "default", "dimension", "values", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Filters/DimensionValues.php#L65-L75
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Configuration/Configuration.php
Configuration.isVersionAvailable
public function isVersionAvailable($version) { if ($this->availableVersions === null) { $this->registerAvailableVersions(); } return isset($this->availableVersions[$version]); }
php
public function isVersionAvailable($version) { if ($this->availableVersions === null) { $this->registerAvailableVersions(); } return isset($this->availableVersions[$version]); }
[ "public", "function", "isVersionAvailable", "(", "$", "version", ")", "{", "if", "(", "$", "this", "->", "availableVersions", "===", "null", ")", "{", "$", "this", "->", "registerAvailableVersions", "(", ")", ";", "}", "return", "isset", "(", "$", "this", ...
If the given version is available, true is returned. @param string $version @return boolean
[ "If", "the", "given", "version", "is", "available", "true", "is", "returned", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Configuration/Configuration.php#L50-L56
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Configuration/Configuration.php
Configuration.getMigrationVersion
public function getMigrationVersion($version) { if ($this->isVersionAvailable($version)) { if ($this->isVersionLoaded($version)) { $configuration = $this->loadedVersions[$version]; } else { $configuration = $this->loadConfiguration($version); $this->loadedVersions[$version] = $configuration; } return $configuration; } throw new MigrationException('Specified version is not available.', 1345821746); }
php
public function getMigrationVersion($version) { if ($this->isVersionAvailable($version)) { if ($this->isVersionLoaded($version)) { $configuration = $this->loadedVersions[$version]; } else { $configuration = $this->loadConfiguration($version); $this->loadedVersions[$version] = $configuration; } return $configuration; } throw new MigrationException('Specified version is not available.', 1345821746); }
[ "public", "function", "getMigrationVersion", "(", "$", "version", ")", "{", "if", "(", "$", "this", "->", "isVersionAvailable", "(", "$", "version", ")", ")", "{", "if", "(", "$", "this", "->", "isVersionLoaded", "(", "$", "version", ")", ")", "{", "$"...
Returns the configuration of the given version, if available. @param string $version @return array @throws MigrationException
[ "Returns", "the", "configuration", "of", "the", "given", "version", "if", "available", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Configuration/Configuration.php#L65-L77
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.import
public function import(\XMLReader $xmlReader, $targetPath, $resourceLoadPath = null) { $this->propertyMappingConfiguration = new ImportExportPropertyMappingConfiguration($resourceLoadPath); $this->nodeNameStack = []; if ($targetPath !== '/') { $pathSegments = explode('/', $targetPath); array_shift($pathSegments); $this->nodeNameStack = array_map(function ($pathSegment) { return Utility::renderValidNodeName($pathSegment); }, $pathSegments); } $formatVersion = $this->determineFormatVersion($xmlReader); switch ($formatVersion) { case self::SUPPORTED_FORMAT_VERSION: $this->securityContext->withoutAuthorizationChecks(function () use ($xmlReader) { $this->importSubtree($xmlReader); }); break; case null: throw new ImportException('Failed to recognize format of the Node Data XML to import. Please make sure that you use a valid Node Data XML structure.', 1409059346); default: throw new ImportException('Failed to import Node Data XML: The format with version ' . $formatVersion . ' is not supported, only version ' . self::SUPPORTED_FORMAT_VERSION . ' is supported.', 1409059352); } }
php
public function import(\XMLReader $xmlReader, $targetPath, $resourceLoadPath = null) { $this->propertyMappingConfiguration = new ImportExportPropertyMappingConfiguration($resourceLoadPath); $this->nodeNameStack = []; if ($targetPath !== '/') { $pathSegments = explode('/', $targetPath); array_shift($pathSegments); $this->nodeNameStack = array_map(function ($pathSegment) { return Utility::renderValidNodeName($pathSegment); }, $pathSegments); } $formatVersion = $this->determineFormatVersion($xmlReader); switch ($formatVersion) { case self::SUPPORTED_FORMAT_VERSION: $this->securityContext->withoutAuthorizationChecks(function () use ($xmlReader) { $this->importSubtree($xmlReader); }); break; case null: throw new ImportException('Failed to recognize format of the Node Data XML to import. Please make sure that you use a valid Node Data XML structure.', 1409059346); default: throw new ImportException('Failed to import Node Data XML: The format with version ' . $formatVersion . ' is not supported, only version ' . self::SUPPORTED_FORMAT_VERSION . ' is supported.', 1409059352); } }
[ "public", "function", "import", "(", "\\", "XMLReader", "$", "xmlReader", ",", "$", "targetPath", ",", "$", "resourceLoadPath", "=", "null", ")", "{", "$", "this", "->", "propertyMappingConfiguration", "=", "new", "ImportExportPropertyMappingConfiguration", "(", "...
Imports the sub-tree from the xml reader into the given target path. The root node of the imported tree becomes a child of the node specified as the target path, as the following example illustrates: 1. Existing Nodes Before Import: path - to - - my - - - targetNode - - - - A - other - - nodes 2. Sub-tree in xml to import to 'path/to/my/targetNode': <B> - <B1/> </B> 3. existing nodes after the import: path - to - - my - - - targetNode - - - - A - - - - B - - - - - B1 - another - - sub-tree @param \XMLReader $xmlReader The XML input to import - must be either XML as a string or a prepared \XMLReader instance containing XML data @param string $targetPath path to the node which becomes parent of the root of the imported sub-tree @param string $resourceLoadPath @throws ImportException @return void
[ "Imports", "the", "sub", "-", "tree", "from", "the", "xml", "reader", "into", "the", "given", "target", "path", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L179-L204
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.determineFormatVersion
protected function determineFormatVersion(\XMLReader $xmlReader) { while ($xmlReader->nodeType !== \XMLReader::ELEMENT || $xmlReader->name !== 'nodes') { if (!$xmlReader->read()) { break; } } if ($xmlReader->name === 'nodes' && $xmlReader->nodeType === \XMLReader::ELEMENT) { return $xmlReader->getAttribute('formatVersion'); } return false; }
php
protected function determineFormatVersion(\XMLReader $xmlReader) { while ($xmlReader->nodeType !== \XMLReader::ELEMENT || $xmlReader->name !== 'nodes') { if (!$xmlReader->read()) { break; } } if ($xmlReader->name === 'nodes' && $xmlReader->nodeType === \XMLReader::ELEMENT) { return $xmlReader->getAttribute('formatVersion'); } return false; }
[ "protected", "function", "determineFormatVersion", "(", "\\", "XMLReader", "$", "xmlReader", ")", "{", "while", "(", "$", "xmlReader", "->", "nodeType", "!==", "\\", "XMLReader", "::", "ELEMENT", "||", "$", "xmlReader", "->", "name", "!==", "'nodes'", ")", "...
Determines the ContentRepository format version of the given xml @param \XMLReader $xmlReader @return null|string the version as a string or null if the version could not be determined
[ "Determines", "the", "ContentRepository", "format", "version", "of", "the", "given", "xml" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L212-L225
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.importSubtree
protected function importSubtree(\XMLReader $xmlReader) { while ($xmlReader->read()) { if ($xmlReader->nodeType === \XMLReader::COMMENT) { continue; } switch ($xmlReader->nodeType) { case \XMLReader::ELEMENT: if (!$xmlReader->isEmptyElement) { $this->parseElement($xmlReader); } break; case \XMLReader::END_ELEMENT: if ((string)$xmlReader->name === 'nodes') { return; // all done, reached the closing </nodes> tag } $this->parseEndElement($xmlReader); break; } } }
php
protected function importSubtree(\XMLReader $xmlReader) { while ($xmlReader->read()) { if ($xmlReader->nodeType === \XMLReader::COMMENT) { continue; } switch ($xmlReader->nodeType) { case \XMLReader::ELEMENT: if (!$xmlReader->isEmptyElement) { $this->parseElement($xmlReader); } break; case \XMLReader::END_ELEMENT: if ((string)$xmlReader->name === 'nodes') { return; // all done, reached the closing </nodes> tag } $this->parseEndElement($xmlReader); break; } } }
[ "protected", "function", "importSubtree", "(", "\\", "XMLReader", "$", "xmlReader", ")", "{", "while", "(", "$", "xmlReader", "->", "read", "(", ")", ")", "{", "if", "(", "$", "xmlReader", "->", "nodeType", "===", "\\", "XMLReader", "::", "COMMENT", ")",...
Imports the sub-tree from the xml reader into the given target path. The root node of the imported tree becomes a child of the node specified by target path. This parser uses the depth-first reading strategy, which means it will read the input from top til bottom. @param \XMLReader $xmlReader A prepared XML Reader with the structure to import @return void
[ "Imports", "the", "sub", "-", "tree", "from", "the", "xml", "reader", "into", "the", "given", "target", "path", ".", "The", "root", "node", "of", "the", "imported", "tree", "becomes", "a", "child", "of", "the", "node", "specified", "by", "target", "path"...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L236-L257
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.parseDimensionsElement
protected function parseDimensionsElement(\XMLReader $reader) { $dimensions = []; $currentDimension = null; while ($reader->read()) { switch ($reader->nodeType) { case \XMLReader::ELEMENT: $currentDimension = $reader->name; break; case \XMLReader::END_ELEMENT: if ($reader->name === 'dimensions') { return $dimensions; } break; case \XMLReader::CDATA: case \XMLReader::TEXT: $dimensions[$currentDimension][] = $reader->value; break; } } return $dimensions; }
php
protected function parseDimensionsElement(\XMLReader $reader) { $dimensions = []; $currentDimension = null; while ($reader->read()) { switch ($reader->nodeType) { case \XMLReader::ELEMENT: $currentDimension = $reader->name; break; case \XMLReader::END_ELEMENT: if ($reader->name === 'dimensions') { return $dimensions; } break; case \XMLReader::CDATA: case \XMLReader::TEXT: $dimensions[$currentDimension][] = $reader->value; break; } } return $dimensions; }
[ "protected", "function", "parseDimensionsElement", "(", "\\", "XMLReader", "$", "reader", ")", "{", "$", "dimensions", "=", "[", "]", ";", "$", "currentDimension", "=", "null", ";", "while", "(", "$", "reader", "->", "read", "(", ")", ")", "{", "switch",...
Parses the content of the dimensions-tag and returns the dimensions as an array 'dimension name' => dimension value @param \XMLReader $reader reader positioned just after an opening dimensions-tag @return array the dimension values
[ "Parses", "the", "content", "of", "the", "dimensions", "-", "tag", "and", "returns", "the", "dimensions", "as", "an", "array", "dimension", "name", "=", ">", "dimension", "value" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L339-L362
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.parseArrayElements
protected function parseArrayElements(\XMLReader $reader, $elementName, $currentNodeIdentifier) { $values = []; $depth = 0; // The following silences static code analysis warnings about undefined variables. // during runtime this doesn't happen, because the $reader must be at an ELEMENT, // thus the variables would be defined in the first case block before they can be // used. $currentType = null; $currentEncoding = null; $currentClassName = null; $currentIdentifier = null; do { switch ($reader->nodeType) { case \XMLReader::ELEMENT: $depth++; // __type="object" __classname="Neos\Media\Domain\Model\ImageVariant" __encoding="json" $currentType = $reader->getAttribute('__type'); $currentClassName = $reader->getAttribute('__classname'); $currentEncoding = $reader->getAttribute('__encoding'); break; case \XMLReader::END_ELEMENT: if ($reader->name === $elementName) { return $values; } break; case \XMLReader::CDATA: case \XMLReader::TEXT: $values[] = $this->convertElementToValue($reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $elementName); break; } } while ($reader->read()); }
php
protected function parseArrayElements(\XMLReader $reader, $elementName, $currentNodeIdentifier) { $values = []; $depth = 0; // The following silences static code analysis warnings about undefined variables. // during runtime this doesn't happen, because the $reader must be at an ELEMENT, // thus the variables would be defined in the first case block before they can be // used. $currentType = null; $currentEncoding = null; $currentClassName = null; $currentIdentifier = null; do { switch ($reader->nodeType) { case \XMLReader::ELEMENT: $depth++; // __type="object" __classname="Neos\Media\Domain\Model\ImageVariant" __encoding="json" $currentType = $reader->getAttribute('__type'); $currentClassName = $reader->getAttribute('__classname'); $currentEncoding = $reader->getAttribute('__encoding'); break; case \XMLReader::END_ELEMENT: if ($reader->name === $elementName) { return $values; } break; case \XMLReader::CDATA: case \XMLReader::TEXT: $values[] = $this->convertElementToValue($reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $elementName); break; } } while ($reader->read()); }
[ "protected", "function", "parseArrayElements", "(", "\\", "XMLReader", "$", "reader", ",", "$", "elementName", ",", "$", "currentNodeIdentifier", ")", "{", "$", "values", "=", "[", "]", ";", "$", "depth", "=", "0", ";", "// The following silences static code ana...
Parses the content of exported array and returns the values @param \XMLReader $reader reader positioned just after an opening array-tag @param string $elementName @param string $currentNodeIdentifier @return array the array values
[ "Parses", "the", "content", "of", "exported", "array", "and", "returns", "the", "values" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L372-L406
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.parsePropertiesElement
protected function parsePropertiesElement(\XMLReader $reader, $currentNodeIdentifier) { $properties = []; $currentProperty = null; $currentType = null; $currentEncoding = null; $currentClassName = null; $currentIdentifier = null; while ($reader->read()) { switch ($reader->nodeType) { case \XMLReader::ELEMENT: $currentProperty = $reader->name; $currentType = $reader->getAttribute('__type'); $currentIdentifier = $reader->getAttribute('__identifier'); $currentClassName = $reader->getAttribute('__classname'); $currentEncoding = $reader->getAttribute('__encoding'); if ($reader->isEmptyElement) { switch ($currentType) { case 'array': $properties[$currentProperty] = []; break; case 'string': $properties[$currentProperty] = ''; break; default: $properties[$currentProperty] = null; } $currentType = null; } // __type="object" __identifier="uuid goes here" __classname="Neos\Media\Domain\Model\ImageVariant" __encoding="json" if ($currentType === 'array') { $value = $this->parseArrayElements($reader, $currentProperty, $currentNodeIdentifier); $properties[$currentProperty] = $value; } break; case \XMLReader::END_ELEMENT: if ($reader->name === 'properties') { return $properties; } break; case \XMLReader::CDATA: case \XMLReader::TEXT: $properties[$currentProperty] = $this->convertElementToValue($reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $currentProperty); break; } } return $properties; }
php
protected function parsePropertiesElement(\XMLReader $reader, $currentNodeIdentifier) { $properties = []; $currentProperty = null; $currentType = null; $currentEncoding = null; $currentClassName = null; $currentIdentifier = null; while ($reader->read()) { switch ($reader->nodeType) { case \XMLReader::ELEMENT: $currentProperty = $reader->name; $currentType = $reader->getAttribute('__type'); $currentIdentifier = $reader->getAttribute('__identifier'); $currentClassName = $reader->getAttribute('__classname'); $currentEncoding = $reader->getAttribute('__encoding'); if ($reader->isEmptyElement) { switch ($currentType) { case 'array': $properties[$currentProperty] = []; break; case 'string': $properties[$currentProperty] = ''; break; default: $properties[$currentProperty] = null; } $currentType = null; } // __type="object" __identifier="uuid goes here" __classname="Neos\Media\Domain\Model\ImageVariant" __encoding="json" if ($currentType === 'array') { $value = $this->parseArrayElements($reader, $currentProperty, $currentNodeIdentifier); $properties[$currentProperty] = $value; } break; case \XMLReader::END_ELEMENT: if ($reader->name === 'properties') { return $properties; } break; case \XMLReader::CDATA: case \XMLReader::TEXT: $properties[$currentProperty] = $this->convertElementToValue($reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $currentProperty); break; } } return $properties; }
[ "protected", "function", "parsePropertiesElement", "(", "\\", "XMLReader", "$", "reader", ",", "$", "currentNodeIdentifier", ")", "{", "$", "properties", "=", "[", "]", ";", "$", "currentProperty", "=", "null", ";", "$", "currentType", "=", "null", ";", "$",...
Parses the content of the properties-tag and returns the properties as an array 'property name' => property value @param \XMLReader $reader reader positioned just after an opening properties-tag @param string $currentNodeIdentifier @return array the properties
[ "Parses", "the", "content", "of", "the", "properties", "-", "tag", "and", "returns", "the", "properties", "as", "an", "array", "property", "name", "=", ">", "property", "value" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L416-L467
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.convertElementToValue
protected function convertElementToValue(\XMLReader $reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $currentProperty) { switch ($currentType) { case 'object': if ($currentClassName === 'DateTime') { $stringValue = trim($reader->value); $value = $this->propertyMapper->convert($stringValue, $currentClassName, $this->propertyMappingConfiguration); if ($this->propertyMapper->getMessages()->hasErrors()) { throw new ImportException(sprintf('Could not convert element <%s> to DateTime for node %s', $currentProperty, $currentNodeIdentifier), 1472992032); } } elseif ($currentEncoding === 'json') { $decodedJson = json_decode($reader->value, true); if (json_last_error() !== JSON_ERROR_NONE) { throw new ImportException(sprintf('Could not parse encoded JSON in element <%s> for node %s: %s', $currentProperty, $currentNodeIdentifier, json_last_error_msg()), 1472992033); } $value = $this->propertyMapper->convert($decodedJson, $currentClassName, $this->propertyMappingConfiguration); if ($this->propertyMapper->getMessages()->hasErrors()) { throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentClassName, $currentNodeIdentifier), 1472992034); } } else { throw new ImportException(sprintf('Unsupported encoding "%s"', $currentEncoding), 1404397061); } break; case 'string': $value = $reader->value; break; default: $value = $this->propertyMapper->convert($reader->value, $currentType, $this->propertyMappingConfiguration); if ($this->propertyMapper->getMessages()->hasErrors()) { throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentType, $currentNodeIdentifier), 1472992035); } return $value; } $this->persistEntities($value); return $value; }
php
protected function convertElementToValue(\XMLReader $reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $currentProperty) { switch ($currentType) { case 'object': if ($currentClassName === 'DateTime') { $stringValue = trim($reader->value); $value = $this->propertyMapper->convert($stringValue, $currentClassName, $this->propertyMappingConfiguration); if ($this->propertyMapper->getMessages()->hasErrors()) { throw new ImportException(sprintf('Could not convert element <%s> to DateTime for node %s', $currentProperty, $currentNodeIdentifier), 1472992032); } } elseif ($currentEncoding === 'json') { $decodedJson = json_decode($reader->value, true); if (json_last_error() !== JSON_ERROR_NONE) { throw new ImportException(sprintf('Could not parse encoded JSON in element <%s> for node %s: %s', $currentProperty, $currentNodeIdentifier, json_last_error_msg()), 1472992033); } $value = $this->propertyMapper->convert($decodedJson, $currentClassName, $this->propertyMappingConfiguration); if ($this->propertyMapper->getMessages()->hasErrors()) { throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentClassName, $currentNodeIdentifier), 1472992034); } } else { throw new ImportException(sprintf('Unsupported encoding "%s"', $currentEncoding), 1404397061); } break; case 'string': $value = $reader->value; break; default: $value = $this->propertyMapper->convert($reader->value, $currentType, $this->propertyMappingConfiguration); if ($this->propertyMapper->getMessages()->hasErrors()) { throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentType, $currentNodeIdentifier), 1472992035); } return $value; } $this->persistEntities($value); return $value; }
[ "protected", "function", "convertElementToValue", "(", "\\", "XMLReader", "$", "reader", ",", "$", "currentType", ",", "$", "currentEncoding", ",", "$", "currentClassName", ",", "$", "currentNodeIdentifier", ",", "$", "currentProperty", ")", "{", "switch", "(", ...
Convert an element to the value it represents. @param \XMLReader $reader @param string $currentType current element (userland) type @param string $currentEncoding date encoding of element @param string $currentClassName class name of element @param string $currentNodeIdentifier identifier of the node @param string $currentProperty current property name @return mixed @throws ImportException
[ "Convert", "an", "element", "to", "the", "value", "it", "represents", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L481-L517
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.persistEntities
protected function persistEntities($propertyValue) { if (!$propertyValue instanceof \Iterator && !is_array($propertyValue)) { $propertyValue = [$propertyValue]; } foreach ($propertyValue as $possibleEntity) { if (is_object($possibleEntity) && $possibleEntity instanceof PersistenceMagicInterface) { $this->persistenceManager->isNewObject($possibleEntity) ? $this->persistenceManager->add($possibleEntity) : $this->persistenceManager->update($possibleEntity); // TODO: Needed because the originalAsset will not cascade persist. We should find a generic solution to this. if ($possibleEntity instanceof ImageVariant) { $asset = $possibleEntity->getOriginalAsset(); $this->persistenceManager->isNewObject($asset) ? $this->persistenceManager->add($asset) : $this->persistenceManager->update($asset); } } } }
php
protected function persistEntities($propertyValue) { if (!$propertyValue instanceof \Iterator && !is_array($propertyValue)) { $propertyValue = [$propertyValue]; } foreach ($propertyValue as $possibleEntity) { if (is_object($possibleEntity) && $possibleEntity instanceof PersistenceMagicInterface) { $this->persistenceManager->isNewObject($possibleEntity) ? $this->persistenceManager->add($possibleEntity) : $this->persistenceManager->update($possibleEntity); // TODO: Needed because the originalAsset will not cascade persist. We should find a generic solution to this. if ($possibleEntity instanceof ImageVariant) { $asset = $possibleEntity->getOriginalAsset(); $this->persistenceManager->isNewObject($asset) ? $this->persistenceManager->add($asset) : $this->persistenceManager->update($asset); } } } }
[ "protected", "function", "persistEntities", "(", "$", "propertyValue", ")", "{", "if", "(", "!", "$", "propertyValue", "instanceof", "\\", "Iterator", "&&", "!", "is_array", "(", "$", "propertyValue", ")", ")", "{", "$", "propertyValue", "=", "[", "$", "pr...
Checks if a propertyValue contains an entity and persists it. @param mixed $propertyValue @return void
[ "Checks", "if", "a", "propertyValue", "contains", "an", "entity", "and", "persists", "it", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L525-L541
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.parseEndElement
protected function parseEndElement(\XMLReader $reader) { switch ($reader->name) { case 'hiddenBeforeDateTime': case 'hiddenAfterDateTime': case 'creationDateTime': case 'lastModificationDateTime': case 'lastPublicationDateTime': case 'accessRoles': break; case 'node': // update current path array_pop($this->nodeNameStack); // update current node identifier array_pop($this->nodeIdentifierStack); break; case 'variant': // we have collected all data for the node so we save it $nodeData = array_pop($this->nodeDataStack); // if XML files lack the identifier for a node, add it here if (!isset($nodeData['identifier'])) { $nodeData['identifier'] = Algorithms::generateUUID(); } $this->persistNodeData($nodeData); break; default: throw new ImportException(sprintf('Unexpected end element <%s> ', $reader->name), 1423578066); break; } }
php
protected function parseEndElement(\XMLReader $reader) { switch ($reader->name) { case 'hiddenBeforeDateTime': case 'hiddenAfterDateTime': case 'creationDateTime': case 'lastModificationDateTime': case 'lastPublicationDateTime': case 'accessRoles': break; case 'node': // update current path array_pop($this->nodeNameStack); // update current node identifier array_pop($this->nodeIdentifierStack); break; case 'variant': // we have collected all data for the node so we save it $nodeData = array_pop($this->nodeDataStack); // if XML files lack the identifier for a node, add it here if (!isset($nodeData['identifier'])) { $nodeData['identifier'] = Algorithms::generateUUID(); } $this->persistNodeData($nodeData); break; default: throw new ImportException(sprintf('Unexpected end element <%s> ', $reader->name), 1423578066); break; } }
[ "protected", "function", "parseEndElement", "(", "\\", "XMLReader", "$", "reader", ")", "{", "switch", "(", "$", "reader", "->", "name", ")", "{", "case", "'hiddenBeforeDateTime'", ":", "case", "'hiddenAfterDateTime'", ":", "case", "'creationDateTime'", ":", "ca...
Parses the closing tags writes data to the database then @param \XMLReader $reader @return void @throws ImportException
[ "Parses", "the", "closing", "tags", "writes", "data", "to", "the", "database", "then" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L550-L581
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
NodeImportService.getParentPath
protected function getParentPath($path) { if ($path === '/') { return ''; } $endIndex = strrpos($path, '/'); $index = strpos($path, '/'); // path is something like /nodeInRootSpace if ($index === $endIndex) { return '/'; } else { // node is something like /node/not/in/root/space return substr($path, 0, $endIndex); } }
php
protected function getParentPath($path) { if ($path === '/') { return ''; } $endIndex = strrpos($path, '/'); $index = strpos($path, '/'); // path is something like /nodeInRootSpace if ($index === $endIndex) { return '/'; } else { // node is something like /node/not/in/root/space return substr($path, 0, $endIndex); } }
[ "protected", "function", "getParentPath", "(", "$", "path", ")", "{", "if", "(", "$", "path", "===", "'/'", ")", "{", "return", "''", ";", "}", "$", "endIndex", "=", "strrpos", "(", "$", "path", ",", "'/'", ")", ";", "$", "index", "=", "strpos", ...
Provides the parent of the given path @param string $path path to get parent for @return string parent path
[ "Provides", "the", "parent", "of", "the", "given", "path" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php#L600-L613
train
neos/neos-development-collection
Neos.Neos/Classes/Service/Controller/WorkspaceController.php
WorkspaceController.publishNodeAction
public function publishNodeAction(NodeInterface $node, $targetWorkspaceName = null) { $targetWorkspace = ($targetWorkspaceName !== null) ? $this->workspaceRepository->findOneByName($targetWorkspaceName) : null; $this->publishingService->publishNode($node, $targetWorkspace); $this->throwStatus(204, 'Node published', ''); }
php
public function publishNodeAction(NodeInterface $node, $targetWorkspaceName = null) { $targetWorkspace = ($targetWorkspaceName !== null) ? $this->workspaceRepository->findOneByName($targetWorkspaceName) : null; $this->publishingService->publishNode($node, $targetWorkspace); $this->throwStatus(204, 'Node published', ''); }
[ "public", "function", "publishNodeAction", "(", "NodeInterface", "$", "node", ",", "$", "targetWorkspaceName", "=", "null", ")", "{", "$", "targetWorkspace", "=", "(", "$", "targetWorkspaceName", "!==", "null", ")", "?", "$", "this", "->", "workspaceRepository",...
Publishes the given node to the specified targetWorkspace @param NodeInterface $node @param string $targetWorkspaceName @return void
[ "Publishes", "the", "given", "node", "to", "the", "specified", "targetWorkspace" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/WorkspaceController.php#L93-L99
train
neos/neos-development-collection
Neos.Neos/Classes/Service/Controller/WorkspaceController.php
WorkspaceController.publishNodesAction
public function publishNodesAction(array $nodes, $targetWorkspaceName = null) { $targetWorkspace = ($targetWorkspaceName !== null) ? $this->workspaceRepository->findOneByName($targetWorkspaceName) : null; $this->publishingService->publishNodes($nodes, $targetWorkspace); $this->throwStatus(204, 'Nodes published', ''); }
php
public function publishNodesAction(array $nodes, $targetWorkspaceName = null) { $targetWorkspace = ($targetWorkspaceName !== null) ? $this->workspaceRepository->findOneByName($targetWorkspaceName) : null; $this->publishingService->publishNodes($nodes, $targetWorkspace); $this->throwStatus(204, 'Nodes published', ''); }
[ "public", "function", "publishNodesAction", "(", "array", "$", "nodes", ",", "$", "targetWorkspaceName", "=", "null", ")", "{", "$", "targetWorkspace", "=", "(", "$", "targetWorkspaceName", "!==", "null", ")", "?", "$", "this", "->", "workspaceRepository", "->...
Publishes the given nodes to the specified targetWorkspace @param array<\Neos\ContentRepository\Domain\Model\NodeInterface> $nodes @param string $targetWorkspaceName @return void
[ "Publishes", "the", "given", "nodes", "to", "the", "specified", "targetWorkspace" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/WorkspaceController.php#L108-L114
train
neos/neos-development-collection
Neos.Neos/Classes/Service/Controller/WorkspaceController.php
WorkspaceController.publishAllAction
public function publishAllAction($sourceWorkspaceName, $targetWorkspaceName) { $sourceWorkspace = $this->workspaceRepository->findOneByName($sourceWorkspaceName); $targetWorkspace = $this->workspaceRepository->findOneByName($targetWorkspaceName); if ($sourceWorkspace === null) { $this->throwStatus(400, 'Invalid source workspace'); } if ($targetWorkspace === null) { $this->throwStatus(400, 'Invalid target workspace'); } $this->publishingService->publishNodes($this->publishingService->getUnpublishedNodes($sourceWorkspace), $targetWorkspace); $this->throwStatus(204, sprintf('All changes in workspace %s have been published to %s', $sourceWorkspaceName, $targetWorkspaceName), ''); }
php
public function publishAllAction($sourceWorkspaceName, $targetWorkspaceName) { $sourceWorkspace = $this->workspaceRepository->findOneByName($sourceWorkspaceName); $targetWorkspace = $this->workspaceRepository->findOneByName($targetWorkspaceName); if ($sourceWorkspace === null) { $this->throwStatus(400, 'Invalid source workspace'); } if ($targetWorkspace === null) { $this->throwStatus(400, 'Invalid target workspace'); } $this->publishingService->publishNodes($this->publishingService->getUnpublishedNodes($sourceWorkspace), $targetWorkspace); $this->throwStatus(204, sprintf('All changes in workspace %s have been published to %s', $sourceWorkspaceName, $targetWorkspaceName), ''); }
[ "public", "function", "publishAllAction", "(", "$", "sourceWorkspaceName", ",", "$", "targetWorkspaceName", ")", "{", "$", "sourceWorkspace", "=", "$", "this", "->", "workspaceRepository", "->", "findOneByName", "(", "$", "sourceWorkspaceName", ")", ";", "$", "tar...
Publish everything in the workspace with the given workspace name @param string $sourceWorkspaceName Name of the source workspace containing the content to publish @param string $targetWorkspaceName Name of the target workspace the content should be published to @return void
[ "Publish", "everything", "in", "the", "workspace", "with", "the", "given", "workspace", "name" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/WorkspaceController.php#L149-L162
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Service/AssetProxiesController.php
AssetProxiesController.showAction
public function showAction(string $assetSourceIdentifier, string $assetProxyIdentifier): void { $assetSources = $this->assetSourceService->getAssetSources(); if (!isset($assetSources[$assetSourceIdentifier])) { $this->throwStatus(404, 'Asset source not found'); } $assetProxyRepository = $assetSources[$assetSourceIdentifier]->getAssetProxyRepository(); $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier); if (!$assetProxy) { $this->throwStatus(404, 'Asset proxy not found'); } $this->view->assign('assetProxy', $assetProxy); }
php
public function showAction(string $assetSourceIdentifier, string $assetProxyIdentifier): void { $assetSources = $this->assetSourceService->getAssetSources(); if (!isset($assetSources[$assetSourceIdentifier])) { $this->throwStatus(404, 'Asset source not found'); } $assetProxyRepository = $assetSources[$assetSourceIdentifier]->getAssetProxyRepository(); $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier); if (!$assetProxy) { $this->throwStatus(404, 'Asset proxy not found'); } $this->view->assign('assetProxy', $assetProxy); }
[ "public", "function", "showAction", "(", "string", "$", "assetSourceIdentifier", ",", "string", "$", "assetProxyIdentifier", ")", ":", "void", "{", "$", "assetSources", "=", "$", "this", "->", "assetSourceService", "->", "getAssetSources", "(", ")", ";", "if", ...
Shows a specific asset proxy @param string $assetSourceIdentifier @param string $assetProxyIdentifier @return void @throws StopActionException @throws UnsupportedRequestTypeException
[ "Shows", "a", "specific", "asset", "proxy" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Service/AssetProxiesController.php#L134-L148
train
neos/neos-development-collection
Neos.Media/Classes/TypeConverter/ImageInterfaceConverter.php
ImageInterfaceConverter.applyTypeSpecificHandling
protected function applyTypeSpecificHandling($asset, $source, array $convertedChildProperties, PropertyMappingConfigurationInterface $configuration) { if ($asset instanceof ImageVariant) { $adjustments = []; if (isset($source['adjustments'])) { foreach ($source['adjustments'] as $adjustmentType => $adjustmentOptions) { if (isset($adjustmentOptions['__type'])) { $adjustmentType = $adjustmentOptions['__type']; unset($adjustmentOptions['__type']); } $identity = null; if (isset($adjustmentOptions['__identity'])) { $identity = $adjustmentOptions['__identity']; unset($adjustmentOptions['__identity']); } $adjustment = $this->propertyMapper->convert($adjustmentOptions, $adjustmentType, $configuration); if ($identity !== null) { ObjectAccess::setProperty($adjustment, 'persistence_object_identifier', $identity, true); } $adjustments[] = $adjustment; } } elseif (isset($source['processingInstructions'])) { $adjustments = $this->processingInstructionsConverter->convertFrom($source['processingInstructions'], 'array'); } if (count($adjustments) > 0) { $asset->addAdjustments($adjustments); } } return $asset; }
php
protected function applyTypeSpecificHandling($asset, $source, array $convertedChildProperties, PropertyMappingConfigurationInterface $configuration) { if ($asset instanceof ImageVariant) { $adjustments = []; if (isset($source['adjustments'])) { foreach ($source['adjustments'] as $adjustmentType => $adjustmentOptions) { if (isset($adjustmentOptions['__type'])) { $adjustmentType = $adjustmentOptions['__type']; unset($adjustmentOptions['__type']); } $identity = null; if (isset($adjustmentOptions['__identity'])) { $identity = $adjustmentOptions['__identity']; unset($adjustmentOptions['__identity']); } $adjustment = $this->propertyMapper->convert($adjustmentOptions, $adjustmentType, $configuration); if ($identity !== null) { ObjectAccess::setProperty($adjustment, 'persistence_object_identifier', $identity, true); } $adjustments[] = $adjustment; } } elseif (isset($source['processingInstructions'])) { $adjustments = $this->processingInstructionsConverter->convertFrom($source['processingInstructions'], 'array'); } if (count($adjustments) > 0) { $asset->addAdjustments($adjustments); } } return $asset; }
[ "protected", "function", "applyTypeSpecificHandling", "(", "$", "asset", ",", "$", "source", ",", "array", "$", "convertedChildProperties", ",", "PropertyMappingConfigurationInterface", "$", "configuration", ")", "{", "if", "(", "$", "asset", "instanceof", "ImageVaria...
Converts and adds ImageAdjustments to the ImageVariant @param ImageInterface $asset @param mixed $source @param array $convertedChildProperties @param PropertyMappingConfigurationInterface $configuration @return ImageInterface|NULL
[ "Converts", "and", "adds", "ImageAdjustments", "to", "the", "ImageVariant" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/TypeConverter/ImageInterfaceConverter.php#L88-L121
train
neos/neos-development-collection
Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php
NodeViewHelper.render
public function render($node = null, $format = null, $absolute = false, array $arguments = [], $section = '', $addQueryString = false, array $argumentsToBeExcludedFromQueryString = [], $baseNodeName = 'documentNode', $nodeVariableName = 'linkedNode', $resolveShortcuts = true) { $baseNode = null; if (!$node instanceof NodeInterface) { $baseNode = $this->getContextVariable($baseNodeName); if (is_string($node) && substr($node, 0, 7) === 'node://') { $node = $this->linkingService->convertUriToObject($node, $baseNode); } } try { $uri = $this->linkingService->createNodeUri( $this->controllerContext, $node, $baseNode, $format, $absolute, $arguments, $section, $addQueryString, $argumentsToBeExcludedFromQueryString, $resolveShortcuts ); $this->tag->addAttribute('href', $uri); } catch (NeosException $exception) { $this->systemLogger->logException($exception); } catch (NoMatchingRouteException $exception) { $this->systemLogger->logException($exception); } $linkedNode = $this->linkingService->getLastLinkedNode(); $this->templateVariableContainer->add($nodeVariableName, $linkedNode); $content = $this->renderChildren(); $this->templateVariableContainer->remove($nodeVariableName); if ($content === null && $linkedNode !== null) { $content = $linkedNode->getLabel(); } $this->tag->setContent($content); $this->tag->forceClosingTag(true); return $this->tag->render(); }
php
public function render($node = null, $format = null, $absolute = false, array $arguments = [], $section = '', $addQueryString = false, array $argumentsToBeExcludedFromQueryString = [], $baseNodeName = 'documentNode', $nodeVariableName = 'linkedNode', $resolveShortcuts = true) { $baseNode = null; if (!$node instanceof NodeInterface) { $baseNode = $this->getContextVariable($baseNodeName); if (is_string($node) && substr($node, 0, 7) === 'node://') { $node = $this->linkingService->convertUriToObject($node, $baseNode); } } try { $uri = $this->linkingService->createNodeUri( $this->controllerContext, $node, $baseNode, $format, $absolute, $arguments, $section, $addQueryString, $argumentsToBeExcludedFromQueryString, $resolveShortcuts ); $this->tag->addAttribute('href', $uri); } catch (NeosException $exception) { $this->systemLogger->logException($exception); } catch (NoMatchingRouteException $exception) { $this->systemLogger->logException($exception); } $linkedNode = $this->linkingService->getLastLinkedNode(); $this->templateVariableContainer->add($nodeVariableName, $linkedNode); $content = $this->renderChildren(); $this->templateVariableContainer->remove($nodeVariableName); if ($content === null && $linkedNode !== null) { $content = $linkedNode->getLabel(); } $this->tag->setContent($content); $this->tag->forceClosingTag(true); return $this->tag->render(); }
[ "public", "function", "render", "(", "$", "node", "=", "null", ",", "$", "format", "=", "null", ",", "$", "absolute", "=", "false", ",", "array", "$", "arguments", "=", "[", "]", ",", "$", "section", "=", "''", ",", "$", "addQueryString", "=", "fal...
Renders the link. Renders the linked node's label if there's no child content. @param mixed $node A node object, a string node path (absolute or relative), a string node://-uri or NULL @param string $format Format to use for the URL, for example "html" or "json" @param boolean $absolute If set, an absolute URI is rendered @param array $arguments Additional arguments to be passed to the UriBuilder (for example pagination parameters) @param string $section The anchor to be added to the URI @param boolean $addQueryString If set, the current query parameters will be kept in the URI @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = true @param string $nodeVariableName The variable the node will be assigned to for the rendered child content @param string $baseNodeName The name of the base node inside the Fusion context to use for the ContentContext or resolving relative paths @param boolean $resolveShortcuts INTERNAL Parameter - if false, shortcuts are not redirected to their target. Only needed on rare backend occasions when we want to link to the shortcut itself. @return string The rendered link @throws ViewHelperException
[ "Renders", "the", "link", ".", "Renders", "the", "linked", "node", "s", "label", "if", "there", "s", "no", "child", "content", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php#L153-L195
train
neos/neos-development-collection
Neos.Neos/Classes/Command/DomainCommandController.php
DomainCommandController.addCommand
public function addCommand($siteNodeName, $hostname, $scheme = null, $port = null) { $site = $this->siteRepository->findOneByNodeName($siteNodeName); if (!$site instanceof Site) { $this->outputLine('<error>No site found with nodeName "%s".</error>', [$siteNodeName]); $this->quit(1); } $domains = $this->domainRepository->findByHostname($hostname); if ($domains->count() > 0) { $this->outputLine('<error>The host name "%s" is not unique.</error>', [$hostname]); $this->quit(1); } $domain = new Domain(); if ($scheme !== null) { $domain->setScheme($scheme); } if ($port !== null) { $domain->setPort($port); } $domain->setSite($site); $domain->setHostname($hostname); $domainValidator = $this->validatorResolver->getBaseValidatorConjunction(Domain::class); $result = $domainValidator->validate($domain); if ($result->hasErrors()) { foreach ($result->getFlattenedErrors() as $propertyName => $errors) { $firstError = array_pop($errors); $this->outputLine('<error>Validation failed for "' . $propertyName . '": ' . $firstError . '</error>'); $this->quit(1); } } $this->domainRepository->add($domain); $this->outputLine('Domain entry created.'); }
php
public function addCommand($siteNodeName, $hostname, $scheme = null, $port = null) { $site = $this->siteRepository->findOneByNodeName($siteNodeName); if (!$site instanceof Site) { $this->outputLine('<error>No site found with nodeName "%s".</error>', [$siteNodeName]); $this->quit(1); } $domains = $this->domainRepository->findByHostname($hostname); if ($domains->count() > 0) { $this->outputLine('<error>The host name "%s" is not unique.</error>', [$hostname]); $this->quit(1); } $domain = new Domain(); if ($scheme !== null) { $domain->setScheme($scheme); } if ($port !== null) { $domain->setPort($port); } $domain->setSite($site); $domain->setHostname($hostname); $domainValidator = $this->validatorResolver->getBaseValidatorConjunction(Domain::class); $result = $domainValidator->validate($domain); if ($result->hasErrors()) { foreach ($result->getFlattenedErrors() as $propertyName => $errors) { $firstError = array_pop($errors); $this->outputLine('<error>Validation failed for "' . $propertyName . '": ' . $firstError . '</error>'); $this->quit(1); } } $this->domainRepository->add($domain); $this->outputLine('Domain entry created.'); }
[ "public", "function", "addCommand", "(", "$", "siteNodeName", ",", "$", "hostname", ",", "$", "scheme", "=", "null", ",", "$", "port", "=", "null", ")", "{", "$", "site", "=", "$", "this", "->", "siteRepository", "->", "findOneByNodeName", "(", "$", "s...
Add a domain record @param string $siteNodeName The nodeName of the site rootNode, e.g. "flowneosio" @param string $hostname The hostname to match on, e.g. "flow.neos.io" @param string $scheme The scheme for linking (http/https) @param integer $port The port for linking (0-49151) @return void
[ "Add", "a", "domain", "record" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/DomainCommandController.php#L56-L93
train
neos/neos-development-collection
Neos.Neos/Classes/Command/DomainCommandController.php
DomainCommandController.listCommand
public function listCommand($hostname = null) { if ($hostname === null) { $domains = $this->domainRepository->findAll(); } else { $domains = $this->domainRepository->findByHostname($hostname); } if (count($domains) === 0) { $this->outputLine('No domain entries available.'); $this->quit(0); } $availableDomains = []; foreach ($domains as $domain) { /** @var \Neos\Neos\Domain\Model\Domain $domain */ $availableDomains[] = [ 'nodeName' => $domain->getSite()->getNodeName(), 'hostname' => (string)$domain, 'active' => $domain->getActive() ? 'active' : 'inactive' ]; } $this->output->outputTable($availableDomains, ['Node name', 'Domain (Scheme/Host/Port)', 'State']); }
php
public function listCommand($hostname = null) { if ($hostname === null) { $domains = $this->domainRepository->findAll(); } else { $domains = $this->domainRepository->findByHostname($hostname); } if (count($domains) === 0) { $this->outputLine('No domain entries available.'); $this->quit(0); } $availableDomains = []; foreach ($domains as $domain) { /** @var \Neos\Neos\Domain\Model\Domain $domain */ $availableDomains[] = [ 'nodeName' => $domain->getSite()->getNodeName(), 'hostname' => (string)$domain, 'active' => $domain->getActive() ? 'active' : 'inactive' ]; } $this->output->outputTable($availableDomains, ['Node name', 'Domain (Scheme/Host/Port)', 'State']); }
[ "public", "function", "listCommand", "(", "$", "hostname", "=", "null", ")", "{", "if", "(", "$", "hostname", "===", "null", ")", "{", "$", "domains", "=", "$", "this", "->", "domainRepository", "->", "findAll", "(", ")", ";", "}", "else", "{", "$", ...
Display a list of available domain records @param string $hostname An optional hostname to search for @return void
[ "Display", "a", "list", "of", "available", "domain", "records" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/DomainCommandController.php#L101-L125
train
neos/neos-development-collection
Neos.Neos/Classes/Command/DomainCommandController.php
DomainCommandController.findDomainsByHostnamePattern
protected function findDomainsByHostnamePattern($hostnamePattern) { return array_filter( $this->domainRepository->findAll()->toArray(), function ($domain) use ($hostnamePattern) { return fnmatch($hostnamePattern, $domain->getHostname()); } ); }
php
protected function findDomainsByHostnamePattern($hostnamePattern) { return array_filter( $this->domainRepository->findAll()->toArray(), function ($domain) use ($hostnamePattern) { return fnmatch($hostnamePattern, $domain->getHostname()); } ); }
[ "protected", "function", "findDomainsByHostnamePattern", "(", "$", "hostnamePattern", ")", "{", "return", "array_filter", "(", "$", "this", "->", "domainRepository", "->", "findAll", "(", ")", "->", "toArray", "(", ")", ",", "function", "(", "$", "domain", ")"...
Find domains that match the given hostname with globbing support @param string $hostnamePattern pattern for the hostname of the domains @return array<Domain>
[ "Find", "domains", "that", "match", "the", "given", "hostname", "with", "globbing", "support" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/DomainCommandController.php#L197-L205
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Transformations/RenameNode.php
RenameNode.execute
public function execute(NodeData $node) { $newNodePath = $node->getParentPath() . '/' . $this->newName; $node->setPath($newNodePath); }
php
public function execute(NodeData $node) { $newNodePath = $node->getParentPath() . '/' . $this->newName; $node->setPath($newNodePath); }
[ "public", "function", "execute", "(", "NodeData", "$", "node", ")", "{", "$", "newNodePath", "=", "$", "node", "->", "getParentPath", "(", ")", ".", "'/'", ".", "$", "this", "->", "newName", ";", "$", "node", "->", "setPath", "(", "$", "newNodePath", ...
Renames the node to the new name. @param NodeData $node @return void
[ "Renames", "the", "node", "to", "the", "new", "name", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Transformations/RenameNode.php#L56-L60
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Integrations/EntityIntegrationService.php
EntityIntegrationService.onFlush
public function onFlush(OnFlushEventArgs $eventArgs) { if (!$this->eventEmittingService->isEnabled()) { return; } $entityManager = $eventArgs->getEntityManager(); $unitOfWork = $entityManager->getUnitOfWork(); foreach ($unitOfWork->getScheduledEntityInsertions() as $entity) { $className = get_class($entity); if (isset($this->monitorEntitiesSetting[$className])) { $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className]; if (isset($entityMonitoringConfiguration['events']['created'])) { $data = []; foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) { $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, ['entity' => $entity]); } $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['created'], $data); $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event); } } } foreach ($unitOfWork->getScheduledEntityDeletions() as $entity) { $className = get_class($entity); if (isset($this->monitorEntitiesSetting[$className])) { $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className]; if (isset($entityMonitoringConfiguration['events']['deleted'])) { $data = []; foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) { $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, ['entity' => $entity]); } $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['deleted'], $data); $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event); } } } }
php
public function onFlush(OnFlushEventArgs $eventArgs) { if (!$this->eventEmittingService->isEnabled()) { return; } $entityManager = $eventArgs->getEntityManager(); $unitOfWork = $entityManager->getUnitOfWork(); foreach ($unitOfWork->getScheduledEntityInsertions() as $entity) { $className = get_class($entity); if (isset($this->monitorEntitiesSetting[$className])) { $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className]; if (isset($entityMonitoringConfiguration['events']['created'])) { $data = []; foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) { $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, ['entity' => $entity]); } $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['created'], $data); $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event); } } } foreach ($unitOfWork->getScheduledEntityDeletions() as $entity) { $className = get_class($entity); if (isset($this->monitorEntitiesSetting[$className])) { $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className]; if (isset($entityMonitoringConfiguration['events']['deleted'])) { $data = []; foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) { $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, ['entity' => $entity]); } $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['deleted'], $data); $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event); } } } }
[ "public", "function", "onFlush", "(", "OnFlushEventArgs", "$", "eventArgs", ")", "{", "if", "(", "!", "$", "this", "->", "eventEmittingService", "->", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "$", "entityManager", "=", "$", "eventArgs", "->", ...
Record events for entity changes. Note: this method is registered as an Doctrine event listener in the settings of this package. TODO: Update/Delete of Entities @param OnFlushEventArgs $eventArgs @return void @throws Exception
[ "Record", "events", "for", "entity", "changes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Integrations/EntityIntegrationService.php#L71-L113
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/ExceptionHandlers/AbstractRenderingExceptionHandler.php
AbstractRenderingExceptionHandler.formatScriptPath
protected function formatScriptPath($fusionPath, $delimiter, $escapeHtml = true) { if ($escapeHtml) { $fusionPath = htmlspecialchars($fusionPath); } // TODO: hardcoded parsing?! where is the library for that $elements = explode('/', $fusionPath); return implode('/' . $delimiter, $elements); }
php
protected function formatScriptPath($fusionPath, $delimiter, $escapeHtml = true) { if ($escapeHtml) { $fusionPath = htmlspecialchars($fusionPath); } // TODO: hardcoded parsing?! where is the library for that $elements = explode('/', $fusionPath); return implode('/' . $delimiter, $elements); }
[ "protected", "function", "formatScriptPath", "(", "$", "fusionPath", ",", "$", "delimiter", ",", "$", "escapeHtml", "=", "true", ")", "{", "if", "(", "$", "escapeHtml", ")", "{", "$", "fusionPath", "=", "htmlspecialchars", "(", "$", "fusionPath", ")", ";",...
breaks the given path to multiple line to allow a nicer formatted logging example: formatScriptPath('page<Page>/body<Template>/content/main<ContentCollection>', ''): page<Page>/body<Template>/content/main<ContentCollection> formatScriptPath('page<Page>/body<Template>/content/main<ContentCollection>', '\n\t\t'): page<Page>/ body<Template>/ content/ main<ContentCollection>' @param string $fusionPath path to format @param string $delimiter path element delimiter @param bool $escapeHtml indicates whether to escape html-characters in the given path @return string
[ "breaks", "the", "given", "path", "to", "multiple", "line", "to", "allow", "a", "nicer", "formatted", "logging" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/ExceptionHandlers/AbstractRenderingExceptionHandler.php#L104-L113
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Strategy/ThumbnailGeneratorStrategy.php
ThumbnailGeneratorStrategy.refresh
public function refresh(Thumbnail $thumbnail) { $generatorClassNames = static::getThumbnailGeneratorClassNames($this->objectManager); foreach ($generatorClassNames as $generator) { $generator = $this->objectManager->get($generator['className']); if (!$generator->canRefresh($thumbnail)) { continue; } $generator->refresh($thumbnail); return; } }
php
public function refresh(Thumbnail $thumbnail) { $generatorClassNames = static::getThumbnailGeneratorClassNames($this->objectManager); foreach ($generatorClassNames as $generator) { $generator = $this->objectManager->get($generator['className']); if (!$generator->canRefresh($thumbnail)) { continue; } $generator->refresh($thumbnail); return; } }
[ "public", "function", "refresh", "(", "Thumbnail", "$", "thumbnail", ")", "{", "$", "generatorClassNames", "=", "static", "::", "getThumbnailGeneratorClassNames", "(", "$", "this", "->", "objectManager", ")", ";", "foreach", "(", "$", "generatorClassNames", "as", ...
Refresh the given thumbnail @param Thumbnail $thumbnail @return void
[ "Refresh", "the", "given", "thumbnail" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Strategy/ThumbnailGeneratorStrategy.php#L41-L52
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Strategy/ThumbnailGeneratorStrategy.php
ThumbnailGeneratorStrategy.getThumbnailGeneratorClassNames
public static function getThumbnailGeneratorClassNames($objectManager) { /** @var ReflectionService $reflectionService */ $reflectionService = $objectManager->get(ReflectionService::class); $generatorClassNames = $reflectionService->getAllImplementationClassNamesForInterface(ThumbnailGeneratorInterface::class); $configurationManager = $objectManager->get(ConfigurationManager::class); $generatorOptions = $configurationManager->getConfiguration('Settings', 'Neos.Media.thumbnailGenerators'); $generators = []; foreach ($generatorClassNames as $generatorClassName) { if (isset($generatorOptions[$generatorClassName]['disable']) && $generatorOptions[$generatorClassName]['disable'] === true) { continue; } if (isset($generatorOptions[$generatorClassName]['priority'])) { $priority = $generatorOptions[$generatorClassName]['priority']; } else { $priority = $generatorClassName::getPriority(); } $generators[] = [ 'priority' => (integer)$priority, 'className' => $generatorClassName ]; } $sorter = new PositionalArraySorter($generators, 'priority'); return array_reverse($sorter->toArray()); }
php
public static function getThumbnailGeneratorClassNames($objectManager) { /** @var ReflectionService $reflectionService */ $reflectionService = $objectManager->get(ReflectionService::class); $generatorClassNames = $reflectionService->getAllImplementationClassNamesForInterface(ThumbnailGeneratorInterface::class); $configurationManager = $objectManager->get(ConfigurationManager::class); $generatorOptions = $configurationManager->getConfiguration('Settings', 'Neos.Media.thumbnailGenerators'); $generators = []; foreach ($generatorClassNames as $generatorClassName) { if (isset($generatorOptions[$generatorClassName]['disable']) && $generatorOptions[$generatorClassName]['disable'] === true) { continue; } if (isset($generatorOptions[$generatorClassName]['priority'])) { $priority = $generatorOptions[$generatorClassName]['priority']; } else { $priority = $generatorClassName::getPriority(); } $generators[] = [ 'priority' => (integer)$priority, 'className' => $generatorClassName ]; } $sorter = new PositionalArraySorter($generators, 'priority'); return array_reverse($sorter->toArray()); }
[ "public", "static", "function", "getThumbnailGeneratorClassNames", "(", "$", "objectManager", ")", "{", "/** @var ReflectionService $reflectionService */", "$", "reflectionService", "=", "$", "objectManager", "->", "get", "(", "ReflectionService", "::", "class", ")", ";",...
Returns all class names implementing the ThumbnailGeneratorInterface. @Flow\CompileStatic @param ObjectManagerInterface $objectManager @return ThumbnailGeneratorInterface[]
[ "Returns", "all", "class", "names", "implementing", "the", "ThumbnailGeneratorInterface", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Strategy/ThumbnailGeneratorStrategy.php#L61-L86
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.injectSettings
public function injectSettings(array $settings) { $this->settings = $settings; if (isset($this->settings['debugMode'])) { $this->setDebugMode($this->settings['debugMode'] === true); } if (isset($this->settings['enableContentCache'])) { $this->setEnableContentCache($this->settings['enableContentCache'] === true); } }
php
public function injectSettings(array $settings) { $this->settings = $settings; if (isset($this->settings['debugMode'])) { $this->setDebugMode($this->settings['debugMode'] === true); } if (isset($this->settings['enableContentCache'])) { $this->setEnableContentCache($this->settings['enableContentCache'] === true); } }
[ "public", "function", "injectSettings", "(", "array", "$", "settings", ")", "{", "$", "this", "->", "settings", "=", "$", "settings", ";", "if", "(", "isset", "(", "$", "this", "->", "settings", "[", "'debugMode'", "]", ")", ")", "{", "$", "this", "-...
Inject settings of this package @param array $settings The settings @return void
[ "Inject", "settings", "of", "this", "package" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L163-L172
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.addCacheTag
public function addCacheTag($key, $value) { if ($this->runtimeContentCache->getEnableContentCache() === false) { return; } $this->runtimeContentCache->addTag($key, $value); }
php
public function addCacheTag($key, $value) { if ($this->runtimeContentCache->getEnableContentCache() === false) { return; } $this->runtimeContentCache->addTag($key, $value); }
[ "public", "function", "addCacheTag", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "this", "->", "runtimeContentCache", "->", "getEnableContentCache", "(", ")", "===", "false", ")", "{", "return", ";", "}", "$", "this", "->", "runtimeCont...
Add a tag to the current cache segment During TS rendering the method can be used to add tag dynamicaly for the current cache segment. @param string $key @param string $value @return void @api
[ "Add", "a", "tag", "to", "the", "current", "cache", "segment" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L184-L190
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.pushContext
public function pushContext($key, $context) { $newContext = $this->getCurrentContext(); $newContext[$key] = $context; $this->contextStack[] = $newContext; }
php
public function pushContext($key, $context) { $newContext = $this->getCurrentContext(); $newContext[$key] = $context; $this->contextStack[] = $newContext; }
[ "public", "function", "pushContext", "(", "$", "key", ",", "$", "context", ")", "{", "$", "newContext", "=", "$", "this", "->", "getCurrentContext", "(", ")", ";", "$", "newContext", "[", "$", "key", "]", "=", "$", "context", ";", "$", "this", "->", ...
Push a new context object to the rendering stack @param string $key the key inside the context @param mixed $context @return void
[ "Push", "a", "new", "context", "object", "to", "the", "rendering", "stack" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L212-L217
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.evaluate
public function evaluate($fusionPath, $contextObject = null) { return $this->evaluateInternal($fusionPath, self::BEHAVIOR_RETURNNULL, $contextObject); }
php
public function evaluate($fusionPath, $contextObject = null) { return $this->evaluateInternal($fusionPath, self::BEHAVIOR_RETURNNULL, $contextObject); }
[ "public", "function", "evaluate", "(", "$", "fusionPath", ",", "$", "contextObject", "=", "null", ")", "{", "return", "$", "this", "->", "evaluateInternal", "(", "$", "fusionPath", ",", "self", "::", "BEHAVIOR_RETURNNULL", ",", "$", "contextObject", ")", ";"...
Evaluate an absolute Fusion path and return the result @param string $fusionPath @param object $contextObject the object available as "this" in Eel expressions. ONLY FOR INTERNAL USE! @return mixed the result of the evaluation, can be a string but also other data types
[ "Evaluate", "an", "absolute", "Fusion", "path", "and", "return", "the", "result" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L271-L274
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.render
public function render($fusionPath) { try { $output = $this->evaluateInternal($fusionPath, self::BEHAVIOR_EXCEPTION); if ($this->debugMode) { $output = sprintf('%1$s<!-- Beginning to render TS path "%2$s" (Context: %3$s) -->%4$s%1$s<!-- End to render TS path "%2$s" (Context: %3$s) -->', chr(10), $fusionPath, implode(', ', array_keys($this->getCurrentContext())), $output ); } } catch (SecurityException $securityException) { throw $securityException; } catch (\Exception $exception) { $output = $this->handleRenderingException($fusionPath, $exception); } return $output; }
php
public function render($fusionPath) { try { $output = $this->evaluateInternal($fusionPath, self::BEHAVIOR_EXCEPTION); if ($this->debugMode) { $output = sprintf('%1$s<!-- Beginning to render TS path "%2$s" (Context: %3$s) -->%4$s%1$s<!-- End to render TS path "%2$s" (Context: %3$s) -->', chr(10), $fusionPath, implode(', ', array_keys($this->getCurrentContext())), $output ); } } catch (SecurityException $securityException) { throw $securityException; } catch (\Exception $exception) { $output = $this->handleRenderingException($fusionPath, $exception); } return $output; }
[ "public", "function", "render", "(", "$", "fusionPath", ")", "{", "try", "{", "$", "output", "=", "$", "this", "->", "evaluateInternal", "(", "$", "fusionPath", ",", "self", "::", "BEHAVIOR_EXCEPTION", ")", ";", "if", "(", "$", "this", "->", "debugMode",...
Render an absolute Fusion path and return the result. Compared to $this->evaluate, this adds some more comments helpful for debugging. @param string $fusionPath @return string @throws \Exception @throws SecurityException
[ "Render", "an", "absolute", "Fusion", "path", "and", "return", "the", "result", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L294-L313
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.handleRenderingException
public function handleRenderingException($fusionPath, \Exception $exception, $useInnerExceptionHandler = false) { $fusionConfiguration = $this->getConfigurationForPath($fusionPath); if (isset($fusionConfiguration['__meta']['exceptionHandler'])) { $exceptionHandlerClass = $fusionConfiguration['__meta']['exceptionHandler']; $invalidExceptionHandlerMessage = 'The class "%s" is not valid for property "@exceptionHandler".'; } else { if ($useInnerExceptionHandler === true) { $exceptionHandlerClass = $this->settings['rendering']['innerExceptionHandler']; } else { $exceptionHandlerClass = $this->settings['rendering']['exceptionHandler']; } $invalidExceptionHandlerMessage = 'The class "%s" is not valid for setting "Neos.Fusion.rendering.exceptionHandler".'; } $exceptionHandler = null; if ($this->objectManager->isRegistered($exceptionHandlerClass)) { $exceptionHandler = $this->objectManager->get($exceptionHandlerClass); } if ($exceptionHandler === null || !($exceptionHandler instanceof AbstractRenderingExceptionHandler)) { $message = sprintf( $invalidExceptionHandlerMessage . "\n" . 'Please specify a fully qualified classname to a subclass of %2$s\AbstractRenderingExceptionHandler.' . "\n" . 'You might implement an own handler or use one of the following:' . "\n" . '%2$s\AbsorbingHandler' . "\n" . '%2$s\HtmlMessageHandler' . "\n" . '%2$s\PlainTextHandler' . "\n" . '%2$s\ThrowingHandler' . "\n" . '%2$s\XmlCommentHandler', $exceptionHandlerClass, 'Neos\Fusion\Core\ExceptionHandlers' ); throw new InvalidConfigurationException($message, 1368788926); } $exceptionHandler->setRuntime($this); if (array_key_exists('__objectType', $fusionConfiguration)) { $fusionPath .= sprintf('<%s>', $fusionConfiguration['__objectType']); } $output = $exceptionHandler->handleRenderingException($fusionPath, $exception); return $output; }
php
public function handleRenderingException($fusionPath, \Exception $exception, $useInnerExceptionHandler = false) { $fusionConfiguration = $this->getConfigurationForPath($fusionPath); if (isset($fusionConfiguration['__meta']['exceptionHandler'])) { $exceptionHandlerClass = $fusionConfiguration['__meta']['exceptionHandler']; $invalidExceptionHandlerMessage = 'The class "%s" is not valid for property "@exceptionHandler".'; } else { if ($useInnerExceptionHandler === true) { $exceptionHandlerClass = $this->settings['rendering']['innerExceptionHandler']; } else { $exceptionHandlerClass = $this->settings['rendering']['exceptionHandler']; } $invalidExceptionHandlerMessage = 'The class "%s" is not valid for setting "Neos.Fusion.rendering.exceptionHandler".'; } $exceptionHandler = null; if ($this->objectManager->isRegistered($exceptionHandlerClass)) { $exceptionHandler = $this->objectManager->get($exceptionHandlerClass); } if ($exceptionHandler === null || !($exceptionHandler instanceof AbstractRenderingExceptionHandler)) { $message = sprintf( $invalidExceptionHandlerMessage . "\n" . 'Please specify a fully qualified classname to a subclass of %2$s\AbstractRenderingExceptionHandler.' . "\n" . 'You might implement an own handler or use one of the following:' . "\n" . '%2$s\AbsorbingHandler' . "\n" . '%2$s\HtmlMessageHandler' . "\n" . '%2$s\PlainTextHandler' . "\n" . '%2$s\ThrowingHandler' . "\n" . '%2$s\XmlCommentHandler', $exceptionHandlerClass, 'Neos\Fusion\Core\ExceptionHandlers' ); throw new InvalidConfigurationException($message, 1368788926); } $exceptionHandler->setRuntime($this); if (array_key_exists('__objectType', $fusionConfiguration)) { $fusionPath .= sprintf('<%s>', $fusionConfiguration['__objectType']); } $output = $exceptionHandler->handleRenderingException($fusionPath, $exception); return $output; }
[ "public", "function", "handleRenderingException", "(", "$", "fusionPath", ",", "\\", "Exception", "$", "exception", ",", "$", "useInnerExceptionHandler", "=", "false", ")", "{", "$", "fusionConfiguration", "=", "$", "this", "->", "getConfigurationForPath", "(", "$...
Handle an Exception thrown while rendering Fusion according to settings specified in Neos.Fusion.rendering.exceptionHandler @param string $fusionPath @param \Exception $exception @param boolean $useInnerExceptionHandler @return string @throws InvalidConfigurationException
[ "Handle", "an", "Exception", "thrown", "while", "rendering", "Fusion", "according", "to", "settings", "specified", "in", "Neos", ".", "Fusion", ".", "rendering", ".", "exceptionHandler" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L325-L368
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.canRenderWithConfiguration
protected function canRenderWithConfiguration(array $fusionConfiguration) { if ($this->hasExpressionOrValue($fusionConfiguration)) { return true; } if (isset($fusionConfiguration['__meta']['class']) && isset($fusionConfiguration['__objectType'])) { return true; } return false; }
php
protected function canRenderWithConfiguration(array $fusionConfiguration) { if ($this->hasExpressionOrValue($fusionConfiguration)) { return true; } if (isset($fusionConfiguration['__meta']['class']) && isset($fusionConfiguration['__objectType'])) { return true; } return false; }
[ "protected", "function", "canRenderWithConfiguration", "(", "array", "$", "fusionConfiguration", ")", "{", "if", "(", "$", "this", "->", "hasExpressionOrValue", "(", "$", "fusionConfiguration", ")", ")", "{", "return", "true", ";", "}", "if", "(", "isset", "("...
Internal evaluation if given configuration is renderable. @param array $fusionConfiguration @return boolean
[ "Internal", "evaluation", "if", "given", "configuration", "is", "renderable", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L390-L401
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.evaluateObjectOrRetrieveFromCache
protected function evaluateObjectOrRetrieveFromCache($fusionObject, $fusionPath, $fusionConfiguration, $cacheContext) { $output = null; $evaluationStatus = self::EVALUATION_SKIPPED; list($cacheHit, $cachedResult) = $this->runtimeContentCache->preEvaluate($cacheContext, $fusionObject); if ($cacheHit) { return $cachedResult; } $evaluateObject = true; if ($this->evaluateIfCondition($fusionConfiguration, $fusionPath, $fusionObject) === false) { $evaluateObject = false; } if ($evaluateObject) { $output = $fusionObject->evaluate(); $evaluationStatus = self::EVALUATION_EXECUTED; } $this->lastEvaluationStatus = $evaluationStatus; if ($evaluateObject) { $output = $this->evaluateProcessors($output, $fusionConfiguration, $fusionPath, $fusionObject); } $output = $this->runtimeContentCache->postProcess($cacheContext, $fusionObject, $output); return $output; }
php
protected function evaluateObjectOrRetrieveFromCache($fusionObject, $fusionPath, $fusionConfiguration, $cacheContext) { $output = null; $evaluationStatus = self::EVALUATION_SKIPPED; list($cacheHit, $cachedResult) = $this->runtimeContentCache->preEvaluate($cacheContext, $fusionObject); if ($cacheHit) { return $cachedResult; } $evaluateObject = true; if ($this->evaluateIfCondition($fusionConfiguration, $fusionPath, $fusionObject) === false) { $evaluateObject = false; } if ($evaluateObject) { $output = $fusionObject->evaluate(); $evaluationStatus = self::EVALUATION_EXECUTED; } $this->lastEvaluationStatus = $evaluationStatus; if ($evaluateObject) { $output = $this->evaluateProcessors($output, $fusionConfiguration, $fusionPath, $fusionObject); } $output = $this->runtimeContentCache->postProcess($cacheContext, $fusionObject, $output); return $output; }
[ "protected", "function", "evaluateObjectOrRetrieveFromCache", "(", "$", "fusionObject", ",", "$", "fusionPath", ",", "$", "fusionConfiguration", ",", "$", "cacheContext", ")", "{", "$", "output", "=", "null", ";", "$", "evaluationStatus", "=", "self", "::", "EVA...
Does the evaluation of a Fusion instance, first checking the cache and if conditions and afterwards applying processors. @param AbstractFusionObject $fusionObject @param string $fusionPath @param array $fusionConfiguration @param array $cacheContext @return mixed
[ "Does", "the", "evaluation", "of", "a", "Fusion", "instance", "first", "checking", "the", "cache", "and", "if", "conditions", "and", "afterwards", "applying", "processors", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L476-L502
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.evaluteExpressionOrValueInternal
protected function evaluteExpressionOrValueInternal($fusionPath, $fusionConfiguration, $cacheContext, $contextObject) { if ($this->evaluateIfCondition($fusionConfiguration, $fusionPath, $contextObject) === false) { $this->finalizePathEvaluation($cacheContext); $this->lastEvaluationStatus = self::EVALUATION_SKIPPED; return null; } $evaluatedExpression = $this->evaluateEelExpressionOrSimpleValueWithProcessor($fusionPath, $fusionConfiguration, $contextObject); $this->finalizePathEvaluation($cacheContext); return $evaluatedExpression; }
php
protected function evaluteExpressionOrValueInternal($fusionPath, $fusionConfiguration, $cacheContext, $contextObject) { if ($this->evaluateIfCondition($fusionConfiguration, $fusionPath, $contextObject) === false) { $this->finalizePathEvaluation($cacheContext); $this->lastEvaluationStatus = self::EVALUATION_SKIPPED; return null; } $evaluatedExpression = $this->evaluateEelExpressionOrSimpleValueWithProcessor($fusionPath, $fusionConfiguration, $contextObject); $this->finalizePathEvaluation($cacheContext); return $evaluatedExpression; }
[ "protected", "function", "evaluteExpressionOrValueInternal", "(", "$", "fusionPath", ",", "$", "fusionConfiguration", ",", "$", "cacheContext", ",", "$", "contextObject", ")", "{", "if", "(", "$", "this", "->", "evaluateIfCondition", "(", "$", "fusionConfiguration",...
Evaluates an EEL expression or value, checking if conditions first and applying processors. @param string $fusionPath @param array $fusionConfiguration @param array $cacheContext @param mixed $contextObject @return mixed
[ "Evaluates", "an", "EEL", "expression", "or", "value", "checking", "if", "conditions", "first", "and", "applying", "processors", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L513-L526
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.prepareContextForFusionObject
protected function prepareContextForFusionObject(AbstractFusionObject $fusionObject, $fusionPath, $fusionConfiguration, $cacheContext) { if ($cacheContext['cacheForPathDisabled'] === true) { $contextArray = $this->getCurrentContext(); $newContextArray = []; foreach ($cacheContext['configuration']['context'] as $contextVariableName) { if (isset($contextArray[$contextVariableName])) { $newContextArray[$contextVariableName] = $contextArray[$contextVariableName]; } } } if (isset($fusionConfiguration['__meta']['context'])) { $newContextArray = isset($newContextArray) ? $newContextArray : $this->getCurrentContext(); foreach ($fusionConfiguration['__meta']['context'] as $contextKey => $contextValue) { $newContextArray[$contextKey] = $this->evaluateInternal($fusionPath . '/__meta/context/' . $contextKey, self::BEHAVIOR_EXCEPTION, $fusionObject); } } if (isset($newContextArray)) { $this->pushContextArray($newContextArray); return true; } return false; }
php
protected function prepareContextForFusionObject(AbstractFusionObject $fusionObject, $fusionPath, $fusionConfiguration, $cacheContext) { if ($cacheContext['cacheForPathDisabled'] === true) { $contextArray = $this->getCurrentContext(); $newContextArray = []; foreach ($cacheContext['configuration']['context'] as $contextVariableName) { if (isset($contextArray[$contextVariableName])) { $newContextArray[$contextVariableName] = $contextArray[$contextVariableName]; } } } if (isset($fusionConfiguration['__meta']['context'])) { $newContextArray = isset($newContextArray) ? $newContextArray : $this->getCurrentContext(); foreach ($fusionConfiguration['__meta']['context'] as $contextKey => $contextValue) { $newContextArray[$contextKey] = $this->evaluateInternal($fusionPath . '/__meta/context/' . $contextKey, self::BEHAVIOR_EXCEPTION, $fusionObject); } } if (isset($newContextArray)) { $this->pushContextArray($newContextArray); return true; } return false; }
[ "protected", "function", "prepareContextForFusionObject", "(", "AbstractFusionObject", "$", "fusionObject", ",", "$", "fusionPath", ",", "$", "fusionConfiguration", ",", "$", "cacheContext", ")", "{", "if", "(", "$", "cacheContext", "[", "'cacheForPathDisabled'", "]",...
Possibly prepares a new context for the current FusionObject and cache context and pushes it to the stack. Returns if a new context was pushed to the stack or not. @param AbstractFusionObject $fusionObject @param string $fusionPath @param array $fusionConfiguration @param array $cacheContext @return boolean @throws Exception @throws RuntimeException @throws SecurityException @throws StopActionException
[ "Possibly", "prepares", "a", "new", "context", "for", "the", "current", "FusionObject", "and", "cache", "context", "and", "pushes", "it", "to", "the", "stack", ".", "Returns", "if", "a", "new", "context", "was", "pushed", "to", "the", "stack", "or", "not",...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L564-L589
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.finalizePathEvaluation
protected function finalizePathEvaluation($cacheContext, $needToPopContext = false, $needToPopApplyValues = false) { if ($needToPopContext) { $this->popContext(); } if ($needToPopApplyValues) { $this->popApplyValues(); } $this->runtimeContentCache->leave($cacheContext); }
php
protected function finalizePathEvaluation($cacheContext, $needToPopContext = false, $needToPopApplyValues = false) { if ($needToPopContext) { $this->popContext(); } if ($needToPopApplyValues) { $this->popApplyValues(); } $this->runtimeContentCache->leave($cacheContext); }
[ "protected", "function", "finalizePathEvaluation", "(", "$", "cacheContext", ",", "$", "needToPopContext", "=", "false", ",", "$", "needToPopApplyValues", "=", "false", ")", "{", "if", "(", "$", "needToPopContext", ")", "{", "$", "this", "->", "popContext", "(...
Ends the evaluation of a fusion path by popping the context and property stack if needed and leaving the cache context. @param array $cacheContext @param boolean $needToPopContext @param boolean $needToPopApplyValues @return void
[ "Ends", "the", "evaluation", "of", "a", "fusion", "path", "by", "popping", "the", "context", "and", "property", "stack", "if", "needed", "and", "leaving", "the", "cache", "context", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L599-L610
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.getConfigurationForPath
protected function getConfigurationForPath($fusionPath) { if (isset($this->configurationOnPathRuntimeCache[$fusionPath])) { return $this->configurationOnPathRuntimeCache[$fusionPath]['c']; } $pathParts = explode('/', $fusionPath); $configuration = $this->fusionConfiguration; $pathUntilNow = ''; $currentPrototypeDefinitions = []; if (isset($configuration['__prototypes'])) { $currentPrototypeDefinitions = $configuration['__prototypes']; } foreach ($pathParts as $pathPart) { $pathUntilNow .= '/' . $pathPart; if (isset($this->configurationOnPathRuntimeCache[$pathUntilNow])) { $configuration = $this->configurationOnPathRuntimeCache[$pathUntilNow]['c']; $currentPrototypeDefinitions = $this->configurationOnPathRuntimeCache[$pathUntilNow]['p']; continue; } $configuration = $this->matchCurrentPathPart($pathPart, $configuration, $currentPrototypeDefinitions); $this->configurationOnPathRuntimeCache[$pathUntilNow]['c'] = $configuration; $this->configurationOnPathRuntimeCache[$pathUntilNow]['p'] = $currentPrototypeDefinitions; } return $configuration; }
php
protected function getConfigurationForPath($fusionPath) { if (isset($this->configurationOnPathRuntimeCache[$fusionPath])) { return $this->configurationOnPathRuntimeCache[$fusionPath]['c']; } $pathParts = explode('/', $fusionPath); $configuration = $this->fusionConfiguration; $pathUntilNow = ''; $currentPrototypeDefinitions = []; if (isset($configuration['__prototypes'])) { $currentPrototypeDefinitions = $configuration['__prototypes']; } foreach ($pathParts as $pathPart) { $pathUntilNow .= '/' . $pathPart; if (isset($this->configurationOnPathRuntimeCache[$pathUntilNow])) { $configuration = $this->configurationOnPathRuntimeCache[$pathUntilNow]['c']; $currentPrototypeDefinitions = $this->configurationOnPathRuntimeCache[$pathUntilNow]['p']; continue; } $configuration = $this->matchCurrentPathPart($pathPart, $configuration, $currentPrototypeDefinitions); $this->configurationOnPathRuntimeCache[$pathUntilNow]['c'] = $configuration; $this->configurationOnPathRuntimeCache[$pathUntilNow]['p'] = $currentPrototypeDefinitions; } return $configuration; }
[ "protected", "function", "getConfigurationForPath", "(", "$", "fusionPath", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "configurationOnPathRuntimeCache", "[", "$", "fusionPath", "]", ")", ")", "{", "return", "$", "this", "->", "configurationOnPathRunt...
Get the Fusion Configuration for the given Fusion path @param string $fusionPath @return array @throws Exception
[ "Get", "the", "Fusion", "Configuration", "for", "the", "given", "Fusion", "path" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L619-L648
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.matchCurrentPathPart
protected function matchCurrentPathPart($pathPart, $previousConfiguration, &$currentPrototypeDefinitions) { if (preg_match('#^([^<]*)(<(.*?)>)?$#', $pathPart, $matches) !== 1) { throw new Exception('Path Part ' . $pathPart . ' not well-formed', 1332494645); } $currentPathSegment = $matches[1]; $configuration = []; if (isset($previousConfiguration[$currentPathSegment])) { $configuration = is_array($previousConfiguration[$currentPathSegment]) ? $previousConfiguration[$currentPathSegment] : $this->simpleTypeToArrayClosure->__invoke($previousConfiguration[$currentPathSegment]); } if (isset($configuration['__prototypes'])) { $currentPrototypeDefinitions = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeDefinitions, $configuration['__prototypes'], $this->simpleTypeToArrayClosure); } $currentPathSegmentType = null; if (isset($configuration['__objectType'])) { $currentPathSegmentType = $configuration['__objectType']; } if (isset($matches[3])) { $currentPathSegmentType = $matches[3]; } if ($currentPathSegmentType !== null) { $configuration['__objectType'] = $currentPathSegmentType; $configuration = $this->mergePrototypesWithConfigurationForPathSegment($configuration, $currentPrototypeDefinitions); } if (is_array($configuration) && !isset($configuration['__value']) && !isset($configuration['__eelExpression']) && !isset($configuration['__meta']['class']) && !isset($configuration['__objectType']) && isset($configuration['__meta']['process'])) { $configuration['__value'] = ''; } return $configuration; }
php
protected function matchCurrentPathPart($pathPart, $previousConfiguration, &$currentPrototypeDefinitions) { if (preg_match('#^([^<]*)(<(.*?)>)?$#', $pathPart, $matches) !== 1) { throw new Exception('Path Part ' . $pathPart . ' not well-formed', 1332494645); } $currentPathSegment = $matches[1]; $configuration = []; if (isset($previousConfiguration[$currentPathSegment])) { $configuration = is_array($previousConfiguration[$currentPathSegment]) ? $previousConfiguration[$currentPathSegment] : $this->simpleTypeToArrayClosure->__invoke($previousConfiguration[$currentPathSegment]); } if (isset($configuration['__prototypes'])) { $currentPrototypeDefinitions = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeDefinitions, $configuration['__prototypes'], $this->simpleTypeToArrayClosure); } $currentPathSegmentType = null; if (isset($configuration['__objectType'])) { $currentPathSegmentType = $configuration['__objectType']; } if (isset($matches[3])) { $currentPathSegmentType = $matches[3]; } if ($currentPathSegmentType !== null) { $configuration['__objectType'] = $currentPathSegmentType; $configuration = $this->mergePrototypesWithConfigurationForPathSegment($configuration, $currentPrototypeDefinitions); } if (is_array($configuration) && !isset($configuration['__value']) && !isset($configuration['__eelExpression']) && !isset($configuration['__meta']['class']) && !isset($configuration['__objectType']) && isset($configuration['__meta']['process'])) { $configuration['__value'] = ''; } return $configuration; }
[ "protected", "function", "matchCurrentPathPart", "(", "$", "pathPart", ",", "$", "previousConfiguration", ",", "&", "$", "currentPrototypeDefinitions", ")", "{", "if", "(", "preg_match", "(", "'#^([^<]*)(<(.*?)>)?$#'", ",", "$", "pathPart", ",", "$", "matches", ")...
Matches the current path segment and prepares the configuration. @param string $pathPart @param array $previousConfiguration @param array $currentPrototypeDefinitions @return array @throws Exception
[ "Matches", "the", "current", "path", "segment", "and", "prepares", "the", "configuration", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L659-L694
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.mergePrototypesWithConfigurationForPathSegment
protected function mergePrototypesWithConfigurationForPathSegment($configuration, &$currentPrototypeDefinitions) { $currentPathSegmentType = $configuration['__objectType']; if (isset($currentPrototypeDefinitions[$currentPathSegmentType])) { $prototypeMergingOrder = [$currentPathSegmentType]; if (isset($currentPrototypeDefinitions[$currentPathSegmentType]['__prototypeChain'])) { $prototypeMergingOrder = array_merge($currentPrototypeDefinitions[$currentPathSegmentType]['__prototypeChain'], $prototypeMergingOrder); } $currentPrototypeWithInheritanceTakenIntoAccount = []; foreach ($prototypeMergingOrder as $prototypeName) { if (!array_key_exists($prototypeName, $currentPrototypeDefinitions)) { throw new Exception(sprintf( 'The Fusion object `%s` which you tried to inherit from does not exist. Maybe you have a typo on the right hand side of your inheritance statement for `%s`.', $prototypeName, $currentPathSegmentType), 1427134340); } $currentPrototypeWithInheritanceTakenIntoAccount = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeWithInheritanceTakenIntoAccount, $currentPrototypeDefinitions[$prototypeName], $this->simpleTypeToArrayClosure); } // We merge the already flattened prototype with the current configuration (in that order), // to make sure that the current configuration (not being defined in the prototype) wins. $configuration = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeWithInheritanceTakenIntoAccount, $configuration, $this->simpleTypeToArrayClosure); // If context-dependent prototypes are set (such as prototype("foo").prototype("baz")), // we update the current prototype definitions. if (isset($currentPrototypeWithInheritanceTakenIntoAccount['__prototypes'])) { $currentPrototypeDefinitions = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeDefinitions, $currentPrototypeWithInheritanceTakenIntoAccount['__prototypes'], $this->simpleTypeToArrayClosure); } } return $configuration; }
php
protected function mergePrototypesWithConfigurationForPathSegment($configuration, &$currentPrototypeDefinitions) { $currentPathSegmentType = $configuration['__objectType']; if (isset($currentPrototypeDefinitions[$currentPathSegmentType])) { $prototypeMergingOrder = [$currentPathSegmentType]; if (isset($currentPrototypeDefinitions[$currentPathSegmentType]['__prototypeChain'])) { $prototypeMergingOrder = array_merge($currentPrototypeDefinitions[$currentPathSegmentType]['__prototypeChain'], $prototypeMergingOrder); } $currentPrototypeWithInheritanceTakenIntoAccount = []; foreach ($prototypeMergingOrder as $prototypeName) { if (!array_key_exists($prototypeName, $currentPrototypeDefinitions)) { throw new Exception(sprintf( 'The Fusion object `%s` which you tried to inherit from does not exist. Maybe you have a typo on the right hand side of your inheritance statement for `%s`.', $prototypeName, $currentPathSegmentType), 1427134340); } $currentPrototypeWithInheritanceTakenIntoAccount = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeWithInheritanceTakenIntoAccount, $currentPrototypeDefinitions[$prototypeName], $this->simpleTypeToArrayClosure); } // We merge the already flattened prototype with the current configuration (in that order), // to make sure that the current configuration (not being defined in the prototype) wins. $configuration = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeWithInheritanceTakenIntoAccount, $configuration, $this->simpleTypeToArrayClosure); // If context-dependent prototypes are set (such as prototype("foo").prototype("baz")), // we update the current prototype definitions. if (isset($currentPrototypeWithInheritanceTakenIntoAccount['__prototypes'])) { $currentPrototypeDefinitions = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeDefinitions, $currentPrototypeWithInheritanceTakenIntoAccount['__prototypes'], $this->simpleTypeToArrayClosure); } } return $configuration; }
[ "protected", "function", "mergePrototypesWithConfigurationForPathSegment", "(", "$", "configuration", ",", "&", "$", "currentPrototypeDefinitions", ")", "{", "$", "currentPathSegmentType", "=", "$", "configuration", "[", "'__objectType'", "]", ";", "if", "(", "isset", ...
Merges the prototype chain into the configuration. @param array $configuration @param array $currentPrototypeDefinitions @return array @throws Exception
[ "Merges", "the", "prototype", "chain", "into", "the", "configuration", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L704-L740
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.instantiateFusionObject
protected function instantiateFusionObject($fusionPath, $fusionConfiguration) { $fusionObjectType = $fusionConfiguration['__objectType']; $fusionObjectClassName = isset($fusionConfiguration['__meta']['class']) ? $fusionConfiguration['__meta']['class'] : null; if (!preg_match('#<[^>]*>$#', $fusionPath)) { // Only add Fusion object type to last path part if not already set $fusionPath .= '<' . $fusionObjectType . '>'; } if (!class_exists($fusionObjectClassName)) { throw new Exception(sprintf( 'The implementation class `%s` defined for Fusion object of type `%s` does not exist. Maybe a typo in the `@class` property.', $fusionObjectClassName, $fusionObjectType), 1347952109); } /** @var $fusionObject AbstractFusionObject */ $fusionObject = new $fusionObjectClassName($this, $fusionPath, $fusionObjectType); if ($this->isArrayFusionObject($fusionObject)) { /** @var $fusionObject AbstractArrayFusionObject */ if (isset($fusionConfiguration['__meta']['ignoreProperties'])) { $evaluatedIgnores = $this->evaluate($fusionPath . '/__meta/ignoreProperties', $fusionObject); $fusionObject->setIgnoreProperties(is_array($evaluatedIgnores) ? $evaluatedIgnores : []); } $this->setPropertiesOnFusionObject($fusionObject, $fusionConfiguration); } return $fusionObject; }
php
protected function instantiateFusionObject($fusionPath, $fusionConfiguration) { $fusionObjectType = $fusionConfiguration['__objectType']; $fusionObjectClassName = isset($fusionConfiguration['__meta']['class']) ? $fusionConfiguration['__meta']['class'] : null; if (!preg_match('#<[^>]*>$#', $fusionPath)) { // Only add Fusion object type to last path part if not already set $fusionPath .= '<' . $fusionObjectType . '>'; } if (!class_exists($fusionObjectClassName)) { throw new Exception(sprintf( 'The implementation class `%s` defined for Fusion object of type `%s` does not exist. Maybe a typo in the `@class` property.', $fusionObjectClassName, $fusionObjectType), 1347952109); } /** @var $fusionObject AbstractFusionObject */ $fusionObject = new $fusionObjectClassName($this, $fusionPath, $fusionObjectType); if ($this->isArrayFusionObject($fusionObject)) { /** @var $fusionObject AbstractArrayFusionObject */ if (isset($fusionConfiguration['__meta']['ignoreProperties'])) { $evaluatedIgnores = $this->evaluate($fusionPath . '/__meta/ignoreProperties', $fusionObject); $fusionObject->setIgnoreProperties(is_array($evaluatedIgnores) ? $evaluatedIgnores : []); } $this->setPropertiesOnFusionObject($fusionObject, $fusionConfiguration); } return $fusionObject; }
[ "protected", "function", "instantiateFusionObject", "(", "$", "fusionPath", ",", "$", "fusionConfiguration", ")", "{", "$", "fusionObjectType", "=", "$", "fusionConfiguration", "[", "'__objectType'", "]", ";", "$", "fusionObjectClassName", "=", "isset", "(", "$", ...
Instantiates a Fusion object specified by the given path and configuration @param string $fusionPath Path to the configuration for this object instance @param array $fusionConfiguration Configuration at the given path @return AbstractFusionObject @throws Exception
[ "Instantiates", "a", "Fusion", "object", "specified", "by", "the", "given", "path", "and", "configuration" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L750-L778
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.evaluateEelExpressionOrSimpleValueWithProcessor
protected function evaluateEelExpressionOrSimpleValueWithProcessor($fusionPath, array $valueConfiguration, AbstractFusionObject $contextObject = null) { if (isset($valueConfiguration['__eelExpression'])) { $evaluatedValue = $this->evaluateEelExpression($valueConfiguration['__eelExpression'], $contextObject); } else { // must be simple type, as this is the only place where this method is called. $evaluatedValue = $valueConfiguration['__value']; } $evaluatedValue = $this->evaluateProcessors($evaluatedValue, $valueConfiguration, $fusionPath, $contextObject); return $evaluatedValue; }
php
protected function evaluateEelExpressionOrSimpleValueWithProcessor($fusionPath, array $valueConfiguration, AbstractFusionObject $contextObject = null) { if (isset($valueConfiguration['__eelExpression'])) { $evaluatedValue = $this->evaluateEelExpression($valueConfiguration['__eelExpression'], $contextObject); } else { // must be simple type, as this is the only place where this method is called. $evaluatedValue = $valueConfiguration['__value']; } $evaluatedValue = $this->evaluateProcessors($evaluatedValue, $valueConfiguration, $fusionPath, $contextObject); return $evaluatedValue; }
[ "protected", "function", "evaluateEelExpressionOrSimpleValueWithProcessor", "(", "$", "fusionPath", ",", "array", "$", "valueConfiguration", ",", "AbstractFusionObject", "$", "contextObject", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "valueConfiguration", "...
Evaluate a simple value or eel expression with processors @param string $fusionPath the Fusion path up to now @param array $valueConfiguration Fusion configuration for the value @param \Neos\Fusion\FusionObjects\AbstractFusionObject $contextObject An optional object for the "this" value inside the context @return mixed The result of the evaluation @throws Exception
[ "Evaluate", "a", "simple", "value", "or", "eel", "expression", "with", "processors" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L850-L862
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.evaluateEelExpression
protected function evaluateEelExpression($expression, AbstractFusionObject $contextObject = null) { if ($expression[0] !== '$' || $expression[1] !== '{') { // We still assume this is an EEL expression and wrap the markers for backwards compatibility. $expression = '${' . $expression . '}'; } $contextVariables = array_merge($this->getDefaultContextVariables(), $this->getCurrentContext()); if (isset($contextVariables['this'])) { throw new Exception('Context variable "this" not allowed, as it is already reserved for a pointer to the current Fusion object.', 1344325044); } $contextVariables['this'] = $contextObject; if ($this->eelEvaluator instanceof \Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy) { $this->eelEvaluator->_activateDependency(); } return EelUtility::evaluateEelExpression($expression, $this->eelEvaluator, $contextVariables); }
php
protected function evaluateEelExpression($expression, AbstractFusionObject $contextObject = null) { if ($expression[0] !== '$' || $expression[1] !== '{') { // We still assume this is an EEL expression and wrap the markers for backwards compatibility. $expression = '${' . $expression . '}'; } $contextVariables = array_merge($this->getDefaultContextVariables(), $this->getCurrentContext()); if (isset($contextVariables['this'])) { throw new Exception('Context variable "this" not allowed, as it is already reserved for a pointer to the current Fusion object.', 1344325044); } $contextVariables['this'] = $contextObject; if ($this->eelEvaluator instanceof \Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy) { $this->eelEvaluator->_activateDependency(); } return EelUtility::evaluateEelExpression($expression, $this->eelEvaluator, $contextVariables); }
[ "protected", "function", "evaluateEelExpression", "(", "$", "expression", ",", "AbstractFusionObject", "$", "contextObject", "=", "null", ")", "{", "if", "(", "$", "expression", "[", "0", "]", "!==", "'$'", "||", "$", "expression", "[", "1", "]", "!==", "'...
Evaluate an Eel expression @param string $expression The Eel expression to evaluate @param \Neos\Fusion\FusionObjects\AbstractFusionObject $contextObject An optional object for the "this" value inside the context @return mixed The result of the evaluated Eel expression @throws Exception
[ "Evaluate", "an", "Eel", "expression" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L872-L891
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.evaluateProcessors
protected function evaluateProcessors($valueToProcess, $configurationWithEventualProcessors, $fusionPath, AbstractFusionObject $contextObject = null) { if (isset($configurationWithEventualProcessors['__meta']['process'])) { $processorConfiguration = $configurationWithEventualProcessors['__meta']['process']; $positionalArraySorter = new PositionalArraySorter($processorConfiguration, '__meta.position'); foreach ($positionalArraySorter->getSortedKeys() as $key) { $processorPath = $fusionPath . '/__meta/process/' . $key; if ($this->evaluateIfCondition($processorConfiguration[$key], $processorPath, $contextObject) === false) { continue; } if (isset($processorConfiguration[$key]['expression'])) { $processorPath .= '/expression'; } $this->pushContext('value', $valueToProcess); $result = $this->evaluateInternal($processorPath, self::BEHAVIOR_EXCEPTION, $contextObject); if ($this->getLastEvaluationStatus() !== static::EVALUATION_SKIPPED) { $valueToProcess = $result; } $this->popContext(); } } return $valueToProcess; }
php
protected function evaluateProcessors($valueToProcess, $configurationWithEventualProcessors, $fusionPath, AbstractFusionObject $contextObject = null) { if (isset($configurationWithEventualProcessors['__meta']['process'])) { $processorConfiguration = $configurationWithEventualProcessors['__meta']['process']; $positionalArraySorter = new PositionalArraySorter($processorConfiguration, '__meta.position'); foreach ($positionalArraySorter->getSortedKeys() as $key) { $processorPath = $fusionPath . '/__meta/process/' . $key; if ($this->evaluateIfCondition($processorConfiguration[$key], $processorPath, $contextObject) === false) { continue; } if (isset($processorConfiguration[$key]['expression'])) { $processorPath .= '/expression'; } $this->pushContext('value', $valueToProcess); $result = $this->evaluateInternal($processorPath, self::BEHAVIOR_EXCEPTION, $contextObject); if ($this->getLastEvaluationStatus() !== static::EVALUATION_SKIPPED) { $valueToProcess = $result; } $this->popContext(); } } return $valueToProcess; }
[ "protected", "function", "evaluateProcessors", "(", "$", "valueToProcess", ",", "$", "configurationWithEventualProcessors", ",", "$", "fusionPath", ",", "AbstractFusionObject", "$", "contextObject", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "configuration...
Evaluate processors on given value. @param mixed $valueToProcess @param array $configurationWithEventualProcessors @param string $fusionPath @param AbstractFusionObject $contextObject @return mixed
[ "Evaluate", "processors", "on", "given", "value", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L964-L988
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Runtime.php
Runtime.throwExceptionForUnrenderablePathIfNeeded
protected function throwExceptionForUnrenderablePathIfNeeded($fusionPath, $fusionConfiguration, $behaviorIfPathNotFound) { if (isset($fusionConfiguration['__objectType'])) { $objectType = $fusionConfiguration['__objectType']; throw new Exceptions\MissingFusionImplementationException(sprintf( "The Fusion object at path `%s` could not be rendered: The Fusion object `%s` is not completely defined (missing property `@class`). Most likely you didn't inherit from a basic object. For example you could add the following line to your Fusion: `prototype(%s) < prototype(Neos.Fusion:Template)`", $fusionPath, $objectType, $objectType), 1332493995); } if ($behaviorIfPathNotFound === self::BEHAVIOR_EXCEPTION) { throw new Exceptions\MissingFusionObjectException(sprintf( 'No Fusion object found in path "%s" Please make sure to define one in your Fusion configuration.', $fusionPath ), 1332493990); } }
php
protected function throwExceptionForUnrenderablePathIfNeeded($fusionPath, $fusionConfiguration, $behaviorIfPathNotFound) { if (isset($fusionConfiguration['__objectType'])) { $objectType = $fusionConfiguration['__objectType']; throw new Exceptions\MissingFusionImplementationException(sprintf( "The Fusion object at path `%s` could not be rendered: The Fusion object `%s` is not completely defined (missing property `@class`). Most likely you didn't inherit from a basic object. For example you could add the following line to your Fusion: `prototype(%s) < prototype(Neos.Fusion:Template)`", $fusionPath, $objectType, $objectType), 1332493995); } if ($behaviorIfPathNotFound === self::BEHAVIOR_EXCEPTION) { throw new Exceptions\MissingFusionObjectException(sprintf( 'No Fusion object found in path "%s" Please make sure to define one in your Fusion configuration.', $fusionPath ), 1332493990); } }
[ "protected", "function", "throwExceptionForUnrenderablePathIfNeeded", "(", "$", "fusionPath", ",", "$", "fusionConfiguration", ",", "$", "behaviorIfPathNotFound", ")", "{", "if", "(", "isset", "(", "$", "fusionConfiguration", "[", "'__objectType'", "]", ")", ")", "{...
Checks and throws an exception for an unrenderable path. @param string $fusionPath The Fusion path that cannot be rendered @param array $fusionConfiguration @param string $behaviorIfPathNotFound One of the BEHAVIOR_* constants @throws Exception\MissingFusionImplementationException @throws Exception\MissingFusionObjectException
[ "Checks", "and", "throws", "an", "exception", "for", "an", "unrenderable", "path", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Runtime.php#L1049-L1068
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php
FirstLevelNodeCache.getByPath
public function getByPath($path) { if (isset($this->nodesByPath[$path])) { return $this->nodesByPath[$path]; } return false; }
php
public function getByPath($path) { if (isset($this->nodesByPath[$path])) { return $this->nodesByPath[$path]; } return false; }
[ "public", "function", "getByPath", "(", "$", "path", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "nodesByPath", "[", "$", "path", "]", ")", ")", "{", "return", "$", "this", "->", "nodesByPath", "[", "$", "path", "]", ";", "}", "return", ...
If the cache contains a node for the given path, it is returned. Otherwise false is returned. @param string $path @return NodeInterface
[ "If", "the", "cache", "contains", "a", "node", "for", "the", "given", "path", "it", "is", "returned", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php#L49-L56
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php
FirstLevelNodeCache.setByPath
public function setByPath($path, NodeInterface $node = null) { $this->nodesByPath[$path] = $node; if ($node !== null) { $this->nodesByIdentifier[$node->getIdentifier()] = $node; } }
php
public function setByPath($path, NodeInterface $node = null) { $this->nodesByPath[$path] = $node; if ($node !== null) { $this->nodesByIdentifier[$node->getIdentifier()] = $node; } }
[ "public", "function", "setByPath", "(", "$", "path", ",", "NodeInterface", "$", "node", "=", "null", ")", "{", "$", "this", "->", "nodesByPath", "[", "$", "path", "]", "=", "$", "node", ";", "if", "(", "$", "node", "!==", "null", ")", "{", "$", "...
Adds the given node to the cache for the given path. The node will also be added under it's identifier. @param string $path @param NodeInterface $node @return void
[ "Adds", "the", "given", "node", "to", "the", "cache", "for", "the", "given", "path", ".", "The", "node", "will", "also", "be", "added", "under", "it", "s", "identifier", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php#L66-L72
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php
FirstLevelNodeCache.getByIdentifier
public function getByIdentifier($identifier) { if (isset($this->nodesByIdentifier[$identifier])) { return $this->nodesByIdentifier[$identifier]; } return false; }
php
public function getByIdentifier($identifier) { if (isset($this->nodesByIdentifier[$identifier])) { return $this->nodesByIdentifier[$identifier]; } return false; }
[ "public", "function", "getByIdentifier", "(", "$", "identifier", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "nodesByIdentifier", "[", "$", "identifier", "]", ")", ")", "{", "return", "$", "this", "->", "nodesByIdentifier", "[", "$", "identifier"...
If the cache contains a node with the given identifier, it is returned. Otherwise false is returned. @param string $identifier @return NodeInterface|boolean
[ "If", "the", "cache", "contains", "a", "node", "with", "the", "given", "identifier", "it", "is", "returned", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php#L82-L89
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php
FirstLevelNodeCache.setByIdentifier
public function setByIdentifier($identifier, NodeInterface $node = null) { $this->nodesByIdentifier[$identifier] = $node; if ($node !== null) { $this->nodesByPath[$node->getPath()] = $node; } }
php
public function setByIdentifier($identifier, NodeInterface $node = null) { $this->nodesByIdentifier[$identifier] = $node; if ($node !== null) { $this->nodesByPath[$node->getPath()] = $node; } }
[ "public", "function", "setByIdentifier", "(", "$", "identifier", ",", "NodeInterface", "$", "node", "=", "null", ")", "{", "$", "this", "->", "nodesByIdentifier", "[", "$", "identifier", "]", "=", "$", "node", ";", "if", "(", "$", "node", "!==", "null", ...
Adds the given node to the cache for the given identifier. The node will also be added with is's path. @param string $identifier @param NodeInterface $node @return void
[ "Adds", "the", "given", "node", "to", "the", "cache", "for", "the", "given", "identifier", ".", "The", "node", "will", "also", "be", "added", "with", "is", "s", "path", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php#L99-L105
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php
FirstLevelNodeCache.getChildNodesByPathAndNodeTypeFilter
public function getChildNodesByPathAndNodeTypeFilter($path, $nodeTypeFilter) { if (isset($this->childNodesByPathAndNodeTypeFilter[$path][$nodeTypeFilter])) { return $this->childNodesByPathAndNodeTypeFilter[$path][$nodeTypeFilter]; } return false; }
php
public function getChildNodesByPathAndNodeTypeFilter($path, $nodeTypeFilter) { if (isset($this->childNodesByPathAndNodeTypeFilter[$path][$nodeTypeFilter])) { return $this->childNodesByPathAndNodeTypeFilter[$path][$nodeTypeFilter]; } return false; }
[ "public", "function", "getChildNodesByPathAndNodeTypeFilter", "(", "$", "path", ",", "$", "nodeTypeFilter", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "childNodesByPathAndNodeTypeFilter", "[", "$", "path", "]", "[", "$", "nodeTypeFilter", "]", ")", ...
Returns the cached child nodes for the given path and node type filter. @param string $path @param string $nodeTypeFilter @return boolean
[ "Returns", "the", "cached", "child", "nodes", "for", "the", "given", "path", "and", "node", "type", "filter", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php#L114-L121
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php
FirstLevelNodeCache.setChildNodesByPathAndNodeTypeFilter
public function setChildNodesByPathAndNodeTypeFilter($path, $nodeTypeFilter, array $nodes) { if (!isset($this->childNodesByPathAndNodeTypeFilter[$path])) { $this->childNodesByPathAndNodeTypeFilter[$path] = []; } foreach ($nodes as $node) { /** @var NodeInterface $node */ $this->nodesByPath[$node->getPath()] = $node; $this->nodesByIdentifier[$node->getIdentifier()] = $node; } $this->childNodesByPathAndNodeTypeFilter[$path][$nodeTypeFilter] = $nodes; }
php
public function setChildNodesByPathAndNodeTypeFilter($path, $nodeTypeFilter, array $nodes) { if (!isset($this->childNodesByPathAndNodeTypeFilter[$path])) { $this->childNodesByPathAndNodeTypeFilter[$path] = []; } foreach ($nodes as $node) { /** @var NodeInterface $node */ $this->nodesByPath[$node->getPath()] = $node; $this->nodesByIdentifier[$node->getIdentifier()] = $node; } $this->childNodesByPathAndNodeTypeFilter[$path][$nodeTypeFilter] = $nodes; }
[ "public", "function", "setChildNodesByPathAndNodeTypeFilter", "(", "$", "path", ",", "$", "nodeTypeFilter", ",", "array", "$", "nodes", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "childNodesByPathAndNodeTypeFilter", "[", "$", "path", "]", ")", ...
Sets the given nodes as child nodes for the given path and node type filter. The nodes will each be added with their path and identifier as well. @param string $path @param string $nodeTypeFilter @param array $nodes @return void
[ "Sets", "the", "given", "nodes", "as", "child", "nodes", "for", "the", "given", "path", "and", "node", "type", "filter", ".", "The", "nodes", "will", "each", "be", "added", "with", "their", "path", "and", "identifier", "as", "well", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/Cache/FirstLevelNodeCache.php#L132-L145
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Parser.php
Parser.parse
public function parse($sourceCode, $contextPathAndFilename = null, array $objectTreeUntilNow = [], $buildPrototypeHierarchy = true) { if (!is_string($sourceCode)) { throw new Fusion\Exception('Cannot parse Fusion - $sourceCode must be of type string!', 1180203775); } $this->initialize(); $this->objectTree = $objectTreeUntilNow; $this->contextPathAndFilename = $contextPathAndFilename; $sourceCode = str_replace("\r\n", "\n", $sourceCode); $this->currentSourceCodeLines = explode(chr(10), $sourceCode); while (($fusionLine = $this->getNextfusionLine()) !== false) { $this->parseFusionLine($fusionLine); } if ($buildPrototypeHierarchy) { $this->buildPrototypeHierarchy(); } return $this->objectTree; }
php
public function parse($sourceCode, $contextPathAndFilename = null, array $objectTreeUntilNow = [], $buildPrototypeHierarchy = true) { if (!is_string($sourceCode)) { throw new Fusion\Exception('Cannot parse Fusion - $sourceCode must be of type string!', 1180203775); } $this->initialize(); $this->objectTree = $objectTreeUntilNow; $this->contextPathAndFilename = $contextPathAndFilename; $sourceCode = str_replace("\r\n", "\n", $sourceCode); $this->currentSourceCodeLines = explode(chr(10), $sourceCode); while (($fusionLine = $this->getNextfusionLine()) !== false) { $this->parseFusionLine($fusionLine); } if ($buildPrototypeHierarchy) { $this->buildPrototypeHierarchy(); } return $this->objectTree; }
[ "public", "function", "parse", "(", "$", "sourceCode", ",", "$", "contextPathAndFilename", "=", "null", ",", "array", "$", "objectTreeUntilNow", "=", "[", "]", ",", "$", "buildPrototypeHierarchy", "=", "true", ")", "{", "if", "(", "!", "is_string", "(", "$...
Parses the given Fusion source code and returns an object tree as the result. @param string $sourceCode The Fusion source code to parse @param string $contextPathAndFilename An optional path and filename to use as a prefix for inclusion of further Fusion files @param array $objectTreeUntilNow Used internally for keeping track of the built object tree @param boolean $buildPrototypeHierarchy Merge prototype configurations or not. Will be false for includes to only do that once at the end. @return array A Fusion object tree, generated from the source code @throws Fusion\Exception @api
[ "Parses", "the", "given", "Fusion", "source", "code", "and", "returns", "an", "object", "tree", "as", "the", "result", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Parser.php#L279-L297
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Parser.php
Parser.setObjectTypeNamespace
public function setObjectTypeNamespace($alias, $namespace) { if (!is_string($alias)) { throw new Fusion\Exception('The alias of a namespace must be valid string!', 1180600696); } if (!is_string($namespace)) { throw new Fusion\Exception('The namespace must be of type string!', 1180600697); } $this->objectTypeNamespaces[$alias] = $namespace; }
php
public function setObjectTypeNamespace($alias, $namespace) { if (!is_string($alias)) { throw new Fusion\Exception('The alias of a namespace must be valid string!', 1180600696); } if (!is_string($namespace)) { throw new Fusion\Exception('The namespace must be of type string!', 1180600697); } $this->objectTypeNamespaces[$alias] = $namespace; }
[ "public", "function", "setObjectTypeNamespace", "(", "$", "alias", ",", "$", "namespace", ")", "{", "if", "(", "!", "is_string", "(", "$", "alias", ")", ")", "{", "throw", "new", "Fusion", "\\", "Exception", "(", "'The alias of a namespace must be valid string!'...
Sets the given alias to the specified namespace. The namespaces defined through this setter or through a "namespace" declaration in one of the Fusions are used to resolve a fully qualified Fusion object name while parsing Fusion code. The alias is the handle by wich the namespace can be referred to. The namespace is, by convention, a package key which must correspond to a namespace used in the prototype definitions for Fusion object types. The special alias "default" is used as a fallback for resolution of unqualified Fusion object types. @param string $alias An alias for the given namespace, for example "neos" @param string $namespace The namespace, for example "Neos.Neos" @return void @throws Fusion\Exception @api
[ "Sets", "the", "given", "alias", "to", "the", "specified", "namespace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Parser.php#L319-L328
train