repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6 values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1 value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
neos/flow-development-collection | Neos.Flow/Classes/Command/TypeConverterCommandController.php | TypeConverterCommandController.listCommand | public function listCommand(string $source = null, string $target = null)
{
$this->outputLine();
if ($source !== null) {
$this->outputLine(sprintf('<info>!!</info> Filter by source : <comment>%s</comment>', $source));
}
if ($target !== null) {
$this->outputLine(sprintf('<info>!!</info> Filter by target type : <comment>%s</comment>', $target));
}
$this->outputLine();
$headers = ['Source', 'Target', 'Priority', 'ClassName'];
$table = [];
foreach ($this->propertyMapper->getTypeConverters() as $sourceType => $targetTypePriorityAndClassName) {
if ($source !== null && preg_match('#' . $source . '#', $sourceType) !== 1) {
continue;
}
foreach ($targetTypePriorityAndClassName as $targetType => $priorityAndClassName) {
if ($target !== null && preg_match('#' . $target . '#', $targetType) !== 1) {
continue;
}
krsort($priorityAndClassName);
foreach ($priorityAndClassName as $priority => $className) {
$table[] = [
$sourceType,
$targetType,
$priority,
$className
];
}
}
}
$sourceSorting = $targetSorting = $prioritySorting = [];
foreach ($table as $key => $row) {
$sourceSorting[$key] = strtolower($row[0]);
$targetSorting[$key] = strtolower($row[1]);
$prioritySorting[$key] = $row[2];
}
array_multisort($sourceSorting, SORT_ASC, $targetSorting, SORT_ASC, $prioritySorting, SORT_NUMERIC, $table);
$this->output->outputTable($table, $headers);
} | php | public function listCommand(string $source = null, string $target = null)
{
$this->outputLine();
if ($source !== null) {
$this->outputLine(sprintf('<info>!!</info> Filter by source : <comment>%s</comment>', $source));
}
if ($target !== null) {
$this->outputLine(sprintf('<info>!!</info> Filter by target type : <comment>%s</comment>', $target));
}
$this->outputLine();
$headers = ['Source', 'Target', 'Priority', 'ClassName'];
$table = [];
foreach ($this->propertyMapper->getTypeConverters() as $sourceType => $targetTypePriorityAndClassName) {
if ($source !== null && preg_match('#' . $source . '#', $sourceType) !== 1) {
continue;
}
foreach ($targetTypePriorityAndClassName as $targetType => $priorityAndClassName) {
if ($target !== null && preg_match('#' . $target . '#', $targetType) !== 1) {
continue;
}
krsort($priorityAndClassName);
foreach ($priorityAndClassName as $priority => $className) {
$table[] = [
$sourceType,
$targetType,
$priority,
$className
];
}
}
}
$sourceSorting = $targetSorting = $prioritySorting = [];
foreach ($table as $key => $row) {
$sourceSorting[$key] = strtolower($row[0]);
$targetSorting[$key] = strtolower($row[1]);
$prioritySorting[$key] = $row[2];
}
array_multisort($sourceSorting, SORT_ASC, $targetSorting, SORT_ASC, $prioritySorting, SORT_NUMERIC, $table);
$this->output->outputTable($table, $headers);
} | [
"public",
"function",
"listCommand",
"(",
"string",
"$",
"source",
"=",
"null",
",",
"string",
"$",
"target",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"outputLine",
"(",
")",
";",
"if",
"(",
"$",
"source",
"!==",
"null",
")",
"{",
"$",
"this",
"->... | Lists all currently active and registered type converters
All active converters are listed with ordered by priority and grouped by
source type first and target type second.
@param string $source Filter by source
@param string $target Filter by target type
@return void | [
"Lists",
"all",
"currently",
"active",
"and",
"registered",
"type",
"converters"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/TypeConverterCommandController.php#L41-L85 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Account.php | Account.initializeRoles | protected function initializeRoles()
{
if ($this->roles !== null) {
return;
}
$this->roles = [];
foreach ($this->roleIdentifiers as $key => $roleIdentifier) {
// check for and clean up roles no longer available
if ($this->policyService->hasRole($roleIdentifier)) {
$this->roles[$roleIdentifier] = $this->policyService->getRole($roleIdentifier);
} else {
unset($this->roleIdentifiers[$key]);
}
}
} | php | protected function initializeRoles()
{
if ($this->roles !== null) {
return;
}
$this->roles = [];
foreach ($this->roleIdentifiers as $key => $roleIdentifier) {
// check for and clean up roles no longer available
if ($this->policyService->hasRole($roleIdentifier)) {
$this->roles[$roleIdentifier] = $this->policyService->getRole($roleIdentifier);
} else {
unset($this->roleIdentifiers[$key]);
}
}
} | [
"protected",
"function",
"initializeRoles",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"roles",
"!==",
"null",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"roles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"roleIdentifiers",
"as",... | Initializes the roles field by fetching the role objects referenced by the roleIdentifiers
@return void | [
"Initializes",
"the",
"roles",
"field",
"by",
"fetching",
"the",
"role",
"objects",
"referenced",
"by",
"the",
"roleIdentifiers"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Account.php#L118-L132 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Account.php | Account.setRoles | public function setRoles(array $roles)
{
$this->roleIdentifiers = [];
$this->roles = [];
foreach ($roles as $role) {
if (!$role instanceof Role) {
throw new \InvalidArgumentException(sprintf('setRoles() only accepts an array of %s instances, given: "%s"', Role::class, gettype($role)), 1397125997);
}
$this->addRole($role);
}
} | php | public function setRoles(array $roles)
{
$this->roleIdentifiers = [];
$this->roles = [];
foreach ($roles as $role) {
if (!$role instanceof Role) {
throw new \InvalidArgumentException(sprintf('setRoles() only accepts an array of %s instances, given: "%s"', Role::class, gettype($role)), 1397125997);
}
$this->addRole($role);
}
} | [
"public",
"function",
"setRoles",
"(",
"array",
"$",
"roles",
")",
"{",
"$",
"this",
"->",
"roleIdentifiers",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"roles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"roles",
"as",
"$",
"role",
")",
"{",
"if",
"("... | Sets the roles for this account
@param array<Role> $roles An array of Policy\Role objects
@return void
@throws \InvalidArgumentException
@api | [
"Sets",
"the",
"roles",
"for",
"this",
"account"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Account.php#L223-L233 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Account.php | Account.hasRole | public function hasRole(Role $role)
{
$this->initializeRoles();
return array_key_exists($role->getIdentifier(), $this->roles);
} | php | public function hasRole(Role $role)
{
$this->initializeRoles();
return array_key_exists($role->getIdentifier(), $this->roles);
} | [
"public",
"function",
"hasRole",
"(",
"Role",
"$",
"role",
")",
"{",
"$",
"this",
"->",
"initializeRoles",
"(",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"role",
"->",
"getIdentifier",
"(",
")",
",",
"$",
"this",
"->",
"roles",
")",
";",
"}"
] | Return if the account has a certain role
@param Role $role
@return boolean
@api | [
"Return",
"if",
"the",
"account",
"has",
"a",
"certain",
"role"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Account.php#L242-L246 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Account.php | Account.addRole | public function addRole(Role $role)
{
if ($role->isAbstract()) {
throw new \InvalidArgumentException(sprintf('Abstract roles can\'t be assigned to accounts directly, but the role "%s" is marked abstract', $role->getIdentifier()), 1399900657);
}
$this->initializeRoles();
if (!$this->hasRole($role)) {
$roleIdentifier = $role->getIdentifier();
$this->roleIdentifiers[] = $roleIdentifier;
$this->roles[$roleIdentifier] = $role;
}
} | php | public function addRole(Role $role)
{
if ($role->isAbstract()) {
throw new \InvalidArgumentException(sprintf('Abstract roles can\'t be assigned to accounts directly, but the role "%s" is marked abstract', $role->getIdentifier()), 1399900657);
}
$this->initializeRoles();
if (!$this->hasRole($role)) {
$roleIdentifier = $role->getIdentifier();
$this->roleIdentifiers[] = $roleIdentifier;
$this->roles[$roleIdentifier] = $role;
}
} | [
"public",
"function",
"addRole",
"(",
"Role",
"$",
"role",
")",
"{",
"if",
"(",
"$",
"role",
"->",
"isAbstract",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Abstract roles can\\'t be assigned to accounts directly, b... | Adds a role to this account
@param Role $role
@return void
@throws \InvalidArgumentException
@api | [
"Adds",
"a",
"role",
"to",
"this",
"account"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Account.php#L256-L267 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Account.php | Account.removeRole | public function removeRole(Role $role)
{
$this->initializeRoles();
if ($this->hasRole($role)) {
$roleIdentifier = $role->getIdentifier();
unset($this->roles[$roleIdentifier]);
$identifierIndex = array_search($roleIdentifier, $this->roleIdentifiers);
unset($this->roleIdentifiers[$identifierIndex]);
}
} | php | public function removeRole(Role $role)
{
$this->initializeRoles();
if ($this->hasRole($role)) {
$roleIdentifier = $role->getIdentifier();
unset($this->roles[$roleIdentifier]);
$identifierIndex = array_search($roleIdentifier, $this->roleIdentifiers);
unset($this->roleIdentifiers[$identifierIndex]);
}
} | [
"public",
"function",
"removeRole",
"(",
"Role",
"$",
"role",
")",
"{",
"$",
"this",
"->",
"initializeRoles",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasRole",
"(",
"$",
"role",
")",
")",
"{",
"$",
"roleIdentifier",
"=",
"$",
"role",
"->",
"g... | Removes a role from this account
@param Role $role
@return void
@api | [
"Removes",
"a",
"role",
"from",
"this",
"account"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Account.php#L276-L285 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Account.php | Account.authenticationAttempted | public function authenticationAttempted($authenticationStatus)
{
if ($authenticationStatus === TokenInterface::WRONG_CREDENTIALS) {
$this->failedAuthenticationCount++;
} elseif ($authenticationStatus === TokenInterface::AUTHENTICATION_SUCCESSFUL) {
$this->lastSuccessfulAuthenticationDate = new \DateTime();
$this->failedAuthenticationCount = 0;
} else {
throw new InvalidAuthenticationStatusException('Invalid authentication status.', 1449151375);
}
} | php | public function authenticationAttempted($authenticationStatus)
{
if ($authenticationStatus === TokenInterface::WRONG_CREDENTIALS) {
$this->failedAuthenticationCount++;
} elseif ($authenticationStatus === TokenInterface::AUTHENTICATION_SUCCESSFUL) {
$this->lastSuccessfulAuthenticationDate = new \DateTime();
$this->failedAuthenticationCount = 0;
} else {
throw new InvalidAuthenticationStatusException('Invalid authentication status.', 1449151375);
}
} | [
"public",
"function",
"authenticationAttempted",
"(",
"$",
"authenticationStatus",
")",
"{",
"if",
"(",
"$",
"authenticationStatus",
"===",
"TokenInterface",
"::",
"WRONG_CREDENTIALS",
")",
"{",
"$",
"this",
"->",
"failedAuthenticationCount",
"++",
";",
"}",
"elseif... | Sets the authentication status. Usually called by the responsible \Neos\Flow\Security\Authentication\AuthenticationManagerInterface
@param integer $authenticationStatus One of WRONG_CREDENTIALS, AUTHENTICATION_SUCCESSFUL
@return void
@throws InvalidAuthenticationStatusException | [
"Sets",
"the",
"authentication",
"status",
".",
"Usually",
"called",
"by",
"the",
"responsible",
"\\",
"Neos",
"\\",
"Flow",
"\\",
"Security",
"\\",
"Authentication",
"\\",
"AuthenticationManagerInterface"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Account.php#L347-L357 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Storage/PackageStorage.php | PackageStorage.getObjectsByPathPattern | public function getObjectsByPathPattern($pattern, callable $callback = null)
{
$directories = [];
if (strpos($pattern, '/') !== false) {
list($packageKeyPattern, $directoryPattern) = explode('/', $pattern, 2);
} else {
$packageKeyPattern = $pattern;
$directoryPattern = '*';
}
// $packageKeyPattern can be used in a future implementation to filter by package key
$packages = $this->packageManager->getFlowPackages();
foreach ($packages as $packageKey => $package) {
if ($directoryPattern === '*') {
$directories[$packageKey][] = $package->getPackagePath();
} else {
$directories[$packageKey] = glob($package->getPackagePath() . $directoryPattern, GLOB_ONLYDIR);
}
}
$iteration = 0;
foreach ($directories as $packageKey => $packageDirectories) {
foreach ($packageDirectories as $directoryPath) {
foreach (Files::getRecursiveDirectoryGenerator($directoryPath) as $resourcePathAndFilename) {
$object = $this->createStorageObject($resourcePathAndFilename, $packages[$packageKey]);
yield $object;
if (is_callable($callback)) {
call_user_func($callback, $iteration, $object);
}
$iteration++;
}
}
}
} | php | public function getObjectsByPathPattern($pattern, callable $callback = null)
{
$directories = [];
if (strpos($pattern, '/') !== false) {
list($packageKeyPattern, $directoryPattern) = explode('/', $pattern, 2);
} else {
$packageKeyPattern = $pattern;
$directoryPattern = '*';
}
// $packageKeyPattern can be used in a future implementation to filter by package key
$packages = $this->packageManager->getFlowPackages();
foreach ($packages as $packageKey => $package) {
if ($directoryPattern === '*') {
$directories[$packageKey][] = $package->getPackagePath();
} else {
$directories[$packageKey] = glob($package->getPackagePath() . $directoryPattern, GLOB_ONLYDIR);
}
}
$iteration = 0;
foreach ($directories as $packageKey => $packageDirectories) {
foreach ($packageDirectories as $directoryPath) {
foreach (Files::getRecursiveDirectoryGenerator($directoryPath) as $resourcePathAndFilename) {
$object = $this->createStorageObject($resourcePathAndFilename, $packages[$packageKey]);
yield $object;
if (is_callable($callback)) {
call_user_func($callback, $iteration, $object);
}
$iteration++;
}
}
}
} | [
"public",
"function",
"getObjectsByPathPattern",
"(",
"$",
"pattern",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"directories",
"=",
"[",
"]",
";",
"if",
"(",
"strpos",
"(",
"$",
"pattern",
",",
"'/'",
")",
"!==",
"false",
")",
"{",
... | Return all Objects stored in this storage filtered by the given directory / filename pattern
@param string $pattern A glob compatible directory / filename pattern
@param callable $callback Function called after each object
@return \Generator<StorageObject> | [
"Return",
"all",
"Objects",
"stored",
"in",
"this",
"storage",
"filtered",
"by",
"the",
"given",
"directory",
"/",
"filename",
"pattern"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Storage/PackageStorage.php#L60-L93 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Storage/PackageStorage.php | PackageStorage.createStorageObject | protected function createStorageObject($resourcePathAndFilename, FlowPackageInterface $resourcePackage)
{
$pathInfo = UnicodeFunctions::pathinfo($resourcePathAndFilename);
$object = new StorageObject();
$object->setFilename($pathInfo['basename']);
$object->setSha1(sha1_file($resourcePathAndFilename));
$object->setMd5(md5_file($resourcePathAndFilename));
$object->setFileSize(filesize($resourcePathAndFilename));
if (isset($pathInfo['dirname'])) {
$object->setRelativePublicationPath($this->prepareRelativePublicationPath($pathInfo['dirname'], $resourcePackage->getPackageKey(), $resourcePackage->getResourcesPath()));
}
$object->setStream(function () use ($resourcePathAndFilename) {
return fopen($resourcePathAndFilename, 'r');
});
return $object;
} | php | protected function createStorageObject($resourcePathAndFilename, FlowPackageInterface $resourcePackage)
{
$pathInfo = UnicodeFunctions::pathinfo($resourcePathAndFilename);
$object = new StorageObject();
$object->setFilename($pathInfo['basename']);
$object->setSha1(sha1_file($resourcePathAndFilename));
$object->setMd5(md5_file($resourcePathAndFilename));
$object->setFileSize(filesize($resourcePathAndFilename));
if (isset($pathInfo['dirname'])) {
$object->setRelativePublicationPath($this->prepareRelativePublicationPath($pathInfo['dirname'], $resourcePackage->getPackageKey(), $resourcePackage->getResourcesPath()));
}
$object->setStream(function () use ($resourcePathAndFilename) {
return fopen($resourcePathAndFilename, 'r');
});
return $object;
} | [
"protected",
"function",
"createStorageObject",
"(",
"$",
"resourcePathAndFilename",
",",
"FlowPackageInterface",
"$",
"resourcePackage",
")",
"{",
"$",
"pathInfo",
"=",
"UnicodeFunctions",
"::",
"pathinfo",
"(",
"$",
"resourcePathAndFilename",
")",
";",
"$",
"object"... | Create a storage object for the given static resource path.
@param string $resourcePathAndFilename
@param FlowPackageInterface $resourcePackage
@return StorageObject | [
"Create",
"a",
"storage",
"object",
"for",
"the",
"given",
"static",
"resource",
"path",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Storage/PackageStorage.php#L102-L119 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Storage/PackageStorage.php | PackageStorage.prepareRelativePublicationPath | protected function prepareRelativePublicationPath($objectPath, $packageKey, $packageResourcePath)
{
$relativePathParts = explode('/', str_replace($packageResourcePath, '', $objectPath), 2);
$relativePath = '';
if (isset($relativePathParts[1])) {
$relativePath = $relativePathParts[1];
}
return Files::concatenatePaths([$packageKey, $relativePath]) . '/';
} | php | protected function prepareRelativePublicationPath($objectPath, $packageKey, $packageResourcePath)
{
$relativePathParts = explode('/', str_replace($packageResourcePath, '', $objectPath), 2);
$relativePath = '';
if (isset($relativePathParts[1])) {
$relativePath = $relativePathParts[1];
}
return Files::concatenatePaths([$packageKey, $relativePath]) . '/';
} | [
"protected",
"function",
"prepareRelativePublicationPath",
"(",
"$",
"objectPath",
",",
"$",
"packageKey",
",",
"$",
"packageResourcePath",
")",
"{",
"$",
"relativePathParts",
"=",
"explode",
"(",
"'/'",
",",
"str_replace",
"(",
"$",
"packageResourcePath",
",",
"'... | Prepares a relative publication path for a package resource.
@param string $objectPath
@param string $packageKey
@param string $packageResourcePath
@return string | [
"Prepares",
"a",
"relative",
"publication",
"path",
"for",
"a",
"package",
"resource",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Storage/PackageStorage.php#L129-L138 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Storage/PackageStorage.php | PackageStorage.getPublicResourcePaths | public function getPublicResourcePaths()
{
$paths = [];
foreach ($this->packageManager->getFlowPackages() as $packageKey => $package) {
$publicResourcesPath = Files::concatenatePaths([$package->getResourcesPath(), 'Public']);
if (is_dir($publicResourcesPath)) {
$paths[$packageKey] = $publicResourcesPath;
}
}
return $paths;
} | php | public function getPublicResourcePaths()
{
$paths = [];
foreach ($this->packageManager->getFlowPackages() as $packageKey => $package) {
$publicResourcesPath = Files::concatenatePaths([$package->getResourcesPath(), 'Public']);
if (is_dir($publicResourcesPath)) {
$paths[$packageKey] = $publicResourcesPath;
}
}
return $paths;
} | [
"public",
"function",
"getPublicResourcePaths",
"(",
")",
"{",
"$",
"paths",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"packageManager",
"->",
"getFlowPackages",
"(",
")",
"as",
"$",
"packageKey",
"=>",
"$",
"package",
")",
"{",
"$",
"public... | Returns the absolute paths of public resources directories of all active packages.
This method is used directly by the FileSystemSymlinkTarget.
@return array<string> | [
"Returns",
"the",
"absolute",
"paths",
"of",
"public",
"resources",
"directories",
"of",
"all",
"active",
"packages",
".",
"This",
"method",
"is",
"used",
"directly",
"by",
"the",
"FileSystemSymlinkTarget",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Storage/PackageStorage.php#L157-L167 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/ViewHelpers/Widget/LinkViewHelper.php | LinkViewHelper.render | public function render($action = null, $arguments = [], $section = '', $format = '', $ajax = false, $includeWidgetContext = false)
{
if ($ajax === true) {
$uri = $this->getAjaxUri();
} else {
if ($action === null) {
throw new ViewHelper\Exception('You have to specify the target action when creating a widget URI with the widget.link ViewHelper', 1357648227);
}
$uri = $this->getWidgetUri();
}
$this->tag->addAttribute('href', $uri);
$this->tag->setContent($this->renderChildren());
$this->tag->forceClosingTag(true);
return $this->tag->render();
} | php | public function render($action = null, $arguments = [], $section = '', $format = '', $ajax = false, $includeWidgetContext = false)
{
if ($ajax === true) {
$uri = $this->getAjaxUri();
} else {
if ($action === null) {
throw new ViewHelper\Exception('You have to specify the target action when creating a widget URI with the widget.link ViewHelper', 1357648227);
}
$uri = $this->getWidgetUri();
}
$this->tag->addAttribute('href', $uri);
$this->tag->setContent($this->renderChildren());
$this->tag->forceClosingTag(true);
return $this->tag->render();
} | [
"public",
"function",
"render",
"(",
"$",
"action",
"=",
"null",
",",
"$",
"arguments",
"=",
"[",
"]",
",",
"$",
"section",
"=",
"''",
",",
"$",
"format",
"=",
"''",
",",
"$",
"ajax",
"=",
"false",
",",
"$",
"includeWidgetContext",
"=",
"false",
")... | Render the link.
@param string $action Target action
@param array $arguments Arguments
@param string $section The anchor to be added to the URI
@param string $format The requested format, e.g. ".html"
@param boolean $ajax true if the URI should be to an AJAX widget, false otherwise.
@param boolean $includeWidgetContext true if the URI should contain the serialized widget context (only useful for stateless AJAX widgets)
@return string The rendered link
@throws ViewHelper\Exception if $action argument is not specified and $ajax is false
@api | [
"Render",
"the",
"link",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/LinkViewHelper.php#L78-L93 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/ViewHelpers/DebugViewHelper.php | DebugViewHelper.render | public function render()
{
$expressionToExamine = $this->renderChildren();
if ($this->arguments['typeOnly'] === true && $expressionToExamine !== null) {
$expressionToExamine = (is_object($expressionToExamine) ? get_class($expressionToExamine) : gettype($expressionToExamine));
}
ob_start();
\Neos\Flow\var_dump($expressionToExamine, $this->arguments['title']);
$output = ob_get_contents();
ob_end_clean();
return $output;
} | php | public function render()
{
$expressionToExamine = $this->renderChildren();
if ($this->arguments['typeOnly'] === true && $expressionToExamine !== null) {
$expressionToExamine = (is_object($expressionToExamine) ? get_class($expressionToExamine) : gettype($expressionToExamine));
}
ob_start();
\Neos\Flow\var_dump($expressionToExamine, $this->arguments['title']);
$output = ob_get_contents();
ob_end_clean();
return $output;
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"expressionToExamine",
"=",
"$",
"this",
"->",
"renderChildren",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"arguments",
"[",
"'typeOnly'",
"]",
"===",
"true",
"&&",
"$",
"expressionToExamine",
"!==",
... | Wrapper for \Neos\Flow\var_dump()
@return string debug string | [
"Wrapper",
"for",
"\\",
"Neos",
"\\",
"Flow",
"\\",
"var_dump",
"()"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/DebugViewHelper.php#L74-L86 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Helper/ArgumentsHelper.php | ArgumentsHelper.buildUnifiedArguments | public static function buildUnifiedArguments(array $getArguments, array $postArguments, array $untangledFiles): array
{
$arguments = Arrays::arrayMergeRecursiveOverrule($getArguments, $postArguments);
$arguments = Arrays::arrayMergeRecursiveOverrule($arguments, $untangledFiles);
return $arguments;
} | php | public static function buildUnifiedArguments(array $getArguments, array $postArguments, array $untangledFiles): array
{
$arguments = Arrays::arrayMergeRecursiveOverrule($getArguments, $postArguments);
$arguments = Arrays::arrayMergeRecursiveOverrule($arguments, $untangledFiles);
return $arguments;
} | [
"public",
"static",
"function",
"buildUnifiedArguments",
"(",
"array",
"$",
"getArguments",
",",
"array",
"$",
"postArguments",
",",
"array",
"$",
"untangledFiles",
")",
":",
"array",
"{",
"$",
"arguments",
"=",
"Arrays",
"::",
"arrayMergeRecursiveOverrule",
"(",
... | Takes the raw GET & POST arguments and maps them into the request object.
Afterwards all mapped arguments can be retrieved by the getArgument(s) method, no matter if they
have been GET, POST or PUT arguments before.
The order of merging is GET, POST, FILES, with later items overriding earlier ones.
@param array $getArguments Arguments as found in $_GET
@param array $postArguments Arguments as found in $_POST
@param array $untangledFiles Untangled $_FILES as provided by \Neos\Flow\Http\Helper\UploadedFilesHelper::untangleFilesArray
@return array the unified arguments
@see \Neos\Flow\Http\Helper\UploadedFilesHelper::untangleFilesArray | [
"Takes",
"the",
"raw",
"GET",
"&",
"POST",
"arguments",
"and",
"maps",
"them",
"into",
"the",
"request",
"object",
".",
"Afterwards",
"all",
"mapped",
"arguments",
"can",
"be",
"retrieved",
"by",
"the",
"getArgument",
"(",
"s",
")",
"method",
"no",
"matter... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Helper/ArgumentsHelper.php#L35-L41 |
neos/flow-development-collection | Neos.Utility.Arrays/Classes/PositionalArraySorter.php | PositionalArraySorter.toArray | public function toArray(): array
{
$sortedArrayKeys = $this->getSortedKeys();
$sortedArray = [];
foreach ($sortedArrayKeys as $key) {
$sortedArray[$key] = $this->subject[$key];
}
return $sortedArray;
} | php | public function toArray(): array
{
$sortedArrayKeys = $this->getSortedKeys();
$sortedArray = [];
foreach ($sortedArrayKeys as $key) {
$sortedArray[$key] = $this->subject[$key];
}
return $sortedArray;
} | [
"public",
"function",
"toArray",
"(",
")",
":",
"array",
"{",
"$",
"sortedArrayKeys",
"=",
"$",
"this",
"->",
"getSortedKeys",
"(",
")",
";",
"$",
"sortedArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"sortedArrayKeys",
"as",
"$",
"key",
")",
"{",
... | Returns a sorted copy of the subject array
@return array | [
"Returns",
"a",
"sorted",
"copy",
"of",
"the",
"subject",
"array"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Arrays/Classes/PositionalArraySorter.php#L94-L103 |
neos/flow-development-collection | Neos.Utility.Arrays/Classes/PositionalArraySorter.php | PositionalArraySorter.getSortedKeys | public function getSortedKeys(): array
{
$arrayKeysWithPosition = $this->collectArrayKeysAndPositions();
$this->extractMiddleKeys($arrayKeysWithPosition);
$this->extractStartKeys($arrayKeysWithPosition);
$this->extractEndKeys($arrayKeysWithPosition);
$this->extractBeforeKeys($arrayKeysWithPosition);
$this->extractAfterKeys($arrayKeysWithPosition);
foreach ($arrayKeysWithPosition as $unresolvedKey => $unresolvedPosition) {
throw new Exception\InvalidPositionException(sprintf('The positional string "%s" (defined for key "%s") is not supported.', $unresolvedPosition, $unresolvedKey), 1379429920);
}
$sortedKeysMap = $this->generateSortedKeysMap();
$sortedKeys = [];
array_walk_recursive($sortedKeysMap, function ($value) use (&$sortedKeys) {
$sortedKeys[] = $value;
});
return $sortedKeys;
} | php | public function getSortedKeys(): array
{
$arrayKeysWithPosition = $this->collectArrayKeysAndPositions();
$this->extractMiddleKeys($arrayKeysWithPosition);
$this->extractStartKeys($arrayKeysWithPosition);
$this->extractEndKeys($arrayKeysWithPosition);
$this->extractBeforeKeys($arrayKeysWithPosition);
$this->extractAfterKeys($arrayKeysWithPosition);
foreach ($arrayKeysWithPosition as $unresolvedKey => $unresolvedPosition) {
throw new Exception\InvalidPositionException(sprintf('The positional string "%s" (defined for key "%s") is not supported.', $unresolvedPosition, $unresolvedKey), 1379429920);
}
$sortedKeysMap = $this->generateSortedKeysMap();
$sortedKeys = [];
array_walk_recursive($sortedKeysMap, function ($value) use (&$sortedKeys) {
$sortedKeys[] = $value;
});
return $sortedKeys;
} | [
"public",
"function",
"getSortedKeys",
"(",
")",
":",
"array",
"{",
"$",
"arrayKeysWithPosition",
"=",
"$",
"this",
"->",
"collectArrayKeysAndPositions",
"(",
")",
";",
"$",
"this",
"->",
"extractMiddleKeys",
"(",
"$",
"arrayKeysWithPosition",
")",
";",
"$",
"... | Returns the keys of $this->subject sorted according to the position meta data
TODO Detect circles in after / before dependencies (#52185)
@return array an ordered list of keys
@throws Exception\InvalidPositionException if the positional string has an unsupported format | [
"Returns",
"the",
"keys",
"of",
"$this",
"-",
">",
"subject",
"sorted",
"according",
"to",
"the",
"position",
"meta",
"data"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Arrays/Classes/PositionalArraySorter.php#L113-L135 |
neos/flow-development-collection | Neos.Utility.Arrays/Classes/PositionalArraySorter.php | PositionalArraySorter.extractMiddleKeys | protected function extractMiddleKeys(array &$arrayKeysWithPosition)
{
$this->middleKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (!is_numeric($position)) {
continue;
}
$this->middleKeys[intval($position)][] = $key;
unset($arrayKeysWithPosition[$key]);
}
ksort($this->middleKeys, SORT_NUMERIC);
} | php | protected function extractMiddleKeys(array &$arrayKeysWithPosition)
{
$this->middleKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (!is_numeric($position)) {
continue;
}
$this->middleKeys[intval($position)][] = $key;
unset($arrayKeysWithPosition[$key]);
}
ksort($this->middleKeys, SORT_NUMERIC);
} | [
"protected",
"function",
"extractMiddleKeys",
"(",
"array",
"&",
"$",
"arrayKeysWithPosition",
")",
"{",
"$",
"this",
"->",
"middleKeys",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arrayKeysWithPosition",
"as",
"$",
"key",
"=>",
"$",
"position",
")",
"{",
"... | Extracts all "middle" keys from $arrayKeysWithPosition. Those are all keys with a numeric position.
The result is a multi-dimensional arrays where the KEY of each array is a PRIORITY and the VALUE is an array of matching KEYS
This also removes matching keys from the given $arrayKeysWithPosition
@param array $arrayKeysWithPosition
@return void | [
"Extracts",
"all",
"middle",
"keys",
"from",
"$arrayKeysWithPosition",
".",
"Those",
"are",
"all",
"keys",
"with",
"a",
"numeric",
"position",
".",
"The",
"result",
"is",
"a",
"multi",
"-",
"dimensional",
"arrays",
"where",
"the",
"KEY",
"of",
"each",
"array... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Arrays/Classes/PositionalArraySorter.php#L145-L156 |
neos/flow-development-collection | Neos.Utility.Arrays/Classes/PositionalArraySorter.php | PositionalArraySorter.extractStartKeys | protected function extractStartKeys(array &$arrayKeysWithPosition)
{
$this->startKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (preg_match('/^start(?: ([0-9]+))?$/', $position, $matches) < 1) {
continue;
}
if (isset($matches[1])) {
$this->startKeys[intval($matches[1])][] = $key;
} else {
$this->startKeys[0][] = $key;
}
unset($arrayKeysWithPosition[$key]);
}
krsort($this->startKeys, SORT_NUMERIC);
} | php | protected function extractStartKeys(array &$arrayKeysWithPosition)
{
$this->startKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (preg_match('/^start(?: ([0-9]+))?$/', $position, $matches) < 1) {
continue;
}
if (isset($matches[1])) {
$this->startKeys[intval($matches[1])][] = $key;
} else {
$this->startKeys[0][] = $key;
}
unset($arrayKeysWithPosition[$key]);
}
krsort($this->startKeys, SORT_NUMERIC);
} | [
"protected",
"function",
"extractStartKeys",
"(",
"array",
"&",
"$",
"arrayKeysWithPosition",
")",
"{",
"$",
"this",
"->",
"startKeys",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arrayKeysWithPosition",
"as",
"$",
"key",
"=>",
"$",
"position",
")",
"{",
"if... | Extracts all "start" keys from $arrayKeysWithPosition. Those are all keys with a position starting with "start"
The result is a multi-dimensional arrays where the KEY of each array is a PRIORITY and the VALUE is an array of matching KEYS
This also removes matching keys from the given $arrayKeysWithPosition
@param array $arrayKeysWithPosition
@return void | [
"Extracts",
"all",
"start",
"keys",
"from",
"$arrayKeysWithPosition",
".",
"Those",
"are",
"all",
"keys",
"with",
"a",
"position",
"starting",
"with",
"start",
"The",
"result",
"is",
"a",
"multi",
"-",
"dimensional",
"arrays",
"where",
"the",
"KEY",
"of",
"e... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Arrays/Classes/PositionalArraySorter.php#L166-L181 |
neos/flow-development-collection | Neos.Utility.Arrays/Classes/PositionalArraySorter.php | PositionalArraySorter.extractEndKeys | protected function extractEndKeys(array &$arrayKeysWithPosition)
{
$this->endKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (preg_match('/^end(?: ([0-9]+))?$/', $position, $matches) < 1) {
continue;
}
if (isset($matches[1])) {
$this->endKeys[intval($matches[1])][] = $key;
} else {
$this->endKeys[0][] = $key;
}
unset($arrayKeysWithPosition[$key]);
}
ksort($this->endKeys, SORT_NUMERIC);
} | php | protected function extractEndKeys(array &$arrayKeysWithPosition)
{
$this->endKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (preg_match('/^end(?: ([0-9]+))?$/', $position, $matches) < 1) {
continue;
}
if (isset($matches[1])) {
$this->endKeys[intval($matches[1])][] = $key;
} else {
$this->endKeys[0][] = $key;
}
unset($arrayKeysWithPosition[$key]);
}
ksort($this->endKeys, SORT_NUMERIC);
} | [
"protected",
"function",
"extractEndKeys",
"(",
"array",
"&",
"$",
"arrayKeysWithPosition",
")",
"{",
"$",
"this",
"->",
"endKeys",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arrayKeysWithPosition",
"as",
"$",
"key",
"=>",
"$",
"position",
")",
"{",
"if",
... | Extracts all "end" keys from $arrayKeysWithPosition. Those are all keys with a position starting with "end"
The result is a multi-dimensional arrays where the KEY of each array is a PRIORITY and the VALUE is an array of matching KEYS
This also removes matching keys from the given $arrayKeysWithPosition
@param array $arrayKeysWithPosition
@return void | [
"Extracts",
"all",
"end",
"keys",
"from",
"$arrayKeysWithPosition",
".",
"Those",
"are",
"all",
"keys",
"with",
"a",
"position",
"starting",
"with",
"end",
"The",
"result",
"is",
"a",
"multi",
"-",
"dimensional",
"arrays",
"where",
"the",
"KEY",
"of",
"each"... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Arrays/Classes/PositionalArraySorter.php#L191-L206 |
neos/flow-development-collection | Neos.Utility.Arrays/Classes/PositionalArraySorter.php | PositionalArraySorter.extractBeforeKeys | protected function extractBeforeKeys(array &$arrayKeysWithPosition)
{
$this->beforeKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (preg_match('/^before (\S+)(?: ([0-9]+))?$/', $position, $matches) < 1) {
continue;
}
if (isset($matches[2])) {
$this->beforeKeys[$matches[1]][$matches[2]][] = $key;
} else {
$this->beforeKeys[$matches[1]][0][] = $key;
}
unset($arrayKeysWithPosition[$key]);
}
foreach ($this->beforeKeys as $key => &$keysByPriority) {
ksort($keysByPriority, SORT_NUMERIC);
}
} | php | protected function extractBeforeKeys(array &$arrayKeysWithPosition)
{
$this->beforeKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (preg_match('/^before (\S+)(?: ([0-9]+))?$/', $position, $matches) < 1) {
continue;
}
if (isset($matches[2])) {
$this->beforeKeys[$matches[1]][$matches[2]][] = $key;
} else {
$this->beforeKeys[$matches[1]][0][] = $key;
}
unset($arrayKeysWithPosition[$key]);
}
foreach ($this->beforeKeys as $key => &$keysByPriority) {
ksort($keysByPriority, SORT_NUMERIC);
}
} | [
"protected",
"function",
"extractBeforeKeys",
"(",
"array",
"&",
"$",
"arrayKeysWithPosition",
")",
"{",
"$",
"this",
"->",
"beforeKeys",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arrayKeysWithPosition",
"as",
"$",
"key",
"=>",
"$",
"position",
")",
"{",
"... | Extracts all "before" keys from $arrayKeysWithPosition. Those are all keys with a position starting with "before"
The result is a multi-dimensional arrays where the KEY of each array is a PRIORITY and the VALUE is an array of matching KEYS
This also removes matching keys from the given $arrayKeysWithPosition
@param array $arrayKeysWithPosition
@return void | [
"Extracts",
"all",
"before",
"keys",
"from",
"$arrayKeysWithPosition",
".",
"Those",
"are",
"all",
"keys",
"with",
"a",
"position",
"starting",
"with",
"before",
"The",
"result",
"is",
"a",
"multi",
"-",
"dimensional",
"arrays",
"where",
"the",
"KEY",
"of",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Arrays/Classes/PositionalArraySorter.php#L216-L233 |
neos/flow-development-collection | Neos.Utility.Arrays/Classes/PositionalArraySorter.php | PositionalArraySorter.extractAfterKeys | protected function extractAfterKeys(array &$arrayKeysWithPosition)
{
$this->afterKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (preg_match('/^after (\S+)(?: ([0-9]+))?$/', $position, $matches) < 1) {
continue;
}
if (isset($matches[2])) {
$this->afterKeys[$matches[1]][$matches[2]][] = $key;
} else {
$this->afterKeys[$matches[1]][0][] = $key;
}
unset($arrayKeysWithPosition[$key]);
}
foreach ($this->afterKeys as $key => &$keysByPriority) {
krsort($keysByPriority, SORT_NUMERIC);
}
} | php | protected function extractAfterKeys(array &$arrayKeysWithPosition)
{
$this->afterKeys = [];
foreach ($arrayKeysWithPosition as $key => $position) {
if (preg_match('/^after (\S+)(?: ([0-9]+))?$/', $position, $matches) < 1) {
continue;
}
if (isset($matches[2])) {
$this->afterKeys[$matches[1]][$matches[2]][] = $key;
} else {
$this->afterKeys[$matches[1]][0][] = $key;
}
unset($arrayKeysWithPosition[$key]);
}
foreach ($this->afterKeys as $key => &$keysByPriority) {
krsort($keysByPriority, SORT_NUMERIC);
}
} | [
"protected",
"function",
"extractAfterKeys",
"(",
"array",
"&",
"$",
"arrayKeysWithPosition",
")",
"{",
"$",
"this",
"->",
"afterKeys",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arrayKeysWithPosition",
"as",
"$",
"key",
"=>",
"$",
"position",
")",
"{",
"if... | Extracts all "after" keys from $arrayKeysWithPosition. Those are all keys with a position starting with "after"
The result is a multi-dimensional arrays where the KEY of each array is a PRIORITY and the VALUE is an array of matching KEYS
This also removes matching keys from the given $arrayKeysWithPosition
@param array $arrayKeysWithPosition
@return void | [
"Extracts",
"all",
"after",
"keys",
"from",
"$arrayKeysWithPosition",
".",
"Those",
"are",
"all",
"keys",
"with",
"a",
"position",
"starting",
"with",
"after",
"The",
"result",
"is",
"a",
"multi",
"-",
"dimensional",
"arrays",
"where",
"the",
"KEY",
"of",
"e... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Arrays/Classes/PositionalArraySorter.php#L243-L260 |
neos/flow-development-collection | Neos.Utility.Arrays/Classes/PositionalArraySorter.php | PositionalArraySorter.collectArrayKeysAndPositions | protected function collectArrayKeysAndPositions(): array
{
$arrayKeysWithPosition = [];
foreach ($this->subject as $key => $value) {
// if the value was set to NULL it was unset and should not be used
if ($value === null) {
continue;
}
$position = ObjectAccess::getPropertyPath($value, $this->positionPropertyPath);
if ($position !== null) {
$arrayKeysWithPosition[$key] = $position;
} elseif (is_numeric($key)) {
$arrayKeysWithPosition[$key] = $key;
} else {
$arrayKeysWithPosition[$key] = 0;
}
}
return $arrayKeysWithPosition;
} | php | protected function collectArrayKeysAndPositions(): array
{
$arrayKeysWithPosition = [];
foreach ($this->subject as $key => $value) {
// if the value was set to NULL it was unset and should not be used
if ($value === null) {
continue;
}
$position = ObjectAccess::getPropertyPath($value, $this->positionPropertyPath);
if ($position !== null) {
$arrayKeysWithPosition[$key] = $position;
} elseif (is_numeric($key)) {
$arrayKeysWithPosition[$key] = $key;
} else {
$arrayKeysWithPosition[$key] = 0;
}
}
return $arrayKeysWithPosition;
} | [
"protected",
"function",
"collectArrayKeysAndPositions",
"(",
")",
":",
"array",
"{",
"$",
"arrayKeysWithPosition",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"subject",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"// if the value was set to NU... | Collect the array keys inside $this->subject with each position meta-argument.
If there is no position but the array is numerically ordered, we use the array index as position.
@return array an associative array where each key of $subject has a position string assigned | [
"Collect",
"the",
"array",
"keys",
"inside",
"$this",
"-",
">",
"subject",
"with",
"each",
"position",
"meta",
"-",
"argument",
".",
"If",
"there",
"is",
"no",
"position",
"but",
"the",
"array",
"is",
"numerically",
"ordered",
"we",
"use",
"the",
"array",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Arrays/Classes/PositionalArraySorter.php#L268-L288 |
neos/flow-development-collection | Neos.Utility.Arrays/Classes/PositionalArraySorter.php | PositionalArraySorter.generateSortedKeysMap | protected function generateSortedKeysMap(): array
{
$sortedKeysMap = [];
$startKeys = $this->startKeys;
$middleKeys = $this->middleKeys;
$endKeys = $this->endKeys;
$beforeKeys = $this->beforeKeys;
$afterKeys = $this->afterKeys;
$flattenFunction = function ($value, $key, $step) use (&$sortedKeysMap, &$beforeKeys, &$afterKeys, &$flattenFunction) {
if (isset($beforeKeys[$value])) {
array_walk_recursive($beforeKeys[$value], $flattenFunction, $step);
unset($beforeKeys[$value]);
}
$sortedKeysMap[$step][] = $value;
if (isset($afterKeys[$value])) {
array_walk_recursive($afterKeys[$value], $flattenFunction, $step);
unset($afterKeys[$value]);
}
};
// 1st step: collect regular keys and process before / after if keys occurred
array_walk_recursive($startKeys, $flattenFunction, 0);
array_walk_recursive($middleKeys, $flattenFunction, 2);
array_walk_recursive($endKeys, $flattenFunction, 4);
// 2nd step: process before / after leftovers for unmatched keys
array_walk_recursive($beforeKeys, $flattenFunction, 1);
array_walk_recursive($afterKeys, $flattenFunction, 3);
ksort($sortedKeysMap);
return $sortedKeysMap;
} | php | protected function generateSortedKeysMap(): array
{
$sortedKeysMap = [];
$startKeys = $this->startKeys;
$middleKeys = $this->middleKeys;
$endKeys = $this->endKeys;
$beforeKeys = $this->beforeKeys;
$afterKeys = $this->afterKeys;
$flattenFunction = function ($value, $key, $step) use (&$sortedKeysMap, &$beforeKeys, &$afterKeys, &$flattenFunction) {
if (isset($beforeKeys[$value])) {
array_walk_recursive($beforeKeys[$value], $flattenFunction, $step);
unset($beforeKeys[$value]);
}
$sortedKeysMap[$step][] = $value;
if (isset($afterKeys[$value])) {
array_walk_recursive($afterKeys[$value], $flattenFunction, $step);
unset($afterKeys[$value]);
}
};
// 1st step: collect regular keys and process before / after if keys occurred
array_walk_recursive($startKeys, $flattenFunction, 0);
array_walk_recursive($middleKeys, $flattenFunction, 2);
array_walk_recursive($endKeys, $flattenFunction, 4);
// 2nd step: process before / after leftovers for unmatched keys
array_walk_recursive($beforeKeys, $flattenFunction, 1);
array_walk_recursive($afterKeys, $flattenFunction, 3);
ksort($sortedKeysMap);
return $sortedKeysMap;
} | [
"protected",
"function",
"generateSortedKeysMap",
"(",
")",
":",
"array",
"{",
"$",
"sortedKeysMap",
"=",
"[",
"]",
";",
"$",
"startKeys",
"=",
"$",
"this",
"->",
"startKeys",
";",
"$",
"middleKeys",
"=",
"$",
"this",
"->",
"middleKeys",
";",
"$",
"endKe... | Flattens start-, middle-, end-, before- and afterKeys to a single dimension and merges them together to a single array
@return array | [
"Flattens",
"start",
"-",
"middle",
"-",
"end",
"-",
"before",
"-",
"and",
"afterKeys",
"to",
"a",
"single",
"dimension",
"and",
"merges",
"them",
"together",
"to",
"a",
"single",
"array"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Arrays/Classes/PositionalArraySorter.php#L295-L327 |
neos/flow-development-collection | Neos.Cache/Classes/Frontend/AbstractFrontend.php | AbstractFrontend.has | public function has(string $entryIdentifier): bool
{
if (!$this->isValidEntryIdentifier($entryIdentifier)) {
throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233058486);
}
return $this->backend->has($entryIdentifier);
} | php | public function has(string $entryIdentifier): bool
{
if (!$this->isValidEntryIdentifier($entryIdentifier)) {
throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233058486);
}
return $this->backend->has($entryIdentifier);
} | [
"public",
"function",
"has",
"(",
"string",
"$",
"entryIdentifier",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidEntryIdentifier",
"(",
"$",
"entryIdentifier",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'\"'",... | Checks if a cache entry with the specified identifier exists.
@param string $entryIdentifier An identifier specifying the cache entry
@return boolean true if such an entry exists, false if not
@throws \InvalidArgumentException
@api | [
"Checks",
"if",
"a",
"cache",
"entry",
"with",
"the",
"specified",
"identifier",
"exists",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Frontend/AbstractFrontend.php#L97-L104 |
neos/flow-development-collection | Neos.Cache/Classes/Frontend/AbstractFrontend.php | AbstractFrontend.remove | public function remove(string $entryIdentifier): bool
{
if (!$this->isValidEntryIdentifier($entryIdentifier)) {
throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233058495);
}
return $this->backend->remove($entryIdentifier);
} | php | public function remove(string $entryIdentifier): bool
{
if (!$this->isValidEntryIdentifier($entryIdentifier)) {
throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233058495);
}
return $this->backend->remove($entryIdentifier);
} | [
"public",
"function",
"remove",
"(",
"string",
"$",
"entryIdentifier",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidEntryIdentifier",
"(",
"$",
"entryIdentifier",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'\"... | Removes the given cache entry from the cache.
@param string $entryIdentifier An identifier specifying the cache entry
@return boolean true if such an entry exists, false if not
@throws \InvalidArgumentException
@api | [
"Removes",
"the",
"given",
"cache",
"entry",
"from",
"the",
"cache",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Frontend/AbstractFrontend.php#L114-L121 |
neos/flow-development-collection | Neos.Cache/Classes/Frontend/AbstractFrontend.php | AbstractFrontend.flushByTag | public function flushByTag(string $tag): int
{
if (!$this->isValidTag($tag)) {
throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1233057359);
}
if ($this->backend instanceof TaggableBackendInterface) {
return $this->backend->flushByTag($tag);
}
return 0;
} | php | public function flushByTag(string $tag): int
{
if (!$this->isValidTag($tag)) {
throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1233057359);
}
if ($this->backend instanceof TaggableBackendInterface) {
return $this->backend->flushByTag($tag);
}
return 0;
} | [
"public",
"function",
"flushByTag",
"(",
"string",
"$",
"tag",
")",
":",
"int",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidTag",
"(",
"$",
"tag",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'\"'",
".",
"$",
"tag",
".",... | Removes all cache entries of this cache which are tagged by the specified tag.
@param string $tag The tag the entries must have
@return integer The number of entries which have been affected by this flush
@throws \InvalidArgumentException
@api | [
"Removes",
"all",
"cache",
"entries",
"of",
"this",
"cache",
"which",
"are",
"tagged",
"by",
"the",
"specified",
"tag",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Frontend/AbstractFrontend.php#L142-L151 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/ViewHelpers/Format/JsonViewHelper.php | JsonViewHelper.render | public function render()
{
$value = $this->arguments['value'];
if ($value === null) {
$value = $this->renderChildren();
}
$options = JSON_HEX_TAG;
if ($this->arguments['forceObject'] !== false) {
$options = $options | JSON_FORCE_OBJECT;
}
return json_encode($value, $options);
} | php | public function render()
{
$value = $this->arguments['value'];
if ($value === null) {
$value = $this->renderChildren();
}
$options = JSON_HEX_TAG;
if ($this->arguments['forceObject'] !== false) {
$options = $options | JSON_FORCE_OBJECT;
}
return json_encode($value, $options);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"arguments",
"[",
"'value'",
"]",
";",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"renderChildren",
"(",
")",
";",
"... | Outputs content with its JSON representation. To prevent issues in HTML context, occurrences
of greater-than or less-than characters are converted to their hexadecimal representations.
If $forceObject is true a JSON object is outputted even if the value is a non-associative array
Example: array('foo', 'bar') as input will not be ["foo","bar"] but {"0":"foo","1":"bar"}
@return string the JSON-encoded string.
@see http://www.php.net/manual/en/function.json-encode.php
@api | [
"Outputs",
"content",
"with",
"its",
"JSON",
"representation",
".",
"To",
"prevent",
"issues",
"in",
"HTML",
"context",
"occurrences",
"of",
"greater",
"-",
"than",
"or",
"less",
"-",
"than",
"characters",
"are",
"converted",
"to",
"their",
"hexadecimal",
"rep... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/Format/JsonViewHelper.php#L77-L90 |
neos/flow-development-collection | Neos.Flow.Log/Classes/Backend/NullBackend.php | NullBackend.append | public function append($message, $severity = 1, $additionalData = null, $packageKey = null, $className = null, $methodName = null)
{
} | php | public function append($message, $severity = 1, $additionalData = null, $packageKey = null, $className = null, $methodName = null)
{
} | [
"public",
"function",
"append",
"(",
"$",
"message",
",",
"$",
"severity",
"=",
"1",
",",
"$",
"additionalData",
"=",
"null",
",",
"$",
"packageKey",
"=",
"null",
",",
"$",
"className",
"=",
"null",
",",
"$",
"methodName",
"=",
"null",
")",
"{",
"}"
... | Ignores the call
@param string $message The message to log
@param integer $severity One of the LOG_* constants
@param mixed $additionalData A variable containing more information about the event to be logged
@param string $packageKey Key of the package triggering the log (determined automatically if not specified)
@param string $className Name of the class triggering the log (determined automatically if not specified)
@param string $methodName Name of the method triggering the log (determined automatically if not specified)
@return void
@api | [
"Ignores",
"the",
"call"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow.Log/Classes/Backend/NullBackend.php#L44-L46 |
neos/flow-development-collection | Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php | FileStorage.renderErrorInfo | protected function renderErrorInfo(\Throwable $error, array $additionalData = [])
{
$maximumDepth = 100;
$backTrace = $error->getTrace();
$message = $this->getErrorLogMessage($error);
$postMortemInfo = $message . PHP_EOL . PHP_EOL . $this->renderBacktrace($backTrace);
$depth = 0;
while (($error->getPrevious() instanceof \Throwable) && $depth < $maximumDepth) {
$error = $error->getPrevious();
$message = 'Previous exception: ' . $this->getErrorLogMessage($error);
$backTrace = $error->getTrace();
$postMortemInfo .= PHP_EOL . $message . PHP_EOL . PHP_EOL . $this->renderBacktrace($backTrace);
++$depth;
}
if ($depth === $maximumDepth) {
$postMortemInfo .= PHP_EOL . 'Maximum chainging depth reached ...';
}
$postMortemInfo .= PHP_EOL . $this->renderRequestInfo();
$postMortemInfo .= PHP_EOL;
$postMortemInfo .= empty($additionalData) ? '' : (new PlainTextFormatter($additionalData))->format();
return $postMortemInfo;
} | php | protected function renderErrorInfo(\Throwable $error, array $additionalData = [])
{
$maximumDepth = 100;
$backTrace = $error->getTrace();
$message = $this->getErrorLogMessage($error);
$postMortemInfo = $message . PHP_EOL . PHP_EOL . $this->renderBacktrace($backTrace);
$depth = 0;
while (($error->getPrevious() instanceof \Throwable) && $depth < $maximumDepth) {
$error = $error->getPrevious();
$message = 'Previous exception: ' . $this->getErrorLogMessage($error);
$backTrace = $error->getTrace();
$postMortemInfo .= PHP_EOL . $message . PHP_EOL . PHP_EOL . $this->renderBacktrace($backTrace);
++$depth;
}
if ($depth === $maximumDepth) {
$postMortemInfo .= PHP_EOL . 'Maximum chainging depth reached ...';
}
$postMortemInfo .= PHP_EOL . $this->renderRequestInfo();
$postMortemInfo .= PHP_EOL;
$postMortemInfo .= empty($additionalData) ? '' : (new PlainTextFormatter($additionalData))->format();
return $postMortemInfo;
} | [
"protected",
"function",
"renderErrorInfo",
"(",
"\\",
"Throwable",
"$",
"error",
",",
"array",
"$",
"additionalData",
"=",
"[",
"]",
")",
"{",
"$",
"maximumDepth",
"=",
"100",
";",
"$",
"backTrace",
"=",
"$",
"error",
"->",
"getTrace",
"(",
")",
";",
... | Get current error post mortem informations with support for error chaining
@param \Throwable $error
@param array $additionalData
@return string | [
"Get",
"current",
"error",
"post",
"mortem",
"informations",
"with",
"support",
"for",
"error",
"chaining"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php#L159-L183 |
neos/flow-development-collection | Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php | FileStorage.renderBacktrace | protected function renderBacktrace($backtrace)
{
$output = '';
if ($this->backtraceRenderer !== null) {
$output = $this->backtraceRenderer->__invoke($backtrace);
}
return $output;
} | php | protected function renderBacktrace($backtrace)
{
$output = '';
if ($this->backtraceRenderer !== null) {
$output = $this->backtraceRenderer->__invoke($backtrace);
}
return $output;
} | [
"protected",
"function",
"renderBacktrace",
"(",
"$",
"backtrace",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"backtraceRenderer",
"!==",
"null",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"backtraceRenderer",
"->",
"__i... | Renders background information about the circumstances of the exception.
@param array $backtrace
@return string | [
"Renders",
"background",
"information",
"about",
"the",
"circumstances",
"of",
"the",
"exception",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php#L204-L212 |
neos/flow-development-collection | Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php | FileStorage.renderRequestInfo | protected function renderRequestInfo()
{
$output = '';
if ($this->requestInformationRenderer !== null) {
$output = $this->requestInformationRenderer->__invoke();
}
return $output;
} | php | protected function renderRequestInfo()
{
$output = '';
if ($this->requestInformationRenderer !== null) {
$output = $this->requestInformationRenderer->__invoke();
}
return $output;
} | [
"protected",
"function",
"renderRequestInfo",
"(",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"requestInformationRenderer",
"!==",
"null",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"requestInformationRenderer",
"->",
"__inv... | Render information about the current request, if possible
@return string | [
"Render",
"information",
"about",
"the",
"current",
"request",
"if",
"possible"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php#L219-L227 |
neos/flow-development-collection | Neos.Flow/Classes/Session/Aspect/SessionObjectMethodsPointcutFilter.php | SessionObjectMethodsPointcutFilter.matches | public function matches($className, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier)
{
if ($methodName === null) {
return false;
}
$objectName = $this->objectManager->getObjectNameByClassName($className);
if (empty($objectName)) {
return false;
}
if ($this->objectManager->getScope($objectName) !== ObjectConfiguration::SCOPE_SESSION) {
return false;
}
if (preg_match('/^__wakeup|__construct|__destruct|__sleep|__serialize|__unserialize|__clone|shutdownObject|initializeObject|inject.*$/', $methodName) !== 0) {
return false;
}
return true;
} | php | public function matches($className, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier)
{
if ($methodName === null) {
return false;
}
$objectName = $this->objectManager->getObjectNameByClassName($className);
if (empty($objectName)) {
return false;
}
if ($this->objectManager->getScope($objectName) !== ObjectConfiguration::SCOPE_SESSION) {
return false;
}
if (preg_match('/^__wakeup|__construct|__destruct|__sleep|__serialize|__unserialize|__clone|shutdownObject|initializeObject|inject.*$/', $methodName) !== 0) {
return false;
}
return true;
} | [
"public",
"function",
"matches",
"(",
"$",
"className",
",",
"$",
"methodName",
",",
"$",
"methodDeclaringClassName",
",",
"$",
"pointcutQueryIdentifier",
")",
"{",
"if",
"(",
"$",
"methodName",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"$",
"o... | Checks if the specified class and method matches against the filter
@param string $className Name of the class to check against
@param string $methodName Name of the method to check against
@param string $methodDeclaringClassName Name of the class the method was originally declared in
@param mixed $pointcutQueryIdentifier Some identifier for this query - must at least differ from a previous identifier. Used for circular reference detection.
@return boolean true if the class / method match, otherwise false | [
"Checks",
"if",
"the",
"specified",
"class",
"and",
"method",
"matches",
"against",
"the",
"filter"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Session/Aspect/SessionObjectMethodsPointcutFilter.php#L50-L70 |
neos/flow-development-collection | Neos.Flow/Classes/Session/Aspect/SessionObjectMethodsPointcutFilter.php | SessionObjectMethodsPointcutFilter.reduceTargetClassNames | public function reduceTargetClassNames(ClassNameIndex $classNameIndex)
{
$sessionClasses = new ClassNameIndex();
$sessionClasses->setClassNames($this->objectManager->getClassNamesByScope(ObjectConfiguration::SCOPE_SESSION));
return $classNameIndex->intersect($sessionClasses);
} | php | public function reduceTargetClassNames(ClassNameIndex $classNameIndex)
{
$sessionClasses = new ClassNameIndex();
$sessionClasses->setClassNames($this->objectManager->getClassNamesByScope(ObjectConfiguration::SCOPE_SESSION));
return $classNameIndex->intersect($sessionClasses);
} | [
"public",
"function",
"reduceTargetClassNames",
"(",
"ClassNameIndex",
"$",
"classNameIndex",
")",
"{",
"$",
"sessionClasses",
"=",
"new",
"ClassNameIndex",
"(",
")",
";",
"$",
"sessionClasses",
"->",
"setClassNames",
"(",
"$",
"this",
"->",
"objectManager",
"->",... | This method is used to optimize the matching process.
@param ClassNameIndex $classNameIndex
@return ClassNameIndex | [
"This",
"method",
"is",
"used",
"to",
"optimize",
"the",
"matching",
"process",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Session/Aspect/SessionObjectMethodsPointcutFilter.php#L98-L103 |
neos/flow-development-collection | Neos.Flow/Classes/Command/PackageCommandController.php | PackageCommandController.createCommand | public function createCommand(string $packageKey, string $packageType = PackageInterface::DEFAULT_COMPOSER_TYPE)
{
if (!$this->packageManager->isPackageKeyValid($packageKey)) {
$this->outputLine('The package key "%s" is not valid.', [$packageKey]);
$this->quit(1);
}
if ($this->packageManager->isPackageAvailable($packageKey)) {
$this->outputLine('The package "%s" already exists.', [$packageKey]);
$this->quit(1);
}
if (!ComposerUtility::isFlowPackageType($packageType)) {
$this->outputLine('The package must be a Flow package, but "%s" is not a valid Flow package type.', [$packageType]);
$this->quit(1);
}
$package = $this->packageManager->createPackage($packageKey, ['type' => $packageType], null);
$this->outputLine('Created new package "' . $packageKey . '" at "' . $package->getPackagePath() . '".');
} | php | public function createCommand(string $packageKey, string $packageType = PackageInterface::DEFAULT_COMPOSER_TYPE)
{
if (!$this->packageManager->isPackageKeyValid($packageKey)) {
$this->outputLine('The package key "%s" is not valid.', [$packageKey]);
$this->quit(1);
}
if ($this->packageManager->isPackageAvailable($packageKey)) {
$this->outputLine('The package "%s" already exists.', [$packageKey]);
$this->quit(1);
}
if (!ComposerUtility::isFlowPackageType($packageType)) {
$this->outputLine('The package must be a Flow package, but "%s" is not a valid Flow package type.', [$packageType]);
$this->quit(1);
}
$package = $this->packageManager->createPackage($packageKey, ['type' => $packageType], null);
$this->outputLine('Created new package "' . $packageKey . '" at "' . $package->getPackagePath() . '".');
} | [
"public",
"function",
"createCommand",
"(",
"string",
"$",
"packageKey",
",",
"string",
"$",
"packageType",
"=",
"PackageInterface",
"::",
"DEFAULT_COMPOSER_TYPE",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"packageManager",
"->",
"isPackageKeyValid",
"(",
"$"... | Create a new package
This command creates a new package which contains only the mandatory
directories and files.
@Flow\FlushesCaches
@param string $packageKey The package key of the package to create
@param string $packageType The package type of the package to create
@return void
@see neos.kickstarter:kickstart:package | [
"Create",
"a",
"new",
"package"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/PackageCommandController.php#L84-L101 |
neos/flow-development-collection | Neos.Flow/Classes/Command/PackageCommandController.php | PackageCommandController.listCommand | public function listCommand(bool $loadingOrder = false)
{
$availablePackages = [];
$frozenPackages = [];
$longestPackageKey = 0;
$freezeSupported = $this->bootstrap->getContext()->isDevelopment();
foreach ($this->packageManager->getAvailablePackages() as $packageKey => $package) {
if (strlen($packageKey) > $longestPackageKey) {
$longestPackageKey = strlen($packageKey);
}
$availablePackages[$packageKey] = $package;
if ($this->packageManager->isPackageFrozen($packageKey)) {
$frozenPackages[$packageKey] = $package;
}
}
if ($loadingOrder === false) {
ksort($availablePackages);
}
$this->outputLine('PACKAGES:');
/** @var PackageInterface|PackageKeyAwareInterface $package */
foreach ($availablePackages as $package) {
$frozenState = ($freezeSupported && isset($frozenPackages[$package->getPackageKey()]) ? '* ' : ' ');
$this->outputLine(' ' . str_pad($package->getPackageKey(), $longestPackageKey + 3) . $frozenState . str_pad($package->getInstalledVersion(), 15));
}
if (count($frozenPackages) > 0 && $freezeSupported) {
$this->outputLine();
$this->outputLine(' * frozen package');
}
} | php | public function listCommand(bool $loadingOrder = false)
{
$availablePackages = [];
$frozenPackages = [];
$longestPackageKey = 0;
$freezeSupported = $this->bootstrap->getContext()->isDevelopment();
foreach ($this->packageManager->getAvailablePackages() as $packageKey => $package) {
if (strlen($packageKey) > $longestPackageKey) {
$longestPackageKey = strlen($packageKey);
}
$availablePackages[$packageKey] = $package;
if ($this->packageManager->isPackageFrozen($packageKey)) {
$frozenPackages[$packageKey] = $package;
}
}
if ($loadingOrder === false) {
ksort($availablePackages);
}
$this->outputLine('PACKAGES:');
/** @var PackageInterface|PackageKeyAwareInterface $package */
foreach ($availablePackages as $package) {
$frozenState = ($freezeSupported && isset($frozenPackages[$package->getPackageKey()]) ? '* ' : ' ');
$this->outputLine(' ' . str_pad($package->getPackageKey(), $longestPackageKey + 3) . $frozenState . str_pad($package->getInstalledVersion(), 15));
}
if (count($frozenPackages) > 0 && $freezeSupported) {
$this->outputLine();
$this->outputLine(' * frozen package');
}
} | [
"public",
"function",
"listCommand",
"(",
"bool",
"$",
"loadingOrder",
"=",
"false",
")",
"{",
"$",
"availablePackages",
"=",
"[",
"]",
";",
"$",
"frozenPackages",
"=",
"[",
"]",
";",
"$",
"longestPackageKey",
"=",
"0",
";",
"$",
"freezeSupported",
"=",
... | List available packages
Lists all locally available packages. Displays the package key, version and
package title.
@param boolean $loadingOrder The returned packages are ordered by their loading order.
@return void The list of packages
@see neos.flow:package:activate
@see neos.flow:package:deactivate | [
"List",
"available",
"packages"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/PackageCommandController.php#L114-L148 |
neos/flow-development-collection | Neos.Flow/Classes/Command/PackageCommandController.php | PackageCommandController.freezeCommand | public function freezeCommand(string $packageKey = 'all')
{
if (!$this->bootstrap->getContext()->isDevelopment()) {
$this->outputLine('Package freezing is only supported in Development context.');
$this->quit(3);
}
$packagesToFreeze = [];
if ($packageKey === 'all') {
foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
if (!$this->packageManager->isPackageFrozen($packageKey)) {
$packagesToFreeze[] = $packageKey;
}
}
if ($packagesToFreeze === []) {
$this->outputLine('Nothing to do, all packages were already frozen.');
$this->quit(0);
}
} elseif ($packageKey === 'blackberry') {
$this->outputLine('http://bit.ly/freeze-blackberry');
$this->quit(42);
} else {
if (!$this->packageManager->isPackageAvailable($packageKey)) {
$this->outputLine('Package "%s" is not available.', [$packageKey]);
$this->quit(2);
}
if ($this->packageManager->isPackageFrozen($packageKey)) {
$this->outputLine('Package "%s" was already frozen.', [$packageKey]);
$this->quit(0);
}
$packagesToFreeze = [$packageKey];
}
foreach ($packagesToFreeze as $packageKey) {
$this->packageManager->freezePackage($packageKey);
$this->outputLine('Froze package "%s".', [$packageKey]);
}
} | php | public function freezeCommand(string $packageKey = 'all')
{
if (!$this->bootstrap->getContext()->isDevelopment()) {
$this->outputLine('Package freezing is only supported in Development context.');
$this->quit(3);
}
$packagesToFreeze = [];
if ($packageKey === 'all') {
foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
if (!$this->packageManager->isPackageFrozen($packageKey)) {
$packagesToFreeze[] = $packageKey;
}
}
if ($packagesToFreeze === []) {
$this->outputLine('Nothing to do, all packages were already frozen.');
$this->quit(0);
}
} elseif ($packageKey === 'blackberry') {
$this->outputLine('http://bit.ly/freeze-blackberry');
$this->quit(42);
} else {
if (!$this->packageManager->isPackageAvailable($packageKey)) {
$this->outputLine('Package "%s" is not available.', [$packageKey]);
$this->quit(2);
}
if ($this->packageManager->isPackageFrozen($packageKey)) {
$this->outputLine('Package "%s" was already frozen.', [$packageKey]);
$this->quit(0);
}
$packagesToFreeze = [$packageKey];
}
foreach ($packagesToFreeze as $packageKey) {
$this->packageManager->freezePackage($packageKey);
$this->outputLine('Froze package "%s".', [$packageKey]);
}
} | [
"public",
"function",
"freezeCommand",
"(",
"string",
"$",
"packageKey",
"=",
"'all'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"bootstrap",
"->",
"getContext",
"(",
")",
"->",
"isDevelopment",
"(",
")",
")",
"{",
"$",
"this",
"->",
"outputLine",
"... | Freeze a package
This function marks a package as <b>frozen</b> in order to improve performance
in a development context. While a package is frozen, any modification of files
within that package won't be tracked and can lead to unexpected behavior.
File monitoring won't consider the given package. Further more, reflection
data for classes contained in the package is cached persistently and loaded
directly on the first request after caches have been flushed. The precompiled
reflection data is stored in the <b>Configuration</b> directory of the
respective package.
By specifying <b>all</b> as a package key, all currently frozen packages are
frozen (the default).
@param string $packageKey Key of the package to freeze
@return void
@see neos.flow:package:unfreeze
@see neos.flow:package:refreeze | [
"Freeze",
"a",
"package"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/PackageCommandController.php#L171-L211 |
neos/flow-development-collection | Neos.Flow/Classes/Command/PackageCommandController.php | PackageCommandController.unfreezeCommand | public function unfreezeCommand(string $packageKey = 'all')
{
if (!$this->bootstrap->getContext()->isDevelopment()) {
$this->outputLine('Package freezing is only supported in Development context.');
$this->quit(3);
}
$packagesToUnfreeze = [];
if ($packageKey === 'all') {
foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
if ($this->packageManager->isPackageFrozen($packageKey)) {
$packagesToUnfreeze[] = $packageKey;
}
}
if ($packagesToUnfreeze === []) {
$this->outputLine('Nothing to do, no packages were frozen.');
$this->quit(0);
}
} else {
if ($packageKey === null) {
$this->outputLine('You must specify a package to unfreeze.');
$this->quit(1);
}
if (!$this->packageManager->isPackageAvailable($packageKey)) {
$this->outputLine('Package "%s" is not available.', [$packageKey]);
$this->quit(2);
}
if (!$this->packageManager->isPackageFrozen($packageKey)) {
$this->outputLine('Package "%s" was not frozen.', [$packageKey]);
$this->quit(0);
}
$packagesToUnfreeze = [$packageKey];
}
foreach ($packagesToUnfreeze as $packageKey) {
$this->packageManager->unfreezePackage($packageKey);
$this->outputLine('Unfroze package "%s".', [$packageKey]);
}
} | php | public function unfreezeCommand(string $packageKey = 'all')
{
if (!$this->bootstrap->getContext()->isDevelopment()) {
$this->outputLine('Package freezing is only supported in Development context.');
$this->quit(3);
}
$packagesToUnfreeze = [];
if ($packageKey === 'all') {
foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
if ($this->packageManager->isPackageFrozen($packageKey)) {
$packagesToUnfreeze[] = $packageKey;
}
}
if ($packagesToUnfreeze === []) {
$this->outputLine('Nothing to do, no packages were frozen.');
$this->quit(0);
}
} else {
if ($packageKey === null) {
$this->outputLine('You must specify a package to unfreeze.');
$this->quit(1);
}
if (!$this->packageManager->isPackageAvailable($packageKey)) {
$this->outputLine('Package "%s" is not available.', [$packageKey]);
$this->quit(2);
}
if (!$this->packageManager->isPackageFrozen($packageKey)) {
$this->outputLine('Package "%s" was not frozen.', [$packageKey]);
$this->quit(0);
}
$packagesToUnfreeze = [$packageKey];
}
foreach ($packagesToUnfreeze as $packageKey) {
$this->packageManager->unfreezePackage($packageKey);
$this->outputLine('Unfroze package "%s".', [$packageKey]);
}
} | [
"public",
"function",
"unfreezeCommand",
"(",
"string",
"$",
"packageKey",
"=",
"'all'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"bootstrap",
"->",
"getContext",
"(",
")",
"->",
"isDevelopment",
"(",
")",
")",
"{",
"$",
"this",
"->",
"outputLine",
... | Unfreeze a package
Unfreezes a previously frozen package. On the next request, this package will
be considered again by the file monitoring and related services – if they are
enabled in the current context.
By specifying <b>all</b> as a package key, all currently frozen packages are
unfrozen (the default).
@param string $packageKey Key of the package to unfreeze, or 'all'
@return void
@see neos.flow:package:freeze
@see neos.flow:cache:flush | [
"Unfreeze",
"a",
"package"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/PackageCommandController.php#L228-L268 |
neos/flow-development-collection | Neos.Flow/Classes/Command/PackageCommandController.php | PackageCommandController.refreezeCommand | public function refreezeCommand(string $packageKey = 'all')
{
if (!$this->bootstrap->getContext()->isDevelopment()) {
$this->outputLine('Package freezing is only supported in Development context.');
$this->quit(3);
}
$packagesToRefreeze = [];
if ($packageKey === 'all') {
foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
if ($this->packageManager->isPackageFrozen($packageKey)) {
$packagesToRefreeze[] = $packageKey;
}
}
if ($packagesToRefreeze === []) {
$this->outputLine('Nothing to do, no packages were frozen.');
$this->quit(0);
}
} else {
if ($packageKey === null) {
$this->outputLine('You must specify a package to refreeze.');
$this->quit(1);
}
if (!$this->packageManager->isPackageAvailable($packageKey)) {
$this->outputLine('Package "%s" is not available.', [$packageKey]);
$this->quit(2);
}
if (!$this->packageManager->isPackageFrozen($packageKey)) {
$this->outputLine('Package "%s" was not frozen.', [$packageKey]);
$this->quit(0);
}
$packagesToRefreeze = [$packageKey];
}
foreach ($packagesToRefreeze as $packageKey) {
$this->packageManager->refreezePackage($packageKey);
$this->outputLine('Refroze package "%s".', [$packageKey]);
}
Scripts::executeCommand('neos.flow:cache:flush', $this->settings, false);
$this->sendAndExit(0);
} | php | public function refreezeCommand(string $packageKey = 'all')
{
if (!$this->bootstrap->getContext()->isDevelopment()) {
$this->outputLine('Package freezing is only supported in Development context.');
$this->quit(3);
}
$packagesToRefreeze = [];
if ($packageKey === 'all') {
foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
if ($this->packageManager->isPackageFrozen($packageKey)) {
$packagesToRefreeze[] = $packageKey;
}
}
if ($packagesToRefreeze === []) {
$this->outputLine('Nothing to do, no packages were frozen.');
$this->quit(0);
}
} else {
if ($packageKey === null) {
$this->outputLine('You must specify a package to refreeze.');
$this->quit(1);
}
if (!$this->packageManager->isPackageAvailable($packageKey)) {
$this->outputLine('Package "%s" is not available.', [$packageKey]);
$this->quit(2);
}
if (!$this->packageManager->isPackageFrozen($packageKey)) {
$this->outputLine('Package "%s" was not frozen.', [$packageKey]);
$this->quit(0);
}
$packagesToRefreeze = [$packageKey];
}
foreach ($packagesToRefreeze as $packageKey) {
$this->packageManager->refreezePackage($packageKey);
$this->outputLine('Refroze package "%s".', [$packageKey]);
}
Scripts::executeCommand('neos.flow:cache:flush', $this->settings, false);
$this->sendAndExit(0);
} | [
"public",
"function",
"refreezeCommand",
"(",
"string",
"$",
"packageKey",
"=",
"'all'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"bootstrap",
"->",
"getContext",
"(",
")",
"->",
"isDevelopment",
"(",
")",
")",
"{",
"$",
"this",
"->",
"outputLine",
... | Refreeze a package
Refreezes a currently frozen package: all precompiled information is removed
and file monitoring will consider the package exactly once, on the next
request. After that request, the package remains frozen again, just with the
updated data.
By specifying <b>all</b> as a package key, all currently frozen packages are
refrozen (the default).
@param string $packageKey Key of the package to refreeze, or 'all'
@return void
@see neos.flow:package:freeze
@see neos.flow:cache:flush | [
"Refreeze",
"a",
"package"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/PackageCommandController.php#L286-L329 |
neos/flow-development-collection | Neos.Flow/Classes/Command/PackageCommandController.php | PackageCommandController.rescanCommand | public function rescanCommand()
{
$packageStates = $this->packageManager->rescanPackages();
$this->outputLine('The following packages are registered and will be loaded in this order:');
$this->outputLine('');
foreach ($packageStates['packages'] as $composerName => $packageState) {
$this->outputLine($composerName);
}
$this->outputLine('');
$this->outputLine('Package rescan successful.');
} | php | public function rescanCommand()
{
$packageStates = $this->packageManager->rescanPackages();
$this->outputLine('The following packages are registered and will be loaded in this order:');
$this->outputLine('');
foreach ($packageStates['packages'] as $composerName => $packageState) {
$this->outputLine($composerName);
}
$this->outputLine('');
$this->outputLine('Package rescan successful.');
} | [
"public",
"function",
"rescanCommand",
"(",
")",
"{",
"$",
"packageStates",
"=",
"$",
"this",
"->",
"packageManager",
"->",
"rescanPackages",
"(",
")",
";",
"$",
"this",
"->",
"outputLine",
"(",
"'The following packages are registered and will be loaded in this order:'"... | Rescan package availability and recreates the PackageStates configuration. | [
"Rescan",
"package",
"availability",
"and",
"recreates",
"the",
"PackageStates",
"configuration",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/PackageCommandController.php#L334-L345 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.getResult | public function getResult()
{
try {
$query = $this->queryBuilder->getQuery();
if ($this->cacheResult === true || $this->settings['cacheAllQueryResults']) {
$query->useResultCache(true);
}
return $query->getResult();
} catch (\Doctrine\ORM\ORMException $ormException) {
$message = $this->throwableStorage->logThrowable($ormException);
$this->logger->error($message, LogEnvironment::fromMethodName(__METHOD__));
return [];
} catch (\Doctrine\DBAL\DBALException $dbalException) {
$message = $this->throwableStorage->logThrowable($dbalException);
$this->logger->debug($message);
if (stripos($dbalException->getMessage(), 'no database selected') !== false) {
$message = 'No database name was specified in the configuration.';
$exception = new Exception\DatabaseConnectionException($message, $dbalException->getCode());
} elseif (stripos($dbalException->getMessage(), 'table') !== false && stripos($dbalException->getMessage(), 'not') !== false && stripos($dbalException->getMessage(), 'exist') !== false) {
$message = 'A table or view seems to be missing from the database.';
$exception = new Exception\DatabaseStructureException($message, $dbalException->getCode());
} else {
$message = 'An error occurred in the Database Abstraction Layer.';
$exception = new Exception\DatabaseException($message, $dbalException->getCode());
}
throw $exception;
} catch (\PDOException $pdoException) {
$message = $this->throwableStorage->logThrowable($pdoException);
$this->logger->error($message, LogEnvironment::fromMethodName(__METHOD__));
if (stripos($pdoException->getMessage(), 'unknown database') !== false
|| (stripos($pdoException->getMessage(), 'database') !== false && strpos($pdoException->getMessage(), 'not') !== false && strpos($pdoException->getMessage(), 'exist') !== false)) {
$message = 'The database which was specified in the configuration does not exist.';
$exception = new Exception\DatabaseConnectionException($message, $pdoException->getCode());
} elseif (stripos($pdoException->getMessage(), 'access denied') !== false
|| stripos($pdoException->getMessage(), 'connection refused') !== false) {
$message = 'The database username / password specified in the configuration seem to be wrong.';
$exception = new Exception\DatabaseConnectionException($message, $pdoException->getCode());
} else {
$message = 'An error occurred while using the PDO Driver: ' . $pdoException->getMessage();
$exception = new Exception\DatabaseException($message, $pdoException->getCode());
}
throw $exception;
}
} | php | public function getResult()
{
try {
$query = $this->queryBuilder->getQuery();
if ($this->cacheResult === true || $this->settings['cacheAllQueryResults']) {
$query->useResultCache(true);
}
return $query->getResult();
} catch (\Doctrine\ORM\ORMException $ormException) {
$message = $this->throwableStorage->logThrowable($ormException);
$this->logger->error($message, LogEnvironment::fromMethodName(__METHOD__));
return [];
} catch (\Doctrine\DBAL\DBALException $dbalException) {
$message = $this->throwableStorage->logThrowable($dbalException);
$this->logger->debug($message);
if (stripos($dbalException->getMessage(), 'no database selected') !== false) {
$message = 'No database name was specified in the configuration.';
$exception = new Exception\DatabaseConnectionException($message, $dbalException->getCode());
} elseif (stripos($dbalException->getMessage(), 'table') !== false && stripos($dbalException->getMessage(), 'not') !== false && stripos($dbalException->getMessage(), 'exist') !== false) {
$message = 'A table or view seems to be missing from the database.';
$exception = new Exception\DatabaseStructureException($message, $dbalException->getCode());
} else {
$message = 'An error occurred in the Database Abstraction Layer.';
$exception = new Exception\DatabaseException($message, $dbalException->getCode());
}
throw $exception;
} catch (\PDOException $pdoException) {
$message = $this->throwableStorage->logThrowable($pdoException);
$this->logger->error($message, LogEnvironment::fromMethodName(__METHOD__));
if (stripos($pdoException->getMessage(), 'unknown database') !== false
|| (stripos($pdoException->getMessage(), 'database') !== false && strpos($pdoException->getMessage(), 'not') !== false && strpos($pdoException->getMessage(), 'exist') !== false)) {
$message = 'The database which was specified in the configuration does not exist.';
$exception = new Exception\DatabaseConnectionException($message, $pdoException->getCode());
} elseif (stripos($pdoException->getMessage(), 'access denied') !== false
|| stripos($pdoException->getMessage(), 'connection refused') !== false) {
$message = 'The database username / password specified in the configuration seem to be wrong.';
$exception = new Exception\DatabaseConnectionException($message, $pdoException->getCode());
} else {
$message = 'An error occurred while using the PDO Driver: ' . $pdoException->getMessage();
$exception = new Exception\DatabaseException($message, $pdoException->getCode());
}
throw $exception;
}
} | [
"public",
"function",
"getResult",
"(",
")",
"{",
"try",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"queryBuilder",
"->",
"getQuery",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"cacheResult",
"===",
"true",
"||",
"$",
"this",
"->",
"settings",
"[",... | Gets the results of this query as array.
Really executes the query on the database.
This should only ever be executed from the QueryResult class.
@return array result set
@throws Exception\DatabaseException
@throws Exception\DatabaseConnectionException
@throws Exception\DatabaseStructureException | [
"Gets",
"the",
"results",
"of",
"this",
"query",
"as",
"array",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L186-L233 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.count | public function count()
{
try {
$originalQuery = $this->queryBuilder->getQuery();
$dqlQuery = clone $originalQuery;
$dqlQuery->setParameters($originalQuery->getParameters());
$dqlQuery->setHint(\Doctrine\ORM\Query::HINT_CUSTOM_TREE_WALKERS, [CountWalker::class]);
$offset = $dqlQuery->getFirstResult();
$limit = $dqlQuery->getMaxResults();
if ($offset !== null) {
$dqlQuery->setFirstResult(null);
}
$numberOfResults = (int)$dqlQuery->getSingleScalarResult();
if ($offset !== null) {
$numberOfResults = max(0, $numberOfResults - $offset);
}
if ($limit !== null) {
$numberOfResults = min($numberOfResults, $limit);
}
return $numberOfResults;
} catch (\Doctrine\ORM\ORMException $ormException) {
$message = $this->throwableStorage->logThrowable($ormException);
$this->logger->error($message, LogEnvironment::fromMethodName(__METHOD__));
return 0;
} catch (\PDOException $pdoException) {
throw new Exception\DatabaseConnectionException($pdoException->getMessage(), $pdoException->getCode());
}
} | php | public function count()
{
try {
$originalQuery = $this->queryBuilder->getQuery();
$dqlQuery = clone $originalQuery;
$dqlQuery->setParameters($originalQuery->getParameters());
$dqlQuery->setHint(\Doctrine\ORM\Query::HINT_CUSTOM_TREE_WALKERS, [CountWalker::class]);
$offset = $dqlQuery->getFirstResult();
$limit = $dqlQuery->getMaxResults();
if ($offset !== null) {
$dqlQuery->setFirstResult(null);
}
$numberOfResults = (int)$dqlQuery->getSingleScalarResult();
if ($offset !== null) {
$numberOfResults = max(0, $numberOfResults - $offset);
}
if ($limit !== null) {
$numberOfResults = min($numberOfResults, $limit);
}
return $numberOfResults;
} catch (\Doctrine\ORM\ORMException $ormException) {
$message = $this->throwableStorage->logThrowable($ormException);
$this->logger->error($message, LogEnvironment::fromMethodName(__METHOD__));
return 0;
} catch (\PDOException $pdoException) {
throw new Exception\DatabaseConnectionException($pdoException->getMessage(), $pdoException->getCode());
}
} | [
"public",
"function",
"count",
"(",
")",
"{",
"try",
"{",
"$",
"originalQuery",
"=",
"$",
"this",
"->",
"queryBuilder",
"->",
"getQuery",
"(",
")",
";",
"$",
"dqlQuery",
"=",
"clone",
"$",
"originalQuery",
";",
"$",
"dqlQuery",
"->",
"setParameters",
"("... | Returns the query result count
@return integer The query result count
@throws Exception\DatabaseConnectionException
@api | [
"Returns",
"the",
"query",
"result",
"count"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L242-L269 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.setOrderings | public function setOrderings(array $orderings)
{
$this->orderings = $orderings;
$this->queryBuilder->resetDQLPart('orderBy');
foreach ($this->orderings as $propertyName => $order) {
$this->queryBuilder->addOrderBy($this->getPropertyNameWithAlias($propertyName), $order);
}
return $this;
} | php | public function setOrderings(array $orderings)
{
$this->orderings = $orderings;
$this->queryBuilder->resetDQLPart('orderBy');
foreach ($this->orderings as $propertyName => $order) {
$this->queryBuilder->addOrderBy($this->getPropertyNameWithAlias($propertyName), $order);
}
return $this;
} | [
"public",
"function",
"setOrderings",
"(",
"array",
"$",
"orderings",
")",
"{",
"$",
"this",
"->",
"orderings",
"=",
"$",
"orderings",
";",
"$",
"this",
"->",
"queryBuilder",
"->",
"resetDQLPart",
"(",
"'orderBy'",
")",
";",
"foreach",
"(",
"$",
"this",
... | Sets the property names to order the result by. Expected like this:
array(
'foo' => \Neos\Flow\Persistence\QueryInterface::ORDER_ASCENDING,
'bar' => \Neos\Flow\Persistence\QueryInterface::ORDER_DESCENDING
)
@param array $orderings The property names to order by
@return QueryInterface
@api | [
"Sets",
"the",
"property",
"names",
"to",
"order",
"the",
"result",
"by",
".",
"Expected",
"like",
"this",
":",
"array",
"(",
"foo",
"=",
">",
"\\",
"Neos",
"\\",
"Flow",
"\\",
"Persistence",
"\\",
"QueryInterface",
"::",
"ORDER_ASCENDING",
"bar",
"=",
"... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L282-L290 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.setLimit | public function setLimit($limit)
{
$this->limit = $limit;
$this->queryBuilder->setMaxResults($limit);
return $this;
} | php | public function setLimit($limit)
{
$this->limit = $limit;
$this->queryBuilder->setMaxResults($limit);
return $this;
} | [
"public",
"function",
"setLimit",
"(",
"$",
"limit",
")",
"{",
"$",
"this",
"->",
"limit",
"=",
"$",
"limit",
";",
"$",
"this",
"->",
"queryBuilder",
"->",
"setMaxResults",
"(",
"$",
"limit",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the maximum size of the result set to limit. Returns $this to allow
for chaining (fluid interface)
@param integer $limit
@return QueryInterface
@api | [
"Sets",
"the",
"maximum",
"size",
"of",
"the",
"result",
"set",
"to",
"limit",
".",
"Returns",
"$this",
"to",
"allow",
"for",
"chaining",
"(",
"fluid",
"interface",
")"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L315-L320 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.setDistinct | public function setDistinct($distinct = true)
{
$this->distinct = $distinct;
$this->queryBuilder->distinct($distinct);
return $this;
} | php | public function setDistinct($distinct = true)
{
$this->distinct = $distinct;
$this->queryBuilder->distinct($distinct);
return $this;
} | [
"public",
"function",
"setDistinct",
"(",
"$",
"distinct",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"distinct",
"=",
"$",
"distinct",
";",
"$",
"this",
"->",
"queryBuilder",
"->",
"distinct",
"(",
"$",
"distinct",
")",
";",
"return",
"$",
"this",
";",... | Sets the DISTINCT flag for this query.
@param boolean $distinct
@return QueryInterface
@api | [
"Sets",
"the",
"DISTINCT",
"flag",
"for",
"this",
"query",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L340-L345 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.setOffset | public function setOffset($offset)
{
$this->offset = $offset;
$this->queryBuilder->setFirstResult($offset);
return $this;
} | php | public function setOffset($offset)
{
$this->offset = $offset;
$this->queryBuilder->setFirstResult($offset);
return $this;
} | [
"public",
"function",
"setOffset",
"(",
"$",
"offset",
")",
"{",
"$",
"this",
"->",
"offset",
"=",
"$",
"offset",
";",
"$",
"this",
"->",
"queryBuilder",
"->",
"setFirstResult",
"(",
"$",
"offset",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the start offset of the result set to offset. Returns $this to
allow for chaining (fluid interface)
@param integer $offset
@return QueryInterface
@api | [
"Sets",
"the",
"start",
"offset",
"of",
"the",
"result",
"set",
"to",
"offset",
".",
"Returns",
"$this",
"to",
"allow",
"for",
"chaining",
"(",
"fluid",
"interface",
")"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L366-L371 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.matching | public function matching($constraint)
{
$this->constraint = $constraint;
$this->queryBuilder->where($constraint);
return $this;
} | php | public function matching($constraint)
{
$this->constraint = $constraint;
$this->queryBuilder->where($constraint);
return $this;
} | [
"public",
"function",
"matching",
"(",
"$",
"constraint",
")",
"{",
"$",
"this",
"->",
"constraint",
"=",
"$",
"constraint",
";",
"$",
"this",
"->",
"queryBuilder",
"->",
"where",
"(",
"$",
"constraint",
")",
";",
"return",
"$",
"this",
";",
"}"
] | The constraint used to limit the result set. Returns $this to allow
for chaining (fluid interface)
@param object $constraint Some constraint, depending on the backend
@return QueryInterface
@api | [
"The",
"constraint",
"used",
"to",
"limit",
"the",
"result",
"set",
".",
"Returns",
"$this",
"to",
"allow",
"for",
"chaining",
"(",
"fluid",
"interface",
")"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L392-L397 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.logicalOr | public function logicalOr($constraint1)
{
if (is_array($constraint1)) {
$constraints = $constraint1;
} else {
$constraints = func_get_args();
}
return call_user_func_array([$this->queryBuilder->expr(), 'orX'], $constraints);
} | php | public function logicalOr($constraint1)
{
if (is_array($constraint1)) {
$constraints = $constraint1;
} else {
$constraints = func_get_args();
}
return call_user_func_array([$this->queryBuilder->expr(), 'orX'], $constraints);
} | [
"public",
"function",
"logicalOr",
"(",
"$",
"constraint1",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"constraint1",
")",
")",
"{",
"$",
"constraints",
"=",
"$",
"constraint1",
";",
"}",
"else",
"{",
"$",
"constraints",
"=",
"func_get_args",
"(",
")",
... | Performs a logical disjunction of the two given constraints. The method
takes one or more constraints and concatenates them with a boolean OR.
It also accepts a single array of constraints to be concatenated.
@param mixed $constraint1 The first of multiple constraints or an array of constraints.
@return object
@api | [
"Performs",
"a",
"logical",
"disjunction",
"of",
"the",
"two",
"given",
"constraints",
".",
"The",
"method",
"takes",
"one",
"or",
"more",
"constraints",
"and",
"concatenates",
"them",
"with",
"a",
"boolean",
"OR",
".",
"It",
"also",
"accepts",
"a",
"single"... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L438-L446 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.equals | public function equals($propertyName, $operand, $caseSensitive = true)
{
$aliasedPropertyName = $this->getPropertyNameWithAlias($propertyName);
if ($operand === null) {
return $this->queryBuilder->expr()->isNull($aliasedPropertyName);
}
if ($caseSensitive === true) {
return $this->queryBuilder->expr()->eq($aliasedPropertyName, $this->getParamNeedle($operand));
}
return $this->queryBuilder->expr()->eq($this->queryBuilder->expr()->lower($aliasedPropertyName), $this->getParamNeedle(UnicodeFunctions::strtolower($operand)));
} | php | public function equals($propertyName, $operand, $caseSensitive = true)
{
$aliasedPropertyName = $this->getPropertyNameWithAlias($propertyName);
if ($operand === null) {
return $this->queryBuilder->expr()->isNull($aliasedPropertyName);
}
if ($caseSensitive === true) {
return $this->queryBuilder->expr()->eq($aliasedPropertyName, $this->getParamNeedle($operand));
}
return $this->queryBuilder->expr()->eq($this->queryBuilder->expr()->lower($aliasedPropertyName), $this->getParamNeedle(UnicodeFunctions::strtolower($operand)));
} | [
"public",
"function",
"equals",
"(",
"$",
"propertyName",
",",
"$",
"operand",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"$",
"aliasedPropertyName",
"=",
"$",
"this",
"->",
"getPropertyNameWithAlias",
"(",
"$",
"propertyName",
")",
";",
"if",
"(",
... | Returns an equals criterion used for matching objects against a query.
It matches if the $operand equals the value of the property named
$propertyName. If $operand is NULL a strict check for NULL is done. For
strings the comparison can be done with or without case-sensitivity.
Note: case-sensitivity is only possible if the database supports it. E.g.
if you are using MySQL with a case-insensitive collation you will not be able
to test for case-sensitive equality (the other way around works, because we
compare lowercased values).
@param string $propertyName The name of the property to compare against
@param mixed $operand The value to compare with
@param boolean $caseSensitive Whether the equality test should be done case-sensitive for strings
@return object
@api | [
"Returns",
"an",
"equals",
"criterion",
"used",
"for",
"matching",
"objects",
"against",
"a",
"query",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L478-L490 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.like | public function like($propertyName, $operand, $caseSensitive = true)
{
$aliasedPropertyName = $this->getPropertyNameWithAlias($propertyName);
if ($caseSensitive === true) {
return $this->queryBuilder->expr()->like($aliasedPropertyName, $this->getParamNeedle($operand));
}
return $this->queryBuilder->expr()->like($this->queryBuilder->expr()->lower($aliasedPropertyName), $this->getParamNeedle(UnicodeFunctions::strtolower($operand)));
} | php | public function like($propertyName, $operand, $caseSensitive = true)
{
$aliasedPropertyName = $this->getPropertyNameWithAlias($propertyName);
if ($caseSensitive === true) {
return $this->queryBuilder->expr()->like($aliasedPropertyName, $this->getParamNeedle($operand));
}
return $this->queryBuilder->expr()->like($this->queryBuilder->expr()->lower($aliasedPropertyName), $this->getParamNeedle(UnicodeFunctions::strtolower($operand)));
} | [
"public",
"function",
"like",
"(",
"$",
"propertyName",
",",
"$",
"operand",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"$",
"aliasedPropertyName",
"=",
"$",
"this",
"->",
"getPropertyNameWithAlias",
"(",
"$",
"propertyName",
")",
";",
"if",
"(",
"$... | Returns a like criterion used for matching objects against a query.
Matches if the property named $propertyName is like the $operand, using
standard SQL wildcards.
@param string $propertyName The name of the property to compare against
@param string $operand The value to compare with
@param boolean $caseSensitive Whether the matching should be done case-sensitive
@return object
@throws InvalidQueryException if used on a non-string property
@api | [
"Returns",
"a",
"like",
"criterion",
"used",
"for",
"matching",
"objects",
"against",
"a",
"query",
".",
"Matches",
"if",
"the",
"property",
"named",
"$propertyName",
"is",
"like",
"the",
"$operand",
"using",
"standard",
"SQL",
"wildcards",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L504-L512 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.in | public function in($propertyName, $operand)
{
// Take care: In cannot be needled at the moment! DQL escapes it, but only as literals, making caching a bit harder.
// This is a todo for Doctrine 2.1
return $this->queryBuilder->expr()->in($this->getPropertyNameWithAlias($propertyName), $operand);
} | php | public function in($propertyName, $operand)
{
// Take care: In cannot be needled at the moment! DQL escapes it, but only as literals, making caching a bit harder.
// This is a todo for Doctrine 2.1
return $this->queryBuilder->expr()->in($this->getPropertyNameWithAlias($propertyName), $operand);
} | [
"public",
"function",
"in",
"(",
"$",
"propertyName",
",",
"$",
"operand",
")",
"{",
"// Take care: In cannot be needled at the moment! DQL escapes it, but only as literals, making caching a bit harder.",
"// This is a todo for Doctrine 2.1",
"return",
"$",
"this",
"->",
"queryBuil... | Returns an "in" criterion used for matching objects against a query. It
matches if the property's value is contained in the multivalued operand.
@param string $propertyName The name of the property to compare against
@param mixed $operand The value to compare with, multivalued
@return object
@throws InvalidQueryException if used on a multi-valued property
@api | [
"Returns",
"an",
"in",
"criterion",
"used",
"for",
"matching",
"objects",
"against",
"a",
"query",
".",
"It",
"matches",
"if",
"the",
"property",
"s",
"value",
"is",
"contained",
"in",
"the",
"multivalued",
"operand",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L555-L560 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.lessThan | public function lessThan($propertyName, $operand)
{
return $this->queryBuilder->expr()->lt($this->getPropertyNameWithAlias($propertyName), $this->getParamNeedle($operand));
} | php | public function lessThan($propertyName, $operand)
{
return $this->queryBuilder->expr()->lt($this->getPropertyNameWithAlias($propertyName), $this->getParamNeedle($operand));
} | [
"public",
"function",
"lessThan",
"(",
"$",
"propertyName",
",",
"$",
"operand",
")",
"{",
"return",
"$",
"this",
"->",
"queryBuilder",
"->",
"expr",
"(",
")",
"->",
"lt",
"(",
"$",
"this",
"->",
"getPropertyNameWithAlias",
"(",
"$",
"propertyName",
")",
... | Returns a less than criterion used for matching objects against a query
@param string $propertyName The name of the property to compare against
@param mixed $operand The value to compare with
@return object
@throws InvalidQueryException if used on a multi-valued property or with a non-literal/non-DateTime operand
@api | [
"Returns",
"a",
"less",
"than",
"criterion",
"used",
"for",
"matching",
"objects",
"against",
"a",
"query"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L571-L574 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.lessThanOrEqual | public function lessThanOrEqual($propertyName, $operand)
{
return $this->queryBuilder->expr()->lte($this->getPropertyNameWithAlias($propertyName), $this->getParamNeedle($operand));
} | php | public function lessThanOrEqual($propertyName, $operand)
{
return $this->queryBuilder->expr()->lte($this->getPropertyNameWithAlias($propertyName), $this->getParamNeedle($operand));
} | [
"public",
"function",
"lessThanOrEqual",
"(",
"$",
"propertyName",
",",
"$",
"operand",
")",
"{",
"return",
"$",
"this",
"->",
"queryBuilder",
"->",
"expr",
"(",
")",
"->",
"lte",
"(",
"$",
"this",
"->",
"getPropertyNameWithAlias",
"(",
"$",
"propertyName",
... | Returns a less or equal than criterion used for matching objects against a query
@param string $propertyName The name of the property to compare against
@param mixed $operand The value to compare with
@return object
@throws InvalidQueryException if used on a multi-valued property or with a non-literal/non-DateTime operand
@api | [
"Returns",
"a",
"less",
"or",
"equal",
"than",
"criterion",
"used",
"for",
"matching",
"objects",
"against",
"a",
"query"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L585-L588 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.greaterThan | public function greaterThan($propertyName, $operand)
{
return $this->queryBuilder->expr()->gt($this->getPropertyNameWithAlias($propertyName), $this->getParamNeedle($operand));
} | php | public function greaterThan($propertyName, $operand)
{
return $this->queryBuilder->expr()->gt($this->getPropertyNameWithAlias($propertyName), $this->getParamNeedle($operand));
} | [
"public",
"function",
"greaterThan",
"(",
"$",
"propertyName",
",",
"$",
"operand",
")",
"{",
"return",
"$",
"this",
"->",
"queryBuilder",
"->",
"expr",
"(",
")",
"->",
"gt",
"(",
"$",
"this",
"->",
"getPropertyNameWithAlias",
"(",
"$",
"propertyName",
")"... | Returns a greater than criterion used for matching objects against a query
@param string $propertyName The name of the property to compare against
@param mixed $operand The value to compare with
@return object
@throws InvalidQueryException if used on a multi-valued property or with a non-literal/non-DateTime operand
@api | [
"Returns",
"a",
"greater",
"than",
"criterion",
"used",
"for",
"matching",
"objects",
"against",
"a",
"query"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L599-L602 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.greaterThanOrEqual | public function greaterThanOrEqual($propertyName, $operand)
{
return $this->queryBuilder->expr()->gte($this->getPropertyNameWithAlias($propertyName), $this->getParamNeedle($operand));
} | php | public function greaterThanOrEqual($propertyName, $operand)
{
return $this->queryBuilder->expr()->gte($this->getPropertyNameWithAlias($propertyName), $this->getParamNeedle($operand));
} | [
"public",
"function",
"greaterThanOrEqual",
"(",
"$",
"propertyName",
",",
"$",
"operand",
")",
"{",
"return",
"$",
"this",
"->",
"queryBuilder",
"->",
"expr",
"(",
")",
"->",
"gte",
"(",
"$",
"this",
"->",
"getPropertyNameWithAlias",
"(",
"$",
"propertyName... | Returns a greater than or equal criterion used for matching objects against a query
@param string $propertyName The name of the property to compare against
@param mixed $operand The value to compare with
@return object
@throws InvalidQueryException if used on a multi-valued property or with a non-literal/non-DateTime operand
@api | [
"Returns",
"a",
"greater",
"than",
"or",
"equal",
"criterion",
"used",
"for",
"matching",
"objects",
"against",
"a",
"query"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L613-L616 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.addParameters | public function addParameters($parameters)
{
foreach ($parameters as $parameter) {
$index = $this->parameterIndex++;
$this->queryBuilder->setParameter($index, $parameter);
}
} | php | public function addParameters($parameters)
{
foreach ($parameters as $parameter) {
$index = $this->parameterIndex++;
$this->queryBuilder->setParameter($index, $parameter);
}
} | [
"public",
"function",
"addParameters",
"(",
"$",
"parameters",
")",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"parameter",
")",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"parameterIndex",
"++",
";",
"$",
"this",
"->",
"queryBuilder",
"->",
"set... | Add parameters to the query
@param array $parameters
@return void | [
"Add",
"parameters",
"to",
"the",
"query"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L624-L630 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.getParamNeedle | protected function getParamNeedle($operand)
{
$index = $this->parameterIndex++;
$this->queryBuilder->setParameter($index, $operand);
return '?' . $index;
} | php | protected function getParamNeedle($operand)
{
$index = $this->parameterIndex++;
$this->queryBuilder->setParameter($index, $operand);
return '?' . $index;
} | [
"protected",
"function",
"getParamNeedle",
"(",
"$",
"operand",
")",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"parameterIndex",
"++",
";",
"$",
"this",
"->",
"queryBuilder",
"->",
"setParameter",
"(",
"$",
"index",
",",
"$",
"operand",
")",
";",
"retur... | Get a needle for parameter binding.
@param mixed $operand
@return string | [
"Get",
"a",
"needle",
"for",
"parameter",
"binding",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L648-L653 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Query.php | Query.getPropertyNameWithAlias | protected function getPropertyNameWithAlias($propertyPath)
{
$aliases = $this->queryBuilder->getRootAliases();
$previousJoinAlias = $aliases[0];
if (strpos($propertyPath, '.') === false) {
return $previousJoinAlias . '.' . $propertyPath;
}
$propertyPathParts = explode('.', $propertyPath);
$conditionPartsCount = count($propertyPathParts);
for ($i = 0; $i < $conditionPartsCount - 1; $i++) {
$joinProperty = $previousJoinAlias . '.' . $propertyPathParts[$i];
$joinAlias = array_search($joinProperty, (array)$this->joins);
if ($joinAlias === false) {
$joinAlias = $propertyPathParts[$i] . $this->joinAliasCounter++;
$this->queryBuilder->leftJoin($joinProperty, $joinAlias);
$this->joins[$joinAlias] = $joinProperty;
}
$previousJoinAlias = $joinAlias;
}
return $previousJoinAlias . '.' . $propertyPathParts[$i];
} | php | protected function getPropertyNameWithAlias($propertyPath)
{
$aliases = $this->queryBuilder->getRootAliases();
$previousJoinAlias = $aliases[0];
if (strpos($propertyPath, '.') === false) {
return $previousJoinAlias . '.' . $propertyPath;
}
$propertyPathParts = explode('.', $propertyPath);
$conditionPartsCount = count($propertyPathParts);
for ($i = 0; $i < $conditionPartsCount - 1; $i++) {
$joinProperty = $previousJoinAlias . '.' . $propertyPathParts[$i];
$joinAlias = array_search($joinProperty, (array)$this->joins);
if ($joinAlias === false) {
$joinAlias = $propertyPathParts[$i] . $this->joinAliasCounter++;
$this->queryBuilder->leftJoin($joinProperty, $joinAlias);
$this->joins[$joinAlias] = $joinProperty;
}
$previousJoinAlias = $joinAlias;
}
return $previousJoinAlias . '.' . $propertyPathParts[$i];
} | [
"protected",
"function",
"getPropertyNameWithAlias",
"(",
"$",
"propertyPath",
")",
"{",
"$",
"aliases",
"=",
"$",
"this",
"->",
"queryBuilder",
"->",
"getRootAliases",
"(",
")",
";",
"$",
"previousJoinAlias",
"=",
"$",
"aliases",
"[",
"0",
"]",
";",
"if",
... | Adds left join clauses along the given property path to the query, if needed.
This enables us to set conditions on related objects.
@param string $propertyPath The path to a sub property, e.g. property.subProperty.foo, or a simple property name
@return string The last part of the property name prefixed by the used join alias, if joins have been added | [
"Adds",
"left",
"join",
"clauses",
"along",
"the",
"given",
"property",
"path",
"to",
"the",
"query",
"if",
"needed",
".",
"This",
"enables",
"us",
"to",
"set",
"conditions",
"on",
"related",
"objects",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Query.php#L662-L684 |
neos/flow-development-collection | Neos.Eel/Classes/Helper/JsonHelper.php | JsonHelper.stringify | public function stringify($value, array $options = []): string
{
$optionSum = array_sum(array_map('constant', $options));
return json_encode($value, $optionSum);
} | php | public function stringify($value, array $options = []): string
{
$optionSum = array_sum(array_map('constant', $options));
return json_encode($value, $optionSum);
} | [
"public",
"function",
"stringify",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"string",
"{",
"$",
"optionSum",
"=",
"array_sum",
"(",
"array_map",
"(",
"'constant'",
",",
"$",
"options",
")",
")",
";",
"return",
"json_enc... | JSON encode the given value
Usage example for options:
Json.stringify(value, ['JSON_UNESCAPED_UNICODE', 'JSON_FORCE_OBJECT'])
@param mixed $value
@param array $options Array of option constant names as strings
@return string | [
"JSON",
"encode",
"the",
"given",
"value"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/Helper/JsonHelper.php#L35-L39 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Client/Browser.php | Browser.request | public function request($uri, $method = 'GET', array $arguments = [], array $files = [], array $server = [], $content = null)
{
if (is_string($uri)) {
$uri = new Uri($uri);
}
if (!$uri instanceof Uri) {
throw new \InvalidArgumentException('$uri must be a URI object or a valid string representation of a URI.', 1333443624);
}
$request = Request::create($uri, $method, $arguments, $files, $server);
if ($content !== null) {
$request->setContent($content);
}
$response = $this->sendRequest($request);
$location = $response->getHeader('Location');
if ($this->followRedirects && $location !== null && $response->getStatusCode() >= 300 && $response->getStatusCode() <= 399) {
if (substr($location, 0, 1) === '/') {
// Location header is a host-absolute URL; so we need to prepend the hostname to create a full URL.
$location = $request->getBaseUri() . ltrim($location, '/');
}
if (in_array($location, $this->redirectionStack) || count($this->redirectionStack) >= $this->maximumRedirections) {
throw new InfiniteRedirectionException('The Location "' . $location . '" to follow for a redirect will probably result into an infinite loop.', 1350391699);
}
$this->redirectionStack[] = $location;
return $this->request($location);
}
$this->redirectionStack = [];
return $response;
} | php | public function request($uri, $method = 'GET', array $arguments = [], array $files = [], array $server = [], $content = null)
{
if (is_string($uri)) {
$uri = new Uri($uri);
}
if (!$uri instanceof Uri) {
throw new \InvalidArgumentException('$uri must be a URI object or a valid string representation of a URI.', 1333443624);
}
$request = Request::create($uri, $method, $arguments, $files, $server);
if ($content !== null) {
$request->setContent($content);
}
$response = $this->sendRequest($request);
$location = $response->getHeader('Location');
if ($this->followRedirects && $location !== null && $response->getStatusCode() >= 300 && $response->getStatusCode() <= 399) {
if (substr($location, 0, 1) === '/') {
// Location header is a host-absolute URL; so we need to prepend the hostname to create a full URL.
$location = $request->getBaseUri() . ltrim($location, '/');
}
if (in_array($location, $this->redirectionStack) || count($this->redirectionStack) >= $this->maximumRedirections) {
throw new InfiniteRedirectionException('The Location "' . $location . '" to follow for a redirect will probably result into an infinite loop.', 1350391699);
}
$this->redirectionStack[] = $location;
return $this->request($location);
}
$this->redirectionStack = [];
return $response;
} | [
"public",
"function",
"request",
"(",
"$",
"uri",
",",
"$",
"method",
"=",
"'GET'",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
",",
"array",
"$",
"files",
"=",
"[",
"]",
",",
"array",
"$",
"server",
"=",
"[",
"]",
",",
"$",
"content",
"=",
... | Requests the given URI with the method and other parameters as specified.
If a Location header was given and the status code is of response type 3xx
(see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, 14.30 Location)
@param string|Uri $uri
@param string $method Request method, for example "GET"
@param array $arguments Arguments to send in the request body
@param array $files
@param array $server
@param string $content
@return Response The HTTP response
@throws \InvalidArgumentException
@throws InfiniteRedirectionException
@api | [
"Requests",
"the",
"given",
"URI",
"with",
"the",
"method",
"and",
"other",
"parameters",
"as",
"specified",
".",
"If",
"a",
"Location",
"header",
"was",
"given",
"and",
"the",
"status",
"code",
"is",
"of",
"response",
"type",
"3xx",
"(",
"see",
"http",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Client/Browser.php#L131-L162 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Client/Browser.php | Browser.sendRequest | public function sendRequest(Request $request)
{
foreach ($this->automaticRequestHeaders->getAll() as $name => $values) {
$request->setHeader($name, $values);
}
$this->lastRequest = $request;
$this->lastResponse = $this->requestEngine->sendRequest($request);
return $this->lastResponse;
} | php | public function sendRequest(Request $request)
{
foreach ($this->automaticRequestHeaders->getAll() as $name => $values) {
$request->setHeader($name, $values);
}
$this->lastRequest = $request;
$this->lastResponse = $this->requestEngine->sendRequest($request);
return $this->lastResponse;
} | [
"public",
"function",
"sendRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"automaticRequestHeaders",
"->",
"getAll",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"values",
")",
"{",
"$",
"request",
"->",
"setHeader",
"(... | Sends a prepared request and returns the respective response.
@param Request $request
@return Response
@api | [
"Sends",
"a",
"prepared",
"request",
"and",
"returns",
"the",
"respective",
"response",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Client/Browser.php#L182-L191 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Client/Browser.php | Browser.getCrawler | public function getCrawler()
{
$crawler = new Crawler(null, $this->lastRequest->getBaseUri());
$crawler->addContent($this->lastResponse->getContent(), $this->lastResponse->getHeader('Content-Type'));
return $crawler;
} | php | public function getCrawler()
{
$crawler = new Crawler(null, $this->lastRequest->getBaseUri());
$crawler->addContent($this->lastResponse->getContent(), $this->lastResponse->getHeader('Content-Type'));
return $crawler;
} | [
"public",
"function",
"getCrawler",
"(",
")",
"{",
"$",
"crawler",
"=",
"new",
"Crawler",
"(",
"null",
",",
"$",
"this",
"->",
"lastRequest",
"->",
"getBaseUri",
"(",
")",
")",
";",
"$",
"crawler",
"->",
"addContent",
"(",
"$",
"this",
"->",
"lastRespo... | Returns the DOM crawler which can be used to interact with the web page
structure, submit forms, click links or fetch specific parts of the
website's contents.
The returned DOM crawler is bound to the response of the last executed
request.
@return \Symfony\Component\DomCrawler\Crawler
@api | [
"Returns",
"the",
"DOM",
"crawler",
"which",
"can",
"be",
"used",
"to",
"interact",
"with",
"the",
"web",
"page",
"structure",
"submit",
"forms",
"click",
"links",
"or",
"fetch",
"specific",
"parts",
"of",
"the",
"website",
"s",
"contents",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Client/Browser.php#L237-L243 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Client/Browser.php | Browser.submit | public function submit(Form $form)
{
return $this->request($form->getUri(), $form->getMethod(), $form->getPhpValues(), $form->getPhpFiles());
} | php | public function submit(Form $form)
{
return $this->request($form->getUri(), $form->getMethod(), $form->getPhpValues(), $form->getPhpFiles());
} | [
"public",
"function",
"submit",
"(",
"Form",
"$",
"form",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"$",
"form",
"->",
"getUri",
"(",
")",
",",
"$",
"form",
"->",
"getMethod",
"(",
")",
",",
"$",
"form",
"->",
"getPhpValues",
"(",
")",... | Submit a form
@param \Symfony\Component\DomCrawler\Form $form
@return Response
@api | [
"Submit",
"a",
"form"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Client/Browser.php#L265-L268 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.resolveConfigurationProcessingType | public function resolveConfigurationProcessingType(string $configurationType): string
{
if (!isset($this->configurationTypes[$configurationType])) {
throw new Exception\InvalidConfigurationTypeException('Configuration type "' . $configurationType . '" is not registered. You can Register it by calling $configurationManager->registerConfigurationType($configurationType).', 1339166495);
}
return $this->configurationTypes[$configurationType]['processingType'];
} | php | public function resolveConfigurationProcessingType(string $configurationType): string
{
if (!isset($this->configurationTypes[$configurationType])) {
throw new Exception\InvalidConfigurationTypeException('Configuration type "' . $configurationType . '" is not registered. You can Register it by calling $configurationManager->registerConfigurationType($configurationType).', 1339166495);
}
return $this->configurationTypes[$configurationType]['processingType'];
} | [
"public",
"function",
"resolveConfigurationProcessingType",
"(",
"string",
"$",
"configurationType",
")",
":",
"string",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configurationTypes",
"[",
"$",
"configurationType",
"]",
")",
")",
"{",
"throw",
"ne... | Resolve the processing type for the configuration type.
This returns the CONFIGURATION_PROCESSING_TYPE_* to use for the given
$configurationType.
@param string $configurationType
@return string
@throws Exception\InvalidConfigurationTypeException on non-existing configurationType | [
"Resolve",
"the",
"processing",
"type",
"for",
"the",
"configuration",
"type",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L248-L255 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.isSplitSourceAllowedForConfigurationType | public function isSplitSourceAllowedForConfigurationType(string $configurationType): bool
{
if (!isset($this->configurationTypes[$configurationType])) {
throw new Exception\InvalidConfigurationTypeException('Configuration type "' . $configurationType . '" is not registered. You can Register it by calling $configurationManager->registerConfigurationType($configurationType).', 1359998400);
}
return $this->configurationTypes[$configurationType]['allowSplitSource'];
} | php | public function isSplitSourceAllowedForConfigurationType(string $configurationType): bool
{
if (!isset($this->configurationTypes[$configurationType])) {
throw new Exception\InvalidConfigurationTypeException('Configuration type "' . $configurationType . '" is not registered. You can Register it by calling $configurationManager->registerConfigurationType($configurationType).', 1359998400);
}
return $this->configurationTypes[$configurationType]['allowSplitSource'];
} | [
"public",
"function",
"isSplitSourceAllowedForConfigurationType",
"(",
"string",
"$",
"configurationType",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configurationTypes",
"[",
"$",
"configurationType",
"]",
")",
")",
"{",
"throw",
... | Check the allowSplitSource setting for the configuration type.
@param string $configurationType
@return boolean
@throws Exception\InvalidConfigurationTypeException on non-existing configurationType | [
"Check",
"the",
"allowSplitSource",
"setting",
"for",
"the",
"configuration",
"type",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L264-L271 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.registerConfigurationType | public function registerConfigurationType(string $configurationType, string $configurationProcessingType = self::CONFIGURATION_PROCESSING_TYPE_DEFAULT, bool $allowSplitSource = false)
{
$configurationProcessingTypes = [
self::CONFIGURATION_PROCESSING_TYPE_DEFAULT,
self::CONFIGURATION_PROCESSING_TYPE_OBJECTS,
self::CONFIGURATION_PROCESSING_TYPE_POLICY,
self::CONFIGURATION_PROCESSING_TYPE_ROUTES,
self::CONFIGURATION_PROCESSING_TYPE_SETTINGS,
self::CONFIGURATION_PROCESSING_TYPE_APPEND
];
if (!in_array($configurationProcessingType, $configurationProcessingTypes)) {
throw new \InvalidArgumentException(sprintf('Specified invalid configuration processing type "%s" while registering custom configuration type "%s"', $configurationProcessingType, $configurationType), 1365496111);
}
$this->configurationTypes[$configurationType] = ['processingType' => $configurationProcessingType, 'allowSplitSource' => $allowSplitSource];
} | php | public function registerConfigurationType(string $configurationType, string $configurationProcessingType = self::CONFIGURATION_PROCESSING_TYPE_DEFAULT, bool $allowSplitSource = false)
{
$configurationProcessingTypes = [
self::CONFIGURATION_PROCESSING_TYPE_DEFAULT,
self::CONFIGURATION_PROCESSING_TYPE_OBJECTS,
self::CONFIGURATION_PROCESSING_TYPE_POLICY,
self::CONFIGURATION_PROCESSING_TYPE_ROUTES,
self::CONFIGURATION_PROCESSING_TYPE_SETTINGS,
self::CONFIGURATION_PROCESSING_TYPE_APPEND
];
if (!in_array($configurationProcessingType, $configurationProcessingTypes)) {
throw new \InvalidArgumentException(sprintf('Specified invalid configuration processing type "%s" while registering custom configuration type "%s"', $configurationProcessingType, $configurationType), 1365496111);
}
$this->configurationTypes[$configurationType] = ['processingType' => $configurationProcessingType, 'allowSplitSource' => $allowSplitSource];
} | [
"public",
"function",
"registerConfigurationType",
"(",
"string",
"$",
"configurationType",
",",
"string",
"$",
"configurationProcessingType",
"=",
"self",
"::",
"CONFIGURATION_PROCESSING_TYPE_DEFAULT",
",",
"bool",
"$",
"allowSplitSource",
"=",
"false",
")",
"{",
"$",
... | Registers a new configuration type with the given configuration processing type.
The processing type must be supported by the ConfigurationManager, see
CONFIGURATION_PROCESSING_TYPE_* for what is available.
@param string $configurationType The type to register, may be anything
@param string $configurationProcessingType One of CONFIGURATION_PROCESSING_TYPE_*, defaults to CONFIGURATION_PROCESSING_TYPE_DEFAULT
@param boolean $allowSplitSource If true, the type will be used as a "prefix" when looking for split configuration. Only supported for DEFAULT and SETTINGS processing types!
@throws \InvalidArgumentException on invalid configuration processing type
@return void | [
"Registers",
"a",
"new",
"configuration",
"type",
"with",
"the",
"given",
"configuration",
"processing",
"type",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L285-L299 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.getConfiguration | public function getConfiguration(string $configurationType, string $configurationPath = null)
{
if (empty($this->configurations[$configurationType])) {
$this->loadConfiguration($configurationType, $this->packages);
}
$configuration = $this->configurations[$configurationType] ?? [];
if ($configurationPath === null || $configuration === null) {
return $configuration;
}
return (Arrays::getValueByPath($configuration, $configurationPath));
} | php | public function getConfiguration(string $configurationType, string $configurationPath = null)
{
if (empty($this->configurations[$configurationType])) {
$this->loadConfiguration($configurationType, $this->packages);
}
$configuration = $this->configurations[$configurationType] ?? [];
if ($configurationPath === null || $configuration === null) {
return $configuration;
}
return (Arrays::getValueByPath($configuration, $configurationPath));
} | [
"public",
"function",
"getConfiguration",
"(",
"string",
"$",
"configurationType",
",",
"string",
"$",
"configurationPath",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"configurations",
"[",
"$",
"configurationType",
"]",
")",
")",
"{"... | Returns the specified raw configuration.
The actual configuration will be merged from different sources in a defined order.
Note that this is a low level method and mostly makes sense to be used by Flow internally.
If possible just use settings and have them injected.
@param string $configurationType The kind of configuration to fetch - must be one of the CONFIGURATION_TYPE_* constants
@param string $configurationPath The path inside the configuration to fetch
@return array|null The configuration or NULL if the configuration doesn't exist
@throws Exception\InvalidConfigurationTypeException on invalid configuration types | [
"Returns",
"the",
"specified",
"raw",
"configuration",
".",
"The",
"actual",
"configuration",
"will",
"be",
"merged",
"from",
"different",
"sources",
"in",
"a",
"defined",
"order",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L324-L336 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.loadConfiguration | protected function loadConfiguration(string $configurationType, array $packages)
{
$this->configurations[$configurationType] = [];
$this->cacheNeedsUpdate = true;
$configurationProcessingType = $this->resolveConfigurationProcessingType($configurationType);
$allowSplitSource = $this->isSplitSourceAllowedForConfigurationType($configurationType);
switch ($configurationProcessingType) {
case self::CONFIGURATION_PROCESSING_TYPE_SETTINGS:
// Make sure that the Flow package is the first item of the packages array:
if (isset($packages['Neos.Flow'])) {
$flowPackage = $packages['Neos.Flow'];
unset($packages['Neos.Flow']);
$packages = array_merge(['Neos.Flow' => $flowPackage], $packages);
unset($flowPackage);
}
$settings = [];
foreach ($packages as $packageKey => $package) {
if (Arrays::getValueByPath($settings, $packageKey) === null) {
$settings = Arrays::setValueByPath($settings, $packageKey, []);
}
$settings = Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load($package->getConfigurationPath() . $configurationType, $allowSplitSource));
}
$settings = Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType, $allowSplitSource));
foreach ($this->orderedListOfContextNames as $contextName) {
foreach ($packages as $package) {
$settings = Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType, $allowSplitSource));
}
$settings = Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType, $allowSplitSource));
}
if ($this->configurations[$configurationType] !== []) {
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $settings);
} else {
$this->configurations[$configurationType] = $settings;
}
$this->configurations[$configurationType]['Neos']['Flow']['core']['context'] = (string)$this->context;
break;
case self::CONFIGURATION_PROCESSING_TYPE_OBJECTS:
foreach ($packages as $packageKey => $package) {
$configuration = $this->configurationSource->load($package->getConfigurationPath() . $configurationType);
$configuration = Arrays::arrayMergeRecursiveOverrule($configuration, $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType));
foreach ($this->orderedListOfContextNames as $contextName) {
$configuration = Arrays::arrayMergeRecursiveOverrule($configuration, $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType));
$configuration = Arrays::arrayMergeRecursiveOverrule($configuration, $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType));
}
$this->configurations[$configurationType][$packageKey] = $configuration;
}
break;
case self::CONFIGURATION_PROCESSING_TYPE_POLICY:
if ($this->context->isTesting()) {
$testingPolicyPathAndFilename = $this->temporaryDirectoryPath . 'Policy';
if ($this->configurationSource->has($testingPolicyPathAndFilename)) {
$this->configurations[$configurationType] = $this->configurationSource->load($testingPolicyPathAndFilename);
break;
}
}
foreach ($packages as $package) {
$packagePolicyConfiguration = $this->configurationSource->load($package->getConfigurationPath() . $configurationType, $allowSplitSource);
$this->configurations[$configurationType] = $this->mergePolicyConfiguration($this->configurations[$configurationType], $packagePolicyConfiguration);
}
$this->configurations[$configurationType] = $this->mergePolicyConfiguration($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType, $allowSplitSource));
foreach ($this->orderedListOfContextNames as $contextName) {
foreach ($packages as $package) {
$packagePolicyConfiguration = $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType, $allowSplitSource);
$this->configurations[$configurationType] = $this->mergePolicyConfiguration($this->configurations[$configurationType], $packagePolicyConfiguration);
}
$this->configurations[$configurationType] = $this->mergePolicyConfiguration($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType, $allowSplitSource));
}
break;
case self::CONFIGURATION_PROCESSING_TYPE_DEFAULT:
foreach ($packages as $package) {
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $this->configurationSource->load($package->getConfigurationPath() . $configurationType, $allowSplitSource));
}
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType, $allowSplitSource));
foreach ($this->orderedListOfContextNames as $contextName) {
foreach ($packages as $package) {
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType, $allowSplitSource));
}
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType, $allowSplitSource));
}
break;
case self::CONFIGURATION_PROCESSING_TYPE_ROUTES:
// load main routes
foreach (array_reverse($this->orderedListOfContextNames) as $contextName) {
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType));
}
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType));
$routeProcessor = new RouteConfigurationProcessor(
($this->getConfiguration(self::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.mvc.routes') ?? []),
$this->orderedListOfContextNames,
$this->packages,
$this->configurationSource
);
$this->configurations[$configurationType] = $routeProcessor->process($this->configurations[$configurationType]);
break;
case self::CONFIGURATION_PROCESSING_TYPE_APPEND:
foreach ($packages as $package) {
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load($package->getConfigurationPath() . $configurationType, $allowSplitSource));
}
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType, $allowSplitSource));
foreach ($this->orderedListOfContextNames as $contextName) {
foreach ($packages as $package) {
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType, $allowSplitSource));
}
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType, $allowSplitSource));
}
break;
default:
throw new Exception\InvalidConfigurationTypeException('Configuration type "' . $configurationType . '" cannot be loaded with loadConfiguration().', 1251450613);
}
$this->unprocessedConfiguration[$configurationType] = $this->configurations[$configurationType];
} | php | protected function loadConfiguration(string $configurationType, array $packages)
{
$this->configurations[$configurationType] = [];
$this->cacheNeedsUpdate = true;
$configurationProcessingType = $this->resolveConfigurationProcessingType($configurationType);
$allowSplitSource = $this->isSplitSourceAllowedForConfigurationType($configurationType);
switch ($configurationProcessingType) {
case self::CONFIGURATION_PROCESSING_TYPE_SETTINGS:
// Make sure that the Flow package is the first item of the packages array:
if (isset($packages['Neos.Flow'])) {
$flowPackage = $packages['Neos.Flow'];
unset($packages['Neos.Flow']);
$packages = array_merge(['Neos.Flow' => $flowPackage], $packages);
unset($flowPackage);
}
$settings = [];
foreach ($packages as $packageKey => $package) {
if (Arrays::getValueByPath($settings, $packageKey) === null) {
$settings = Arrays::setValueByPath($settings, $packageKey, []);
}
$settings = Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load($package->getConfigurationPath() . $configurationType, $allowSplitSource));
}
$settings = Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType, $allowSplitSource));
foreach ($this->orderedListOfContextNames as $contextName) {
foreach ($packages as $package) {
$settings = Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType, $allowSplitSource));
}
$settings = Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType, $allowSplitSource));
}
if ($this->configurations[$configurationType] !== []) {
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $settings);
} else {
$this->configurations[$configurationType] = $settings;
}
$this->configurations[$configurationType]['Neos']['Flow']['core']['context'] = (string)$this->context;
break;
case self::CONFIGURATION_PROCESSING_TYPE_OBJECTS:
foreach ($packages as $packageKey => $package) {
$configuration = $this->configurationSource->load($package->getConfigurationPath() . $configurationType);
$configuration = Arrays::arrayMergeRecursiveOverrule($configuration, $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType));
foreach ($this->orderedListOfContextNames as $contextName) {
$configuration = Arrays::arrayMergeRecursiveOverrule($configuration, $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType));
$configuration = Arrays::arrayMergeRecursiveOverrule($configuration, $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType));
}
$this->configurations[$configurationType][$packageKey] = $configuration;
}
break;
case self::CONFIGURATION_PROCESSING_TYPE_POLICY:
if ($this->context->isTesting()) {
$testingPolicyPathAndFilename = $this->temporaryDirectoryPath . 'Policy';
if ($this->configurationSource->has($testingPolicyPathAndFilename)) {
$this->configurations[$configurationType] = $this->configurationSource->load($testingPolicyPathAndFilename);
break;
}
}
foreach ($packages as $package) {
$packagePolicyConfiguration = $this->configurationSource->load($package->getConfigurationPath() . $configurationType, $allowSplitSource);
$this->configurations[$configurationType] = $this->mergePolicyConfiguration($this->configurations[$configurationType], $packagePolicyConfiguration);
}
$this->configurations[$configurationType] = $this->mergePolicyConfiguration($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType, $allowSplitSource));
foreach ($this->orderedListOfContextNames as $contextName) {
foreach ($packages as $package) {
$packagePolicyConfiguration = $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType, $allowSplitSource);
$this->configurations[$configurationType] = $this->mergePolicyConfiguration($this->configurations[$configurationType], $packagePolicyConfiguration);
}
$this->configurations[$configurationType] = $this->mergePolicyConfiguration($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType, $allowSplitSource));
}
break;
case self::CONFIGURATION_PROCESSING_TYPE_DEFAULT:
foreach ($packages as $package) {
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $this->configurationSource->load($package->getConfigurationPath() . $configurationType, $allowSplitSource));
}
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType, $allowSplitSource));
foreach ($this->orderedListOfContextNames as $contextName) {
foreach ($packages as $package) {
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType, $allowSplitSource));
}
$this->configurations[$configurationType] = Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType, $allowSplitSource));
}
break;
case self::CONFIGURATION_PROCESSING_TYPE_ROUTES:
// load main routes
foreach (array_reverse($this->orderedListOfContextNames) as $contextName) {
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType));
}
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType));
$routeProcessor = new RouteConfigurationProcessor(
($this->getConfiguration(self::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.mvc.routes') ?? []),
$this->orderedListOfContextNames,
$this->packages,
$this->configurationSource
);
$this->configurations[$configurationType] = $routeProcessor->process($this->configurations[$configurationType]);
break;
case self::CONFIGURATION_PROCESSING_TYPE_APPEND:
foreach ($packages as $package) {
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load($package->getConfigurationPath() . $configurationType, $allowSplitSource));
}
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $configurationType, $allowSplitSource));
foreach ($this->orderedListOfContextNames as $contextName) {
foreach ($packages as $package) {
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load($package->getConfigurationPath() . $contextName . '/' . $configurationType, $allowSplitSource));
}
$this->configurations[$configurationType] = array_merge($this->configurations[$configurationType], $this->configurationSource->load(FLOW_PATH_CONFIGURATION . $contextName . '/' . $configurationType, $allowSplitSource));
}
break;
default:
throw new Exception\InvalidConfigurationTypeException('Configuration type "' . $configurationType . '" cannot be loaded with loadConfiguration().', 1251450613);
}
$this->unprocessedConfiguration[$configurationType] = $this->configurations[$configurationType];
} | [
"protected",
"function",
"loadConfiguration",
"(",
"string",
"$",
"configurationType",
",",
"array",
"$",
"packages",
")",
"{",
"$",
"this",
"->",
"configurations",
"[",
"$",
"configurationType",
"]",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"cacheNeedsUpdate",
... | Loads special configuration defined in the specified packages and merges them with
those potentially existing in the global configuration folders. The result is stored
in the configuration manager's configuration registry and can be retrieved with the
getConfiguration() method.
@param string $configurationType The kind of configuration to load - must be one of the CONFIGURATION_TYPE_* constants
@param FlowPackageInterface[] $packages An array of Package objects (indexed by package key) to consider
@throws Exception\InvalidConfigurationTypeException
@throws Exception\InvalidConfigurationException
@return void | [
"Loads",
"special",
"configuration",
"defined",
"in",
"the",
"specified",
"packages",
"and",
"merges",
"them",
"with",
"those",
"potentially",
"existing",
"in",
"the",
"global",
"configuration",
"folders",
".",
"The",
"result",
"is",
"stored",
"in",
"the",
"conf... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L377-L499 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.loadConfigurationCache | public function loadConfigurationCache(): bool
{
$cachePathAndFilename = $this->constructConfigurationCachePath();
$configurations = @include $cachePathAndFilename;
if ($configurations !== false) {
$this->configurations = $configurations;
return true;
}
return false;
} | php | public function loadConfigurationCache(): bool
{
$cachePathAndFilename = $this->constructConfigurationCachePath();
$configurations = @include $cachePathAndFilename;
if ($configurations !== false) {
$this->configurations = $configurations;
return true;
}
return false;
} | [
"public",
"function",
"loadConfigurationCache",
"(",
")",
":",
"bool",
"{",
"$",
"cachePathAndFilename",
"=",
"$",
"this",
"->",
"constructConfigurationCachePath",
"(",
")",
";",
"$",
"configurations",
"=",
"@",
"include",
"$",
"cachePathAndFilename",
";",
"if",
... | If a cache file with previously saved configuration exists, it is loaded.
@return boolean If cached configuration was loaded or not | [
"If",
"a",
"cache",
"file",
"with",
"previously",
"saved",
"configuration",
"exists",
"it",
"is",
"loaded",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L506-L516 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.flushConfigurationCache | public function flushConfigurationCache()
{
$this->configurations = [self::CONFIGURATION_TYPE_SETTINGS => []];
if ($this->temporaryDirectoryPath === null) {
return;
}
$cachePathAndFilename = $this->constructConfigurationCachePath();
if (is_file($cachePathAndFilename)) {
if (unlink($cachePathAndFilename) === false) {
throw new Exception(sprintf('Could not delete configuration cache file "%s". Check file permissions for the parent directory.', $cachePathAndFilename), 1341999203);
}
OpcodeCacheHelper::clearAllActive($cachePathAndFilename);
}
} | php | public function flushConfigurationCache()
{
$this->configurations = [self::CONFIGURATION_TYPE_SETTINGS => []];
if ($this->temporaryDirectoryPath === null) {
return;
}
$cachePathAndFilename = $this->constructConfigurationCachePath();
if (is_file($cachePathAndFilename)) {
if (unlink($cachePathAndFilename) === false) {
throw new Exception(sprintf('Could not delete configuration cache file "%s". Check file permissions for the parent directory.', $cachePathAndFilename), 1341999203);
}
OpcodeCacheHelper::clearAllActive($cachePathAndFilename);
}
} | [
"public",
"function",
"flushConfigurationCache",
"(",
")",
"{",
"$",
"this",
"->",
"configurations",
"=",
"[",
"self",
"::",
"CONFIGURATION_TYPE_SETTINGS",
"=>",
"[",
"]",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"temporaryDirectoryPath",
"===",
"null",
")",
... | If a cache file with previously saved configuration exists, it is removed.
Internal: After this the configuration manager is left without any configuration,
use refreshConfiguration if you want to reread the configuration.
@return void
@throws Exception
@see refreshConfiguration | [
"If",
"a",
"cache",
"file",
"with",
"previously",
"saved",
"configuration",
"exists",
"it",
"is",
"removed",
".",
"Internal",
":",
"After",
"this",
"the",
"configuration",
"manager",
"is",
"left",
"without",
"any",
"configuration",
"use",
"refreshConfiguration",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L527-L541 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.saveConfigurationCache | protected function saveConfigurationCache()
{
// Make sure that all configuration types are loaded before writing configuration caches.
foreach (array_keys($this->configurationTypes) as $configurationType) {
if (!isset($this->unprocessedConfiguration[$configurationType]) || !is_array($this->unprocessedConfiguration[$configurationType])) {
$this->loadConfiguration($configurationType, $this->packages);
}
}
if ($this->temporaryDirectoryPath === null) {
return;
}
$cachePathAndFilename = $this->constructConfigurationCachePath();
if (!file_exists(dirname($cachePathAndFilename))) {
Files::createDirectoryRecursively(dirname($cachePathAndFilename));
}
file_put_contents($cachePathAndFilename, '<?php return ' . $this->replaceVariablesInPhpString(var_export($this->unprocessedConfiguration, true)) . ';');
OpcodeCacheHelper::clearAllActive($cachePathAndFilename);
$this->cacheNeedsUpdate = false;
} | php | protected function saveConfigurationCache()
{
// Make sure that all configuration types are loaded before writing configuration caches.
foreach (array_keys($this->configurationTypes) as $configurationType) {
if (!isset($this->unprocessedConfiguration[$configurationType]) || !is_array($this->unprocessedConfiguration[$configurationType])) {
$this->loadConfiguration($configurationType, $this->packages);
}
}
if ($this->temporaryDirectoryPath === null) {
return;
}
$cachePathAndFilename = $this->constructConfigurationCachePath();
if (!file_exists(dirname($cachePathAndFilename))) {
Files::createDirectoryRecursively(dirname($cachePathAndFilename));
}
file_put_contents($cachePathAndFilename, '<?php return ' . $this->replaceVariablesInPhpString(var_export($this->unprocessedConfiguration, true)) . ';');
OpcodeCacheHelper::clearAllActive($cachePathAndFilename);
$this->cacheNeedsUpdate = false;
} | [
"protected",
"function",
"saveConfigurationCache",
"(",
")",
"{",
"// Make sure that all configuration types are loaded before writing configuration caches.",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"configurationTypes",
")",
"as",
"$",
"configurationType",
")",
... | Saves the current configuration into a cache file and creates a cache inclusion script
in the context's Configuration directory.
@return void
@throws Exception | [
"Saves",
"the",
"current",
"configuration",
"into",
"a",
"cache",
"file",
"and",
"creates",
"a",
"cache",
"inclusion",
"script",
"in",
"the",
"context",
"s",
"Configuration",
"directory",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L550-L571 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.replaceVariablesInPhpString | protected function replaceVariablesInPhpString(string $phpString)
{
$phpString = preg_replace_callback('/
(?<startString>=>\s\'.*?)? # optionally assignment operator and starting a string
(?P<fullMatch>% # an expression is indicated by %
(?P<expression>
(?:(?:\\\?[\d\w_\\\]+\:\:) # either a class name followed by ::
| # or
(?:(?P<prefix>[a-z]+)\:) # a prefix followed by : (like "env:")
)?
(?P<name>[A-Z_0-9]+)) # the actual variable name in all upper
%) # concluded by %
(?<endString>[^%]*?(?:\',\n)?)? # optionally concluding a string
/mx', function ($matchGroup) {
$replacement = "";
$constantDoesNotStartAsBeginning = false;
if ($matchGroup['startString'] !== "=> '") {
$constantDoesNotStartAsBeginning = true;
}
$replacement .= ($constantDoesNotStartAsBeginning ? $matchGroup['startString'] . "' . " : '=> ');
if (isset($matchGroup['prefix']) && $matchGroup['prefix'] === 'env') {
$replacement .= "getenv('" . $matchGroup['name'] . "')";
} elseif (isset($matchGroup['expression'])) {
$replacement .= "(defined('" . $matchGroup['expression'] . "') ? constant('" . $matchGroup['expression'] . "') : null)";
}
$constantUntilEndOfLine = false;
if (!isset($matchGroup['endString'])) {
$matchGroup['endString'] = "',\n";
}
if ($matchGroup['endString'] === "',\n") {
$constantUntilEndOfLine = true;
}
$replacement .= ($constantUntilEndOfLine ? ",\n" : " . '" . $matchGroup['endString']);
return $replacement;
}, $phpString);
return $phpString;
} | php | protected function replaceVariablesInPhpString(string $phpString)
{
$phpString = preg_replace_callback('/
(?<startString>=>\s\'.*?)? # optionally assignment operator and starting a string
(?P<fullMatch>% # an expression is indicated by %
(?P<expression>
(?:(?:\\\?[\d\w_\\\]+\:\:) # either a class name followed by ::
| # or
(?:(?P<prefix>[a-z]+)\:) # a prefix followed by : (like "env:")
)?
(?P<name>[A-Z_0-9]+)) # the actual variable name in all upper
%) # concluded by %
(?<endString>[^%]*?(?:\',\n)?)? # optionally concluding a string
/mx', function ($matchGroup) {
$replacement = "";
$constantDoesNotStartAsBeginning = false;
if ($matchGroup['startString'] !== "=> '") {
$constantDoesNotStartAsBeginning = true;
}
$replacement .= ($constantDoesNotStartAsBeginning ? $matchGroup['startString'] . "' . " : '=> ');
if (isset($matchGroup['prefix']) && $matchGroup['prefix'] === 'env') {
$replacement .= "getenv('" . $matchGroup['name'] . "')";
} elseif (isset($matchGroup['expression'])) {
$replacement .= "(defined('" . $matchGroup['expression'] . "') ? constant('" . $matchGroup['expression'] . "') : null)";
}
$constantUntilEndOfLine = false;
if (!isset($matchGroup['endString'])) {
$matchGroup['endString'] = "',\n";
}
if ($matchGroup['endString'] === "',\n") {
$constantUntilEndOfLine = true;
}
$replacement .= ($constantUntilEndOfLine ? ",\n" : " . '" . $matchGroup['endString']);
return $replacement;
}, $phpString);
return $phpString;
} | [
"protected",
"function",
"replaceVariablesInPhpString",
"(",
"string",
"$",
"phpString",
")",
"{",
"$",
"phpString",
"=",
"preg_replace_callback",
"(",
"'/\n (?<startString>=>\\s\\'.*?)? # optionally assignment operator and starting a string\n (?P<fullMatch>... | Replaces variables (in the format %CONSTANT% or %env:ENVIRONMENT_VARIABLE%)
in the given php exported configuration string.
This is applied before caching to alllow runtime evaluation of constants and environment variables.
@param string $phpString
@return mixed | [
"Replaces",
"variables",
"(",
"in",
"the",
"format",
"%CONSTANT%",
"or",
"%env",
":",
"ENVIRONMENT_VARIABLE%",
")",
"in",
"the",
"given",
"php",
"exported",
"configuration",
"string",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L592-L632 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.mergePolicyConfiguration | protected function mergePolicyConfiguration(array $firstConfigurationArray, array $secondConfigurationArray): array
{
$result = Arrays::arrayMergeRecursiveOverrule($firstConfigurationArray, $secondConfigurationArray);
if (!isset($result['roles'])) {
return $result;
}
foreach ($result['roles'] as $roleIdentifier => $roleConfiguration) {
if (!isset($firstConfigurationArray['roles'][$roleIdentifier]['privileges']) || !isset($secondConfigurationArray['roles'][$roleIdentifier]['privileges'])) {
continue;
}
$result['roles'][$roleIdentifier]['privileges'] = array_merge($firstConfigurationArray['roles'][$roleIdentifier]['privileges'], $secondConfigurationArray['roles'][$roleIdentifier]['privileges']);
}
return $result;
} | php | protected function mergePolicyConfiguration(array $firstConfigurationArray, array $secondConfigurationArray): array
{
$result = Arrays::arrayMergeRecursiveOverrule($firstConfigurationArray, $secondConfigurationArray);
if (!isset($result['roles'])) {
return $result;
}
foreach ($result['roles'] as $roleIdentifier => $roleConfiguration) {
if (!isset($firstConfigurationArray['roles'][$roleIdentifier]['privileges']) || !isset($secondConfigurationArray['roles'][$roleIdentifier]['privileges'])) {
continue;
}
$result['roles'][$roleIdentifier]['privileges'] = array_merge($firstConfigurationArray['roles'][$roleIdentifier]['privileges'], $secondConfigurationArray['roles'][$roleIdentifier]['privileges']);
}
return $result;
} | [
"protected",
"function",
"mergePolicyConfiguration",
"(",
"array",
"$",
"firstConfigurationArray",
",",
"array",
"$",
"secondConfigurationArray",
")",
":",
"array",
"{",
"$",
"result",
"=",
"Arrays",
"::",
"arrayMergeRecursiveOverrule",
"(",
"$",
"firstConfigurationArra... | Merges two policy configuration arrays.
@param array $firstConfigurationArray
@param array $secondConfigurationArray
@return array | [
"Merges",
"two",
"policy",
"configuration",
"arrays",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L641-L654 |
neos/flow-development-collection | Neos.Flow/Classes/Configuration/ConfigurationManager.php | ConfigurationManager.constructConfigurationCachePath | protected function constructConfigurationCachePath(): string
{
$configurationCachePath = $this->temporaryDirectoryPath . 'Configuration/';
return $configurationCachePath . str_replace('/', '_', (string)$this->context) . 'Configurations.php';
} | php | protected function constructConfigurationCachePath(): string
{
$configurationCachePath = $this->temporaryDirectoryPath . 'Configuration/';
return $configurationCachePath . str_replace('/', '_', (string)$this->context) . 'Configurations.php';
} | [
"protected",
"function",
"constructConfigurationCachePath",
"(",
")",
":",
"string",
"{",
"$",
"configurationCachePath",
"=",
"$",
"this",
"->",
"temporaryDirectoryPath",
".",
"'Configuration/'",
";",
"return",
"$",
"configurationCachePath",
".",
"str_replace",
"(",
"... | Constructs a path to the configuration cache PHP file.
Derived from the temporary path and application context.
@return string | [
"Constructs",
"a",
"path",
"to",
"the",
"configuration",
"cache",
"PHP",
"file",
".",
"Derived",
"from",
"the",
"temporary",
"path",
"and",
"application",
"context",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Configuration/ConfigurationManager.php#L662-L666 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ClassReflection.php | ClassReflection.getInterfaces | public function getInterfaces()
{
$extendedInterfaces = [];
$interfaces = parent::getInterfaces();
foreach ($interfaces as $interface) {
$extendedInterfaces[] = new ClassReflection($interface->getName());
}
return $extendedInterfaces;
} | php | public function getInterfaces()
{
$extendedInterfaces = [];
$interfaces = parent::getInterfaces();
foreach ($interfaces as $interface) {
$extendedInterfaces[] = new ClassReflection($interface->getName());
}
return $extendedInterfaces;
} | [
"public",
"function",
"getInterfaces",
"(",
")",
"{",
"$",
"extendedInterfaces",
"=",
"[",
"]",
";",
"$",
"interfaces",
"=",
"parent",
"::",
"getInterfaces",
"(",
")",
";",
"foreach",
"(",
"$",
"interfaces",
"as",
"$",
"interface",
")",
"{",
"$",
"extend... | Replacement for the original getInterfaces() method which makes sure
that ClassReflection objects are returned instead of the
original ReflectionClass instances.
@return array<ClassReflection> Class reflection objects of the properties in this class | [
"Replacement",
"for",
"the",
"original",
"getInterfaces",
"()",
"method",
"which",
"makes",
"sure",
"that",
"ClassReflection",
"objects",
"are",
"returned",
"instead",
"of",
"the",
"original",
"ReflectionClass",
"instances",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ClassReflection.php#L68-L76 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ClassReflection.php | ClassReflection.getParentClass | public function getParentClass()
{
$parentClass = parent::getParentClass();
return ($parentClass === false) ? false : new ClassReflection($parentClass->getName());
} | php | public function getParentClass()
{
$parentClass = parent::getParentClass();
return ($parentClass === false) ? false : new ClassReflection($parentClass->getName());
} | [
"public",
"function",
"getParentClass",
"(",
")",
"{",
"$",
"parentClass",
"=",
"parent",
"::",
"getParentClass",
"(",
")",
";",
"return",
"(",
"$",
"parentClass",
"===",
"false",
")",
"?",
"false",
":",
"new",
"ClassReflection",
"(",
"$",
"parentClass",
"... | Replacement for the original getParentClass() method which makes sure
that a ClassReflection object is returned instead of the
orginal ReflectionClass instance.
@return ClassReflection Reflection of the parent class - if any | [
"Replacement",
"for",
"the",
"original",
"getParentClass",
"()",
"method",
"which",
"makes",
"sure",
"that",
"a",
"ClassReflection",
"object",
"is",
"returned",
"instead",
"of",
"the",
"orginal",
"ReflectionClass",
"instance",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ClassReflection.php#L117-L121 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ClassReflection.php | ClassReflection.getProperties | public function getProperties($filter = null)
{
$extendedProperties = [];
$properties = ($filter === null ? parent::getProperties() : parent::getProperties($filter));
foreach ($properties as $property) {
$extendedProperties[] = new PropertyReflection($this->getName(), $property->getName());
}
return $extendedProperties;
} | php | public function getProperties($filter = null)
{
$extendedProperties = [];
$properties = ($filter === null ? parent::getProperties() : parent::getProperties($filter));
foreach ($properties as $property) {
$extendedProperties[] = new PropertyReflection($this->getName(), $property->getName());
}
return $extendedProperties;
} | [
"public",
"function",
"getProperties",
"(",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"extendedProperties",
"=",
"[",
"]",
";",
"$",
"properties",
"=",
"(",
"$",
"filter",
"===",
"null",
"?",
"parent",
"::",
"getProperties",
"(",
")",
":",
"parent",
"... | Replacement for the original getProperties() method which makes sure
that PropertyReflection objects are returned instead of the
orginal ReflectionProperty instances.
@param integer $filter A filter mask
@return array<PropertyReflection> Property reflection objects of the properties in this class | [
"Replacement",
"for",
"the",
"original",
"getProperties",
"()",
"method",
"which",
"makes",
"sure",
"that",
"PropertyReflection",
"objects",
"are",
"returned",
"instead",
"of",
"the",
"orginal",
"ReflectionProperty",
"instances",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ClassReflection.php#L131-L139 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ClassReflection.php | ClassReflection.newInstanceWithoutConstructor | public function newInstanceWithoutConstructor()
{
$instance = parent::newInstanceWithoutConstructor();
if (method_exists($instance, '__wakeup') && is_callable([$instance, '__wakeup'])) {
$instance->__wakeup();
}
return $instance;
} | php | public function newInstanceWithoutConstructor()
{
$instance = parent::newInstanceWithoutConstructor();
if (method_exists($instance, '__wakeup') && is_callable([$instance, '__wakeup'])) {
$instance->__wakeup();
}
return $instance;
} | [
"public",
"function",
"newInstanceWithoutConstructor",
"(",
")",
"{",
"$",
"instance",
"=",
"parent",
"::",
"newInstanceWithoutConstructor",
"(",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"instance",
",",
"'__wakeup'",
")",
"&&",
"is_callable",
"(",
"[",
... | Creates a new class instance without invoking the constructor.
Overridden to make sure DI works even when instances are created using
newInstanceWithoutConstructor()
@see https://github.com/doctrine/doctrine2/commit/530c01b5e3ed7345cde564bd511794ac72f49b65
@return object | [
"Creates",
"a",
"new",
"class",
"instance",
"without",
"invoking",
"the",
"constructor",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ClassReflection.php#L205-L214 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ClassReflection.php | ClassReflection.getDocCommentParser | protected function getDocCommentParser()
{
if (!is_object($this->docCommentParser)) {
$this->docCommentParser = new DocCommentParser;
$this->docCommentParser->parseDocComment($this->getDocComment());
}
return $this->docCommentParser;
} | php | protected function getDocCommentParser()
{
if (!is_object($this->docCommentParser)) {
$this->docCommentParser = new DocCommentParser;
$this->docCommentParser->parseDocComment($this->getDocComment());
}
return $this->docCommentParser;
} | [
"protected",
"function",
"getDocCommentParser",
"(",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"docCommentParser",
")",
")",
"{",
"$",
"this",
"->",
"docCommentParser",
"=",
"new",
"DocCommentParser",
";",
"$",
"this",
"->",
"docCommentP... | Returns an instance of the doc comment parser and
runs the parse() method.
@return DocCommentParser | [
"Returns",
"an",
"instance",
"of",
"the",
"doc",
"comment",
"parser",
"and",
"runs",
"the",
"parse",
"()",
"method",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ClassReflection.php#L222-L229 |
neos/flow-development-collection | Neos.Flow/Classes/Session/Aspect/LazyLoadingAspect.php | LazyLoadingAspect.initializeSession | public function initializeSession(JoinPointInterface $joinPoint)
{
$session = $this->sessionManager->getCurrentSession();
if ($session->isStarted() === true) {
return;
}
$objectName = $this->objectManager->getObjectNameByClassName(get_class($joinPoint->getProxy()));
$methodName = $joinPoint->getMethodName();
$this->logger->debug(sprintf('Session initialization triggered by %s->%s.', $objectName, $methodName));
$session->start();
} | php | public function initializeSession(JoinPointInterface $joinPoint)
{
$session = $this->sessionManager->getCurrentSession();
if ($session->isStarted() === true) {
return;
}
$objectName = $this->objectManager->getObjectNameByClassName(get_class($joinPoint->getProxy()));
$methodName = $joinPoint->getMethodName();
$this->logger->debug(sprintf('Session initialization triggered by %s->%s.', $objectName, $methodName));
$session->start();
} | [
"public",
"function",
"initializeSession",
"(",
"JoinPointInterface",
"$",
"joinPoint",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"sessionManager",
"->",
"getCurrentSession",
"(",
")",
";",
"if",
"(",
"$",
"session",
"->",
"isStarted",
"(",
")",
"===... | Before advice for all methods annotated with "@Flow\Session(autoStart=true)".
Those methods will trigger a session initialization if a session does not exist
yet.
@param JoinPointInterface $joinPoint The current join point
@return void
@fixme The pointcut expression below does not consider the options of the session annotation – needs adjustments in the AOP framework
@Flow\Before("methodAnnotatedWith(Neos\Flow\Annotations\Session)") | [
"Before",
"advice",
"for",
"all",
"methods",
"annotated",
"with",
"@Flow",
"\\",
"Session",
"(",
"autoStart",
"=",
"true",
")",
".",
"Those",
"methods",
"will",
"trigger",
"a",
"session",
"initialization",
"if",
"a",
"session",
"does",
"not",
"exist",
"yet",... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Session/Aspect/LazyLoadingAspect.php#L85-L98 |
neos/flow-development-collection | Neos.Flow/Classes/Session/Aspect/LazyLoadingAspect.php | LazyLoadingAspect.callMethodOnOriginalSessionObject | public function callMethodOnOriginalSessionObject(JoinPointInterface $joinPoint)
{
$objectName = $this->objectManager->getObjectNameByClassName(get_class($joinPoint->getProxy()));
$methodName = $joinPoint->getMethodName();
$proxy = $joinPoint->getProxy();
if (!isset($this->sessionOriginalInstances[$objectName])) {
$this->sessionOriginalInstances[$objectName] = $this->objectManager->get($objectName);
}
if ($this->sessionOriginalInstances[$objectName] === $proxy) {
return $joinPoint->getAdviceChain()->proceed($joinPoint);
} else {
return call_user_func_array([$this->sessionOriginalInstances[$objectName], $methodName], $joinPoint->getMethodArguments());
}
} | php | public function callMethodOnOriginalSessionObject(JoinPointInterface $joinPoint)
{
$objectName = $this->objectManager->getObjectNameByClassName(get_class($joinPoint->getProxy()));
$methodName = $joinPoint->getMethodName();
$proxy = $joinPoint->getProxy();
if (!isset($this->sessionOriginalInstances[$objectName])) {
$this->sessionOriginalInstances[$objectName] = $this->objectManager->get($objectName);
}
if ($this->sessionOriginalInstances[$objectName] === $proxy) {
return $joinPoint->getAdviceChain()->proceed($joinPoint);
} else {
return call_user_func_array([$this->sessionOriginalInstances[$objectName], $methodName], $joinPoint->getMethodArguments());
}
} | [
"public",
"function",
"callMethodOnOriginalSessionObject",
"(",
"JoinPointInterface",
"$",
"joinPoint",
")",
"{",
"$",
"objectName",
"=",
"$",
"this",
"->",
"objectManager",
"->",
"getObjectNameByClassName",
"(",
"get_class",
"(",
"$",
"joinPoint",
"->",
"getProxy",
... | Around advice, wrapping every method of a scope session object. It redirects
all method calls to the session object once there is one.
@param JoinPointInterface $joinPoint The current join point
@return mixed
@Flow\Around("filter(Neos\Flow\Session\Aspect\SessionObjectMethodsPointcutFilter)") | [
"Around",
"advice",
"wrapping",
"every",
"method",
"of",
"a",
"scope",
"session",
"object",
".",
"It",
"redirects",
"all",
"method",
"calls",
"to",
"the",
"session",
"object",
"once",
"there",
"is",
"one",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Session/Aspect/LazyLoadingAspect.php#L108-L123 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/View/TemplatePaths.php | TemplatePaths.getTemplateRootPaths | public function getTemplateRootPaths()
{
if ($this->templateRootPaths !== []) {
return $this->templateRootPaths;
}
if ($this->templateRootPathPattern === null) {
return [];
}
$templateRootPath = $this->templateRootPathPattern;
if (isset($this->patternReplacementVariables['packageKey'])) {
$templateRootPath = str_replace('@packageResourcesPath', 'resource://' . $this->patternReplacementVariables['packageKey'], $templateRootPath);
}
return [$templateRootPath];
} | php | public function getTemplateRootPaths()
{
if ($this->templateRootPaths !== []) {
return $this->templateRootPaths;
}
if ($this->templateRootPathPattern === null) {
return [];
}
$templateRootPath = $this->templateRootPathPattern;
if (isset($this->patternReplacementVariables['packageKey'])) {
$templateRootPath = str_replace('@packageResourcesPath', 'resource://' . $this->patternReplacementVariables['packageKey'], $templateRootPath);
}
return [$templateRootPath];
} | [
"public",
"function",
"getTemplateRootPaths",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"templateRootPaths",
"!==",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"templateRootPaths",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"templateRootPathPattern",
... | Resolves the template root to be used inside other paths.
@return array Path(s) to template root directory | [
"Resolves",
"the",
"template",
"root",
"to",
"be",
"used",
"inside",
"other",
"paths",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/View/TemplatePaths.php#L122-L138 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/View/TemplatePaths.php | TemplatePaths.resolveTemplateFileForControllerAndActionAndFormat | public function resolveTemplateFileForControllerAndActionAndFormat($controller, $action, $format = null)
{
if ($this->templatePathAndFilename) {
return $this->templatePathAndFilename;
}
$action = ucfirst($action);
$paths = $this->getTemplateRootPaths();
if (isset($this->options['templatePathAndFilenamePattern'])) {
$paths = $this->expandGenericPathPattern($this->options['templatePathAndFilenamePattern'], array_merge($this->patternReplacementVariables, [
'controllerName' => $controller,
'action' => $action,
'format' => ($format !== null ? $format : $this->patternReplacementVariables['format'])
]), false, false);
}
foreach ($paths as $path) {
if (is_file($path)) {
return $path;
}
}
throw new Exception\InvalidTemplateResourceException('Template could not be loaded. I tried "' . implode('", "', $paths) . '"', 1225709595);
} | php | public function resolveTemplateFileForControllerAndActionAndFormat($controller, $action, $format = null)
{
if ($this->templatePathAndFilename) {
return $this->templatePathAndFilename;
}
$action = ucfirst($action);
$paths = $this->getTemplateRootPaths();
if (isset($this->options['templatePathAndFilenamePattern'])) {
$paths = $this->expandGenericPathPattern($this->options['templatePathAndFilenamePattern'], array_merge($this->patternReplacementVariables, [
'controllerName' => $controller,
'action' => $action,
'format' => ($format !== null ? $format : $this->patternReplacementVariables['format'])
]), false, false);
}
foreach ($paths as $path) {
if (is_file($path)) {
return $path;
}
}
throw new Exception\InvalidTemplateResourceException('Template could not be loaded. I tried "' . implode('", "', $paths) . '"', 1225709595);
} | [
"public",
"function",
"resolveTemplateFileForControllerAndActionAndFormat",
"(",
"$",
"controller",
",",
"$",
"action",
",",
"$",
"format",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"templatePathAndFilename",
")",
"{",
"return",
"$",
"this",
"->",
"... | Resolves a template file based on the given controller and action,
together with eventually defined patternReplacementVariables.
@param string $controller
@param string $action
@param string $format
@return mixed|string
@throws Exception\InvalidTemplateResourceException | [
"Resolves",
"a",
"template",
"file",
"based",
"on",
"the",
"given",
"controller",
"and",
"action",
"together",
"with",
"eventually",
"defined",
"patternReplacementVariables",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/View/TemplatePaths.php#L221-L245 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/View/TemplatePaths.php | TemplatePaths.getLayoutPathAndFilename | public function getLayoutPathAndFilename($layoutName = 'Default')
{
if (isset($this->options['layoutPathAndFilename'])) {
return $this->options['layoutPathAndFilename'];
}
$layoutName = ucfirst($layoutName);
$paths = $this->getLayoutRootPaths();
if (isset($this->options['layoutPathAndFilenamePattern'])) {
$paths = $this->expandGenericPathPattern($this->options['layoutPathAndFilenamePattern'], array_merge($this->patternReplacementVariables, [
'layout' => $layoutName
]), true, true);
}
foreach ($paths as $layoutPathAndFilename) {
if (is_file($layoutPathAndFilename)) {
return $layoutPathAndFilename;
}
}
throw new Exception\InvalidTemplateResourceException('The layout files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
} | php | public function getLayoutPathAndFilename($layoutName = 'Default')
{
if (isset($this->options['layoutPathAndFilename'])) {
return $this->options['layoutPathAndFilename'];
}
$layoutName = ucfirst($layoutName);
$paths = $this->getLayoutRootPaths();
if (isset($this->options['layoutPathAndFilenamePattern'])) {
$paths = $this->expandGenericPathPattern($this->options['layoutPathAndFilenamePattern'], array_merge($this->patternReplacementVariables, [
'layout' => $layoutName
]), true, true);
}
foreach ($paths as $layoutPathAndFilename) {
if (is_file($layoutPathAndFilename)) {
return $layoutPathAndFilename;
}
}
throw new Exception\InvalidTemplateResourceException('The layout files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
} | [
"public",
"function",
"getLayoutPathAndFilename",
"(",
"$",
"layoutName",
"=",
"'Default'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'layoutPathAndFilename'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"options",
"[",
"'... | Resolve the path and file name of the layout file, based on
$this->options['layoutPathAndFilename'] and $this->options['layoutPathAndFilenamePattern'].
In case a layout has already been set with setLayoutPathAndFilename(),
this method returns that path, otherwise a path and filename will be
resolved using the layoutPathAndFilenamePattern.
@param string $layoutName Name of the layout to use. If none given, use "Default"
@return string Path and filename of layout files
@throws Exception\InvalidTemplateResourceException | [
"Resolve",
"the",
"path",
"and",
"file",
"name",
"of",
"the",
"layout",
"file",
"based",
"on",
"$this",
"-",
">",
"options",
"[",
"layoutPathAndFilename",
"]",
"and",
"$this",
"-",
">",
"options",
"[",
"layoutPathAndFilenamePattern",
"]",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/View/TemplatePaths.php#L259-L279 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/View/TemplatePaths.php | TemplatePaths.getPartialPathAndFilename | public function getPartialPathAndFilename($partialName)
{
$patternReplacementVariables = array_merge($this->patternReplacementVariables, [
'partial' => $partialName,
]);
if (strpos($partialName, ':') !== false) {
list($packageKey, $actualPartialName) = explode(':', $partialName);
$package = $this->packageManager->getPackage($packageKey);
$patternReplacementVariables['package'] = $packageKey;
$patternReplacementVariables['packageResourcesPath'] = $package->getResourcesPath();
$patternReplacementVariables['partial'] = $actualPartialName;
}
$paths = $this->expandGenericPathPattern($this->options['partialPathAndFilenamePattern'], $patternReplacementVariables, true, true);
foreach ($paths as $partialPathAndFilename) {
if (is_file($partialPathAndFilename)) {
return $partialPathAndFilename;
}
}
throw new Exception\InvalidTemplateResourceException('The partial files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
} | php | public function getPartialPathAndFilename($partialName)
{
$patternReplacementVariables = array_merge($this->patternReplacementVariables, [
'partial' => $partialName,
]);
if (strpos($partialName, ':') !== false) {
list($packageKey, $actualPartialName) = explode(':', $partialName);
$package = $this->packageManager->getPackage($packageKey);
$patternReplacementVariables['package'] = $packageKey;
$patternReplacementVariables['packageResourcesPath'] = $package->getResourcesPath();
$patternReplacementVariables['partial'] = $actualPartialName;
}
$paths = $this->expandGenericPathPattern($this->options['partialPathAndFilenamePattern'], $patternReplacementVariables, true, true);
foreach ($paths as $partialPathAndFilename) {
if (is_file($partialPathAndFilename)) {
return $partialPathAndFilename;
}
}
throw new Exception\InvalidTemplateResourceException('The partial files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
} | [
"public",
"function",
"getPartialPathAndFilename",
"(",
"$",
"partialName",
")",
"{",
"$",
"patternReplacementVariables",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"patternReplacementVariables",
",",
"[",
"'partial'",
"=>",
"$",
"partialName",
",",
"]",
")",
";"... | Resolve the partial path and filename based on $this->options['partialPathAndFilenamePattern'].
@param string $partialName The name of the partial
@return string the full path which should be used. The path definitely exists.
@throws InvalidTemplateResourceException | [
"Resolve",
"the",
"partial",
"path",
"and",
"filename",
"based",
"on",
"$this",
"-",
">",
"options",
"[",
"partialPathAndFilenamePattern",
"]",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/View/TemplatePaths.php#L288-L311 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/View/TemplatePaths.php | TemplatePaths.sanitizePath | protected function sanitizePath($path)
{
if (empty($path)) {
return '';
}
$path = Files::getUnixStylePath($path);
if (is_dir($path)) {
$path = Files::getNormalizedPath($path);
}
return $path;
} | php | protected function sanitizePath($path)
{
if (empty($path)) {
return '';
}
$path = Files::getUnixStylePath($path);
if (is_dir($path)) {
$path = Files::getNormalizedPath($path);
}
return $path;
} | [
"protected",
"function",
"sanitizePath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"path",
"=",
"Files",
"::",
"getUnixStylePath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"is_dir"... | Sanitize a path, ensuring it is absolute and
if a directory, suffixed by a trailing slash.
@param string $path
@return string | [
"Sanitize",
"a",
"path",
"ensuring",
"it",
"is",
"absolute",
"and",
"if",
"a",
"directory",
"suffixed",
"by",
"a",
"trailing",
"slash",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/View/TemplatePaths.php#L340-L352 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/View/TemplatePaths.php | TemplatePaths.expandGenericPathPattern | protected function expandGenericPathPattern($pattern, array $patternReplacementVariables, $bubbleControllerAndSubpackage, $formatIsOptional)
{
$paths = [$pattern];
$paths = $this->expandPatterns($paths, '@templateRoot', isset($patternReplacementVariables['templateRoot']) ? [$patternReplacementVariables['templateRoot']] : $this->getTemplateRootPaths());
$paths = $this->expandPatterns($paths, '@partialRoot', isset($patternReplacementVariables['partialRoot']) ? [$patternReplacementVariables['partialRoot']] : $this->getPartialRootPaths());
$paths = $this->expandPatterns($paths, '@layoutRoot', isset($patternReplacementVariables['layoutRoot']) ? [$patternReplacementVariables['layoutRoot']] : $this->getLayoutRootPaths());
$subPackageKey = isset($patternReplacementVariables['subPackageKey']) ? $patternReplacementVariables['subPackageKey'] : '';
$controllerName = isset($patternReplacementVariables['controllerName']) ? $patternReplacementVariables['controllerName'] : '';
$format = isset($patternReplacementVariables['format']) ? $patternReplacementVariables['format'] : '';
unset($patternReplacementVariables['subPackageKey']);
unset($patternReplacementVariables['controllerName']);
unset($patternReplacementVariables['format']);
$paths = $this->expandSubPackageAndController($paths, $controllerName, $subPackageKey, $bubbleControllerAndSubpackage);
if ($formatIsOptional) {
$paths = $this->expandPatterns($paths, '.@format', ['.' . $format, '']);
$paths = $this->expandPatterns($paths, '@format', [$format, '']);
} else {
$paths = $this->expandPatterns($paths, '.@format', ['.' . $format]);
$paths = $this->expandPatterns($paths, '@format', [$format]);
}
foreach ($patternReplacementVariables as $variableName => $variableValue) {
$paths = $this->replacePatternVariable($paths, $variableName, $variableValue);
}
return array_values(array_unique($paths));
} | php | protected function expandGenericPathPattern($pattern, array $patternReplacementVariables, $bubbleControllerAndSubpackage, $formatIsOptional)
{
$paths = [$pattern];
$paths = $this->expandPatterns($paths, '@templateRoot', isset($patternReplacementVariables['templateRoot']) ? [$patternReplacementVariables['templateRoot']] : $this->getTemplateRootPaths());
$paths = $this->expandPatterns($paths, '@partialRoot', isset($patternReplacementVariables['partialRoot']) ? [$patternReplacementVariables['partialRoot']] : $this->getPartialRootPaths());
$paths = $this->expandPatterns($paths, '@layoutRoot', isset($patternReplacementVariables['layoutRoot']) ? [$patternReplacementVariables['layoutRoot']] : $this->getLayoutRootPaths());
$subPackageKey = isset($patternReplacementVariables['subPackageKey']) ? $patternReplacementVariables['subPackageKey'] : '';
$controllerName = isset($patternReplacementVariables['controllerName']) ? $patternReplacementVariables['controllerName'] : '';
$format = isset($patternReplacementVariables['format']) ? $patternReplacementVariables['format'] : '';
unset($patternReplacementVariables['subPackageKey']);
unset($patternReplacementVariables['controllerName']);
unset($patternReplacementVariables['format']);
$paths = $this->expandSubPackageAndController($paths, $controllerName, $subPackageKey, $bubbleControllerAndSubpackage);
if ($formatIsOptional) {
$paths = $this->expandPatterns($paths, '.@format', ['.' . $format, '']);
$paths = $this->expandPatterns($paths, '@format', [$format, '']);
} else {
$paths = $this->expandPatterns($paths, '.@format', ['.' . $format]);
$paths = $this->expandPatterns($paths, '@format', [$format]);
}
foreach ($patternReplacementVariables as $variableName => $variableValue) {
$paths = $this->replacePatternVariable($paths, $variableName, $variableValue);
}
return array_values(array_unique($paths));
} | [
"protected",
"function",
"expandGenericPathPattern",
"(",
"$",
"pattern",
",",
"array",
"$",
"patternReplacementVariables",
",",
"$",
"bubbleControllerAndSubpackage",
",",
"$",
"formatIsOptional",
")",
"{",
"$",
"paths",
"=",
"[",
"$",
"pattern",
"]",
";",
"$",
... | Processes following placeholders inside $pattern:
- "@templateRoot"
- "@partialRoot"
- "@layoutRoot"
- "@subpackage"
- "@controller"
- "@format"
This method is used to generate "fallback chains" for file system locations where a certain Partial can reside.
If $bubbleControllerAndSubpackage is false and $formatIsOptional is false, then the resulting array will only have one element
with all the above placeholders replaced.
If you set $bubbleControllerAndSubpackage to true, then you will get an array with potentially many elements:
The first element of the array is like above. The second element has the @ controller part set to "" (the empty string)
The third element now has the @ controller part again stripped off, and has the last subpackage part stripped off as well.
This continues until both "@subpackage" and "@controller" are empty.
Example for $bubbleControllerAndSubpackage is true, we have the MyCompany\MyPackage\MySubPackage\Controller\MyController
as Controller Object Name and the current format is "html"
If pattern is "@templateRoot/@subpackage/@controller/@action.@format", then the resulting array is:
- "Resources/Private/Templates/MySubPackage/My/@action.html"
- "Resources/Private/Templates/MySubPackage/@action.html"
- "Resources/Private/Templates/@action.html"
If you set $formatIsOptional to true, then for any of the above arrays, every element will be duplicated - once with "@format"
replaced by the current request format, and once with ."@format" stripped off.
@param string $pattern Pattern to be resolved
@param array $patternReplacementVariables The variables to replace in the pattern
@param boolean $bubbleControllerAndSubpackage if true, then we successively split off parts from "@controller" and "@subpackage" until both are empty.
@param boolean $formatIsOptional if true, then half of the resulting strings will have ."@format" stripped off, and the other half will have it.
@return array unix style paths | [
"Processes",
"following",
"placeholders",
"inside",
"$pattern",
":",
"-",
"@templateRoot",
"-",
"@partialRoot",
"-",
"@layoutRoot",
"-",
"@subpackage",
"-",
"@controller",
"-",
"@format"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/View/TemplatePaths.php#L404-L433 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/View/TemplatePaths.php | TemplatePaths.expandPatterns | protected function expandPatterns(array $patterns, $search, array $replacements)
{
if ($replacements === []) {
return $patterns;
}
$patternsWithReplacements = [];
foreach ($patterns as $pattern) {
foreach ($replacements as $replacement) {
$patternsWithReplacements[] = Files::getUnixStylePath(str_replace($search, $replacement, $pattern));
}
}
return $patternsWithReplacements;
} | php | protected function expandPatterns(array $patterns, $search, array $replacements)
{
if ($replacements === []) {
return $patterns;
}
$patternsWithReplacements = [];
foreach ($patterns as $pattern) {
foreach ($replacements as $replacement) {
$patternsWithReplacements[] = Files::getUnixStylePath(str_replace($search, $replacement, $pattern));
}
}
return $patternsWithReplacements;
} | [
"protected",
"function",
"expandPatterns",
"(",
"array",
"$",
"patterns",
",",
"$",
"search",
",",
"array",
"$",
"replacements",
")",
"{",
"if",
"(",
"$",
"replacements",
"===",
"[",
"]",
")",
"{",
"return",
"$",
"patterns",
";",
"}",
"$",
"patternsWithR... | Expands the given $patterns by adding an array element for each $replacement
replacing occurrences of $search.
@param array $patterns
@param string $search
@param array $replacements
@return void | [
"Expands",
"the",
"given",
"$patterns",
"by",
"adding",
"an",
"array",
"element",
"for",
"each",
"$replacement",
"replacing",
"occurrences",
"of",
"$search",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/View/TemplatePaths.php#L491-L504 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/View/TemplatePaths.php | TemplatePaths.setOption | public function setOption($optionName, $value)
{
$this->options[$optionName] = $value;
if (ObjectAccess::isPropertySettable($this, $optionName)) {
ObjectAccess::setProperty($this, $optionName, $value);
}
} | php | public function setOption($optionName, $value)
{
$this->options[$optionName] = $value;
if (ObjectAccess::isPropertySettable($this, $optionName)) {
ObjectAccess::setProperty($this, $optionName, $value);
}
} | [
"public",
"function",
"setOption",
"(",
"$",
"optionName",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"$",
"optionName",
"]",
"=",
"$",
"value",
";",
"if",
"(",
"ObjectAccess",
"::",
"isPropertySettable",
"(",
"$",
"this",
",",
"$"... | Set a specific option of this object
@param string $optionName
@param mixed $value
@return void | [
"Set",
"a",
"specific",
"option",
"of",
"this",
"object"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/View/TemplatePaths.php#L524-L530 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/View/TemplatePaths.php | TemplatePaths.createIdentifierForFile | protected function createIdentifierForFile($pathAndFilename, $prefix)
{
$templateModifiedTimestamp = 0;
$isStandardInput = $pathAndFilename === 'php://stdin';
$isFile = is_file($pathAndFilename);
if ($isStandardInput === false && $isFile === false) {
throw new InvalidTemplateResourceException(sprintf('The fluid file "%s" was not found.', $pathAndFilename), 1475831187);
}
if ($isStandardInput === false) {
$templateModifiedTimestamp = filemtime($pathAndFilename);
}
return sprintf('%s_%s', $prefix, sha1($pathAndFilename . '|' . $templateModifiedTimestamp));
} | php | protected function createIdentifierForFile($pathAndFilename, $prefix)
{
$templateModifiedTimestamp = 0;
$isStandardInput = $pathAndFilename === 'php://stdin';
$isFile = is_file($pathAndFilename);
if ($isStandardInput === false && $isFile === false) {
throw new InvalidTemplateResourceException(sprintf('The fluid file "%s" was not found.', $pathAndFilename), 1475831187);
}
if ($isStandardInput === false) {
$templateModifiedTimestamp = filemtime($pathAndFilename);
}
return sprintf('%s_%s', $prefix, sha1($pathAndFilename . '|' . $templateModifiedTimestamp));
} | [
"protected",
"function",
"createIdentifierForFile",
"(",
"$",
"pathAndFilename",
",",
"$",
"prefix",
")",
"{",
"$",
"templateModifiedTimestamp",
"=",
"0",
";",
"$",
"isStandardInput",
"=",
"$",
"pathAndFilename",
"===",
"'php://stdin'",
";",
"$",
"isFile",
"=",
... | Returns a unique identifier for the given file in the format
<PackageKey>_<SubPackageKey>_<ControllerName>_<prefix>_<SHA1>
The SH1 hash is a checksum that is based on the file path and last modification date
@param string $pathAndFilename
@param string $prefix
@return string
@throws InvalidTemplateResourceException | [
"Returns",
"a",
"unique",
"identifier",
"for",
"the",
"given",
"file",
"in",
"the",
"format",
"<PackageKey",
">",
"_<SubPackageKey",
">",
"_<ControllerName",
">",
"_<prefix",
">",
"_<SHA1",
">",
"The",
"SH1",
"hash",
"is",
"a",
"checksum",
"that",
"is",
"bas... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/View/TemplatePaths.php#L542-L556 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/ResourceRepository.php | ResourceRepository.remove | public function remove($object)
{
// Intercept a second call for the same PersistentResource object because it might cause an endless loop caused by
// the ResourceManager's deleteResource() method which also calls this remove() function:
if (!$this->removedResources->contains($object)) {
$this->removedResources->attach($object);
parent::remove($object);
}
} | php | public function remove($object)
{
// Intercept a second call for the same PersistentResource object because it might cause an endless loop caused by
// the ResourceManager's deleteResource() method which also calls this remove() function:
if (!$this->removedResources->contains($object)) {
$this->removedResources->attach($object);
parent::remove($object);
}
} | [
"public",
"function",
"remove",
"(",
"$",
"object",
")",
"{",
"// Intercept a second call for the same PersistentResource object because it might cause an endless loop caused by",
"// the ResourceManager's deleteResource() method which also calls this remove() function:",
"if",
"(",
"!",
"... | Removes a PersistentResource object from this repository
@param object $object
@return void | [
"Removes",
"a",
"PersistentResource",
"object",
"from",
"this",
"repository"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/ResourceRepository.php#L93-L101 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/ResourceRepository.php | ResourceRepository.findByIdentifier | public function findByIdentifier($identifier)
{
$object = $this->persistenceManager->getObjectByIdentifier($identifier, $this->entityClassName);
if ($object === null) {
foreach ($this->addedResources as $addedResource) {
if ($this->persistenceManager->getIdentifierByObject($addedResource) === $identifier) {
$object = $addedResource;
break;
}
}
}
return $object;
} | php | public function findByIdentifier($identifier)
{
$object = $this->persistenceManager->getObjectByIdentifier($identifier, $this->entityClassName);
if ($object === null) {
foreach ($this->addedResources as $addedResource) {
if ($this->persistenceManager->getIdentifierByObject($addedResource) === $identifier) {
$object = $addedResource;
break;
}
}
}
return $object;
} | [
"public",
"function",
"findByIdentifier",
"(",
"$",
"identifier",
")",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"persistenceManager",
"->",
"getObjectByIdentifier",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"entityClassName",
")",
";",
"if",
"(",
"$... | Finds an object matching the given identifier.
@param mixed $identifier The identifier of the object to find
@return object The matching object if found, otherwise NULL
@api | [
"Finds",
"an",
"object",
"matching",
"the",
"given",
"identifier",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/ResourceRepository.php#L121-L134 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/ResourceRepository.php | ResourceRepository.findAllIterator | public function findAllIterator()
{
/** @var QueryBuilder $queryBuilder */
$queryBuilder = $this->entityManager->createQueryBuilder();
return $queryBuilder
->select('PersistentResource')
->from($this->getEntityClassName(), 'PersistentResource')
->getQuery()->iterate();
} | php | public function findAllIterator()
{
/** @var QueryBuilder $queryBuilder */
$queryBuilder = $this->entityManager->createQueryBuilder();
return $queryBuilder
->select('PersistentResource')
->from($this->getEntityClassName(), 'PersistentResource')
->getQuery()->iterate();
} | [
"public",
"function",
"findAllIterator",
"(",
")",
"{",
"/** @var QueryBuilder $queryBuilder */",
"$",
"queryBuilder",
"=",
"$",
"this",
"->",
"entityManager",
"->",
"createQueryBuilder",
"(",
")",
";",
"return",
"$",
"queryBuilder",
"->",
"select",
"(",
"'Persisten... | Finds all objects and return an IterableResult
@return IterableResult | [
"Finds",
"all",
"objects",
"and",
"return",
"an",
"IterableResult"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/ResourceRepository.php#L165-L173 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/ResourceRepository.php | ResourceRepository.findByCollectionNameIterator | public function findByCollectionNameIterator($collectionName)
{
/** @var QueryBuilder $queryBuilder */
$queryBuilder = $this->entityManager->createQueryBuilder();
return $queryBuilder
->select('PersistentResource')
->from($this->getEntityClassName(), 'PersistentResource')
->where('PersistentResource.collectionName = :collectionName')
->setParameter(':collectionName', $collectionName)
->getQuery()->iterate();
} | php | public function findByCollectionNameIterator($collectionName)
{
/** @var QueryBuilder $queryBuilder */
$queryBuilder = $this->entityManager->createQueryBuilder();
return $queryBuilder
->select('PersistentResource')
->from($this->getEntityClassName(), 'PersistentResource')
->where('PersistentResource.collectionName = :collectionName')
->setParameter(':collectionName', $collectionName)
->getQuery()->iterate();
} | [
"public",
"function",
"findByCollectionNameIterator",
"(",
"$",
"collectionName",
")",
"{",
"/** @var QueryBuilder $queryBuilder */",
"$",
"queryBuilder",
"=",
"$",
"this",
"->",
"entityManager",
"->",
"createQueryBuilder",
"(",
")",
";",
"return",
"$",
"queryBuilder",
... | Finds all objects by collection name and return an IterableResult
@param string $collectionName
@return IterableResult | [
"Finds",
"all",
"objects",
"by",
"collection",
"name",
"and",
"return",
"an",
"IterableResult"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/ResourceRepository.php#L181-L191 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/ResourceRepository.php | ResourceRepository.findSimilarResources | public function findSimilarResources(PersistentResource $resource)
{
$query = $this->createQuery();
$query->matching(
$query->logicalAnd(
$query->equals('sha1', $resource->getSha1()),
$query->equals('filename', $resource->getFilename()),
$query->equals('collectionName', $resource->getCollectionName())
)
);
return $query->execute();
} | php | public function findSimilarResources(PersistentResource $resource)
{
$query = $this->createQuery();
$query->matching(
$query->logicalAnd(
$query->equals('sha1', $resource->getSha1()),
$query->equals('filename', $resource->getFilename()),
$query->equals('collectionName', $resource->getCollectionName())
)
);
return $query->execute();
} | [
"public",
"function",
"findSimilarResources",
"(",
"PersistentResource",
"$",
"resource",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"createQuery",
"(",
")",
";",
"$",
"query",
"->",
"matching",
"(",
"$",
"query",
"->",
"logicalAnd",
"(",
"$",
"query"... | Finds other resources which are referring to the same resource data, filename and collection
@param PersistentResource $resource The resource used for finding similar resources
@return QueryResultInterface The result, including the given resource | [
"Finds",
"other",
"resources",
"which",
"are",
"referring",
"to",
"the",
"same",
"resource",
"data",
"filename",
"and",
"collection"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/ResourceRepository.php#L199-L210 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/ResourceRepository.php | ResourceRepository.findBySha1 | public function findBySha1($sha1Hash)
{
$query = $this->createQuery();
$query->matching($query->equals('sha1', $sha1Hash));
$resources = $query->execute()->toArray();
foreach ($this->addedResources as $importedResource) {
if ($importedResource->getSha1() === $sha1Hash) {
$resources[] = $importedResource;
}
}
return $resources;
} | php | public function findBySha1($sha1Hash)
{
$query = $this->createQuery();
$query->matching($query->equals('sha1', $sha1Hash));
$resources = $query->execute()->toArray();
foreach ($this->addedResources as $importedResource) {
if ($importedResource->getSha1() === $sha1Hash) {
$resources[] = $importedResource;
}
}
return $resources;
} | [
"public",
"function",
"findBySha1",
"(",
"$",
"sha1Hash",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"createQuery",
"(",
")",
";",
"$",
"query",
"->",
"matching",
"(",
"$",
"query",
"->",
"equals",
"(",
"'sha1'",
",",
"$",
"sha1Hash",
")",
")",
... | Find all resources with the same SHA1 hash
@param string $sha1Hash
@return array | [
"Find",
"all",
"resources",
"with",
"the",
"same",
"SHA1",
"hash"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/ResourceRepository.php#L218-L230 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/ResourceRepository.php | ResourceRepository.findBySha1AndCollectionName | public function findBySha1AndCollectionName($sha1Hash, $collectionName)
{
$query = $this->createQuery();
$query->matching(
$query->logicalAnd(
$query->equals('sha1', $sha1Hash),
$query->equals('collectionName', $collectionName)
)
);
$resources = $query->execute()->toArray();
foreach ($this->addedResources as $importedResource) {
if ($importedResource->getSha1() === $sha1Hash && $importedResource->getCollectionName() === $collectionName) {
$resources[] = $importedResource;
}
}
return $resources;
} | php | public function findBySha1AndCollectionName($sha1Hash, $collectionName)
{
$query = $this->createQuery();
$query->matching(
$query->logicalAnd(
$query->equals('sha1', $sha1Hash),
$query->equals('collectionName', $collectionName)
)
);
$resources = $query->execute()->toArray();
foreach ($this->addedResources as $importedResource) {
if ($importedResource->getSha1() === $sha1Hash && $importedResource->getCollectionName() === $collectionName) {
$resources[] = $importedResource;
}
}
return $resources;
} | [
"public",
"function",
"findBySha1AndCollectionName",
"(",
"$",
"sha1Hash",
",",
"$",
"collectionName",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"createQuery",
"(",
")",
";",
"$",
"query",
"->",
"matching",
"(",
"$",
"query",
"->",
"logicalAnd",
"(",... | Find all resources with the same SHA1 hash and collection
@param string $sha1Hash
@param string $collectionName
@return array | [
"Find",
"all",
"resources",
"with",
"the",
"same",
"SHA1",
"hash",
"and",
"collection"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/ResourceRepository.php#L239-L256 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/ResourceRepository.php | ResourceRepository.findOneBySha1 | public function findOneBySha1($sha1Hash)
{
$query = $this->createQuery();
$query->matching($query->equals('sha1', $sha1Hash))->setLimit(1);
/** @var PersistentResource $resource */
$resource = $query->execute()->getFirst();
if ($resource === null) {
/** @var PersistentResource $importedResource */
foreach ($this->addedResources as $importedResource) {
if ($importedResource->getSha1() === $sha1Hash) {
return $importedResource;
}
}
}
return $resource;
} | php | public function findOneBySha1($sha1Hash)
{
$query = $this->createQuery();
$query->matching($query->equals('sha1', $sha1Hash))->setLimit(1);
/** @var PersistentResource $resource */
$resource = $query->execute()->getFirst();
if ($resource === null) {
/** @var PersistentResource $importedResource */
foreach ($this->addedResources as $importedResource) {
if ($importedResource->getSha1() === $sha1Hash) {
return $importedResource;
}
}
}
return $resource;
} | [
"public",
"function",
"findOneBySha1",
"(",
"$",
"sha1Hash",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"createQuery",
"(",
")",
";",
"$",
"query",
"->",
"matching",
"(",
"$",
"query",
"->",
"equals",
"(",
"'sha1'",
",",
"$",
"sha1Hash",
")",
")... | Find one resource by SHA1
@param string $sha1Hash
@return PersistentResource | [
"Find",
"one",
"resource",
"by",
"SHA1"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/ResourceRepository.php#L264-L280 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/Dto/UriConstraints.php | UriConstraints.merge | public function merge(UriConstraints $uriConstraints): self
{
$mergedConstraints = array_merge($this->constraints, $uriConstraints->constraints);
return new static($mergedConstraints);
} | php | public function merge(UriConstraints $uriConstraints): self
{
$mergedConstraints = array_merge($this->constraints, $uriConstraints->constraints);
return new static($mergedConstraints);
} | [
"public",
"function",
"merge",
"(",
"UriConstraints",
"$",
"uriConstraints",
")",
":",
"self",
"{",
"$",
"mergedConstraints",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"constraints",
",",
"$",
"uriConstraints",
"->",
"constraints",
")",
";",
"return",
"new",... | Merge two instances of UriConstraints
Constraints of the given $uriConstraints instance will overrule similar constraints of this instance
@param UriConstraints $uriConstraints
@return UriConstraints | [
"Merge",
"two",
"instances",
"of",
"UriConstraints",
"Constraints",
"of",
"the",
"given",
"$uriConstraints",
"instance",
"will",
"overrule",
"similar",
"constraints",
"of",
"this",
"instance"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/Dto/UriConstraints.php#L75-L79 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/Dto/UriConstraints.php | UriConstraints.withScheme | public function withScheme(string $scheme): self
{
$newConstraints = $this->constraints;
$newConstraints[self::CONSTRAINT_SCHEME] = $scheme;
return new static($newConstraints);
} | php | public function withScheme(string $scheme): self
{
$newConstraints = $this->constraints;
$newConstraints[self::CONSTRAINT_SCHEME] = $scheme;
return new static($newConstraints);
} | [
"public",
"function",
"withScheme",
"(",
"string",
"$",
"scheme",
")",
":",
"self",
"{",
"$",
"newConstraints",
"=",
"$",
"this",
"->",
"constraints",
";",
"$",
"newConstraints",
"[",
"self",
"::",
"CONSTRAINT_SCHEME",
"]",
"=",
"$",
"scheme",
";",
"return... | Create a new instance with the scheme constraint added
@param string $scheme The URI scheme to force, usually "http" or "https"
@return UriConstraints | [
"Create",
"a",
"new",
"instance",
"with",
"the",
"scheme",
"constraint",
"added"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/Dto/UriConstraints.php#L87-L92 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/Dto/UriConstraints.php | UriConstraints.withHost | public function withHost(string $host): self
{
$newConstraints = $this->constraints;
$newConstraints[self::CONSTRAINT_HOST] = $host;
return new static($newConstraints);
} | php | public function withHost(string $host): self
{
$newConstraints = $this->constraints;
$newConstraints[self::CONSTRAINT_HOST] = $host;
return new static($newConstraints);
} | [
"public",
"function",
"withHost",
"(",
"string",
"$",
"host",
")",
":",
"self",
"{",
"$",
"newConstraints",
"=",
"$",
"this",
"->",
"constraints",
";",
"$",
"newConstraints",
"[",
"self",
"::",
"CONSTRAINT_HOST",
"]",
"=",
"$",
"host",
";",
"return",
"ne... | Create a new instance with the host constraint added
@param string $host The URI host part to force, for example "neos.io"
@return UriConstraints | [
"Create",
"a",
"new",
"instance",
"with",
"the",
"host",
"constraint",
"added"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/Dto/UriConstraints.php#L100-L105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.