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/Persistence/Doctrine/Service.php | Service.getMigrationDescription | protected function getMigrationDescription(Version $version, DocCommentParser $parser)
{
if ($version->getMigration()->getDescription()) {
return $version->getMigration()->getDescription();
} else {
$reflectedClass = new \ReflectionClass($version->getMigration());
$parser->parseDocComment($reflectedClass->getDocComment());
return str_replace([chr(10), chr(13)], ' ', $parser->getDescription());
}
} | php | protected function getMigrationDescription(Version $version, DocCommentParser $parser)
{
if ($version->getMigration()->getDescription()) {
return $version->getMigration()->getDescription();
} else {
$reflectedClass = new \ReflectionClass($version->getMigration());
$parser->parseDocComment($reflectedClass->getDocComment());
return str_replace([chr(10), chr(13)], ' ', $parser->getDescription());
}
} | [
"protected",
"function",
"getMigrationDescription",
"(",
"Version",
"$",
"version",
",",
"DocCommentParser",
"$",
"parser",
")",
"{",
"if",
"(",
"$",
"version",
"->",
"getMigration",
"(",
")",
"->",
"getDescription",
"(",
")",
")",
"{",
"return",
"$",
"versi... | Returns the description of a migration.
If available it is fetched from the getDescription() method, if that returns an empty value
the class docblock is used instead.
@param Version $version
@param DocCommentParser $parser
@return string
@throws \ReflectionException | [
"Returns",
"the",
"description",
"of",
"a",
"migration",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Service.php#L399-L408 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Service.php | Service.executeMigrations | public function executeMigrations($version = null, $outputPathAndFilename = null, $dryRun = false, $quiet = false)
{
$configuration = $this->getMigrationConfiguration();
$migration = new Migration($configuration);
if ($outputPathAndFilename !== null) {
$migration->writeSqlFile($outputPathAndFilename, $version);
} else {
$migration->migrate($version, $dryRun);
}
if ($quiet === true) {
$output = '';
foreach ($this->output as $line) {
$line = strip_tags($line);
if (strpos($line, ' ++ migrating ') !== false || strpos($line, ' -- reverting ') !== false) {
$output .= substr($line, -15);
}
}
return $output;
} else {
return implode(PHP_EOL, $this->output);
}
} | php | public function executeMigrations($version = null, $outputPathAndFilename = null, $dryRun = false, $quiet = false)
{
$configuration = $this->getMigrationConfiguration();
$migration = new Migration($configuration);
if ($outputPathAndFilename !== null) {
$migration->writeSqlFile($outputPathAndFilename, $version);
} else {
$migration->migrate($version, $dryRun);
}
if ($quiet === true) {
$output = '';
foreach ($this->output as $line) {
$line = strip_tags($line);
if (strpos($line, ' ++ migrating ') !== false || strpos($line, ' -- reverting ') !== false) {
$output .= substr($line, -15);
}
}
return $output;
} else {
return implode(PHP_EOL, $this->output);
}
} | [
"public",
"function",
"executeMigrations",
"(",
"$",
"version",
"=",
"null",
",",
"$",
"outputPathAndFilename",
"=",
"null",
",",
"$",
"dryRun",
"=",
"false",
",",
"$",
"quiet",
"=",
"false",
")",
"{",
"$",
"configuration",
"=",
"$",
"this",
"->",
"getMi... | Execute all new migrations, up to $version if given.
If $outputPathAndFilename is given, the SQL statements will be written to the given file instead of executed.
@param string $version The version to migrate to
@param string $outputPathAndFilename A file to write SQL to, instead of executing it
@param boolean $dryRun Whether to do a dry run or not
@param boolean $quiet Whether to do a quiet run or not
@return string
@throws MigrationException
@throws DBALException | [
"Execute",
"all",
"new",
"migrations",
"up",
"to",
"$version",
"if",
"given",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Service.php#L423-L446 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Service.php | Service.executeMigration | public function executeMigration($version, $direction = 'up', $outputPathAndFilename = null, $dryRun = false)
{
$version = $this->getMigrationConfiguration()->getVersion($version);
if ($outputPathAndFilename !== null) {
$version->writeSqlFile($outputPathAndFilename, $direction);
} else {
$version->execute($direction, $dryRun);
}
return strip_tags(implode(PHP_EOL, $this->output));
} | php | public function executeMigration($version, $direction = 'up', $outputPathAndFilename = null, $dryRun = false)
{
$version = $this->getMigrationConfiguration()->getVersion($version);
if ($outputPathAndFilename !== null) {
$version->writeSqlFile($outputPathAndFilename, $direction);
} else {
$version->execute($direction, $dryRun);
}
return strip_tags(implode(PHP_EOL, $this->output));
} | [
"public",
"function",
"executeMigration",
"(",
"$",
"version",
",",
"$",
"direction",
"=",
"'up'",
",",
"$",
"outputPathAndFilename",
"=",
"null",
",",
"$",
"dryRun",
"=",
"false",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getMigrationConfiguration"... | Execute a single migration in up or down direction. If $path is given, the
SQL statements will be written to the file in $path instead of executed.
@param string $version The version to migrate to
@param string $direction
@param string $outputPathAndFilename A file to write SQL to, instead of executing it
@param boolean $dryRun Whether to do a dry run or not
@return string
@throws MigrationException
@throws DBALException | [
"Execute",
"a",
"single",
"migration",
"in",
"up",
"or",
"down",
"direction",
".",
"If",
"$path",
"is",
"given",
"the",
"SQL",
"statements",
"will",
"be",
"written",
"to",
"the",
"file",
"in",
"$path",
"instead",
"of",
"executed",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Service.php#L460-L470 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Service.php | Service.markAsMigrated | public function markAsMigrated($version, $markAsMigrated)
{
$configuration = $this->getMigrationConfiguration();
if ($version === 'all') {
foreach ($configuration->getMigrations() as $version) {
if ($markAsMigrated === true && $configuration->hasVersionMigrated($version) === false) {
$version->markMigrated();
} elseif ($markAsMigrated === false && $configuration->hasVersionMigrated($version) === true) {
$version->markNotMigrated();
}
}
} else {
if ($configuration->hasVersion($version) === false) {
throw MigrationException::unknownMigrationVersion($version);
}
$version = $configuration->getVersion($version);
if ($markAsMigrated === true) {
if ($configuration->hasVersionMigrated($version) === true) {
throw new MigrationException(sprintf('The version "%s" is already marked as executed.', $version));
}
$version->markMigrated();
} else {
if ($configuration->hasVersionMigrated($version) === false) {
throw new MigrationException(sprintf('The version "%s" is already marked as not executed.', $version));
}
$version->markNotMigrated();
}
}
} | php | public function markAsMigrated($version, $markAsMigrated)
{
$configuration = $this->getMigrationConfiguration();
if ($version === 'all') {
foreach ($configuration->getMigrations() as $version) {
if ($markAsMigrated === true && $configuration->hasVersionMigrated($version) === false) {
$version->markMigrated();
} elseif ($markAsMigrated === false && $configuration->hasVersionMigrated($version) === true) {
$version->markNotMigrated();
}
}
} else {
if ($configuration->hasVersion($version) === false) {
throw MigrationException::unknownMigrationVersion($version);
}
$version = $configuration->getVersion($version);
if ($markAsMigrated === true) {
if ($configuration->hasVersionMigrated($version) === true) {
throw new MigrationException(sprintf('The version "%s" is already marked as executed.', $version));
}
$version->markMigrated();
} else {
if ($configuration->hasVersionMigrated($version) === false) {
throw new MigrationException(sprintf('The version "%s" is already marked as not executed.', $version));
}
$version->markNotMigrated();
}
}
} | [
"public",
"function",
"markAsMigrated",
"(",
"$",
"version",
",",
"$",
"markAsMigrated",
")",
"{",
"$",
"configuration",
"=",
"$",
"this",
"->",
"getMigrationConfiguration",
"(",
")",
";",
"if",
"(",
"$",
"version",
"===",
"'all'",
")",
"{",
"foreach",
"("... | Add a migration version to the migrations table or remove it.
This does not execute any migration code but simply records a version
as migrated or not.
@param string $version The version to add or remove
@param boolean $markAsMigrated
@return void
@throws MigrationException
@throws \LogicException
@throws DBALException | [
"Add",
"a",
"migration",
"version",
"to",
"the",
"migrations",
"table",
"or",
"remove",
"it",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Service.php#L485-L516 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Service.php | Service.generateMigration | public function generateMigration($diffAgainstCurrent = true, $filterExpression = null)
{
$configuration = $this->getMigrationConfiguration();
$up = null;
$down = null;
if ($diffAgainstCurrent === true) {
/** @var \Doctrine\DBAL\Connection $connection */
$connection = $this->entityManager->getConnection();
if ($filterExpression) {
$connection->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression);
}
$metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
if (empty($metadata)) {
return ['No mapping information to process.', null];
}
$tool = new SchemaTool($this->entityManager);
$fromSchema = $connection->getSchemaManager()->createSchema();
$toSchema = $tool->getSchemaFromMetadata($metadata);
if ($filterExpression) {
foreach ($toSchema->getTables() as $table) {
$tableName = $table->getName();
if (!preg_match($filterExpression, $this->resolveTableName($tableName))) {
$toSchema->dropTable($tableName);
}
}
foreach ($toSchema->getSequences() as $sequence) {
$sequenceName = $sequence->getName();
if (!preg_match($filterExpression, $this->resolveTableName($sequenceName))) {
$toSchema->dropSequence($sequenceName);
}
}
}
$platform = $connection->getDatabasePlatform();
$up = $this->buildCodeFromSql($configuration, $fromSchema->getMigrateToSql($toSchema, $platform));
$down = $this->buildCodeFromSql($configuration, $fromSchema->getMigrateFromSql($toSchema, $platform));
if (!$up && !$down) {
return ['No changes detected in your mapping information.', null];
}
}
return ['Generated new migration class!', $this->writeMigrationClassToFile($configuration, $up, $down)];
} | php | public function generateMigration($diffAgainstCurrent = true, $filterExpression = null)
{
$configuration = $this->getMigrationConfiguration();
$up = null;
$down = null;
if ($diffAgainstCurrent === true) {
/** @var \Doctrine\DBAL\Connection $connection */
$connection = $this->entityManager->getConnection();
if ($filterExpression) {
$connection->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression);
}
$metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
if (empty($metadata)) {
return ['No mapping information to process.', null];
}
$tool = new SchemaTool($this->entityManager);
$fromSchema = $connection->getSchemaManager()->createSchema();
$toSchema = $tool->getSchemaFromMetadata($metadata);
if ($filterExpression) {
foreach ($toSchema->getTables() as $table) {
$tableName = $table->getName();
if (!preg_match($filterExpression, $this->resolveTableName($tableName))) {
$toSchema->dropTable($tableName);
}
}
foreach ($toSchema->getSequences() as $sequence) {
$sequenceName = $sequence->getName();
if (!preg_match($filterExpression, $this->resolveTableName($sequenceName))) {
$toSchema->dropSequence($sequenceName);
}
}
}
$platform = $connection->getDatabasePlatform();
$up = $this->buildCodeFromSql($configuration, $fromSchema->getMigrateToSql($toSchema, $platform));
$down = $this->buildCodeFromSql($configuration, $fromSchema->getMigrateFromSql($toSchema, $platform));
if (!$up && !$down) {
return ['No changes detected in your mapping information.', null];
}
}
return ['Generated new migration class!', $this->writeMigrationClassToFile($configuration, $up, $down)];
} | [
"public",
"function",
"generateMigration",
"(",
"$",
"diffAgainstCurrent",
"=",
"true",
",",
"$",
"filterExpression",
"=",
"null",
")",
"{",
"$",
"configuration",
"=",
"$",
"this",
"->",
"getMigrationConfiguration",
"(",
")",
";",
"$",
"up",
"=",
"null",
";"... | Generates a new migration file and returns the path to it.
If $diffAgainstCurrent is true, it generates a migration file with the
diff between current DB structure and the found mapping metadata.
Only include tables/sequences matching the $filterExpression regexp when
diffing models and existing schema.
Otherwise an empty migration skeleton is generated.
@param boolean $diffAgainstCurrent
@param string $filterExpression
@return array Path to the new file
@throws DBALException
@throws \Doctrine\ORM\ORMException
@throws FilesException | [
"Generates",
"a",
"new",
"migration",
"file",
"and",
"returns",
"the",
"path",
"to",
"it",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Service.php#L536-L587 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Service.php | Service.resolveTableName | private function resolveTableName(string $name): string
{
$pos = strpos($name, '.');
return false === $pos ? $name : substr($name, $pos + 1);
} | php | private function resolveTableName(string $name): string
{
$pos = strpos($name, '.');
return false === $pos ? $name : substr($name, $pos + 1);
} | [
"private",
"function",
"resolveTableName",
"(",
"string",
"$",
"name",
")",
":",
"string",
"{",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"name",
",",
"'.'",
")",
";",
"return",
"false",
"===",
"$",
"pos",
"?",
"$",
"name",
":",
"substr",
"(",
"$",
"nam... | Resolve a table name from its fully qualified name. The `$name` argument
comes from Doctrine\DBAL\Schema\Table#getName which can sometimes return
a namespaced name with the form `{namespace}.{tableName}`. This extracts
the table name from that.
@param string $name
@return string | [
"Resolve",
"a",
"table",
"name",
"from",
"its",
"fully",
"qualified",
"name",
".",
"The",
"$name",
"argument",
"comes",
"from",
"Doctrine",
"\\",
"DBAL",
"\\",
"Schema",
"\\",
"Table#getName",
"which",
"can",
"sometimes",
"return",
"a",
"namespaced",
"name",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Service.php#L598-L603 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Service.php | Service.buildCodeFromSql | protected function buildCodeFromSql(Configuration $configuration, array $sql): string
{
$currentPlatform = $configuration->getConnection()->getDatabasePlatform()->getName();
$code = [];
foreach ($sql as $query) {
if (stripos($query, $configuration->getMigrationsTableName()) !== false) {
continue;
}
$code[] = sprintf('$this->addSql(%s);', var_export($query, true));
}
if (!empty($code)) {
array_unshift(
$code,
sprintf(
'$this->abortIf($this->connection->getDatabasePlatform()->getName() !== %s, %s);',
var_export($currentPlatform, true),
var_export(sprintf('Migration can only be executed safely on "%s".', $currentPlatform), true)
),
''
);
}
return implode(chr(10), $code);
} | php | protected function buildCodeFromSql(Configuration $configuration, array $sql): string
{
$currentPlatform = $configuration->getConnection()->getDatabasePlatform()->getName();
$code = [];
foreach ($sql as $query) {
if (stripos($query, $configuration->getMigrationsTableName()) !== false) {
continue;
}
$code[] = sprintf('$this->addSql(%s);', var_export($query, true));
}
if (!empty($code)) {
array_unshift(
$code,
sprintf(
'$this->abortIf($this->connection->getDatabasePlatform()->getName() !== %s, %s);',
var_export($currentPlatform, true),
var_export(sprintf('Migration can only be executed safely on "%s".', $currentPlatform), true)
),
''
);
}
return implode(chr(10), $code);
} | [
"protected",
"function",
"buildCodeFromSql",
"(",
"Configuration",
"$",
"configuration",
",",
"array",
"$",
"sql",
")",
":",
"string",
"{",
"$",
"currentPlatform",
"=",
"$",
"configuration",
"->",
"getConnection",
"(",
")",
"->",
"getDatabasePlatform",
"(",
")",... | Returns PHP code for a migration file that "executes" the given
array of SQL statements.
@param Configuration $configuration
@param array $sql
@return string
@throws DBALException | [
"Returns",
"PHP",
"code",
"for",
"a",
"migration",
"file",
"that",
"executes",
"the",
"given",
"array",
"of",
"SQL",
"statements",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Service.php#L684-L708 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Service.php | Service.getForeignKeyHandlingSql | public static function getForeignKeyHandlingSql(Schema $schema, AbstractPlatform $platform, $tableNames, $search, $replace)
{
$foreignKeyHandlingSql = ['drop' => [], 'add' => []];
$tables = $schema->getTables();
foreach ($tables as $table) {
$foreignKeys = $table->getForeignKeys();
foreach ($foreignKeys as $foreignKey) {
if (!in_array($table->getName(), $tableNames) && !in_array($foreignKey->getForeignTableName(), $tableNames)) {
continue;
}
$localColumns = $foreignKey->getLocalColumns();
$foreignColumns = $foreignKey->getForeignColumns();
if (in_array($search, $foreignColumns) || in_array($search, $localColumns)) {
if (in_array($foreignKey->getLocalTableName(), $tableNames)) {
array_walk(
$localColumns,
function (&$value) use ($search, $replace) {
if ($value === $search) {
$value = $replace;
}
}
);
}
if (in_array($foreignKey->getForeignTableName(), $tableNames)) {
array_walk(
$foreignColumns,
function (&$value) use ($search, $replace) {
if ($value === $search) {
$value = $replace;
}
}
);
}
$identifierConstructorCallback = function ($columnName) {
return new Identifier($columnName);
};
$localColumns = array_map($identifierConstructorCallback, $localColumns);
$foreignColumns = array_map($identifierConstructorCallback, $foreignColumns);
$newForeignKey = clone $foreignKey;
ObjectAccess::setProperty($newForeignKey, '_localColumnNames', $localColumns, true);
ObjectAccess::setProperty($newForeignKey, '_foreignColumnNames', $foreignColumns, true);
$foreignKeyHandlingSql['drop'][] = $platform->getDropForeignKeySQL($foreignKey, $table);
$foreignKeyHandlingSql['add'][] = $platform->getCreateForeignKeySQL($newForeignKey, $table);
}
}
}
return $foreignKeyHandlingSql;
} | php | public static function getForeignKeyHandlingSql(Schema $schema, AbstractPlatform $platform, $tableNames, $search, $replace)
{
$foreignKeyHandlingSql = ['drop' => [], 'add' => []];
$tables = $schema->getTables();
foreach ($tables as $table) {
$foreignKeys = $table->getForeignKeys();
foreach ($foreignKeys as $foreignKey) {
if (!in_array($table->getName(), $tableNames) && !in_array($foreignKey->getForeignTableName(), $tableNames)) {
continue;
}
$localColumns = $foreignKey->getLocalColumns();
$foreignColumns = $foreignKey->getForeignColumns();
if (in_array($search, $foreignColumns) || in_array($search, $localColumns)) {
if (in_array($foreignKey->getLocalTableName(), $tableNames)) {
array_walk(
$localColumns,
function (&$value) use ($search, $replace) {
if ($value === $search) {
$value = $replace;
}
}
);
}
if (in_array($foreignKey->getForeignTableName(), $tableNames)) {
array_walk(
$foreignColumns,
function (&$value) use ($search, $replace) {
if ($value === $search) {
$value = $replace;
}
}
);
}
$identifierConstructorCallback = function ($columnName) {
return new Identifier($columnName);
};
$localColumns = array_map($identifierConstructorCallback, $localColumns);
$foreignColumns = array_map($identifierConstructorCallback, $foreignColumns);
$newForeignKey = clone $foreignKey;
ObjectAccess::setProperty($newForeignKey, '_localColumnNames', $localColumns, true);
ObjectAccess::setProperty($newForeignKey, '_foreignColumnNames', $foreignColumns, true);
$foreignKeyHandlingSql['drop'][] = $platform->getDropForeignKeySQL($foreignKey, $table);
$foreignKeyHandlingSql['add'][] = $platform->getCreateForeignKeySQL($newForeignKey, $table);
}
}
}
return $foreignKeyHandlingSql;
} | [
"public",
"static",
"function",
"getForeignKeyHandlingSql",
"(",
"Schema",
"$",
"schema",
",",
"AbstractPlatform",
"$",
"platform",
",",
"$",
"tableNames",
",",
"$",
"search",
",",
"$",
"replace",
")",
"{",
"$",
"foreignKeyHandlingSql",
"=",
"[",
"'drop'",
"=>... | This serves a rather strange use case: renaming columns used in FK constraints.
For a column that is used in a FK constraint to be renamed, the FK constraint has to be
dropped first, then the column can be renamed and last the FK constraint needs to be
added back (using the new name, of course).
This method helps with the task of handling the FK constraints during this. Given a list
of tables that contain columns to be renamed and a search/replace pair for the column name,
it will return an array with arrays with drop and add SQL statements.
Use them like this before and after renaming the affected fields:
// collect foreign keys pointing to "our" tables
$tableNames = array(...);
$foreignKeyHandlingSql = $this->getForeignKeyHandlingSql($schema, $tableNames, 'old_name', 'new_name');
// drop FK constraints
foreach ($foreignKeyHandlingSql['drop'] as $sql) {
$this->addSql($sql);
}
// rename columns now
// add back FK constraints
foreach ($foreignKeyHandlingSql['add'] as $sql) {
$this->addSql($sql);
}
@param Schema $schema
@param AbstractPlatform $platform
@param array $tableNames
@param string $search
@param string $replace
@return array | [
"This",
"serves",
"a",
"rather",
"strange",
"use",
"case",
":",
"renaming",
"columns",
"used",
"in",
"FK",
"constraints",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Service.php#L757-L808 |
neos/flow-development-collection | Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php | FilterOperation.evaluate | public function evaluate(FlowQuery $flowQuery, array $arguments)
{
if (!isset($arguments[0]) || empty($arguments[0])) {
return;
}
if (!is_string($arguments[0])) {
throw new FizzleException('filter operation expects string argument', 1332489625);
}
$filter = $arguments[0];
$parsedFilter = FizzleParser::parseFilterGroup($filter);
$filteredContext = [];
$context = $flowQuery->getContext();
foreach ($context as $element) {
if ($this->matchesFilterGroup($element, $parsedFilter)) {
$filteredContext[] = $element;
}
}
$flowQuery->setContext($filteredContext);
} | php | public function evaluate(FlowQuery $flowQuery, array $arguments)
{
if (!isset($arguments[0]) || empty($arguments[0])) {
return;
}
if (!is_string($arguments[0])) {
throw new FizzleException('filter operation expects string argument', 1332489625);
}
$filter = $arguments[0];
$parsedFilter = FizzleParser::parseFilterGroup($filter);
$filteredContext = [];
$context = $flowQuery->getContext();
foreach ($context as $element) {
if ($this->matchesFilterGroup($element, $parsedFilter)) {
$filteredContext[] = $element;
}
}
$flowQuery->setContext($filteredContext);
} | [
"public",
"function",
"evaluate",
"(",
"FlowQuery",
"$",
"flowQuery",
",",
"array",
"$",
"arguments",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"arguments",
"[",
"0",
"]",
")",
"||",
"empty",
"(",
"$",
"arguments",
"[",
"0",
"]",
")",
")",
"{",
... | {@inheritdoc}
@param FlowQuery $flowQuery the FlowQuery object
@param array $arguments the filter expression to use (in index 0)
@return void
@throws FizzleException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php#L84-L104 |
neos/flow-development-collection | Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php | FilterOperation.matchesFilterGroup | protected function matchesFilterGroup($element, array $parsedFilter)
{
foreach ($parsedFilter['Filters'] as $filter) {
if ($this->matchesFilter($element, $filter)) {
return true;
}
}
return false;
} | php | protected function matchesFilterGroup($element, array $parsedFilter)
{
foreach ($parsedFilter['Filters'] as $filter) {
if ($this->matchesFilter($element, $filter)) {
return true;
}
}
return false;
} | [
"protected",
"function",
"matchesFilterGroup",
"(",
"$",
"element",
",",
"array",
"$",
"parsedFilter",
")",
"{",
"foreach",
"(",
"$",
"parsedFilter",
"[",
"'Filters'",
"]",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"matchesFilter",
"(",
... | Evaluate Filter Group. An element matches the filter group if it
matches at least one part of the filter group.
Filter Group is something like "[foo], [bar]"
@param object $element
@param array $parsedFilter
@return boolean true if $element matches filter group, false otherwise | [
"Evaluate",
"Filter",
"Group",
".",
"An",
"element",
"matches",
"the",
"filter",
"group",
"if",
"it",
"matches",
"at",
"least",
"one",
"part",
"of",
"the",
"filter",
"group",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php#L116-L125 |
neos/flow-development-collection | Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php | FilterOperation.matchesFilter | protected function matchesFilter($element, $filter)
{
if (isset($filter['IdentifierFilter']) && !$this->matchesIdentifierFilter($element, $filter['IdentifierFilter'])) {
return false;
}
if (isset($filter['PropertyNameFilter']) && !$this->matchesPropertyNameFilter($element, $filter['PropertyNameFilter'])) {
return false;
}
if (isset($filter['AttributeFilters'])) {
foreach ($filter['AttributeFilters'] as $attributeFilter) {
if (!$this->matchesAttributeFilter($element, $attributeFilter)) {
return false;
}
}
}
return true;
} | php | protected function matchesFilter($element, $filter)
{
if (isset($filter['IdentifierFilter']) && !$this->matchesIdentifierFilter($element, $filter['IdentifierFilter'])) {
return false;
}
if (isset($filter['PropertyNameFilter']) && !$this->matchesPropertyNameFilter($element, $filter['PropertyNameFilter'])) {
return false;
}
if (isset($filter['AttributeFilters'])) {
foreach ($filter['AttributeFilters'] as $attributeFilter) {
if (!$this->matchesAttributeFilter($element, $attributeFilter)) {
return false;
}
}
}
return true;
} | [
"protected",
"function",
"matchesFilter",
"(",
"$",
"element",
",",
"$",
"filter",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"filter",
"[",
"'IdentifierFilter'",
"]",
")",
"&&",
"!",
"$",
"this",
"->",
"matchesIdentifierFilter",
"(",
"$",
"element",
",",
"... | Match a single filter, i.e. [foo]. It matches only if all filter parts match.
@param object $element
@param string $filter
@return boolean true if $element matches filter, false otherwise | [
"Match",
"a",
"single",
"filter",
"i",
".",
"e",
".",
"[",
"foo",
"]",
".",
"It",
"matches",
"only",
"if",
"all",
"filter",
"parts",
"match",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php#L134-L151 |
neos/flow-development-collection | Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php | FilterOperation.matchesAttributeFilter | protected function matchesAttributeFilter($element, array $attributeFilter)
{
if ($attributeFilter['PropertyPath'] !== null) {
$value = $this->getPropertyPath($element, $attributeFilter['PropertyPath']);
} else {
$value = $element;
}
$operand = null;
if (isset($attributeFilter['Operand'])) {
$operand = $attributeFilter['Operand'];
}
return $this->evaluateOperator($value, $attributeFilter['Operator'], $operand);
} | php | protected function matchesAttributeFilter($element, array $attributeFilter)
{
if ($attributeFilter['PropertyPath'] !== null) {
$value = $this->getPropertyPath($element, $attributeFilter['PropertyPath']);
} else {
$value = $element;
}
$operand = null;
if (isset($attributeFilter['Operand'])) {
$operand = $attributeFilter['Operand'];
}
return $this->evaluateOperator($value, $attributeFilter['Operator'], $operand);
} | [
"protected",
"function",
"matchesAttributeFilter",
"(",
"$",
"element",
",",
"array",
"$",
"attributeFilter",
")",
"{",
"if",
"(",
"$",
"attributeFilter",
"[",
"'PropertyPath'",
"]",
"!==",
"null",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getProperty... | Match a single attribute filter
@param mixed $element
@param array $attributeFilter
@return boolean | [
"Match",
"a",
"single",
"attribute",
"filter"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php#L173-L186 |
neos/flow-development-collection | Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php | FilterOperation.evaluateOperator | protected function evaluateOperator($value, $operator, $operand)
{
switch ($operator) {
case '=':
return $value === $operand;
case '!=':
return $value !== $operand;
case '<':
return $value < $operand;
case '<=':
return $value <= $operand;
case '>':
return $value > $operand;
case '>=':
return $value >= $operand;
case '$=':
if (is_array($value)) {
if ($this->evaluateOperator(end($value), '=', $operand)) {
return true;
}
return false;
} else {
return strrpos($value, (string)$operand) === strlen($value) - strlen($operand);
}
case '^=':
if (is_array($value)) {
if ($this->evaluateOperator(reset($value), '=', $operand)) {
return true;
}
return false;
} else {
return strpos($value, (string)$operand) === 0;
}
case '*=':
if (is_array($value)) {
foreach ($value as $item) {
if ($this->evaluateOperator($item, '=', $operand)) {
return true;
}
}
return false;
} else {
return strpos($value, (string)$operand) !== false;
}
case 'instanceof':
if ($this->operandIsSimpleType($operand)) {
return $this->handleSimpleTypeOperand($operand, $value);
} else {
return ($value instanceof $operand);
}
case '!instanceof':
if ($this->operandIsSimpleType($operand)) {
return !$this->handleSimpleTypeOperand($operand, $value);
} else {
return !($value instanceof $operand);
}
default:
return ($value !== null);
}
} | php | protected function evaluateOperator($value, $operator, $operand)
{
switch ($operator) {
case '=':
return $value === $operand;
case '!=':
return $value !== $operand;
case '<':
return $value < $operand;
case '<=':
return $value <= $operand;
case '>':
return $value > $operand;
case '>=':
return $value >= $operand;
case '$=':
if (is_array($value)) {
if ($this->evaluateOperator(end($value), '=', $operand)) {
return true;
}
return false;
} else {
return strrpos($value, (string)$operand) === strlen($value) - strlen($operand);
}
case '^=':
if (is_array($value)) {
if ($this->evaluateOperator(reset($value), '=', $operand)) {
return true;
}
return false;
} else {
return strpos($value, (string)$operand) === 0;
}
case '*=':
if (is_array($value)) {
foreach ($value as $item) {
if ($this->evaluateOperator($item, '=', $operand)) {
return true;
}
}
return false;
} else {
return strpos($value, (string)$operand) !== false;
}
case 'instanceof':
if ($this->operandIsSimpleType($operand)) {
return $this->handleSimpleTypeOperand($operand, $value);
} else {
return ($value instanceof $operand);
}
case '!instanceof':
if ($this->operandIsSimpleType($operand)) {
return !$this->handleSimpleTypeOperand($operand, $value);
} else {
return !($value instanceof $operand);
}
default:
return ($value !== null);
}
} | [
"protected",
"function",
"evaluateOperator",
"(",
"$",
"value",
",",
"$",
"operator",
",",
"$",
"operand",
")",
"{",
"switch",
"(",
"$",
"operator",
")",
"{",
"case",
"'='",
":",
"return",
"$",
"value",
"===",
"$",
"operand",
";",
"case",
"'!='",
":",
... | Evaluate an operator
@param mixed $value
@param string $operator
@param mixed $operand
@return boolean | [
"Evaluate",
"an",
"operator"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/Operations/Object/FilterOperation.php#L221-L280 |
neos/flow-development-collection | Neos.Flow/Classes/Security/RequestPatternResolver.php | RequestPatternResolver.resolveRequestPatternClass | public function resolveRequestPatternClass($name)
{
$resolvedClassName = $this->objectManager->getClassNameByObjectName($name);
if ($resolvedClassName !== false) {
return $resolvedClassName;
}
$resolvedClassName = $this->objectManager->getClassNameByObjectName('Neos\Flow\Security\RequestPattern\\' . $name);
if ($resolvedClassName !== false) {
return $resolvedClassName;
}
throw new Exception\NoRequestPatternFoundException('A request pattern with the name: "' . $name . '" could not be resolved.', 1217154134);
} | php | public function resolveRequestPatternClass($name)
{
$resolvedClassName = $this->objectManager->getClassNameByObjectName($name);
if ($resolvedClassName !== false) {
return $resolvedClassName;
}
$resolvedClassName = $this->objectManager->getClassNameByObjectName('Neos\Flow\Security\RequestPattern\\' . $name);
if ($resolvedClassName !== false) {
return $resolvedClassName;
}
throw new Exception\NoRequestPatternFoundException('A request pattern with the name: "' . $name . '" could not be resolved.', 1217154134);
} | [
"public",
"function",
"resolveRequestPatternClass",
"(",
"$",
"name",
")",
"{",
"$",
"resolvedClassName",
"=",
"$",
"this",
"->",
"objectManager",
"->",
"getClassNameByObjectName",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"resolvedClassName",
"!==",
"false",
... | Resolves the class name of a request pattern. If a valid request pattern class name is given, it is just returned.
@param string $name The (short) name of the pattern
@return string The class name of the request pattern, NULL if no class was found.
@throws Exception\NoRequestPatternFoundException | [
"Resolves",
"the",
"class",
"name",
"of",
"a",
"request",
"pattern",
".",
"If",
"a",
"valid",
"request",
"pattern",
"class",
"name",
"is",
"given",
"it",
"is",
"just",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/RequestPatternResolver.php#L46-L59 |
neos/flow-development-collection | Neos.Flow/Classes/Command/ConfigurationCommandController.php | ConfigurationCommandController.showCommand | public function showCommand(string $type = 'Settings', string $path = null)
{
$availableConfigurationTypes = $this->configurationManager->getAvailableConfigurationTypes();
if (in_array($type, $availableConfigurationTypes)) {
$configuration = $this->configurationManager->getConfiguration($type);
if ($path !== null) {
$configuration = Arrays::getValueByPath($configuration, $path);
}
$typeAndPath = $type . ($path ? ': ' . $path : '');
if ($configuration === null) {
$this->outputLine('<b>Configuration "%s" was empty!</b>', [$typeAndPath]);
} else {
$yaml = Yaml::dump($configuration, 99);
$this->outputLine('<b>Configuration "%s":</b>', [$typeAndPath]);
$this->outputLine();
$this->outputLine($yaml . chr(10));
}
} else {
$this->outputLine('<b>Configuration type "%s" was not found!</b>', [$type]);
$this->outputLine('<b>Available configuration types:</b>');
foreach ($availableConfigurationTypes as $availableConfigurationType) {
$this->outputLine(' ' . $availableConfigurationType);
}
$this->outputLine();
$this->outputLine('Hint: <b>%s configuration:show --type <configurationType></b>', [$this->getFlowInvocationString()]);
$this->outputLine(' shows the configuration of the specified type.');
}
} | php | public function showCommand(string $type = 'Settings', string $path = null)
{
$availableConfigurationTypes = $this->configurationManager->getAvailableConfigurationTypes();
if (in_array($type, $availableConfigurationTypes)) {
$configuration = $this->configurationManager->getConfiguration($type);
if ($path !== null) {
$configuration = Arrays::getValueByPath($configuration, $path);
}
$typeAndPath = $type . ($path ? ': ' . $path : '');
if ($configuration === null) {
$this->outputLine('<b>Configuration "%s" was empty!</b>', [$typeAndPath]);
} else {
$yaml = Yaml::dump($configuration, 99);
$this->outputLine('<b>Configuration "%s":</b>', [$typeAndPath]);
$this->outputLine();
$this->outputLine($yaml . chr(10));
}
} else {
$this->outputLine('<b>Configuration type "%s" was not found!</b>', [$type]);
$this->outputLine('<b>Available configuration types:</b>');
foreach ($availableConfigurationTypes as $availableConfigurationType) {
$this->outputLine(' ' . $availableConfigurationType);
}
$this->outputLine();
$this->outputLine('Hint: <b>%s configuration:show --type <configurationType></b>', [$this->getFlowInvocationString()]);
$this->outputLine(' shows the configuration of the specified type.');
}
} | [
"public",
"function",
"showCommand",
"(",
"string",
"$",
"type",
"=",
"'Settings'",
",",
"string",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"availableConfigurationTypes",
"=",
"$",
"this",
"->",
"configurationManager",
"->",
"getAvailableConfigurationTypes",
"(",
... | Show the active configuration settings
The command shows the configuration of the current context as it is used by Flow itself.
You can specify the configuration type and path if you want to show parts of the configuration.
Display all settings:
./flow configuration:show
Display Flow persistence settings:
./flow configuration:show --path Neos.Flow.persistence
Display Flow Object Cache configuration
./flow configuration:show --type Caches --path Flow_Object_Classes
@param string $type Configuration type to show, defaults to Settings
@param string $path path to subconfiguration separated by "." like "Neos.Flow"
@return void | [
"Show",
"the",
"active",
"configuration",
"settings"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/ConfigurationCommandController.php#L69-L96 |
neos/flow-development-collection | Neos.Flow/Classes/Command/ConfigurationCommandController.php | ConfigurationCommandController.listTypesCommand | public function listTypesCommand()
{
$this->outputLine('The following configuration types are registered:');
$this->outputLine();
foreach ($this->configurationManager->getAvailableConfigurationTypes() as $type) {
$this->outputFormatted('- %s', [$type]);
}
} | php | public function listTypesCommand()
{
$this->outputLine('The following configuration types are registered:');
$this->outputLine();
foreach ($this->configurationManager->getAvailableConfigurationTypes() as $type) {
$this->outputFormatted('- %s', [$type]);
}
} | [
"public",
"function",
"listTypesCommand",
"(",
")",
"{",
"$",
"this",
"->",
"outputLine",
"(",
"'The following configuration types are registered:'",
")",
";",
"$",
"this",
"->",
"outputLine",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"configurationManager... | List registered configuration types
@return void | [
"List",
"registered",
"configuration",
"types"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/ConfigurationCommandController.php#L103-L111 |
neos/flow-development-collection | Neos.Flow/Classes/Command/ConfigurationCommandController.php | ConfigurationCommandController.validateCommand | public function validateCommand(string $type = null, string $path = null, bool $verbose = false)
{
if ($type === null) {
$this->outputLine('Validating <b>all</b> configuration');
} else {
$this->outputLine('Validating <b>' . $type . '</b> configuration' . ($path !== null ? ' on path <b>' . $path . '</b>' : ''));
}
$this->outputLine();
$validatedSchemaFiles = [];
try {
$result = $this->configurationSchemaValidator->validate($type, $path, $validatedSchemaFiles);
} catch (SchemaValidationException $exception) {
$this->outputLine('<b>Exception:</b>');
$this->outputFormatted($exception->getMessage(), [], 4);
$this->quit(2);
return;
}
if ($verbose) {
$this->outputLine('<b>Loaded Schema Files:</b>');
foreach ($validatedSchemaFiles as $validatedSchemaFile) {
$this->outputLine('- ' . substr($validatedSchemaFile, strlen(FLOW_PATH_ROOT)));
}
$this->outputLine();
if ($result->hasNotices()) {
$notices = $result->getFlattenedNotices();
$this->outputLine('<b>%d notices:</b>', [count($notices)]);
/** @var Notice $notice */
foreach ($notices as $path => $pathNotices) {
foreach ($pathNotices as $notice) {
$this->outputLine(' - %s -> %s', [$path, $notice->render()]);
}
}
$this->outputLine();
}
}
if ($result->hasErrors()) {
$errors = $result->getFlattenedErrors();
$this->outputLine('<b>%d errors were found:</b>', [count($errors)]);
/** @var Error $error */
foreach ($errors as $path => $pathErrors) {
foreach ($pathErrors as $error) {
$this->outputLine(' - %s -> %s', [$path, $error->render()]);
}
}
$this->quit(1);
} else {
$this->outputLine('<b>All Valid!</b>');
}
} | php | public function validateCommand(string $type = null, string $path = null, bool $verbose = false)
{
if ($type === null) {
$this->outputLine('Validating <b>all</b> configuration');
} else {
$this->outputLine('Validating <b>' . $type . '</b> configuration' . ($path !== null ? ' on path <b>' . $path . '</b>' : ''));
}
$this->outputLine();
$validatedSchemaFiles = [];
try {
$result = $this->configurationSchemaValidator->validate($type, $path, $validatedSchemaFiles);
} catch (SchemaValidationException $exception) {
$this->outputLine('<b>Exception:</b>');
$this->outputFormatted($exception->getMessage(), [], 4);
$this->quit(2);
return;
}
if ($verbose) {
$this->outputLine('<b>Loaded Schema Files:</b>');
foreach ($validatedSchemaFiles as $validatedSchemaFile) {
$this->outputLine('- ' . substr($validatedSchemaFile, strlen(FLOW_PATH_ROOT)));
}
$this->outputLine();
if ($result->hasNotices()) {
$notices = $result->getFlattenedNotices();
$this->outputLine('<b>%d notices:</b>', [count($notices)]);
/** @var Notice $notice */
foreach ($notices as $path => $pathNotices) {
foreach ($pathNotices as $notice) {
$this->outputLine(' - %s -> %s', [$path, $notice->render()]);
}
}
$this->outputLine();
}
}
if ($result->hasErrors()) {
$errors = $result->getFlattenedErrors();
$this->outputLine('<b>%d errors were found:</b>', [count($errors)]);
/** @var Error $error */
foreach ($errors as $path => $pathErrors) {
foreach ($pathErrors as $error) {
$this->outputLine(' - %s -> %s', [$path, $error->render()]);
}
}
$this->quit(1);
} else {
$this->outputLine('<b>All Valid!</b>');
}
} | [
"public",
"function",
"validateCommand",
"(",
"string",
"$",
"type",
"=",
"null",
",",
"string",
"$",
"path",
"=",
"null",
",",
"bool",
"$",
"verbose",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"out... | Validate the given configuration
<b>Validate all configuration</b>
./flow configuration:validate
<b>Validate configuration at a certain subtype</b>
./flow configuration:validate --type Settings --path Neos.Flow.persistence
You can retrieve the available configuration types with:
./flow configuration:listtypes
@param string $type Configuration type to validate
@param string $path path to the subconfiguration separated by "." like "Neos.Flow"
@param boolean $verbose if true, output more verbose information on the schema files which were used
@return void | [
"Validate",
"the",
"given",
"configuration"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/ConfigurationCommandController.php#L130-L181 |
neos/flow-development-collection | Neos.Flow/Classes/Command/ConfigurationCommandController.php | ConfigurationCommandController.generateSchemaCommand | public function generateSchemaCommand(string $type = null, string $path = null, string $yaml = null)
{
$data = null;
if ($yaml !== null && is_file($yaml) && is_readable($yaml)) {
$data = Yaml::parseFile($yaml);
} elseif ($type !== null) {
$data = $this->configurationManager->getConfiguration($type);
if ($path !== null) {
$data = Arrays::getValueByPath($data, $path);
}
}
if (empty($data)) {
$this->outputLine('Data was not found or is empty');
$this->quit(1);
}
$this->outputLine(Yaml::dump($this->schemaGenerator->generate($data), 99));
} | php | public function generateSchemaCommand(string $type = null, string $path = null, string $yaml = null)
{
$data = null;
if ($yaml !== null && is_file($yaml) && is_readable($yaml)) {
$data = Yaml::parseFile($yaml);
} elseif ($type !== null) {
$data = $this->configurationManager->getConfiguration($type);
if ($path !== null) {
$data = Arrays::getValueByPath($data, $path);
}
}
if (empty($data)) {
$this->outputLine('Data was not found or is empty');
$this->quit(1);
}
$this->outputLine(Yaml::dump($this->schemaGenerator->generate($data), 99));
} | [
"public",
"function",
"generateSchemaCommand",
"(",
"string",
"$",
"type",
"=",
"null",
",",
"string",
"$",
"path",
"=",
"null",
",",
"string",
"$",
"yaml",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"null",
";",
"if",
"(",
"$",
"yaml",
"!==",
"null",
... | Generate a schema for the given configuration or YAML file.
./flow configuration:generateschema --type Settings --path Neos.Flow.persistence
The schema will be output to standard output.
@param string $type Configuration type to create a schema for
@param string $path path to the subconfiguration separated by "." like "Neos.Flow"
@param string $yaml YAML file to create a schema for
@return void | [
"Generate",
"a",
"schema",
"for",
"the",
"given",
"configuration",
"or",
"YAML",
"file",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/ConfigurationCommandController.php#L195-L213 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.initializeObject | public function initializeObject()
{
foreach ($this->options as $key => $value) {
$isOptionSet = $this->setOption($key, $value);
if (!$isOptionSet) {
throw new TargetException(sprintf('An unknown option "%s" was specified in the configuration of a resource FileSystemTarget. Please check your settings.', $key), 1361525952);
}
}
if (!is_writable($this->path)) {
@Files::createDirectoryRecursively($this->path);
}
if (!is_dir($this->path) && !is_link($this->path)) {
throw new TargetException('The directory "' . $this->path . '" which was configured as a publishing target does not exist and could not be created.', 1207124538);
}
if (!is_writable($this->path)) {
throw new TargetException('The directory "' . $this->path . '" which was configured as a publishing target is not writable.', 1207124546);
}
} | php | public function initializeObject()
{
foreach ($this->options as $key => $value) {
$isOptionSet = $this->setOption($key, $value);
if (!$isOptionSet) {
throw new TargetException(sprintf('An unknown option "%s" was specified in the configuration of a resource FileSystemTarget. Please check your settings.', $key), 1361525952);
}
}
if (!is_writable($this->path)) {
@Files::createDirectoryRecursively($this->path);
}
if (!is_dir($this->path) && !is_link($this->path)) {
throw new TargetException('The directory "' . $this->path . '" which was configured as a publishing target does not exist and could not be created.', 1207124538);
}
if (!is_writable($this->path)) {
throw new TargetException('The directory "' . $this->path . '" which was configured as a publishing target is not writable.', 1207124546);
}
} | [
"public",
"function",
"initializeObject",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"isOptionSet",
"=",
"$",
"this",
"->",
"setOption",
"(",
"$",
"key",
",",
"$",
"value",
")",
... | Initializes this resource publishing target
@return void
@throws TargetException | [
"Initializes",
"this",
"resource",
"publishing",
"target"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L147-L165 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.checkAndRemovePackageSymlinks | protected function checkAndRemovePackageSymlinks(StorageInterface $storage)
{
if (!$storage instanceof PackageStorage) {
return;
}
foreach ($storage->getPublicResourcePaths() as $packageKey => $path) {
$targetPathAndFilename = $this->path . $packageKey;
if (Files::is_link($targetPathAndFilename)) {
Files::unlink($targetPathAndFilename);
}
}
} | php | protected function checkAndRemovePackageSymlinks(StorageInterface $storage)
{
if (!$storage instanceof PackageStorage) {
return;
}
foreach ($storage->getPublicResourcePaths() as $packageKey => $path) {
$targetPathAndFilename = $this->path . $packageKey;
if (Files::is_link($targetPathAndFilename)) {
Files::unlink($targetPathAndFilename);
}
}
} | [
"protected",
"function",
"checkAndRemovePackageSymlinks",
"(",
"StorageInterface",
"$",
"storage",
")",
"{",
"if",
"(",
"!",
"$",
"storage",
"instanceof",
"PackageStorage",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"storage",
"->",
"getPublicResourcePaths... | Checks if the PackageStorage has been previously initialized with symlinks
and clears them. Otherwise the original sources would be overwritten.
@param StorageInterface $storage
@return void | [
"Checks",
"if",
"the",
"PackageStorage",
"has",
"been",
"previously",
"initialized",
"with",
"symlinks",
"and",
"clears",
"them",
".",
"Otherwise",
"the",
"original",
"sources",
"would",
"be",
"overwritten",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L184-L195 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.publishCollection | public function publishCollection(CollectionInterface $collection, callable $callback = null)
{
$storage = $collection->getStorage();
$this->checkAndRemovePackageSymlinks($storage);
foreach ($collection->getObjects($callback) as $object) {
/** @var StorageObject $object */
$sourceStream = $object->getStream();
if ($sourceStream === false) {
$this->handleMissingData($object, $collection);
continue;
}
$this->publishFile($sourceStream, $this->getRelativePublicationPathAndFilename($object));
fclose($sourceStream);
}
} | php | public function publishCollection(CollectionInterface $collection, callable $callback = null)
{
$storage = $collection->getStorage();
$this->checkAndRemovePackageSymlinks($storage);
foreach ($collection->getObjects($callback) as $object) {
/** @var StorageObject $object */
$sourceStream = $object->getStream();
if ($sourceStream === false) {
$this->handleMissingData($object, $collection);
continue;
}
$this->publishFile($sourceStream, $this->getRelativePublicationPathAndFilename($object));
fclose($sourceStream);
}
} | [
"public",
"function",
"publishCollection",
"(",
"CollectionInterface",
"$",
"collection",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"storage",
"=",
"$",
"collection",
"->",
"getStorage",
"(",
")",
";",
"$",
"this",
"->",
"checkAndRemovePack... | Publishes the whole collection to this target
@param CollectionInterface $collection The collection to publish
@param callable $callback Function called after each resource publishing
@return void | [
"Publishes",
"the",
"whole",
"collection",
"to",
"this",
"target"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L204-L218 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.publishResource | public function publishResource(PersistentResource $resource, CollectionInterface $collection)
{
$sourceStream = $resource->getStream();
if ($sourceStream === false) {
$this->handleMissingData($resource, $collection);
return;
}
$this->publishFile($sourceStream, $this->getRelativePublicationPathAndFilename($resource));
fclose($sourceStream);
} | php | public function publishResource(PersistentResource $resource, CollectionInterface $collection)
{
$sourceStream = $resource->getStream();
if ($sourceStream === false) {
$this->handleMissingData($resource, $collection);
return;
}
$this->publishFile($sourceStream, $this->getRelativePublicationPathAndFilename($resource));
fclose($sourceStream);
} | [
"public",
"function",
"publishResource",
"(",
"PersistentResource",
"$",
"resource",
",",
"CollectionInterface",
"$",
"collection",
")",
"{",
"$",
"sourceStream",
"=",
"$",
"resource",
"->",
"getStream",
"(",
")",
";",
"if",
"(",
"$",
"sourceStream",
"===",
"f... | Publishes the given persistent resource from the given storage
@param PersistentResource $resource The resource to publish
@param CollectionInterface $collection The collection the given resource belongs to
@return void | [
"Publishes",
"the",
"given",
"persistent",
"resource",
"from",
"the",
"given",
"storage"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L227-L236 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.handleMissingData | protected function handleMissingData(ResourceMetaDataInterface $resource, CollectionInterface $collection)
{
$message = sprintf('Could not publish resource %s with SHA1 hash %s of collection %s because there seems to be no corresponding data in the storage.', $resource->getFilename(), $resource->getSha1(), $collection->getName());
$this->messageCollector->append($message);
} | php | protected function handleMissingData(ResourceMetaDataInterface $resource, CollectionInterface $collection)
{
$message = sprintf('Could not publish resource %s with SHA1 hash %s of collection %s because there seems to be no corresponding data in the storage.', $resource->getFilename(), $resource->getSha1(), $collection->getName());
$this->messageCollector->append($message);
} | [
"protected",
"function",
"handleMissingData",
"(",
"ResourceMetaDataInterface",
"$",
"resource",
",",
"CollectionInterface",
"$",
"collection",
")",
"{",
"$",
"message",
"=",
"sprintf",
"(",
"'Could not publish resource %s with SHA1 hash %s of collection %s because there seems to... | Handle missing data notification
@param CollectionInterface $collection
@param ResourceMetaDataInterface $resource | [
"Handle",
"missing",
"data",
"notification"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L244-L248 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.unpublishResource | public function unpublishResource(PersistentResource $resource)
{
$resources = $this->resourceRepository->findSimilarResources($resource);
if (count($resources) > 1) {
$message = sprintf('Did not unpublish resource %s with SHA1 hash %s because it is used by other Resource objects.', $resource->getFilename(), $resource->getSha1());
$this->messageCollector->append($message, Error::SEVERITY_NOTICE);
return;
}
$this->unpublishFile($this->getRelativePublicationPathAndFilename($resource));
} | php | public function unpublishResource(PersistentResource $resource)
{
$resources = $this->resourceRepository->findSimilarResources($resource);
if (count($resources) > 1) {
$message = sprintf('Did not unpublish resource %s with SHA1 hash %s because it is used by other Resource objects.', $resource->getFilename(), $resource->getSha1());
$this->messageCollector->append($message, Error::SEVERITY_NOTICE);
return;
}
$this->unpublishFile($this->getRelativePublicationPathAndFilename($resource));
} | [
"public",
"function",
"unpublishResource",
"(",
"PersistentResource",
"$",
"resource",
")",
"{",
"$",
"resources",
"=",
"$",
"this",
"->",
"resourceRepository",
"->",
"findSimilarResources",
"(",
"$",
"resource",
")",
";",
"if",
"(",
"count",
"(",
"$",
"resour... | Unpublishes the given persistent resource
@param PersistentResource $resource The resource to unpublish
@return void | [
"Unpublishes",
"the",
"given",
"persistent",
"resource"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L256-L265 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.getPublicPersistentResourceUri | public function getPublicPersistentResourceUri(PersistentResource $resource)
{
return $this->getResourcesBaseUri() . $this->encodeRelativePathAndFilenameForUri($this->getRelativePublicationPathAndFilename($resource));
} | php | public function getPublicPersistentResourceUri(PersistentResource $resource)
{
return $this->getResourcesBaseUri() . $this->encodeRelativePathAndFilenameForUri($this->getRelativePublicationPathAndFilename($resource));
} | [
"public",
"function",
"getPublicPersistentResourceUri",
"(",
"PersistentResource",
"$",
"resource",
")",
"{",
"return",
"$",
"this",
"->",
"getResourcesBaseUri",
"(",
")",
".",
"$",
"this",
"->",
"encodeRelativePathAndFilenameForUri",
"(",
"$",
"this",
"->",
"getRel... | Returns the web accessible URI pointing to the specified persistent resource
@param PersistentResource $resource PersistentResource object
@return string The URI
@throws Exception | [
"Returns",
"the",
"web",
"accessible",
"URI",
"pointing",
"to",
"the",
"specified",
"persistent",
"resource"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L285-L288 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.publishFile | protected function publishFile($sourceStream, $relativeTargetPathAndFilename)
{
$pathInfo = UnicodeFunctions::pathinfo($relativeTargetPathAndFilename);
if (isset($pathInfo['extension']) && array_key_exists(strtolower($pathInfo['extension']), $this->extensionBlacklist) && $this->extensionBlacklist[strtolower($pathInfo['extension'])] === true) {
throw new TargetException(sprintf('Could not publish "%s" into resource publishing target "%s" because the filename extension "%s" is blacklisted.', $sourceStream, $this->name, strtolower($pathInfo['extension'])), 1447148472);
}
$targetPathAndFilename = $this->path . $relativeTargetPathAndFilename;
$streamMetaData = stream_get_meta_data($sourceStream);
$sourcePathAndFilename = $streamMetaData['uri'] ?? null;
if (@fstat($sourceStream) === false) {
throw new TargetException(sprintf('Could not publish "%s" into resource publishing target "%s" because the source file is not accessible (file stat failed).', $sourceStream, $this->name), 1375258499);
}
// If you switch from FileSystemSymlinkTarget than we need to remove the symlink before trying to write the file
$targetPathAndFilenameInfo = new \SplFileInfo($targetPathAndFilename);
if ($targetPathAndFilenameInfo->isLink() && $targetPathAndFilenameInfo->getRealPath() === $sourcePathAndFilename) {
Files::unlink($targetPathAndFilename);
}
if (!file_exists(dirname($targetPathAndFilename))) {
Files::createDirectoryRecursively(dirname($targetPathAndFilename));
}
if (!is_writable(dirname($targetPathAndFilename))) {
throw new Exception(sprintf('Could not publish "%s" into resource publishing target "%s" because the target file "%s" is not writable.', $sourceStream, $this->name, $targetPathAndFilename), 1428917322, (isset($exception) ? $exception : null));
}
try {
$targetFileHandle = fopen($targetPathAndFilename, 'w');
$result = stream_copy_to_stream($sourceStream, $targetFileHandle);
fclose($targetFileHandle);
} catch (\Exception $exception) {
$result = false;
}
if ($result === false) {
throw new TargetException(sprintf('Could not publish "%s" into resource publishing target "%s" because the source file could not be copied to the target location.', $sourceStream, $this->name), 1375258399, (isset($exception) ? $exception : null));
}
$this->logger->debug(sprintf('FileSystemTarget: Published file. (target: %s, file: %s)', $this->name, $relativeTargetPathAndFilename));
} | php | protected function publishFile($sourceStream, $relativeTargetPathAndFilename)
{
$pathInfo = UnicodeFunctions::pathinfo($relativeTargetPathAndFilename);
if (isset($pathInfo['extension']) && array_key_exists(strtolower($pathInfo['extension']), $this->extensionBlacklist) && $this->extensionBlacklist[strtolower($pathInfo['extension'])] === true) {
throw new TargetException(sprintf('Could not publish "%s" into resource publishing target "%s" because the filename extension "%s" is blacklisted.', $sourceStream, $this->name, strtolower($pathInfo['extension'])), 1447148472);
}
$targetPathAndFilename = $this->path . $relativeTargetPathAndFilename;
$streamMetaData = stream_get_meta_data($sourceStream);
$sourcePathAndFilename = $streamMetaData['uri'] ?? null;
if (@fstat($sourceStream) === false) {
throw new TargetException(sprintf('Could not publish "%s" into resource publishing target "%s" because the source file is not accessible (file stat failed).', $sourceStream, $this->name), 1375258499);
}
// If you switch from FileSystemSymlinkTarget than we need to remove the symlink before trying to write the file
$targetPathAndFilenameInfo = new \SplFileInfo($targetPathAndFilename);
if ($targetPathAndFilenameInfo->isLink() && $targetPathAndFilenameInfo->getRealPath() === $sourcePathAndFilename) {
Files::unlink($targetPathAndFilename);
}
if (!file_exists(dirname($targetPathAndFilename))) {
Files::createDirectoryRecursively(dirname($targetPathAndFilename));
}
if (!is_writable(dirname($targetPathAndFilename))) {
throw new Exception(sprintf('Could not publish "%s" into resource publishing target "%s" because the target file "%s" is not writable.', $sourceStream, $this->name, $targetPathAndFilename), 1428917322, (isset($exception) ? $exception : null));
}
try {
$targetFileHandle = fopen($targetPathAndFilename, 'w');
$result = stream_copy_to_stream($sourceStream, $targetFileHandle);
fclose($targetFileHandle);
} catch (\Exception $exception) {
$result = false;
}
if ($result === false) {
throw new TargetException(sprintf('Could not publish "%s" into resource publishing target "%s" because the source file could not be copied to the target location.', $sourceStream, $this->name), 1375258399, (isset($exception) ? $exception : null));
}
$this->logger->debug(sprintf('FileSystemTarget: Published file. (target: %s, file: %s)', $this->name, $relativeTargetPathAndFilename));
} | [
"protected",
"function",
"publishFile",
"(",
"$",
"sourceStream",
",",
"$",
"relativeTargetPathAndFilename",
")",
"{",
"$",
"pathInfo",
"=",
"UnicodeFunctions",
"::",
"pathinfo",
"(",
"$",
"relativeTargetPathAndFilename",
")",
";",
"if",
"(",
"isset",
"(",
"$",
... | Publishes the given source stream to this target, with the given relative path.
@param resource $sourceStream Stream of the source to publish
@param string $relativeTargetPathAndFilename relative path and filename in the target directory
@return void
@throws TargetException | [
"Publishes",
"the",
"given",
"source",
"stream",
"to",
"this",
"target",
"with",
"the",
"given",
"relative",
"path",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L309-L350 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.getResourcesBaseUri | protected function getResourcesBaseUri()
{
if ($this->absoluteBaseUri === null) {
$this->absoluteBaseUri = $this->detectResourcesBaseUri();
}
return $this->absoluteBaseUri;
} | php | protected function getResourcesBaseUri()
{
if ($this->absoluteBaseUri === null) {
$this->absoluteBaseUri = $this->detectResourcesBaseUri();
}
return $this->absoluteBaseUri;
} | [
"protected",
"function",
"getResourcesBaseUri",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"absoluteBaseUri",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"absoluteBaseUri",
"=",
"$",
"this",
"->",
"detectResourcesBaseUri",
"(",
")",
";",
"}",
"return",
"... | Returns the resolved absolute base URI for resources of this target.
@return string The absolute base URI for resources in this target | [
"Returns",
"the",
"resolved",
"absolute",
"base",
"URI",
"for",
"resources",
"of",
"this",
"target",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L381-L388 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.detectResourcesBaseUri | protected function detectResourcesBaseUri()
{
if ($this->baseUri !== '' && ($this->baseUri[0] === '/' || strpos($this->baseUri, '://') !== false)) {
return $this->baseUri;
}
$requestHandler = $this->bootstrap->getActiveRequestHandler();
if ($requestHandler instanceof HttpRequestHandlerInterface) {
return $requestHandler->getHttpRequest()->getBaseUri() . $this->baseUri;
}
if ($this->httpBaseUri === null) {
throw new TargetException(sprintf('The base URI for resources could not be detected. Please specify the "Neos.Flow.http.baseUri" setting or use an absolute "baseUri" option for target "%s".', $this->name), 1438093977);
}
return $this->httpBaseUri . $this->baseUri;
} | php | protected function detectResourcesBaseUri()
{
if ($this->baseUri !== '' && ($this->baseUri[0] === '/' || strpos($this->baseUri, '://') !== false)) {
return $this->baseUri;
}
$requestHandler = $this->bootstrap->getActiveRequestHandler();
if ($requestHandler instanceof HttpRequestHandlerInterface) {
return $requestHandler->getHttpRequest()->getBaseUri() . $this->baseUri;
}
if ($this->httpBaseUri === null) {
throw new TargetException(sprintf('The base URI for resources could not be detected. Please specify the "Neos.Flow.http.baseUri" setting or use an absolute "baseUri" option for target "%s".', $this->name), 1438093977);
}
return $this->httpBaseUri . $this->baseUri;
} | [
"protected",
"function",
"detectResourcesBaseUri",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"baseUri",
"!==",
"''",
"&&",
"(",
"$",
"this",
"->",
"baseUri",
"[",
"0",
"]",
"===",
"'/'",
"||",
"strpos",
"(",
"$",
"this",
"->",
"baseUri",
",",
"':/... | Detects and returns the website's absolute base URI
@return string The resolved resource base URI, @see getResourcesBaseUri()
@throws TargetException if the baseUri can't be resolved | [
"Detects",
"and",
"returns",
"the",
"website",
"s",
"absolute",
"base",
"URI"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L396-L411 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.getRelativePublicationPathAndFilename | protected function getRelativePublicationPathAndFilename(ResourceMetaDataInterface $object)
{
if ($object->getRelativePublicationPath() !== '') {
$pathAndFilename = $object->getRelativePublicationPath() . $object->getFilename();
} else {
if ($this->subdivideHashPathSegment) {
$sha1Hash = $object->getSha1();
$pathAndFilename = $sha1Hash[0] . '/' . $sha1Hash[1] . '/' . $sha1Hash[2] . '/' . $sha1Hash[3] . '/' . $sha1Hash . '/' . $object->getFilename();
} else {
$pathAndFilename = $object->getSha1() . '/' . $object->getFilename();
}
}
return $pathAndFilename;
} | php | protected function getRelativePublicationPathAndFilename(ResourceMetaDataInterface $object)
{
if ($object->getRelativePublicationPath() !== '') {
$pathAndFilename = $object->getRelativePublicationPath() . $object->getFilename();
} else {
if ($this->subdivideHashPathSegment) {
$sha1Hash = $object->getSha1();
$pathAndFilename = $sha1Hash[0] . '/' . $sha1Hash[1] . '/' . $sha1Hash[2] . '/' . $sha1Hash[3] . '/' . $sha1Hash . '/' . $object->getFilename();
} else {
$pathAndFilename = $object->getSha1() . '/' . $object->getFilename();
}
}
return $pathAndFilename;
} | [
"protected",
"function",
"getRelativePublicationPathAndFilename",
"(",
"ResourceMetaDataInterface",
"$",
"object",
")",
"{",
"if",
"(",
"$",
"object",
"->",
"getRelativePublicationPath",
"(",
")",
"!==",
"''",
")",
"{",
"$",
"pathAndFilename",
"=",
"$",
"object",
... | Determines and returns the relative path and filename for the given Storage Object or PersistentResource. If the given
object represents a persistent resource, its own relative publication path will be empty. If the given object
represents a static resources, it will contain a relative path.
No matter which kind of resource, persistent or static, this function will return a sub directory structure
if no relative publication path was defined in the given object.
@param ResourceMetaDataInterface $object PersistentResource or Storage Object
@return string The relative path and filename, for example "c/8/2/8/c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" (if subdivideHashPathSegment is on) or "c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" (if it's off) | [
"Determines",
"and",
"returns",
"the",
"relative",
"path",
"and",
"filename",
"for",
"the",
"given",
"Storage",
"Object",
"or",
"PersistentResource",
".",
"If",
"the",
"given",
"object",
"represents",
"a",
"persistent",
"resource",
"its",
"own",
"relative",
"pub... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L424-L437 |
neos/flow-development-collection | Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php | FileSystemTarget.setOption | protected function setOption($key, $value)
{
switch ($key) {
case 'baseUri':
case 'path':
case 'extensionBlacklist':
$this->$key = $value;
break;
case 'subdivideHashPathSegment':
$this->subdivideHashPathSegment = (boolean)$value;
break;
default:
return false;
}
return true;
} | php | protected function setOption($key, $value)
{
switch ($key) {
case 'baseUri':
case 'path':
case 'extensionBlacklist':
$this->$key = $value;
break;
case 'subdivideHashPathSegment':
$this->subdivideHashPathSegment = (boolean)$value;
break;
default:
return false;
}
return true;
} | [
"protected",
"function",
"setOption",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"key",
")",
"{",
"case",
"'baseUri'",
":",
"case",
"'path'",
":",
"case",
"'extensionBlacklist'",
":",
"$",
"this",
"->",
"$",
"key",
"=",
"$",
"v... | Set an option value and return if it was set.
@param string $key
@param mixed $value
@return boolean | [
"Set",
"an",
"option",
"value",
"and",
"return",
"if",
"it",
"was",
"set",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php#L446-L462 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/ViewHelpers/Format/CurrencyViewHelper.php | CurrencyViewHelper.initializeArguments | public function initializeArguments()
{
$this->registerArgument('currencySign', 'string', '(optional) The currency sign, eg $ or €.', false, '');
$this->registerArgument('decimalSeparator', 'string', '(optional) The separator for the decimal point.', false, ',');
$this->registerArgument('thousandsSeparator', 'string', '(optional) The thousands separator.', false, '.');
$this->registerArgument('prependCurrency', 'boolean', '(optional) Indicates if currency symbol should be placed before or after the numeric value.', false, false);
$this->registerArgument('separateCurrency', 'boolean', '(optional) Indicates if a space character should be placed between the number and the currency sign.', false, true);
$this->registerArgument('decimals', 'integer', '(optional) The number of decimal places.', false, 2);
$this->registerArgument('currencyCode', 'string', '(optional) The ISO 4217 currency code of the currency to format. Used to set decimal places and rounding.', false, null);
} | php | public function initializeArguments()
{
$this->registerArgument('currencySign', 'string', '(optional) The currency sign, eg $ or €.', false, '');
$this->registerArgument('decimalSeparator', 'string', '(optional) The separator for the decimal point.', false, ',');
$this->registerArgument('thousandsSeparator', 'string', '(optional) The thousands separator.', false, '.');
$this->registerArgument('prependCurrency', 'boolean', '(optional) Indicates if currency symbol should be placed before or after the numeric value.', false, false);
$this->registerArgument('separateCurrency', 'boolean', '(optional) Indicates if a space character should be placed between the number and the currency sign.', false, true);
$this->registerArgument('decimals', 'integer', '(optional) The number of decimal places.', false, 2);
$this->registerArgument('currencyCode', 'string', '(optional) The ISO 4217 currency code of the currency to format. Used to set decimal places and rounding.', false, null);
} | [
"public",
"function",
"initializeArguments",
"(",
")",
"{",
"$",
"this",
"->",
"registerArgument",
"(",
"'currencySign'",
",",
"'string'",
",",
"'(optional) The currency sign, eg $ or €.', ",
"f",
"lse, ",
"'",
");",
"",
"",
"$",
"this",
"->",
"registerArgument",
... | Initialize the arguments.
@return void
@api | [
"Initialize",
"the",
"arguments",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/Format/CurrencyViewHelper.php#L108-L117 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/ObjectPathMappingRepository.php | ObjectPathMappingRepository.persistEntities | public function persistEntities()
{
foreach ($this->entityManager->getUnitOfWork()->getIdentityMap() as $className => $entities) {
if ($className === $this->entityClassName) {
$this->entityManager->flush($entities);
return;
}
}
} | php | public function persistEntities()
{
foreach ($this->entityManager->getUnitOfWork()->getIdentityMap() as $className => $entities) {
if ($className === $this->entityClassName) {
$this->entityManager->flush($entities);
return;
}
}
} | [
"public",
"function",
"persistEntities",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"entityManager",
"->",
"getUnitOfWork",
"(",
")",
"->",
"getIdentityMap",
"(",
")",
"as",
"$",
"className",
"=>",
"$",
"entities",
")",
"{",
"if",
"(",
"$",
"class... | Persists all entities managed by the repository and all cascading dependencies
@return void | [
"Persists",
"all",
"entities",
"managed",
"by",
"the",
"repository",
"and",
"all",
"cascading",
"dependencies"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/ObjectPathMappingRepository.php#L95-L103 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/ViewHelpers/Format/HtmlentitiesDecodeViewHelper.php | HtmlentitiesDecodeViewHelper.renderStatic | public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$value = $arguments['value'];
if ($value === null) {
$value = $renderChildrenClosure();
}
if (!is_string($value) && !(is_object($value) && method_exists($value, '__toString'))) {
return $value;
}
$flags = $arguments['keepQuotes'] ? ENT_NOQUOTES : ENT_COMPAT;
return html_entity_decode($value, $flags, $arguments['encoding']);
} | php | public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$value = $arguments['value'];
if ($value === null) {
$value = $renderChildrenClosure();
}
if (!is_string($value) && !(is_object($value) && method_exists($value, '__toString'))) {
return $value;
}
$flags = $arguments['keepQuotes'] ? ENT_NOQUOTES : ENT_COMPAT;
return html_entity_decode($value, $flags, $arguments['encoding']);
} | [
"public",
"static",
"function",
"renderStatic",
"(",
"array",
"$",
"arguments",
",",
"\\",
"Closure",
"$",
"renderChildrenClosure",
",",
"RenderingContextInterface",
"$",
"renderingContext",
")",
"{",
"$",
"value",
"=",
"$",
"arguments",
"[",
"'value'",
"]",
";"... | Applies html_entity_decode() on the specified value.
@param array $arguments
@param \Closure $renderChildrenClosure
@param RenderingContextInterface $renderingContext
@return string | [
"Applies",
"html_entity_decode",
"()",
"on",
"the",
"specified",
"value",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/Format/HtmlentitiesDecodeViewHelper.php#L87-L99 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/Pbkdf2HashingStrategy.php | Pbkdf2HashingStrategy.hashPassword | public function hashPassword($password, $staticSalt = null)
{
$dynamicSalt = UtilityAlgorithms::generateRandomBytes($this->dynamicSaltLength);
$result = CryptographyAlgorithms::pbkdf2($password, $dynamicSalt . $staticSalt, $this->iterationCount, $this->derivedKeyLength, $this->algorithm);
return base64_encode($dynamicSalt) . ',' . base64_encode($result);
} | php | public function hashPassword($password, $staticSalt = null)
{
$dynamicSalt = UtilityAlgorithms::generateRandomBytes($this->dynamicSaltLength);
$result = CryptographyAlgorithms::pbkdf2($password, $dynamicSalt . $staticSalt, $this->iterationCount, $this->derivedKeyLength, $this->algorithm);
return base64_encode($dynamicSalt) . ',' . base64_encode($result);
} | [
"public",
"function",
"hashPassword",
"(",
"$",
"password",
",",
"$",
"staticSalt",
"=",
"null",
")",
"{",
"$",
"dynamicSalt",
"=",
"UtilityAlgorithms",
"::",
"generateRandomBytes",
"(",
"$",
"this",
"->",
"dynamicSaltLength",
")",
";",
"$",
"result",
"=",
"... | Hash a password for storage using PBKDF2 and the configured parameters.
Will use a combination of a random dynamic salt and the given static salt.
@param string $password Cleartext password that should be hashed
@param string $staticSalt Static salt that will be appended to the random dynamic salt
@return string A Base64 encoded string with the derived key (hashed password) and dynamic salt | [
"Hash",
"a",
"password",
"for",
"storage",
"using",
"PBKDF2",
"and",
"the",
"configured",
"parameters",
".",
"Will",
"use",
"a",
"combination",
"of",
"a",
"random",
"dynamic",
"salt",
"and",
"the",
"given",
"static",
"salt",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/Pbkdf2HashingStrategy.php#L71-L76 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/Pbkdf2HashingStrategy.php | Pbkdf2HashingStrategy.validatePassword | public function validatePassword($password, $hashedPasswordAndSalt, $staticSalt = null)
{
$parts = explode(',', $hashedPasswordAndSalt);
if (count($parts) !== 2) {
throw new \InvalidArgumentException('The derived key with salt must contain a salt, separated with a comma from the derived key', 1306172911);
}
$dynamicSalt = base64_decode($parts[0]);
$derivedKey = base64_decode($parts[1]);
$derivedKeyLength = strlen($derivedKey);
return $derivedKey === CryptographyAlgorithms::pbkdf2($password, $dynamicSalt . $staticSalt, $this->iterationCount, $derivedKeyLength, $this->algorithm);
} | php | public function validatePassword($password, $hashedPasswordAndSalt, $staticSalt = null)
{
$parts = explode(',', $hashedPasswordAndSalt);
if (count($parts) !== 2) {
throw new \InvalidArgumentException('The derived key with salt must contain a salt, separated with a comma from the derived key', 1306172911);
}
$dynamicSalt = base64_decode($parts[0]);
$derivedKey = base64_decode($parts[1]);
$derivedKeyLength = strlen($derivedKey);
return $derivedKey === CryptographyAlgorithms::pbkdf2($password, $dynamicSalt . $staticSalt, $this->iterationCount, $derivedKeyLength, $this->algorithm);
} | [
"public",
"function",
"validatePassword",
"(",
"$",
"password",
",",
"$",
"hashedPasswordAndSalt",
",",
"$",
"staticSalt",
"=",
"null",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"','",
",",
"$",
"hashedPasswordAndSalt",
")",
";",
"if",
"(",
"count",
"("... | Validate a password against a derived key (hashed password) and salt using PBKDF2.
Iteration count and algorithm have to match the parameters when generating the derived key.
@param string $password The cleartext password
@param string $hashedPasswordAndSalt The derived key and salt in Base64 encoding as returned by hashPassword for verification
@param string $staticSalt Static salt that will be appended to the dynamic salt
@return boolean true if the given password matches the hashed password
@throws \InvalidArgumentException | [
"Validate",
"a",
"password",
"against",
"a",
"derived",
"key",
"(",
"hashed",
"password",
")",
"and",
"salt",
"using",
"PBKDF2",
".",
"Iteration",
"count",
"and",
"algorithm",
"have",
"to",
"match",
"the",
"parameters",
"when",
"generating",
"the",
"derived",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/Pbkdf2HashingStrategy.php#L88-L98 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php | Compiler.getProxyClass | public function getProxyClass($fullClassName)
{
if (interface_exists($fullClassName) || in_array(BaseTestCase::class, class_parents($fullClassName))) {
return false;
}
if (class_exists($fullClassName) === false) {
return false;
}
$classReflection = new \ReflectionClass($fullClassName);
if ($classReflection->isInternal() === true) {
return false;
}
$proxyAnnotation = $this->reflectionService->getClassAnnotation($fullClassName, Flow\Proxy::class);
if ($proxyAnnotation !== null && $proxyAnnotation->enabled === false) {
return false;
}
if (in_array(substr($fullClassName, 0, $this->blacklistedSubPackagesLength), $this->blacklistedSubPackages)) {
return false;
}
// Annotation classes (like \Neos\Flow\Annotations\Entity) must never be proxied because that would break the Doctrine AnnotationParser
if ($classReflection->isFinal() && preg_match('/^\s?\*\s?\@Annotation\s/m', $classReflection->getDocComment()) === 1) {
return false;
}
if (!isset($this->proxyClasses[$fullClassName])) {
$this->proxyClasses[$fullClassName] = new ProxyClass($fullClassName);
$this->proxyClasses[$fullClassName]->injectReflectionService($this->reflectionService);
}
return $this->proxyClasses[$fullClassName];
} | php | public function getProxyClass($fullClassName)
{
if (interface_exists($fullClassName) || in_array(BaseTestCase::class, class_parents($fullClassName))) {
return false;
}
if (class_exists($fullClassName) === false) {
return false;
}
$classReflection = new \ReflectionClass($fullClassName);
if ($classReflection->isInternal() === true) {
return false;
}
$proxyAnnotation = $this->reflectionService->getClassAnnotation($fullClassName, Flow\Proxy::class);
if ($proxyAnnotation !== null && $proxyAnnotation->enabled === false) {
return false;
}
if (in_array(substr($fullClassName, 0, $this->blacklistedSubPackagesLength), $this->blacklistedSubPackages)) {
return false;
}
// Annotation classes (like \Neos\Flow\Annotations\Entity) must never be proxied because that would break the Doctrine AnnotationParser
if ($classReflection->isFinal() && preg_match('/^\s?\*\s?\@Annotation\s/m', $classReflection->getDocComment()) === 1) {
return false;
}
if (!isset($this->proxyClasses[$fullClassName])) {
$this->proxyClasses[$fullClassName] = new ProxyClass($fullClassName);
$this->proxyClasses[$fullClassName]->injectReflectionService($this->reflectionService);
}
return $this->proxyClasses[$fullClassName];
} | [
"public",
"function",
"getProxyClass",
"(",
"$",
"fullClassName",
")",
"{",
"if",
"(",
"interface_exists",
"(",
"$",
"fullClassName",
")",
"||",
"in_array",
"(",
"BaseTestCase",
"::",
"class",
",",
"class_parents",
"(",
"$",
"fullClassName",
")",
")",
")",
"... | Returns a proxy class object for the specified original class.
If no such proxy class has been created yet by this renderer,
this function will create one and register it for later use.
If the class is not proxable, false will be returned
@param string $fullClassName Name of the original class
@return ProxyClass|boolean | [
"Returns",
"a",
"proxy",
"class",
"object",
"for",
"the",
"specified",
"original",
"class",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php#L124-L157 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php | Compiler.hasCacheEntryForClass | public function hasCacheEntryForClass($fullClassName)
{
if (isset($this->proxyClasses[$fullClassName])) {
return false;
}
return $this->classesCache->has(str_replace('\\', '_', $fullClassName));
} | php | public function hasCacheEntryForClass($fullClassName)
{
if (isset($this->proxyClasses[$fullClassName])) {
return false;
}
return $this->classesCache->has(str_replace('\\', '_', $fullClassName));
} | [
"public",
"function",
"hasCacheEntryForClass",
"(",
"$",
"fullClassName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"proxyClasses",
"[",
"$",
"fullClassName",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"clas... | Checks if the specified class still exists in the code cache. If that is the case, it means that obviously
the proxy class doesn't have to be rebuilt because otherwise the cache would have been flushed by the file
monitor or some other mechanism.
@param string $fullClassName Name of the original class
@return boolean true if a cache entry exists | [
"Checks",
"if",
"the",
"specified",
"class",
"still",
"exists",
"in",
"the",
"code",
"cache",
".",
"If",
"that",
"is",
"the",
"case",
"it",
"means",
"that",
"obviously",
"the",
"proxy",
"class",
"doesn",
"t",
"have",
"to",
"be",
"rebuilt",
"because",
"ot... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php#L167-L173 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php | Compiler.compile | public function compile()
{
$classCount = 0;
foreach ($this->objectManager->getRegisteredClassNames() as $fullOriginalClassNames) {
foreach ($fullOriginalClassNames as $fullOriginalClassName) {
if (isset($this->proxyClasses[$fullOriginalClassName])) {
$proxyClassCode = $this->proxyClasses[$fullOriginalClassName]->render();
if ($proxyClassCode !== '') {
$class = new \ReflectionClass($fullOriginalClassName);
$classPathAndFilename = $class->getFileName();
$this->cacheOriginalClassFileAndProxyCode($fullOriginalClassName, $classPathAndFilename, $proxyClassCode);
$this->storedProxyClasses[str_replace('\\', '_', $fullOriginalClassName)] = true;
$classCount++;
}
} else {
if ($this->classesCache->has(str_replace('\\', '_', $fullOriginalClassName))) {
$this->storedProxyClasses[str_replace('\\', '_', $fullOriginalClassName)] = true;
}
}
}
}
return $classCount;
} | php | public function compile()
{
$classCount = 0;
foreach ($this->objectManager->getRegisteredClassNames() as $fullOriginalClassNames) {
foreach ($fullOriginalClassNames as $fullOriginalClassName) {
if (isset($this->proxyClasses[$fullOriginalClassName])) {
$proxyClassCode = $this->proxyClasses[$fullOriginalClassName]->render();
if ($proxyClassCode !== '') {
$class = new \ReflectionClass($fullOriginalClassName);
$classPathAndFilename = $class->getFileName();
$this->cacheOriginalClassFileAndProxyCode($fullOriginalClassName, $classPathAndFilename, $proxyClassCode);
$this->storedProxyClasses[str_replace('\\', '_', $fullOriginalClassName)] = true;
$classCount++;
}
} else {
if ($this->classesCache->has(str_replace('\\', '_', $fullOriginalClassName))) {
$this->storedProxyClasses[str_replace('\\', '_', $fullOriginalClassName)] = true;
}
}
}
}
return $classCount;
} | [
"public",
"function",
"compile",
"(",
")",
"{",
"$",
"classCount",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"objectManager",
"->",
"getRegisteredClassNames",
"(",
")",
"as",
"$",
"fullOriginalClassNames",
")",
"{",
"foreach",
"(",
"$",
"fullOriginal... | Compiles the configured proxy classes and methods as static PHP code and stores it in the proxy class code cache.
Also builds the static object container which acts as a registry for non-prototype objects during runtime.
@return integer Number of classes which have been compiled | [
"Compiles",
"the",
"configured",
"proxy",
"classes",
"and",
"methods",
"as",
"static",
"PHP",
"code",
"and",
"stores",
"it",
"in",
"the",
"proxy",
"class",
"code",
"cache",
".",
"Also",
"builds",
"the",
"static",
"object",
"container",
"which",
"acts",
"as",... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php#L181-L203 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php | Compiler.cacheOriginalClassFileAndProxyCode | protected function cacheOriginalClassFileAndProxyCode($className, $pathAndFilename, $proxyClassCode)
{
$classCode = file_get_contents($pathAndFilename);
$classCode = $this->stripOpeningPhpTag($classCode);
$classNameSuffix = self::ORIGINAL_CLASSNAME_SUFFIX;
$classCode = preg_replace_callback('/^([a-z\s]*?)(final\s+)?(interface|class)\s+([a-zA-Z0-9_]+)/m', function ($matches) use ($pathAndFilename, $classNameSuffix, $proxyClassCode) {
$classNameAccordingToFileName = basename($pathAndFilename, '.php');
if ($matches[4] !== $classNameAccordingToFileName) {
throw new Exception('The name of the class "' . $matches[4] . '" is not the same as the filename which is "' . basename($pathAndFilename) . '". Path: ' . $pathAndFilename, 1398356897);
}
return $matches[1] . $matches[3] . ' ' . $matches[4] . $classNameSuffix;
}, $classCode);
// comment out "final" keyword, if the method is final and if it is advised (= part of the $proxyClassCode)
// Note: Method name regex according to http://php.net/manual/en/language.oop5.basic.php
$classCode = preg_replace_callback('/^(\s*)((public|protected)\s+)?final(\s+(public|protected))?(\s+function\s+)([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]+\s*\()/m', function ($matches) use ($pathAndFilename, $classNameSuffix, $proxyClassCode) {
// the method is not advised => don't remove the final keyword
if (strpos($proxyClassCode, $matches[0]) === false) {
return $matches[0];
}
return $matches[1] . $matches[2] . '/*final*/' . $matches[4] . $matches[6] . $matches[7];
}, $classCode);
$classCode = preg_replace('/\\?>[\n\s\r]*$/', '', $classCode);
$proxyClassCode .= "\n" . '# PathAndFilename: ' . $pathAndFilename;
$separator =
PHP_EOL . '#' .
PHP_EOL . '# Start of Flow generated Proxy code' .
PHP_EOL . '#' . PHP_EOL;
$this->classesCache->set(str_replace('\\', '_', $className), $classCode . $separator . $proxyClassCode);
} | php | protected function cacheOriginalClassFileAndProxyCode($className, $pathAndFilename, $proxyClassCode)
{
$classCode = file_get_contents($pathAndFilename);
$classCode = $this->stripOpeningPhpTag($classCode);
$classNameSuffix = self::ORIGINAL_CLASSNAME_SUFFIX;
$classCode = preg_replace_callback('/^([a-z\s]*?)(final\s+)?(interface|class)\s+([a-zA-Z0-9_]+)/m', function ($matches) use ($pathAndFilename, $classNameSuffix, $proxyClassCode) {
$classNameAccordingToFileName = basename($pathAndFilename, '.php');
if ($matches[4] !== $classNameAccordingToFileName) {
throw new Exception('The name of the class "' . $matches[4] . '" is not the same as the filename which is "' . basename($pathAndFilename) . '". Path: ' . $pathAndFilename, 1398356897);
}
return $matches[1] . $matches[3] . ' ' . $matches[4] . $classNameSuffix;
}, $classCode);
// comment out "final" keyword, if the method is final and if it is advised (= part of the $proxyClassCode)
// Note: Method name regex according to http://php.net/manual/en/language.oop5.basic.php
$classCode = preg_replace_callback('/^(\s*)((public|protected)\s+)?final(\s+(public|protected))?(\s+function\s+)([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]+\s*\()/m', function ($matches) use ($pathAndFilename, $classNameSuffix, $proxyClassCode) {
// the method is not advised => don't remove the final keyword
if (strpos($proxyClassCode, $matches[0]) === false) {
return $matches[0];
}
return $matches[1] . $matches[2] . '/*final*/' . $matches[4] . $matches[6] . $matches[7];
}, $classCode);
$classCode = preg_replace('/\\?>[\n\s\r]*$/', '', $classCode);
$proxyClassCode .= "\n" . '# PathAndFilename: ' . $pathAndFilename;
$separator =
PHP_EOL . '#' .
PHP_EOL . '# Start of Flow generated Proxy code' .
PHP_EOL . '#' . PHP_EOL;
$this->classesCache->set(str_replace('\\', '_', $className), $classCode . $separator . $proxyClassCode);
} | [
"protected",
"function",
"cacheOriginalClassFileAndProxyCode",
"(",
"$",
"className",
",",
"$",
"pathAndFilename",
",",
"$",
"proxyClassCode",
")",
"{",
"$",
"classCode",
"=",
"file_get_contents",
"(",
"$",
"pathAndFilename",
")",
";",
"$",
"classCode",
"=",
"$",
... | Reads the specified class file, appends ORIGINAL_CLASSNAME_SUFFIX to its
class name and stores the result in the proxy classes cache.
@param string $className Short class name of the class to copy
@param string $pathAndFilename Full path and filename of the original class file
@param string $proxyClassCode The code that makes up the proxy class
@return void
@throws Exception If the original class filename doesn't match the actual class name inside the file. | [
"Reads",
"the",
"specified",
"class",
"file",
"appends",
"ORIGINAL_CLASSNAME_SUFFIX",
"to",
"its",
"class",
"name",
"and",
"stores",
"the",
"result",
"in",
"the",
"proxy",
"classes",
"cache",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php#L231-L265 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php | Compiler.renderAnnotation | public static function renderAnnotation($annotation)
{
$annotationAsString = '@\\' . get_class($annotation);
$optionNames = get_class_vars(get_class($annotation));
$optionsAsStrings = [];
foreach ($optionNames as $optionName => $optionDefault) {
$optionValue = $annotation->$optionName;
$optionValueAsString = '';
if (is_object($optionValue)) {
$optionValueAsString = self::renderAnnotation($optionValue);
} elseif (is_scalar($optionValue) && is_string($optionValue)) {
$optionValueAsString = '"' . $optionValue . '"';
} elseif (is_bool($optionValue)) {
$optionValueAsString = $optionValue ? 'true' : 'false';
} elseif (is_scalar($optionValue)) {
$optionValueAsString = $optionValue;
} elseif (is_array($optionValue)) {
$optionValueAsString = self::renderOptionArrayValueAsString($optionValue);
}
switch ($optionName) {
case 'value':
$optionsAsStrings[] = $optionValueAsString;
break;
default:
if ($optionValue === $optionDefault) {
break;
}
$optionsAsStrings[] = $optionName . '=' . $optionValueAsString;
}
}
return $annotationAsString . ($optionsAsStrings !== [] ? '(' . implode(', ', $optionsAsStrings) . ')' : '');
} | php | public static function renderAnnotation($annotation)
{
$annotationAsString = '@\\' . get_class($annotation);
$optionNames = get_class_vars(get_class($annotation));
$optionsAsStrings = [];
foreach ($optionNames as $optionName => $optionDefault) {
$optionValue = $annotation->$optionName;
$optionValueAsString = '';
if (is_object($optionValue)) {
$optionValueAsString = self::renderAnnotation($optionValue);
} elseif (is_scalar($optionValue) && is_string($optionValue)) {
$optionValueAsString = '"' . $optionValue . '"';
} elseif (is_bool($optionValue)) {
$optionValueAsString = $optionValue ? 'true' : 'false';
} elseif (is_scalar($optionValue)) {
$optionValueAsString = $optionValue;
} elseif (is_array($optionValue)) {
$optionValueAsString = self::renderOptionArrayValueAsString($optionValue);
}
switch ($optionName) {
case 'value':
$optionsAsStrings[] = $optionValueAsString;
break;
default:
if ($optionValue === $optionDefault) {
break;
}
$optionsAsStrings[] = $optionName . '=' . $optionValueAsString;
}
}
return $annotationAsString . ($optionsAsStrings !== [] ? '(' . implode(', ', $optionsAsStrings) . ')' : '');
} | [
"public",
"static",
"function",
"renderAnnotation",
"(",
"$",
"annotation",
")",
"{",
"$",
"annotationAsString",
"=",
"'@\\\\'",
".",
"get_class",
"(",
"$",
"annotation",
")",
";",
"$",
"optionNames",
"=",
"get_class_vars",
"(",
"get_class",
"(",
"$",
"annotat... | Render the source (string) form of an Annotation instance.
@param \Doctrine\Common\Annotations\Annotation $annotation
@return string | [
"Render",
"the",
"source",
"(",
"string",
")",
"form",
"of",
"an",
"Annotation",
"instance",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php#L285-L317 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php | Compiler.renderOptionArrayValueAsString | protected static function renderOptionArrayValueAsString(array $optionValue)
{
$values = [];
foreach ($optionValue as $k => $v) {
$value = '';
if (is_string($k)) {
$value .= '"' . $k . '"=';
}
if (is_object($v)) {
$value .= self::renderAnnotation($v);
} elseif (is_array($v)) {
$value .= self::renderOptionArrayValueAsString($v);
} elseif (is_scalar($v) && is_string($v)) {
$value .= '"' . $v . '"';
} elseif (is_bool($v)) {
$value .= $v ? 'true' : 'false';
} elseif (is_scalar($v)) {
$value .= $v;
}
$values[] = $value;
}
return '{ ' . implode(', ', $values) . ' }';
} | php | protected static function renderOptionArrayValueAsString(array $optionValue)
{
$values = [];
foreach ($optionValue as $k => $v) {
$value = '';
if (is_string($k)) {
$value .= '"' . $k . '"=';
}
if (is_object($v)) {
$value .= self::renderAnnotation($v);
} elseif (is_array($v)) {
$value .= self::renderOptionArrayValueAsString($v);
} elseif (is_scalar($v) && is_string($v)) {
$value .= '"' . $v . '"';
} elseif (is_bool($v)) {
$value .= $v ? 'true' : 'false';
} elseif (is_scalar($v)) {
$value .= $v;
}
$values[] = $value;
}
return '{ ' . implode(', ', $values) . ' }';
} | [
"protected",
"static",
"function",
"renderOptionArrayValueAsString",
"(",
"array",
"$",
"optionValue",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"optionValue",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"value",
"=",
"''",
"... | Render an array value as string for an annotation.
@param array $optionValue
@return string | [
"Render",
"an",
"array",
"value",
"as",
"string",
"for",
"an",
"annotation",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php#L325-L347 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CacheCommandController.php | CacheCommandController.flushCommand | public function flushCommand(bool $force = false)
{
// Internal note: the $force option is evaluated early in the Flow
// bootstrap in order to reliably flush the temporary data before any
// other code can cause fatal errors.
$this->cacheManager->flushCaches();
$this->outputLine('Flushed all caches for "' . $this->bootstrap->getContext() . '" context.');
if ($this->lockManager->isSiteLocked()) {
$this->lockManager->unlockSite();
}
$frozenPackages = [];
foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
if ($this->packageManager->isPackageFrozen($packageKey)) {
$frozenPackages[] = $packageKey;
}
}
if ($frozenPackages !== []) {
$this->outputFormatted(PHP_EOL . 'Please note that the following package' . (count($frozenPackages) === 1 ? ' is' : 's are') . ' currently frozen: ' . PHP_EOL);
$this->outputFormatted(implode(PHP_EOL, $frozenPackages) . PHP_EOL, [], 2);
$message = 'As code and configuration changes in these packages are not detected, the application may respond ';
$message .= 'unexpectedly if modifications were done anyway or the remaining code relies on these changes.' . PHP_EOL . PHP_EOL;
$message .= 'You may call <b>package:refreeze all</b> in order to refresh frozen packages or use the <b>--force</b> ';
$message .= 'option of this <b>cache:flush</b> command to flush caches if Flow becomes unresponsive.' . PHP_EOL;
$this->outputFormatted($message, [$frozenPackages]);
}
$this->sendAndExit(0);
} | php | public function flushCommand(bool $force = false)
{
// Internal note: the $force option is evaluated early in the Flow
// bootstrap in order to reliably flush the temporary data before any
// other code can cause fatal errors.
$this->cacheManager->flushCaches();
$this->outputLine('Flushed all caches for "' . $this->bootstrap->getContext() . '" context.');
if ($this->lockManager->isSiteLocked()) {
$this->lockManager->unlockSite();
}
$frozenPackages = [];
foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
if ($this->packageManager->isPackageFrozen($packageKey)) {
$frozenPackages[] = $packageKey;
}
}
if ($frozenPackages !== []) {
$this->outputFormatted(PHP_EOL . 'Please note that the following package' . (count($frozenPackages) === 1 ? ' is' : 's are') . ' currently frozen: ' . PHP_EOL);
$this->outputFormatted(implode(PHP_EOL, $frozenPackages) . PHP_EOL, [], 2);
$message = 'As code and configuration changes in these packages are not detected, the application may respond ';
$message .= 'unexpectedly if modifications were done anyway or the remaining code relies on these changes.' . PHP_EOL . PHP_EOL;
$message .= 'You may call <b>package:refreeze all</b> in order to refresh frozen packages or use the <b>--force</b> ';
$message .= 'option of this <b>cache:flush</b> command to flush caches if Flow becomes unresponsive.' . PHP_EOL;
$this->outputFormatted($message, [$frozenPackages]);
}
$this->sendAndExit(0);
} | [
"public",
"function",
"flushCommand",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
"{",
"// Internal note: the $force option is evaluated early in the Flow",
"// bootstrap in order to reliably flush the temporary data before any",
"// other code can cause fatal errors.",
"$",
"this",
... | Flush all caches
The flush command flushes all caches (including code caches) which have been
registered with Flow's Cache Manager. It will NOT remove any session data, unless
you specifically configure the session caches to not be persistent.
If fatal errors caused by a package prevent the compile time bootstrap
from running, the removal of any temporary data can be forced by specifying
the option <b>--force</b>.
This command does not remove the precompiled data provided by frozen
packages unless the <b>--force</b> option is used.
@param boolean $force Force flushing of any temporary data
@return void
@see neos.flow:cache:warmup
@see neos.flow:package:freeze
@see neos.flow:package:refreeze | [
"Flush",
"all",
"caches"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CacheCommandController.php#L147-L179 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CacheCommandController.php | CacheCommandController.flushOneCommand | public function flushOneCommand(string $identifier)
{
if (!$this->cacheManager->hasCache($identifier)) {
$this->outputLine('The cache "%s" does not exist.', [$identifier]);
$cacheConfigurations = $this->cacheManager->getCacheConfigurations();
$shortestDistance = -1;
foreach (array_keys($cacheConfigurations) as $existingIdentifier) {
$distance = levenshtein($existingIdentifier, $identifier);
if ($distance <= $shortestDistance || $shortestDistance < 0) {
$shortestDistance = $distance;
$closestIdentifier = $existingIdentifier;
}
}
if (isset($closestIdentifier)) {
$this->outputLine('Did you mean "%s"?', [$closestIdentifier]);
}
$this->quit(1);
}
$this->cacheManager->getCache($identifier)->flush();
$this->outputLine('Flushed "%s" cache for "%s" context.', [$identifier, $this->bootstrap->getContext()]);
$this->sendAndExit(0);
} | php | public function flushOneCommand(string $identifier)
{
if (!$this->cacheManager->hasCache($identifier)) {
$this->outputLine('The cache "%s" does not exist.', [$identifier]);
$cacheConfigurations = $this->cacheManager->getCacheConfigurations();
$shortestDistance = -1;
foreach (array_keys($cacheConfigurations) as $existingIdentifier) {
$distance = levenshtein($existingIdentifier, $identifier);
if ($distance <= $shortestDistance || $shortestDistance < 0) {
$shortestDistance = $distance;
$closestIdentifier = $existingIdentifier;
}
}
if (isset($closestIdentifier)) {
$this->outputLine('Did you mean "%s"?', [$closestIdentifier]);
}
$this->quit(1);
}
$this->cacheManager->getCache($identifier)->flush();
$this->outputLine('Flushed "%s" cache for "%s" context.', [$identifier, $this->bootstrap->getContext()]);
$this->sendAndExit(0);
} | [
"public",
"function",
"flushOneCommand",
"(",
"string",
"$",
"identifier",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"cacheManager",
"->",
"hasCache",
"(",
"$",
"identifier",
")",
")",
"{",
"$",
"this",
"->",
"outputLine",
"(",
"'The cache \"%s\" does not... | Flushes a particular cache by its identifier
Given a cache identifier, this flushes just that one cache. To find
the cache identifiers, you can use the configuration:show command with
the type set to "Caches".
Note that this does not have a force-flush option since it's not
meant to remove temporary code data, resulting into a broken state if
code files lack.
@param string $identifier Cache identifier to flush cache for
@return void
@see neos.flow:cache:flush
@see neos.flow:configuration:show | [
"Flushes",
"a",
"particular",
"cache",
"by",
"its",
"identifier"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CacheCommandController.php#L197-L221 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CacheCommandController.php | CacheCommandController.listCommand | public function listCommand(bool $quiet = false)
{
$cacheConfigurations = $this->cacheManager->getCacheConfigurations();
$defaultConfiguration = $cacheConfigurations['Default'];
unset($cacheConfigurations['Default']);
ksort($cacheConfigurations);
$headers = ['Cache', 'Backend', 'Status'];
$erroneousCaches = [];
$rows = [];
foreach ($cacheConfigurations as $identifier => $configuration) {
$cache = $this->cacheManager->getCache($identifier);
if (isset($configuration['persistent']) && $configuration['persistent'] === true) {
$identifier = $identifier . ' <comment>*</comment>';
}
$backendClassName = isset($configuration['backend']) ? '<b>' . $configuration['backend'] . '</b>' : $defaultConfiguration['backend'];
$cacheBackend = $cache->getBackend();
if (!$cacheBackend instanceof WithStatusInterface) {
$status = '?';
} else {
$statusResult = $cacheBackend->getStatus();
if ($statusResult->hasErrors()) {
$erroneousCaches[] = $identifier;
$status = '<error>ERROR</error>';
} elseif ($statusResult->hasWarnings()) {
$erroneousCaches[] = $identifier;
$status = '<comment>WARNING</comment>';
} else {
$status = '<success>OK</success>';
}
}
$row = [$identifier, $backendClassName, $status];
$rows[] = $row;
}
if (!$quiet) {
$this->output->outputTable($rows, $headers);
$this->outputLine('<comment>*</comment> = Persistent Cache');
$this->outputLine('<b>Bold = Custom</b>, Thin = Default');
$this->outputLine();
}
if ($erroneousCaches !== []) {
$this->outputLine('<error>The following caches contain errors or warnings: %s</error>', [implode(', ', $erroneousCaches)]);
$quiet || $this->outputLine('Use the <em>neos.flow:cache:show</em> Command for more information');
$this->quit(1);
return;
}
} | php | public function listCommand(bool $quiet = false)
{
$cacheConfigurations = $this->cacheManager->getCacheConfigurations();
$defaultConfiguration = $cacheConfigurations['Default'];
unset($cacheConfigurations['Default']);
ksort($cacheConfigurations);
$headers = ['Cache', 'Backend', 'Status'];
$erroneousCaches = [];
$rows = [];
foreach ($cacheConfigurations as $identifier => $configuration) {
$cache = $this->cacheManager->getCache($identifier);
if (isset($configuration['persistent']) && $configuration['persistent'] === true) {
$identifier = $identifier . ' <comment>*</comment>';
}
$backendClassName = isset($configuration['backend']) ? '<b>' . $configuration['backend'] . '</b>' : $defaultConfiguration['backend'];
$cacheBackend = $cache->getBackend();
if (!$cacheBackend instanceof WithStatusInterface) {
$status = '?';
} else {
$statusResult = $cacheBackend->getStatus();
if ($statusResult->hasErrors()) {
$erroneousCaches[] = $identifier;
$status = '<error>ERROR</error>';
} elseif ($statusResult->hasWarnings()) {
$erroneousCaches[] = $identifier;
$status = '<comment>WARNING</comment>';
} else {
$status = '<success>OK</success>';
}
}
$row = [$identifier, $backendClassName, $status];
$rows[] = $row;
}
if (!$quiet) {
$this->output->outputTable($rows, $headers);
$this->outputLine('<comment>*</comment> = Persistent Cache');
$this->outputLine('<b>Bold = Custom</b>, Thin = Default');
$this->outputLine();
}
if ($erroneousCaches !== []) {
$this->outputLine('<error>The following caches contain errors or warnings: %s</error>', [implode(', ', $erroneousCaches)]);
$quiet || $this->outputLine('Use the <em>neos.flow:cache:show</em> Command for more information');
$this->quit(1);
return;
}
} | [
"public",
"function",
"listCommand",
"(",
"bool",
"$",
"quiet",
"=",
"false",
")",
"{",
"$",
"cacheConfigurations",
"=",
"$",
"this",
"->",
"cacheManager",
"->",
"getCacheConfigurations",
"(",
")",
";",
"$",
"defaultConfiguration",
"=",
"$",
"cacheConfigurations... | List all configured caches and their status if available
This command will exit with a code 1 if at least one cache status contains errors or warnings
This allows the command to be easily integrated in CI setups (the --quiet flag can be used to reduce verbosity)
@param bool $quiet If set, this command only outputs errors & warnings
@return void
@see neos.flow:cache:show
@throws NoSuchCacheException | StopActionException | [
"List",
"all",
"configured",
"caches",
"and",
"their",
"status",
"if",
"available"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CacheCommandController.php#L252-L300 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CacheCommandController.php | CacheCommandController.showCommand | public function showCommand(string $cacheIdentifier)
{
try {
$cache = $this->cacheManager->getCache($cacheIdentifier);
} catch (NoSuchCacheException $exception) {
$this->outputLine('<error>A Cache with id "%s" is not configured.</error>', [$cacheIdentifier]);
$this->outputLine('Use the <i>neos.flow:cache:list</i> command to get a list of all configured Caches.');
$this->quit(1);
return;
}
$cacheConfigurations = $this->cacheManager->getCacheConfigurations();
$defaultConfiguration = $cacheConfigurations['Default'];
$cacheConfiguration = $cacheConfigurations[$cache->getIdentifier()];
$cacheBackend = $cache->getBackend();
$this->outputLine('<b>Identifier</b>: %s', [$cache->getIdentifier()]);
$this->outputLine('<b>Frontend</b>: %s', [TypeHandling::getTypeForValue($cache)]);
$this->outputLine('<b>Backend</b>: %s', [TypeHandling::getTypeForValue($cacheBackend)]);
$options = $cacheConfiguration['backendOptions'] ?? $defaultConfiguration['backendOptions'];
$this->outputLine('<b>Backend Options</b>:');
$this->outputLine(json_encode($options, JSON_PRETTY_PRINT));
if ($cacheBackend instanceof WithStatusInterface) {
$this->outputLine();
$this->outputLine('<b>Status:</b>');
$this->outputLine('=======');
$cacheStatus = $cacheBackend->getStatus();
$this->renderResult($cacheStatus);
if ($cacheStatus->hasErrors() || $cacheStatus->hasWarnings()) {
$this->quit(1);
return;
}
}
} | php | public function showCommand(string $cacheIdentifier)
{
try {
$cache = $this->cacheManager->getCache($cacheIdentifier);
} catch (NoSuchCacheException $exception) {
$this->outputLine('<error>A Cache with id "%s" is not configured.</error>', [$cacheIdentifier]);
$this->outputLine('Use the <i>neos.flow:cache:list</i> command to get a list of all configured Caches.');
$this->quit(1);
return;
}
$cacheConfigurations = $this->cacheManager->getCacheConfigurations();
$defaultConfiguration = $cacheConfigurations['Default'];
$cacheConfiguration = $cacheConfigurations[$cache->getIdentifier()];
$cacheBackend = $cache->getBackend();
$this->outputLine('<b>Identifier</b>: %s', [$cache->getIdentifier()]);
$this->outputLine('<b>Frontend</b>: %s', [TypeHandling::getTypeForValue($cache)]);
$this->outputLine('<b>Backend</b>: %s', [TypeHandling::getTypeForValue($cacheBackend)]);
$options = $cacheConfiguration['backendOptions'] ?? $defaultConfiguration['backendOptions'];
$this->outputLine('<b>Backend Options</b>:');
$this->outputLine(json_encode($options, JSON_PRETTY_PRINT));
if ($cacheBackend instanceof WithStatusInterface) {
$this->outputLine();
$this->outputLine('<b>Status:</b>');
$this->outputLine('=======');
$cacheStatus = $cacheBackend->getStatus();
$this->renderResult($cacheStatus);
if ($cacheStatus->hasErrors() || $cacheStatus->hasWarnings()) {
$this->quit(1);
return;
}
}
} | [
"public",
"function",
"showCommand",
"(",
"string",
"$",
"cacheIdentifier",
")",
"{",
"try",
"{",
"$",
"cache",
"=",
"$",
"this",
"->",
"cacheManager",
"->",
"getCache",
"(",
"$",
"cacheIdentifier",
")",
";",
"}",
"catch",
"(",
"NoSuchCacheException",
"$",
... | Display details of a cache including a detailed status if available
@param string $cacheIdentifier identifier of the cache (for example "Flow_Core")
@return void
@see neos.flow:cache:list
@throws StopActionException | [
"Display",
"details",
"of",
"a",
"cache",
"including",
"a",
"detailed",
"status",
"if",
"available"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CacheCommandController.php#L310-L343 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CacheCommandController.php | CacheCommandController.setupCommand | public function setupCommand(string $cacheIdentifier)
{
try {
$cache = $this->cacheManager->getCache($cacheIdentifier);
} catch (NoSuchCacheException $exception) {
$this->outputLine('<error>A Cache with id "%s" is not configured.</error>', [$cacheIdentifier]);
$this->outputLine('Use the <i>neos.flow:cache:list</i> command to get a list of all configured Caches.');
$this->quit(1);
return;
}
$cacheBackend = $cache->getBackend();
if (!$cacheBackend instanceof WithSetupInterface) {
$this->outputLine('<error>The Cache "%s" is configured to use the backend "%s" but this does not implement the WithSetupInterface.</error>', [$cacheIdentifier, TypeHandling::getTypeForValue($cacheBackend)]);
$this->quit(1);
return;
}
$this->outputLine('Setting up backend <b>%s</b> for cache "%s"', [TypeHandling::getTypeForValue($cacheBackend), $cache->getIdentifier()]);
$setupResult = $cacheBackend->setup();
$this->renderResult($setupResult);
if ($setupResult->hasErrors() || $setupResult->hasWarnings()) {
$this->quit(1);
return;
}
} | php | public function setupCommand(string $cacheIdentifier)
{
try {
$cache = $this->cacheManager->getCache($cacheIdentifier);
} catch (NoSuchCacheException $exception) {
$this->outputLine('<error>A Cache with id "%s" is not configured.</error>', [$cacheIdentifier]);
$this->outputLine('Use the <i>neos.flow:cache:list</i> command to get a list of all configured Caches.');
$this->quit(1);
return;
}
$cacheBackend = $cache->getBackend();
if (!$cacheBackend instanceof WithSetupInterface) {
$this->outputLine('<error>The Cache "%s" is configured to use the backend "%s" but this does not implement the WithSetupInterface.</error>', [$cacheIdentifier, TypeHandling::getTypeForValue($cacheBackend)]);
$this->quit(1);
return;
}
$this->outputLine('Setting up backend <b>%s</b> for cache "%s"', [TypeHandling::getTypeForValue($cacheBackend), $cache->getIdentifier()]);
$setupResult = $cacheBackend->setup();
$this->renderResult($setupResult);
if ($setupResult->hasErrors() || $setupResult->hasWarnings()) {
$this->quit(1);
return;
}
} | [
"public",
"function",
"setupCommand",
"(",
"string",
"$",
"cacheIdentifier",
")",
"{",
"try",
"{",
"$",
"cache",
"=",
"$",
"this",
"->",
"cacheManager",
"->",
"getCache",
"(",
"$",
"cacheIdentifier",
")",
";",
"}",
"catch",
"(",
"NoSuchCacheException",
"$",
... | Setup the given Cache if possible
Invokes the setup() method on the configured CacheBackend (if it implements the WithSetupInterface)
which should setup and validate the backend (i.e. create required database tables, directories, ...)
@param string $cacheIdentifier
@return void
@see neos.flow:cache:list
@see neos.flow:cache:setupall
@throws StopActionException | [
"Setup",
"the",
"given",
"Cache",
"if",
"possible"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CacheCommandController.php#L357-L380 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CacheCommandController.php | CacheCommandController.setupAllCommand | public function setupAllCommand(bool $quiet = false)
{
$cacheConfigurations = $this->cacheManager->getCacheConfigurations();
unset($cacheConfigurations['Default']);
$hasErrorsOrWarnings = false;
foreach (array_keys($cacheConfigurations) as $cacheIdentifier) {
$cache = $this->cacheManager->getCache($cacheIdentifier);
$cacheBackend = $cache->getBackend();
$quiet || $this->outputLine('<b>%s:</b>', [$cache->getIdentifier()]);
if (!$cacheBackend instanceof WithSetupInterface) {
$quiet || $this->outputLine('Skipped, because backend "%s" does not implement the WithSetupInterface', [TypeHandling::getTypeForValue($cacheBackend)]);
continue;
}
$result = $cacheBackend->setup();
$hasErrorsOrWarnings = $hasErrorsOrWarnings || $result->hasErrors() || $result->hasWarnings();
if (!$quiet || $result->hasErrors()) {
$this->renderResult($result);
}
}
if ($hasErrorsOrWarnings) {
$this->quit(1);
return;
}
} | php | public function setupAllCommand(bool $quiet = false)
{
$cacheConfigurations = $this->cacheManager->getCacheConfigurations();
unset($cacheConfigurations['Default']);
$hasErrorsOrWarnings = false;
foreach (array_keys($cacheConfigurations) as $cacheIdentifier) {
$cache = $this->cacheManager->getCache($cacheIdentifier);
$cacheBackend = $cache->getBackend();
$quiet || $this->outputLine('<b>%s:</b>', [$cache->getIdentifier()]);
if (!$cacheBackend instanceof WithSetupInterface) {
$quiet || $this->outputLine('Skipped, because backend "%s" does not implement the WithSetupInterface', [TypeHandling::getTypeForValue($cacheBackend)]);
continue;
}
$result = $cacheBackend->setup();
$hasErrorsOrWarnings = $hasErrorsOrWarnings || $result->hasErrors() || $result->hasWarnings();
if (!$quiet || $result->hasErrors()) {
$this->renderResult($result);
}
}
if ($hasErrorsOrWarnings) {
$this->quit(1);
return;
}
} | [
"public",
"function",
"setupAllCommand",
"(",
"bool",
"$",
"quiet",
"=",
"false",
")",
"{",
"$",
"cacheConfigurations",
"=",
"$",
"this",
"->",
"cacheManager",
"->",
"getCacheConfigurations",
"(",
")",
";",
"unset",
"(",
"$",
"cacheConfigurations",
"[",
"'Defa... | Setup all Caches
Invokes the setup() method on all configured CacheBackend that implement the WithSetupInterface interface
which should setup and validate the backend (i.e. create required database tables, directories, ...)
This command will exit with a code 1 if at least one cache setup failed
This allows the command to be easily integrated in CI setups (the --quiet flag can be used to reduce verbosity)
@param bool $quiet If set, this command only outputs errors & warnings
@return void
@see neos.flow:cache:setup
@throws NoSuchCacheException | StopActionException | [
"Setup",
"all",
"Caches"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CacheCommandController.php#L396-L419 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CacheCommandController.php | CacheCommandController.sysCommand | public function sysCommand(int $address)
{
if ($address === 64738) {
$this->cacheManager->flushCaches();
$content = 'G1syShtbMkobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgKioqKiBDT01NT0RPUkUgNjQgQkFTSUMgVjIgKioqKiAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gIDY0SyBSQU0gU1lTVEVNICAzODkxMSBCQVNJQyBCWVRFUyBGUkVFICAgG1swbQobWzE7MzdtG1sxOzQ0bSBSRUFEWS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtIEZMVVNIIENBQ0hFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSBPSywgRkxVU0hFRCBBTEwgQ0FDSEVTLiAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtIFJFQURZLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gG1sxOzQ3bSAbWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQoK';
$this->response->setOutputFormat(Response::OUTPUTFORMAT_RAW);
$this->response->appendContent(base64_decode($content));
if ($this->lockManager->isSiteLocked()) {
$this->lockManager->unlockSite();
}
$this->sendAndExit(0);
}
} | php | public function sysCommand(int $address)
{
if ($address === 64738) {
$this->cacheManager->flushCaches();
$content = 'G1syShtbMkobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgKioqKiBDT01NT0RPUkUgNjQgQkFTSUMgVjIgKioqKiAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gIDY0SyBSQU0gU1lTVEVNICAzODkxMSBCQVNJQyBCWVRFUyBGUkVFICAgG1swbQobWzE7MzdtG1sxOzQ0bSBSRUFEWS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtIEZMVVNIIENBQ0hFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSBPSywgRkxVU0hFRCBBTEwgQ0FDSEVTLiAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtIFJFQURZLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gG1sxOzQ3bSAbWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQoK';
$this->response->setOutputFormat(Response::OUTPUTFORMAT_RAW);
$this->response->appendContent(base64_decode($content));
if ($this->lockManager->isSiteLocked()) {
$this->lockManager->unlockSite();
}
$this->sendAndExit(0);
}
} | [
"public",
"function",
"sysCommand",
"(",
"int",
"$",
"address",
")",
"{",
"if",
"(",
"$",
"address",
"===",
"64738",
")",
"{",
"$",
"this",
"->",
"cacheManager",
"->",
"flushCaches",
"(",
")",
";",
"$",
"content",
"=",
"'G1syShtbMkobWzE7MzdtG1sxOzQ0bSAgICAgI... | Call system function
@Flow\Internal
@param integer $address
@return void | [
"Call",
"system",
"function"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CacheCommandController.php#L428-L440 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CacheCommandController.php | CacheCommandController.renderResult | private function renderResult(Result $result)
{
if ($result->hasNotices()) {
/** @var Notice $notice */
foreach ($result->getNotices() as $notice) {
if (!empty($notice->getTitle())) {
$this->outputLine('<b>%s</b>: %s', [$notice->getTitle(), $notice->render()]);
} else {
$this->outputLine($notice->render());
}
}
}
if ($result->hasErrors()) {
/** @var Error $error */
foreach ($result->getErrors() as $error) {
$this->outputLine('<error>ERROR: %s</error>', [$error->render()]);
}
}
if ($result->hasWarnings()) {
/** @var Warning $warning */
foreach ($result->getWarnings() as $warning) {
if (!empty($warning->getTitle())) {
$this->outputLine('<b>%s</b>: <comment>%s</comment>', [$warning->getTitle(), $warning->render()]);
} else {
$this->outputLine('<comment>%s</comment>', [$warning->render()]);
}
}
}
if (!$result->hasErrors() && !$result->hasWarnings()) {
$this->outputLine('<success>OK</success>');
}
} | php | private function renderResult(Result $result)
{
if ($result->hasNotices()) {
/** @var Notice $notice */
foreach ($result->getNotices() as $notice) {
if (!empty($notice->getTitle())) {
$this->outputLine('<b>%s</b>: %s', [$notice->getTitle(), $notice->render()]);
} else {
$this->outputLine($notice->render());
}
}
}
if ($result->hasErrors()) {
/** @var Error $error */
foreach ($result->getErrors() as $error) {
$this->outputLine('<error>ERROR: %s</error>', [$error->render()]);
}
}
if ($result->hasWarnings()) {
/** @var Warning $warning */
foreach ($result->getWarnings() as $warning) {
if (!empty($warning->getTitle())) {
$this->outputLine('<b>%s</b>: <comment>%s</comment>', [$warning->getTitle(), $warning->render()]);
} else {
$this->outputLine('<comment>%s</comment>', [$warning->render()]);
}
}
}
if (!$result->hasErrors() && !$result->hasWarnings()) {
$this->outputLine('<success>OK</success>');
}
} | [
"private",
"function",
"renderResult",
"(",
"Result",
"$",
"result",
")",
"{",
"if",
"(",
"$",
"result",
"->",
"hasNotices",
"(",
")",
")",
"{",
"/** @var Notice $notice */",
"foreach",
"(",
"$",
"result",
"->",
"getNotices",
"(",
")",
"as",
"$",
"notice",... | Outputs the given Result object in a human-readable way
@param Result $result
@return void | [
"Outputs",
"the",
"given",
"Result",
"object",
"in",
"a",
"human",
"-",
"readable",
"way"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CacheCommandController.php#L448-L480 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/StandardController.php | StandardController.resolveView | protected function resolveView()
{
$view = new SimpleTemplateView(['templateSource' => file_get_contents(FLOW_PATH_FLOW . 'Resources/Private/Mvc/StandardView_Template.html')]);
$view->setControllerContext($this->controllerContext);
return $view;
} | php | protected function resolveView()
{
$view = new SimpleTemplateView(['templateSource' => file_get_contents(FLOW_PATH_FLOW . 'Resources/Private/Mvc/StandardView_Template.html')]);
$view->setControllerContext($this->controllerContext);
return $view;
} | [
"protected",
"function",
"resolveView",
"(",
")",
"{",
"$",
"view",
"=",
"new",
"SimpleTemplateView",
"(",
"[",
"'templateSource'",
"=>",
"file_get_contents",
"(",
"FLOW_PATH_FLOW",
".",
"'Resources/Private/Mvc/StandardView_Template.html'",
")",
"]",
")",
";",
"$",
... | Overrides the standard resolveView method
@return ViewInterface $view The view | [
"Overrides",
"the",
"standard",
"resolveView",
"method"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/StandardController.php#L30-L35 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parse | public function parse(string $pointcutExpression, string $sourceHint): PointcutFilterComposite
{
$this->sourceHint = $sourceHint;
if (!is_string($pointcutExpression) || strlen($pointcutExpression) === 0) {
throw new InvalidPointcutExpressionException(sprintf('Pointcut expression must be a valid string, "%s" given, defined in "%s"', gettype($pointcutExpression), $this->sourceHint), 1168874738);
}
$pointcutFilterComposite = new PointcutFilterComposite();
$pointcutExpressionParts = preg_split(self::PATTERN_SPLITBYOPERATOR, $pointcutExpression, -1, PREG_SPLIT_DELIM_CAPTURE);
$count = count($pointcutExpressionParts);
for ($partIndex = 0; $partIndex < $count; $partIndex += 2) {
$operator = ($partIndex > 0) ? trim($pointcutExpressionParts[$partIndex - 1]) : '&&';
$expression = trim($pointcutExpressionParts[$partIndex]);
if ($expression[0] === '!') {
$expression = trim(substr($expression, 1));
$operator .= '!';
}
if (strpos($expression, '(') === false) {
$this->parseDesignatorPointcut($operator, $expression, $pointcutFilterComposite);
} else {
$matches = [];
$numberOfMatches = preg_match(self::PATTERN_MATCHPOINTCUTDESIGNATOR, $expression, $matches);
if ($numberOfMatches !== 1) {
throw new InvalidPointcutExpressionException('Syntax error: Pointcut designator expected near "' . $expression . '", defined in ' . $this->sourceHint, 1168874739);
}
$pointcutDesignator = $matches[0];
$signaturePattern = $this->getSubstringBetweenParentheses($expression);
switch ($pointcutDesignator) {
case 'classAnnotatedWith':
case 'class':
case 'methodAnnotatedWith':
case 'method':
case 'within':
case 'filter':
case 'setting':
$parseMethodName = 'parseDesignator' . ucfirst($pointcutDesignator);
$this->$parseMethodName($operator, $signaturePattern, $pointcutFilterComposite);
break;
case 'evaluate':
$this->parseRuntimeEvaluations($operator, $signaturePattern, $pointcutFilterComposite);
break;
default:
throw new AopException('Support for pointcut designator "' . $pointcutDesignator . '" has not been implemented (yet), defined in ' . $this->sourceHint, 1168874740);
}
}
}
return $pointcutFilterComposite;
} | php | public function parse(string $pointcutExpression, string $sourceHint): PointcutFilterComposite
{
$this->sourceHint = $sourceHint;
if (!is_string($pointcutExpression) || strlen($pointcutExpression) === 0) {
throw new InvalidPointcutExpressionException(sprintf('Pointcut expression must be a valid string, "%s" given, defined in "%s"', gettype($pointcutExpression), $this->sourceHint), 1168874738);
}
$pointcutFilterComposite = new PointcutFilterComposite();
$pointcutExpressionParts = preg_split(self::PATTERN_SPLITBYOPERATOR, $pointcutExpression, -1, PREG_SPLIT_DELIM_CAPTURE);
$count = count($pointcutExpressionParts);
for ($partIndex = 0; $partIndex < $count; $partIndex += 2) {
$operator = ($partIndex > 0) ? trim($pointcutExpressionParts[$partIndex - 1]) : '&&';
$expression = trim($pointcutExpressionParts[$partIndex]);
if ($expression[0] === '!') {
$expression = trim(substr($expression, 1));
$operator .= '!';
}
if (strpos($expression, '(') === false) {
$this->parseDesignatorPointcut($operator, $expression, $pointcutFilterComposite);
} else {
$matches = [];
$numberOfMatches = preg_match(self::PATTERN_MATCHPOINTCUTDESIGNATOR, $expression, $matches);
if ($numberOfMatches !== 1) {
throw new InvalidPointcutExpressionException('Syntax error: Pointcut designator expected near "' . $expression . '", defined in ' . $this->sourceHint, 1168874739);
}
$pointcutDesignator = $matches[0];
$signaturePattern = $this->getSubstringBetweenParentheses($expression);
switch ($pointcutDesignator) {
case 'classAnnotatedWith':
case 'class':
case 'methodAnnotatedWith':
case 'method':
case 'within':
case 'filter':
case 'setting':
$parseMethodName = 'parseDesignator' . ucfirst($pointcutDesignator);
$this->$parseMethodName($operator, $signaturePattern, $pointcutFilterComposite);
break;
case 'evaluate':
$this->parseRuntimeEvaluations($operator, $signaturePattern, $pointcutFilterComposite);
break;
default:
throw new AopException('Support for pointcut designator "' . $pointcutDesignator . '" has not been implemented (yet), defined in ' . $this->sourceHint, 1168874740);
}
}
}
return $pointcutFilterComposite;
} | [
"public",
"function",
"parse",
"(",
"string",
"$",
"pointcutExpression",
",",
"string",
"$",
"sourceHint",
")",
":",
"PointcutFilterComposite",
"{",
"$",
"this",
"->",
"sourceHint",
"=",
"$",
"sourceHint",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"pointcu... | Parses a string pointcut expression and returns the pointcut
objects accordingly
@param string $pointcutExpression The expression defining the pointcut
@param string $sourceHint A message giving a hint on where the expression was defined. This is used in error messages.
@return PointcutFilterComposite A composite of class-filters, method-filters and pointcuts
@throws InvalidPointcutExpressionException
@throws AopException | [
"Parses",
"a",
"string",
"pointcut",
"expression",
"and",
"returns",
"the",
"pointcut",
"objects",
"accordingly"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L122-L172 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parseDesignatorClassAnnotatedWith | protected function parseDesignatorClassAnnotatedWith(string $operator, string $annotationPattern, PointcutFilterComposite $pointcutFilterComposite): void
{
$annotationPropertyConstraints = [];
$this->parseAnnotationPattern($annotationPattern, $annotationPropertyConstraints);
$filter = new PointcutClassAnnotatedWithFilter($annotationPattern, $annotationPropertyConstraints);
$filter->injectReflectionService($this->reflectionService);
$filter->injectLogger($this->objectManager->get(PsrLoggerFactoryInterface::class)->get('systemLogger'));
$pointcutFilterComposite->addFilter($operator, $filter);
} | php | protected function parseDesignatorClassAnnotatedWith(string $operator, string $annotationPattern, PointcutFilterComposite $pointcutFilterComposite): void
{
$annotationPropertyConstraints = [];
$this->parseAnnotationPattern($annotationPattern, $annotationPropertyConstraints);
$filter = new PointcutClassAnnotatedWithFilter($annotationPattern, $annotationPropertyConstraints);
$filter->injectReflectionService($this->reflectionService);
$filter->injectLogger($this->objectManager->get(PsrLoggerFactoryInterface::class)->get('systemLogger'));
$pointcutFilterComposite->addFilter($operator, $filter);
} | [
"protected",
"function",
"parseDesignatorClassAnnotatedWith",
"(",
"string",
"$",
"operator",
",",
"string",
"$",
"annotationPattern",
",",
"PointcutFilterComposite",
"$",
"pointcutFilterComposite",
")",
":",
"void",
"{",
"$",
"annotationPropertyConstraints",
"=",
"[",
... | Takes a class annotation filter pattern and adds a so configured class annotation filter to the
filter composite object.
@param string $operator The operator
@param string $annotationPattern The pattern expression as configuration for the class annotation filter
@param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the class annotation filter) will be added to this composite object.
@return void | [
"Takes",
"a",
"class",
"annotation",
"filter",
"pattern",
"and",
"adds",
"a",
"so",
"configured",
"class",
"annotation",
"filter",
"to",
"the",
"filter",
"composite",
"object",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L183-L192 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parseDesignatorClass | protected function parseDesignatorClass(string $operator, string $classPattern, PointcutFilterComposite $pointcutFilterComposite): void
{
$filter = new PointcutClassNameFilter($classPattern);
$filter->injectReflectionService($this->reflectionService);
$pointcutFilterComposite->addFilter($operator, $filter);
} | php | protected function parseDesignatorClass(string $operator, string $classPattern, PointcutFilterComposite $pointcutFilterComposite): void
{
$filter = new PointcutClassNameFilter($classPattern);
$filter->injectReflectionService($this->reflectionService);
$pointcutFilterComposite->addFilter($operator, $filter);
} | [
"protected",
"function",
"parseDesignatorClass",
"(",
"string",
"$",
"operator",
",",
"string",
"$",
"classPattern",
",",
"PointcutFilterComposite",
"$",
"pointcutFilterComposite",
")",
":",
"void",
"{",
"$",
"filter",
"=",
"new",
"PointcutClassNameFilter",
"(",
"$"... | Takes a class filter pattern and adds a so configured class filter to the
filter composite object.
@param string $operator The operator
@param string $classPattern The pattern expression as configuration for the class filter
@param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the class filter) will be added to this composite object.
@return void | [
"Takes",
"a",
"class",
"filter",
"pattern",
"and",
"adds",
"a",
"so",
"configured",
"class",
"filter",
"to",
"the",
"filter",
"composite",
"object",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L203-L208 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parseAnnotationPattern | protected function parseAnnotationPattern(string &$annotationPattern, array &$annotationPropertyConstraints): void
{
if (strpos($annotationPattern, '(') !== false) {
$matches = [];
preg_match(self::PATTERN_MATCHMETHODNAMEANDARGUMENTS, $annotationPattern, $matches);
$annotationPattern = $matches['MethodName'];
$annotationPropertiesPattern = $matches['MethodArguments'];
$annotationPropertyConstraints = $this->getArgumentConstraintsFromMethodArgumentsPattern($annotationPropertiesPattern);
}
} | php | protected function parseAnnotationPattern(string &$annotationPattern, array &$annotationPropertyConstraints): void
{
if (strpos($annotationPattern, '(') !== false) {
$matches = [];
preg_match(self::PATTERN_MATCHMETHODNAMEANDARGUMENTS, $annotationPattern, $matches);
$annotationPattern = $matches['MethodName'];
$annotationPropertiesPattern = $matches['MethodArguments'];
$annotationPropertyConstraints = $this->getArgumentConstraintsFromMethodArgumentsPattern($annotationPropertiesPattern);
}
} | [
"protected",
"function",
"parseAnnotationPattern",
"(",
"string",
"&",
"$",
"annotationPattern",
",",
"array",
"&",
"$",
"annotationPropertyConstraints",
")",
":",
"void",
"{",
"if",
"(",
"strpos",
"(",
"$",
"annotationPattern",
",",
"'('",
")",
"!==",
"false",
... | Parse an annotation pattern and adjust $annotationPattern and $annotationPropertyConstraints as
needed.
@param string $annotationPattern
@param array $annotationPropertyConstraints
@return void | [
"Parse",
"an",
"annotation",
"pattern",
"and",
"adjust",
"$annotationPattern",
"and",
"$annotationPropertyConstraints",
"as",
"needed",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L238-L248 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parseDesignatorMethod | protected function parseDesignatorMethod(string $operator, string $signaturePattern, PointcutFilterComposite $pointcutFilterComposite): void
{
if (strpos($signaturePattern, '->') === false) {
throw new InvalidPointcutExpressionException('Syntax error: "->" expected in "' . $signaturePattern . '", defined in ' . $this->sourceHint, 1169027339);
}
$methodVisibility = $this->getVisibilityFromSignaturePattern($signaturePattern);
list($classPattern, $methodPattern) = explode('->', $signaturePattern, 2);
if (strpos($methodPattern, '(') === false) {
throw new InvalidPointcutExpressionException('Syntax error: "(" expected in "' . $methodPattern . '", defined in ' . $this->sourceHint, 1169144299);
}
$matches = [];
preg_match(self::PATTERN_MATCHMETHODNAMEANDARGUMENTS, $methodPattern, $matches);
$methodNamePattern = $matches['MethodName'];
$methodArgumentPattern = $matches['MethodArguments'];
$methodArgumentConstraints = $this->getArgumentConstraintsFromMethodArgumentsPattern($methodArgumentPattern);
$classNameFilter = new PointcutClassNameFilter($classPattern);
$classNameFilter->injectReflectionService($this->reflectionService);
$methodNameFilter = new PointcutMethodNameFilter($methodNamePattern, $methodVisibility, $methodArgumentConstraints);
/** @var LoggerInterface $logger */
$logger = $this->objectManager->get(PsrLoggerFactoryInterface::class)->get('systemLogger');
$methodNameFilter->injectLogger($logger);
$methodNameFilter->injectReflectionService($this->reflectionService);
if ($operator !== '&&') {
$subComposite = new PointcutFilterComposite();
$subComposite->addFilter('&&', $classNameFilter);
$subComposite->addFilter('&&', $methodNameFilter);
$pointcutFilterComposite->addFilter($operator, $subComposite);
} else {
$pointcutFilterComposite->addFilter('&&', $classNameFilter);
$pointcutFilterComposite->addFilter('&&', $methodNameFilter);
}
} | php | protected function parseDesignatorMethod(string $operator, string $signaturePattern, PointcutFilterComposite $pointcutFilterComposite): void
{
if (strpos($signaturePattern, '->') === false) {
throw new InvalidPointcutExpressionException('Syntax error: "->" expected in "' . $signaturePattern . '", defined in ' . $this->sourceHint, 1169027339);
}
$methodVisibility = $this->getVisibilityFromSignaturePattern($signaturePattern);
list($classPattern, $methodPattern) = explode('->', $signaturePattern, 2);
if (strpos($methodPattern, '(') === false) {
throw new InvalidPointcutExpressionException('Syntax error: "(" expected in "' . $methodPattern . '", defined in ' . $this->sourceHint, 1169144299);
}
$matches = [];
preg_match(self::PATTERN_MATCHMETHODNAMEANDARGUMENTS, $methodPattern, $matches);
$methodNamePattern = $matches['MethodName'];
$methodArgumentPattern = $matches['MethodArguments'];
$methodArgumentConstraints = $this->getArgumentConstraintsFromMethodArgumentsPattern($methodArgumentPattern);
$classNameFilter = new PointcutClassNameFilter($classPattern);
$classNameFilter->injectReflectionService($this->reflectionService);
$methodNameFilter = new PointcutMethodNameFilter($methodNamePattern, $methodVisibility, $methodArgumentConstraints);
/** @var LoggerInterface $logger */
$logger = $this->objectManager->get(PsrLoggerFactoryInterface::class)->get('systemLogger');
$methodNameFilter->injectLogger($logger);
$methodNameFilter->injectReflectionService($this->reflectionService);
if ($operator !== '&&') {
$subComposite = new PointcutFilterComposite();
$subComposite->addFilter('&&', $classNameFilter);
$subComposite->addFilter('&&', $methodNameFilter);
$pointcutFilterComposite->addFilter($operator, $subComposite);
} else {
$pointcutFilterComposite->addFilter('&&', $classNameFilter);
$pointcutFilterComposite->addFilter('&&', $methodNameFilter);
}
} | [
"protected",
"function",
"parseDesignatorMethod",
"(",
"string",
"$",
"operator",
",",
"string",
"$",
"signaturePattern",
",",
"PointcutFilterComposite",
"$",
"pointcutFilterComposite",
")",
":",
"void",
"{",
"if",
"(",
"strpos",
"(",
"$",
"signaturePattern",
",",
... | Splits the parameters of the pointcut designator "method" into a class
and a method part and adds the appropriately configured filters to the
filter composite object.
@param string $operator The operator
@param string $signaturePattern The pattern expression defining the class and method - the "signature"
@param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the class and method filter) will be added to this composite object.
@return void
@throws InvalidPointcutExpressionException if there's an error in the pointcut expression | [
"Splits",
"the",
"parameters",
"of",
"the",
"pointcut",
"designator",
"method",
"into",
"a",
"class",
"and",
"a",
"method",
"part",
"and",
"adds",
"the",
"appropriately",
"configured",
"filters",
"to",
"the",
"filter",
"composite",
"object",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L261-L297 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parseDesignatorWithin | protected function parseDesignatorWithin(string $operator, string $signaturePattern, PointcutFilterComposite $pointcutFilterComposite): void
{
$filter = new PointcutClassTypeFilter($signaturePattern);
$filter->injectReflectionService($this->reflectionService);
$pointcutFilterComposite->addFilter($operator, $filter);
} | php | protected function parseDesignatorWithin(string $operator, string $signaturePattern, PointcutFilterComposite $pointcutFilterComposite): void
{
$filter = new PointcutClassTypeFilter($signaturePattern);
$filter->injectReflectionService($this->reflectionService);
$pointcutFilterComposite->addFilter($operator, $filter);
} | [
"protected",
"function",
"parseDesignatorWithin",
"(",
"string",
"$",
"operator",
",",
"string",
"$",
"signaturePattern",
",",
"PointcutFilterComposite",
"$",
"pointcutFilterComposite",
")",
":",
"void",
"{",
"$",
"filter",
"=",
"new",
"PointcutClassTypeFilter",
"(",
... | Adds a class type filter to the pointcut filter composite
@param string $operator
@param string $signaturePattern The pattern expression defining the class type
@param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the class type filter) will be added to this composite object.
@return void | [
"Adds",
"a",
"class",
"type",
"filter",
"to",
"the",
"pointcut",
"filter",
"composite"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L307-L312 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parseDesignatorPointcut | protected function parseDesignatorPointcut(string $operator, string $pointcutExpression, PointcutFilterComposite $pointcutFilterComposite): void
{
if (strpos($pointcutExpression, '->') === false) {
throw new InvalidPointcutExpressionException('Syntax error: "->" expected in "' . $pointcutExpression . '", defined in ' . $this->sourceHint, 1172219205);
}
list($aspectClassName, $pointcutMethodName) = explode('->', $pointcutExpression, 2);
$pointcutFilter = new PointcutFilter($aspectClassName, $pointcutMethodName);
$pointcutFilter->injectProxyClassBuilder($this->proxyClassBuilder);
$pointcutFilterComposite->addFilter($operator, $pointcutFilter);
} | php | protected function parseDesignatorPointcut(string $operator, string $pointcutExpression, PointcutFilterComposite $pointcutFilterComposite): void
{
if (strpos($pointcutExpression, '->') === false) {
throw new InvalidPointcutExpressionException('Syntax error: "->" expected in "' . $pointcutExpression . '", defined in ' . $this->sourceHint, 1172219205);
}
list($aspectClassName, $pointcutMethodName) = explode('->', $pointcutExpression, 2);
$pointcutFilter = new PointcutFilter($aspectClassName, $pointcutMethodName);
$pointcutFilter->injectProxyClassBuilder($this->proxyClassBuilder);
$pointcutFilterComposite->addFilter($operator, $pointcutFilter);
} | [
"protected",
"function",
"parseDesignatorPointcut",
"(",
"string",
"$",
"operator",
",",
"string",
"$",
"pointcutExpression",
",",
"PointcutFilterComposite",
"$",
"pointcutFilterComposite",
")",
":",
"void",
"{",
"if",
"(",
"strpos",
"(",
"$",
"pointcutExpression",
... | Splits the value of the pointcut designator "pointcut" into an aspect
class- and a pointcut method part and adds the appropriately configured
filter to the composite object.
@param string $operator The operator
@param string $pointcutExpression The pointcut expression (value of the designator)
@param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the pointcut filter) will be added to this composite object.
@return void
@throws InvalidPointcutExpressionException | [
"Splits",
"the",
"value",
"of",
"the",
"pointcut",
"designator",
"pointcut",
"into",
"an",
"aspect",
"class",
"-",
"and",
"a",
"pointcut",
"method",
"part",
"and",
"adds",
"the",
"appropriately",
"configured",
"filter",
"to",
"the",
"composite",
"object",
"."
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L325-L334 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parseDesignatorFilter | protected function parseDesignatorFilter(string $operator, string $filterObjectName, PointcutFilterComposite $pointcutFilterComposite): void
{
$customFilter = $this->objectManager->get($filterObjectName);
if (!$customFilter instanceof PointcutFilterInterface) {
throw new InvalidPointcutExpressionException('Invalid custom filter: "' . $filterObjectName . '" does not implement the required PointcutFilterInterface, defined in ' . $this->sourceHint, 1231871755);
}
$pointcutFilterComposite->addFilter($operator, $customFilter);
} | php | protected function parseDesignatorFilter(string $operator, string $filterObjectName, PointcutFilterComposite $pointcutFilterComposite): void
{
$customFilter = $this->objectManager->get($filterObjectName);
if (!$customFilter instanceof PointcutFilterInterface) {
throw new InvalidPointcutExpressionException('Invalid custom filter: "' . $filterObjectName . '" does not implement the required PointcutFilterInterface, defined in ' . $this->sourceHint, 1231871755);
}
$pointcutFilterComposite->addFilter($operator, $customFilter);
} | [
"protected",
"function",
"parseDesignatorFilter",
"(",
"string",
"$",
"operator",
",",
"string",
"$",
"filterObjectName",
",",
"PointcutFilterComposite",
"$",
"pointcutFilterComposite",
")",
":",
"void",
"{",
"$",
"customFilter",
"=",
"$",
"this",
"->",
"objectManag... | Adds a custom filter to the pointcut filter composite
@param string $operator The operator
@param string $filterObjectName Object Name of the custom filter (value of the designator)
@param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the custom filter) will be added to this composite object.
@return void
@throws InvalidPointcutExpressionException | [
"Adds",
"a",
"custom",
"filter",
"to",
"the",
"pointcut",
"filter",
"composite"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L345-L352 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parseDesignatorSetting | protected function parseDesignatorSetting(string $operator, string $configurationPath, PointcutFilterComposite $pointcutFilterComposite): void
{
$filter = new PointcutSettingFilter($configurationPath);
/** @var ConfigurationManager $configurationManager */
$configurationManager = $this->objectManager->get(ConfigurationManager::class);
$filter->injectConfigurationManager($configurationManager);
$pointcutFilterComposite->addFilter($operator, $filter);
} | php | protected function parseDesignatorSetting(string $operator, string $configurationPath, PointcutFilterComposite $pointcutFilterComposite): void
{
$filter = new PointcutSettingFilter($configurationPath);
/** @var ConfigurationManager $configurationManager */
$configurationManager = $this->objectManager->get(ConfigurationManager::class);
$filter->injectConfigurationManager($configurationManager);
$pointcutFilterComposite->addFilter($operator, $filter);
} | [
"protected",
"function",
"parseDesignatorSetting",
"(",
"string",
"$",
"operator",
",",
"string",
"$",
"configurationPath",
",",
"PointcutFilterComposite",
"$",
"pointcutFilterComposite",
")",
":",
"void",
"{",
"$",
"filter",
"=",
"new",
"PointcutSettingFilter",
"(",
... | Adds a setting filter to the pointcut filter composite
@param string $operator The operator
@param string $configurationPath The path to the settings option, that should be used
@param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the custom filter) will be added to this composite object.
@return void | [
"Adds",
"a",
"setting",
"filter",
"to",
"the",
"pointcut",
"filter",
"composite"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L362-L370 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.parseRuntimeEvaluations | protected function parseRuntimeEvaluations(string $operator, string $runtimeEvaluations, PointcutFilterComposite $pointcutFilterComposite): void
{
$runtimeEvaluationsDefinition = [
$operator => [
'evaluateConditions' => $this->getRuntimeEvaluationConditionsFromEvaluateString($runtimeEvaluations)
]
];
$pointcutFilterComposite->setGlobalRuntimeEvaluationsDefinition($runtimeEvaluationsDefinition);
} | php | protected function parseRuntimeEvaluations(string $operator, string $runtimeEvaluations, PointcutFilterComposite $pointcutFilterComposite): void
{
$runtimeEvaluationsDefinition = [
$operator => [
'evaluateConditions' => $this->getRuntimeEvaluationConditionsFromEvaluateString($runtimeEvaluations)
]
];
$pointcutFilterComposite->setGlobalRuntimeEvaluationsDefinition($runtimeEvaluationsDefinition);
} | [
"protected",
"function",
"parseRuntimeEvaluations",
"(",
"string",
"$",
"operator",
",",
"string",
"$",
"runtimeEvaluations",
",",
"PointcutFilterComposite",
"$",
"pointcutFilterComposite",
")",
":",
"void",
"{",
"$",
"runtimeEvaluationsDefinition",
"=",
"[",
"$",
"op... | Adds runtime evaluations to the pointcut filter composite
@param string $operator The operator
@param string $runtimeEvaluations The runtime evaluations string
@param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the custom filter) will be added to this composite object.
@return void | [
"Adds",
"runtime",
"evaluations",
"to",
"the",
"pointcut",
"filter",
"composite"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L380-L389 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.getSubstringBetweenParentheses | protected function getSubstringBetweenParentheses(string $string): string
{
$startingPosition = 0;
$openParentheses = 0;
$substring = '';
$length = strlen($string);
for ($i = $startingPosition; $i < $length; $i++) {
if ($string[$i] === ')') {
$openParentheses--;
}
if ($openParentheses > 0) {
$substring .= $string{$i};
}
if ($string[$i] === '(') {
$openParentheses++;
}
}
if ($openParentheses < 0) {
throw new InvalidPointcutExpressionException('Pointcut expression is in excess of ' . abs($openParentheses) . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966689);
}
if ($openParentheses > 0) {
throw new InvalidPointcutExpressionException('Pointcut expression lacks of ' . $openParentheses . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966690);
}
return $substring;
} | php | protected function getSubstringBetweenParentheses(string $string): string
{
$startingPosition = 0;
$openParentheses = 0;
$substring = '';
$length = strlen($string);
for ($i = $startingPosition; $i < $length; $i++) {
if ($string[$i] === ')') {
$openParentheses--;
}
if ($openParentheses > 0) {
$substring .= $string{$i};
}
if ($string[$i] === '(') {
$openParentheses++;
}
}
if ($openParentheses < 0) {
throw new InvalidPointcutExpressionException('Pointcut expression is in excess of ' . abs($openParentheses) . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966689);
}
if ($openParentheses > 0) {
throw new InvalidPointcutExpressionException('Pointcut expression lacks of ' . $openParentheses . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966690);
}
return $substring;
} | [
"protected",
"function",
"getSubstringBetweenParentheses",
"(",
"string",
"$",
"string",
")",
":",
"string",
"{",
"$",
"startingPosition",
"=",
"0",
";",
"$",
"openParentheses",
"=",
"0",
";",
"$",
"substring",
"=",
"''",
";",
"$",
"length",
"=",
"strlen",
... | Returns the substring of $string which is enclosed by parentheses
of the first level.
@param string $string The string to parse
@return string The inner part between the first level of parentheses
@throws InvalidPointcutExpressionException | [
"Returns",
"the",
"substring",
"of",
"$string",
"which",
"is",
"enclosed",
"by",
"parentheses",
"of",
"the",
"first",
"level",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L399-L424 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.getVisibilityFromSignaturePattern | protected function getVisibilityFromSignaturePattern(string &$signaturePattern)
{
$visibility = null;
$matches = [];
$numberOfMatches = preg_match_all(self::PATTERN_MATCHVISIBILITYMODIFIER, $signaturePattern, $matches, PREG_SET_ORDER);
if ($numberOfMatches > 1) {
throw new InvalidPointcutExpressionException('Syntax error: method name expected after visibility modifier in "' . $signaturePattern . '", defined in ' . $this->sourceHint, 1172492754);
}
if ($numberOfMatches === false) {
throw new InvalidPointcutExpressionException('Error while matching visibility modifier in "' . $signaturePattern . '", defined in ' . $this->sourceHint, 1172492967);
}
if ($numberOfMatches === 1) {
$visibility = $matches[0][1];
$signaturePattern = trim(substr($signaturePattern, strlen($visibility)));
}
return $visibility;
} | php | protected function getVisibilityFromSignaturePattern(string &$signaturePattern)
{
$visibility = null;
$matches = [];
$numberOfMatches = preg_match_all(self::PATTERN_MATCHVISIBILITYMODIFIER, $signaturePattern, $matches, PREG_SET_ORDER);
if ($numberOfMatches > 1) {
throw new InvalidPointcutExpressionException('Syntax error: method name expected after visibility modifier in "' . $signaturePattern . '", defined in ' . $this->sourceHint, 1172492754);
}
if ($numberOfMatches === false) {
throw new InvalidPointcutExpressionException('Error while matching visibility modifier in "' . $signaturePattern . '", defined in ' . $this->sourceHint, 1172492967);
}
if ($numberOfMatches === 1) {
$visibility = $matches[0][1];
$signaturePattern = trim(substr($signaturePattern, strlen($visibility)));
}
return $visibility;
} | [
"protected",
"function",
"getVisibilityFromSignaturePattern",
"(",
"string",
"&",
"$",
"signaturePattern",
")",
"{",
"$",
"visibility",
"=",
"null",
";",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"numberOfMatches",
"=",
"preg_match_all",
"(",
"self",
"::",
"PAT... | Parses the signature pattern and returns the visibility modifier if any. If a modifier
was found, it will be removed from the $signaturePattern.
@param string &$signaturePattern The regular expression for matching the method() signature
@return string|null Visibility modifier or NULL of none was found
@throws InvalidPointcutExpressionException | [
"Parses",
"the",
"signature",
"pattern",
"and",
"returns",
"the",
"visibility",
"modifier",
"if",
"any",
".",
"If",
"a",
"modifier",
"was",
"found",
"it",
"will",
"be",
"removed",
"from",
"the",
"$signaturePattern",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L434-L450 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.getArgumentConstraintsFromMethodArgumentsPattern | protected function getArgumentConstraintsFromMethodArgumentsPattern(string $methodArgumentsPattern): array
{
$matches = [];
$argumentConstraints = [];
preg_match_all(self::PATTERN_MATCHRUNTIMEEVALUATIONSDEFINITION, $methodArgumentsPattern, $matches);
$matchesCount = count($matches[0]);
for ($i = 0; $i < $matchesCount; $i++) {
if ($matches[2][$i] === 'in' || $matches[2][$i] === 'matches') {
$list = [];
$listEntries = [];
if (preg_match('/^\s*\(.*\)\s*$/', $matches[3][$i], $list) > 0) {
preg_match_all(self::PATTERN_MATCHRUNTIMEEVALUATIONSVALUELIST, $list[0], $listEntries);
$matches[3][$i] = $listEntries[1];
}
}
$argumentConstraints[$matches[1][$i]]['operator'][] = $matches[2][$i];
$argumentConstraints[$matches[1][$i]]['value'][] = $matches[3][$i];
}
return $argumentConstraints;
} | php | protected function getArgumentConstraintsFromMethodArgumentsPattern(string $methodArgumentsPattern): array
{
$matches = [];
$argumentConstraints = [];
preg_match_all(self::PATTERN_MATCHRUNTIMEEVALUATIONSDEFINITION, $methodArgumentsPattern, $matches);
$matchesCount = count($matches[0]);
for ($i = 0; $i < $matchesCount; $i++) {
if ($matches[2][$i] === 'in' || $matches[2][$i] === 'matches') {
$list = [];
$listEntries = [];
if (preg_match('/^\s*\(.*\)\s*$/', $matches[3][$i], $list) > 0) {
preg_match_all(self::PATTERN_MATCHRUNTIMEEVALUATIONSVALUELIST, $list[0], $listEntries);
$matches[3][$i] = $listEntries[1];
}
}
$argumentConstraints[$matches[1][$i]]['operator'][] = $matches[2][$i];
$argumentConstraints[$matches[1][$i]]['value'][] = $matches[3][$i];
}
return $argumentConstraints;
} | [
"protected",
"function",
"getArgumentConstraintsFromMethodArgumentsPattern",
"(",
"string",
"$",
"methodArgumentsPattern",
")",
":",
"array",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"argumentConstraints",
"=",
"[",
"]",
";",
"preg_match_all",
"(",
"self",
":... | Parses the method arguments pattern and returns the corresponding constraints array
@param string $methodArgumentsPattern The arguments pattern defined in the pointcut expression
@return array The corresponding constraints array | [
"Parses",
"the",
"method",
"arguments",
"pattern",
"and",
"returns",
"the",
"corresponding",
"constraints",
"array"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L458-L481 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php | PointcutExpressionParser.getRuntimeEvaluationConditionsFromEvaluateString | protected function getRuntimeEvaluationConditionsFromEvaluateString(string $evaluateString): array
{
$matches = [];
$runtimeEvaluationConditions = [];
preg_match_all(self::PATTERN_MATCHRUNTIMEEVALUATIONSDEFINITION, $evaluateString, $matches);
$matchesCount = count($matches[0]);
for ($i = 0; $i < $matchesCount; $i++) {
if ($matches[2][$i] === 'in' || $matches[2][$i] === 'matches') {
$list = [];
$listEntries = [];
if (preg_match('/^\s*\(.*\)\s*$/', $matches[3][$i], $list) > 0) {
preg_match_all(self::PATTERN_MATCHRUNTIMEEVALUATIONSVALUELIST, $list[0], $listEntries);
$matches[3][$i] = $listEntries[1];
}
}
$runtimeEvaluationConditions[] = [
'operator' => $matches[2][$i],
'leftValue' => $matches[1][$i],
'rightValue' => $matches[3][$i],
];
}
return $runtimeEvaluationConditions;
} | php | protected function getRuntimeEvaluationConditionsFromEvaluateString(string $evaluateString): array
{
$matches = [];
$runtimeEvaluationConditions = [];
preg_match_all(self::PATTERN_MATCHRUNTIMEEVALUATIONSDEFINITION, $evaluateString, $matches);
$matchesCount = count($matches[0]);
for ($i = 0; $i < $matchesCount; $i++) {
if ($matches[2][$i] === 'in' || $matches[2][$i] === 'matches') {
$list = [];
$listEntries = [];
if (preg_match('/^\s*\(.*\)\s*$/', $matches[3][$i], $list) > 0) {
preg_match_all(self::PATTERN_MATCHRUNTIMEEVALUATIONSVALUELIST, $list[0], $listEntries);
$matches[3][$i] = $listEntries[1];
}
}
$runtimeEvaluationConditions[] = [
'operator' => $matches[2][$i],
'leftValue' => $matches[1][$i],
'rightValue' => $matches[3][$i],
];
}
return $runtimeEvaluationConditions;
} | [
"protected",
"function",
"getRuntimeEvaluationConditionsFromEvaluateString",
"(",
"string",
"$",
"evaluateString",
")",
":",
"array",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"runtimeEvaluationConditions",
"=",
"[",
"]",
";",
"preg_match_all",
"(",
"self",
":... | Parses the evaluate string for runtime evaluations and returns the corresponding conditions array
@param string $evaluateString The evaluate string defined in the pointcut expression
@return array The corresponding constraints array | [
"Parses",
"the",
"evaluate",
"string",
"for",
"runtime",
"evaluations",
"and",
"returns",
"the",
"corresponding",
"conditions",
"array"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php#L489-L515 |
neos/flow-development-collection | Neos.Flow/Classes/Session/SessionManager.php | SessionManager.getSession | public function getSession($sessionIdentifier)
{
if ($this->currentSession !== null && $this->currentSession->isStarted() && $this->currentSession->getId() === $sessionIdentifier) {
return $this->currentSession;
}
if (isset($this->remoteSessions[$sessionIdentifier])) {
return $this->remoteSessions[$sessionIdentifier];
}
if ($this->metaDataCache->has($sessionIdentifier)) {
$sessionInfo = $this->metaDataCache->get($sessionIdentifier);
$this->remoteSessions[$sessionIdentifier] = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
return $this->remoteSessions[$sessionIdentifier];
}
} | php | public function getSession($sessionIdentifier)
{
if ($this->currentSession !== null && $this->currentSession->isStarted() && $this->currentSession->getId() === $sessionIdentifier) {
return $this->currentSession;
}
if (isset($this->remoteSessions[$sessionIdentifier])) {
return $this->remoteSessions[$sessionIdentifier];
}
if ($this->metaDataCache->has($sessionIdentifier)) {
$sessionInfo = $this->metaDataCache->get($sessionIdentifier);
$this->remoteSessions[$sessionIdentifier] = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
return $this->remoteSessions[$sessionIdentifier];
}
} | [
"public",
"function",
"getSession",
"(",
"$",
"sessionIdentifier",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentSession",
"!==",
"null",
"&&",
"$",
"this",
"->",
"currentSession",
"->",
"isStarted",
"(",
")",
"&&",
"$",
"this",
"->",
"currentSession",
"... | Returns the specified session. If no session with the given identifier exists,
NULL is returned.
@param string $sessionIdentifier The session identifier
@return SessionInterface
@api | [
"Returns",
"the",
"specified",
"session",
".",
"If",
"no",
"session",
"with",
"the",
"given",
"identifier",
"exists",
"NULL",
"is",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Session/SessionManager.php#L103-L116 |
neos/flow-development-collection | Neos.Flow/Classes/Session/SessionManager.php | SessionManager.getActiveSessions | public function getActiveSessions()
{
$activeSessions = [];
foreach ($this->metaDataCache->getByTag('session') as $sessionIdentifier => $sessionInfo) {
$session = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
$activeSessions[] = $session;
}
return $activeSessions;
} | php | public function getActiveSessions()
{
$activeSessions = [];
foreach ($this->metaDataCache->getByTag('session') as $sessionIdentifier => $sessionInfo) {
$session = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
$activeSessions[] = $session;
}
return $activeSessions;
} | [
"public",
"function",
"getActiveSessions",
"(",
")",
"{",
"$",
"activeSessions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"metaDataCache",
"->",
"getByTag",
"(",
"'session'",
")",
"as",
"$",
"sessionIdentifier",
"=>",
"$",
"sessionInfo",
")",
... | Returns all active sessions, even remote ones.
@return array<SessionInterface>
@api | [
"Returns",
"all",
"active",
"sessions",
"even",
"remote",
"ones",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Session/SessionManager.php#L124-L132 |
neos/flow-development-collection | Neos.Flow/Classes/Session/SessionManager.php | SessionManager.getSessionsByTag | public function getSessionsByTag($tag)
{
$taggedSessions = [];
foreach ($this->metaDataCache->getByTag(Session::TAG_PREFIX . $tag) as $sessionIdentifier => $sessionInfo) {
$session = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
$taggedSessions[] = $session;
}
return $taggedSessions;
} | php | public function getSessionsByTag($tag)
{
$taggedSessions = [];
foreach ($this->metaDataCache->getByTag(Session::TAG_PREFIX . $tag) as $sessionIdentifier => $sessionInfo) {
$session = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
$taggedSessions[] = $session;
}
return $taggedSessions;
} | [
"public",
"function",
"getSessionsByTag",
"(",
"$",
"tag",
")",
"{",
"$",
"taggedSessions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"metaDataCache",
"->",
"getByTag",
"(",
"Session",
"::",
"TAG_PREFIX",
".",
"$",
"tag",
")",
"as",
"$",
"... | Returns all sessions which are tagged by the specified tag.
@param string $tag A valid Cache Frontend tag
@return array A collection of Session objects or an empty array if tag did not match
@api | [
"Returns",
"all",
"sessions",
"which",
"are",
"tagged",
"by",
"the",
"specified",
"tag",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Session/SessionManager.php#L141-L149 |
neos/flow-development-collection | Neos.Flow/Classes/Session/SessionManager.php | SessionManager.destroySessionsByTag | public function destroySessionsByTag($tag, $reason = '')
{
$sessions = $this->getSessionsByTag($tag);
foreach ($sessions as $session) {
/** @var SessionInterface $session */
$session->destroy($reason);
}
return count($sessions);
} | php | public function destroySessionsByTag($tag, $reason = '')
{
$sessions = $this->getSessionsByTag($tag);
foreach ($sessions as $session) {
/** @var SessionInterface $session */
$session->destroy($reason);
}
return count($sessions);
} | [
"public",
"function",
"destroySessionsByTag",
"(",
"$",
"tag",
",",
"$",
"reason",
"=",
"''",
")",
"{",
"$",
"sessions",
"=",
"$",
"this",
"->",
"getSessionsByTag",
"(",
"$",
"tag",
")",
";",
"foreach",
"(",
"$",
"sessions",
"as",
"$",
"session",
")",
... | Destroys all sessions which are tagged with the specified tag.
@param string $tag A valid Cache Frontend tag
@param string $reason A reason to mention in log output for why the sessions have been destroyed. For example: "The corresponding account was deleted"
@return integer Number of sessions which have been destroyed | [
"Destroys",
"all",
"sessions",
"which",
"are",
"tagged",
"with",
"the",
"specified",
"tag",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Session/SessionManager.php#L158-L166 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/ViewHelpers/FlashMessagesViewHelper.php | FlashMessagesViewHelper.initializeArguments | public function initializeArguments()
{
$this->registerUniversalTagAttributes();
$this->registerArgument('as', 'string', 'The name of the current flashMessage variable for rendering inside', false, null);
$this->registerArgument('severity', 'string', 'severity of the messages (One of the \Neos\Error\Messages\Message::SEVERITY_* constants)', false, null);
} | php | public function initializeArguments()
{
$this->registerUniversalTagAttributes();
$this->registerArgument('as', 'string', 'The name of the current flashMessage variable for rendering inside', false, null);
$this->registerArgument('severity', 'string', 'severity of the messages (One of the \Neos\Error\Messages\Message::SEVERITY_* constants)', false, null);
} | [
"public",
"function",
"initializeArguments",
"(",
")",
"{",
"$",
"this",
"->",
"registerUniversalTagAttributes",
"(",
")",
";",
"$",
"this",
"->",
"registerArgument",
"(",
"'as'",
",",
"'string'",
",",
"'The name of the current flashMessage variable for rendering inside'"... | Initialize arguments
@return void
@api | [
"Initialize",
"arguments"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FlashMessagesViewHelper.php#L75-L80 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/JoinPoint.php | JoinPoint.getMethodArgument | public function getMethodArgument($argumentName)
{
if (!array_key_exists($argumentName, $this->methodArguments)) {
throw new InvalidArgumentException('The argument "' . $argumentName . '" does not exist in method ' . $this->className . '->' . $this->methodName, 1172750905);
}
return $this->methodArguments[$argumentName];
} | php | public function getMethodArgument($argumentName)
{
if (!array_key_exists($argumentName, $this->methodArguments)) {
throw new InvalidArgumentException('The argument "' . $argumentName . '" does not exist in method ' . $this->className . '->' . $this->methodName, 1172750905);
}
return $this->methodArguments[$argumentName];
} | [
"public",
"function",
"getMethodArgument",
"(",
"$",
"argumentName",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"argumentName",
",",
"$",
"this",
"->",
"methodArguments",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The argument... | Returns the value of the specified method argument
@param string $argumentName Name of the argument
@return mixed Value of the argument
@throws Exception\InvalidArgumentException
@api | [
"Returns",
"the",
"value",
"of",
"the",
"specified",
"method",
"argument"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/JoinPoint.php#L140-L146 |
neos/flow-development-collection | Neos.Flow/Classes/Aop/JoinPoint.php | JoinPoint.setMethodArgument | public function setMethodArgument($argumentName, $argumentValue): void
{
if (!array_key_exists($argumentName, $this->methodArguments)) {
throw new InvalidArgumentException('The argument "' . $argumentName . '" does not exist in method ' . $this->className . '->' . $this->methodName, 1309260269);
}
$this->methodArguments[$argumentName] = $argumentValue;
} | php | public function setMethodArgument($argumentName, $argumentValue): void
{
if (!array_key_exists($argumentName, $this->methodArguments)) {
throw new InvalidArgumentException('The argument "' . $argumentName . '" does not exist in method ' . $this->className . '->' . $this->methodName, 1309260269);
}
$this->methodArguments[$argumentName] = $argumentValue;
} | [
"public",
"function",
"setMethodArgument",
"(",
"$",
"argumentName",
",",
"$",
"argumentValue",
")",
":",
"void",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"argumentName",
",",
"$",
"this",
"->",
"methodArguments",
")",
")",
"{",
"throw",
"new",
"... | Sets the value of the specified method argument
@param string $argumentName Name of the argument
@param mixed $argumentValue Value of the argument
@return void
@throws Exception\InvalidArgumentException
@api | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"method",
"argument"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/JoinPoint.php#L157-L163 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/Core/Parser/SyntaxTree/Expression/LegacyNamespaceExpressionNode.php | LegacyNamespaceExpressionNode.evaluateExpression | public static function evaluateExpression(RenderingContextInterface $renderingContext, $expression, array $matches)
{
$renderingContext->getViewHelperResolver()->addNamespace($matches[1], $matches[2]);
} | php | public static function evaluateExpression(RenderingContextInterface $renderingContext, $expression, array $matches)
{
$renderingContext->getViewHelperResolver()->addNamespace($matches[1], $matches[2]);
} | [
"public",
"static",
"function",
"evaluateExpression",
"(",
"RenderingContextInterface",
"$",
"renderingContext",
",",
"$",
"expression",
",",
"array",
"$",
"matches",
")",
"{",
"$",
"renderingContext",
"->",
"getViewHelperResolver",
"(",
")",
"->",
"addNamespace",
"... | Evaluates the expression stored in this node, in the context of $renderingcontext.
@param RenderingContextInterface $renderingContext
@param string $expression
@param array $matches
@return mixed | [
"Evaluates",
"the",
"expression",
"stored",
"in",
"this",
"node",
"in",
"the",
"context",
"of",
"$renderingcontext",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Parser/SyntaxTree/Expression/LegacyNamespaceExpressionNode.php#L37-L40 |
neos/flow-development-collection | Neos.Flow/Classes/I18n/Detector.php | Detector.detectLocaleFromHttpHeader | public function detectLocaleFromHttpHeader($acceptLanguageHeader)
{
$acceptableLanguages = I18n\Utility::parseAcceptLanguageHeader($acceptLanguageHeader);
if ($acceptableLanguages === false) {
return $this->localizationService->getConfiguration()->getDefaultLocale();
}
foreach ($acceptableLanguages as $languageIdentifier) {
if ($languageIdentifier === '*') {
return $this->localizationService->getConfiguration()->getDefaultLocale();
}
try {
$locale = new Locale($languageIdentifier);
} catch (Exception\InvalidLocaleIdentifierException $exception) {
continue;
}
$bestMatchingLocale = $this->localeCollection->findBestMatchingLocale($locale);
if ($bestMatchingLocale !== null) {
return $bestMatchingLocale;
}
}
return $this->localizationService->getConfiguration()->getDefaultLocale();
} | php | public function detectLocaleFromHttpHeader($acceptLanguageHeader)
{
$acceptableLanguages = I18n\Utility::parseAcceptLanguageHeader($acceptLanguageHeader);
if ($acceptableLanguages === false) {
return $this->localizationService->getConfiguration()->getDefaultLocale();
}
foreach ($acceptableLanguages as $languageIdentifier) {
if ($languageIdentifier === '*') {
return $this->localizationService->getConfiguration()->getDefaultLocale();
}
try {
$locale = new Locale($languageIdentifier);
} catch (Exception\InvalidLocaleIdentifierException $exception) {
continue;
}
$bestMatchingLocale = $this->localeCollection->findBestMatchingLocale($locale);
if ($bestMatchingLocale !== null) {
return $bestMatchingLocale;
}
}
return $this->localizationService->getConfiguration()->getDefaultLocale();
} | [
"public",
"function",
"detectLocaleFromHttpHeader",
"(",
"$",
"acceptLanguageHeader",
")",
"{",
"$",
"acceptableLanguages",
"=",
"I18n",
"\\",
"Utility",
"::",
"parseAcceptLanguageHeader",
"(",
"$",
"acceptLanguageHeader",
")",
";",
"if",
"(",
"$",
"acceptableLanguage... | Returns best-matching Locale object based on the Accept-Language header
provided as parameter. System default locale will be returned if no
successful matches were done.
@param string $acceptLanguageHeader The Accept-Language HTTP header
@return Locale Best-matching existing Locale instance
@api | [
"Returns",
"best",
"-",
"matching",
"Locale",
"object",
"based",
"on",
"the",
"Accept",
"-",
"Language",
"header",
"provided",
"as",
"parameter",
".",
"System",
"default",
"locale",
"will",
"be",
"returned",
"if",
"no",
"successful",
"matches",
"were",
"done",... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Detector.php#L65-L92 |
neos/flow-development-collection | Neos.Flow/Classes/I18n/Detector.php | Detector.detectLocaleFromLocaleTag | public function detectLocaleFromLocaleTag($localeIdentifier)
{
try {
return $this->detectLocaleFromTemplateLocale(new Locale($localeIdentifier));
} catch (Exception\InvalidLocaleIdentifierException $exception) {
return $this->localizationService->getConfiguration()->getDefaultLocale();
}
} | php | public function detectLocaleFromLocaleTag($localeIdentifier)
{
try {
return $this->detectLocaleFromTemplateLocale(new Locale($localeIdentifier));
} catch (Exception\InvalidLocaleIdentifierException $exception) {
return $this->localizationService->getConfiguration()->getDefaultLocale();
}
} | [
"public",
"function",
"detectLocaleFromLocaleTag",
"(",
"$",
"localeIdentifier",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"detectLocaleFromTemplateLocale",
"(",
"new",
"Locale",
"(",
"$",
"localeIdentifier",
")",
")",
";",
"}",
"catch",
"(",
"Exception... | Returns best-matching Locale object based on the locale identifier
provided as parameter. System default locale will be returned if no
successful matches were done.
@param string $localeIdentifier The locale identifier as used in Locale class
@return Locale Best-matching existing Locale instance
@api | [
"Returns",
"best",
"-",
"matching",
"Locale",
"object",
"based",
"on",
"the",
"locale",
"identifier",
"provided",
"as",
"parameter",
".",
"System",
"default",
"locale",
"will",
"be",
"returned",
"if",
"no",
"successful",
"matches",
"were",
"done",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Detector.php#L103-L110 |
neos/flow-development-collection | Neos.Flow/Classes/I18n/Detector.php | Detector.detectLocaleFromTemplateLocale | public function detectLocaleFromTemplateLocale(Locale $locale)
{
$bestMatchingLocale = $this->localeCollection->findBestMatchingLocale($locale);
if ($bestMatchingLocale !== null) {
return $bestMatchingLocale;
}
return $this->localizationService->getConfiguration()->getDefaultLocale();
} | php | public function detectLocaleFromTemplateLocale(Locale $locale)
{
$bestMatchingLocale = $this->localeCollection->findBestMatchingLocale($locale);
if ($bestMatchingLocale !== null) {
return $bestMatchingLocale;
}
return $this->localizationService->getConfiguration()->getDefaultLocale();
} | [
"public",
"function",
"detectLocaleFromTemplateLocale",
"(",
"Locale",
"$",
"locale",
")",
"{",
"$",
"bestMatchingLocale",
"=",
"$",
"this",
"->",
"localeCollection",
"->",
"findBestMatchingLocale",
"(",
"$",
"locale",
")",
";",
"if",
"(",
"$",
"bestMatchingLocale... | Returns best-matching Locale object based on the template Locale object
provided as parameter. System default locale will be returned if no
successful matches were done.
@param Locale $locale The template Locale object
@return Locale Best-matching existing Locale instance
@api | [
"Returns",
"best",
"-",
"matching",
"Locale",
"object",
"based",
"on",
"the",
"template",
"Locale",
"object",
"provided",
"as",
"parameter",
".",
"System",
"default",
"locale",
"will",
"be",
"returned",
"if",
"no",
"successful",
"matches",
"were",
"done",
"."
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Detector.php#L121-L130 |
neos/flow-development-collection | Neos.Flow/Classes/Security/DummyContext.php | DummyContext.getAuthenticationTokensOfType | public function getAuthenticationTokensOfType($className)
{
$tokens = [];
foreach ($this->tokens as $token) {
if ($token instanceof $className) {
$tokens[] = $token;
}
}
return $tokens;
} | php | public function getAuthenticationTokensOfType($className)
{
$tokens = [];
foreach ($this->tokens as $token) {
if ($token instanceof $className) {
$tokens[] = $token;
}
}
return $tokens;
} | [
"public",
"function",
"getAuthenticationTokensOfType",
"(",
"$",
"className",
")",
"{",
"$",
"tokens",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"tokens",
"as",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"token",
"instanceof",
"$",
"className",... | Returns all Authentication\Tokens of the security context which are
active for the current request and of the given type. If a token has a request pattern that cannot match
against the current request it is determined as not active.
@param string $className The class name
@return TokenInterface[] Array of set tokens of the specified type | [
"Returns",
"all",
"Authentication",
"\\",
"Tokens",
"of",
"the",
"security",
"context",
"which",
"are",
"active",
"for",
"the",
"current",
"request",
"and",
"of",
"the",
"given",
"type",
".",
"If",
"a",
"token",
"has",
"a",
"request",
"pattern",
"that",
"c... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/DummyContext.php#L117-L127 |
neos/flow-development-collection | Neos.Flow/Classes/Security/DummyContext.php | DummyContext.hasRole | public function hasRole($roleIdentifier)
{
if ($roleIdentifier === 'Neos.Flow:Everybody') {
return true;
}
if ($roleIdentifier === 'Neos.Flow:Anonymous') {
return (!empty($this->roles));
}
if ($roleIdentifier === 'Neos.Flow:AuthenticatedUser') {
return (empty($this->roles));
}
return isset($this->roles[$roleIdentifier]);
} | php | public function hasRole($roleIdentifier)
{
if ($roleIdentifier === 'Neos.Flow:Everybody') {
return true;
}
if ($roleIdentifier === 'Neos.Flow:Anonymous') {
return (!empty($this->roles));
}
if ($roleIdentifier === 'Neos.Flow:AuthenticatedUser') {
return (empty($this->roles));
}
return isset($this->roles[$roleIdentifier]);
} | [
"public",
"function",
"hasRole",
"(",
"$",
"roleIdentifier",
")",
"{",
"if",
"(",
"$",
"roleIdentifier",
"===",
"'Neos.Flow:Everybody'",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"roleIdentifier",
"===",
"'Neos.Flow:Anonymous'",
")",
"{",
"return",... | Returns true, if at least one of the currently authenticated accounts holds
a role with the given identifier, also recursively.
@param string $roleIdentifier The string representation of the role to search for
@return boolean true, if a role with the given string representation was found | [
"Returns",
"true",
"if",
"at",
"least",
"one",
"of",
"the",
"currently",
"authenticated",
"accounts",
"holds",
"a",
"role",
"with",
"the",
"given",
"identifier",
"also",
"recursively",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/DummyContext.php#L161-L174 |
neos/flow-development-collection | Neos.Flow/Classes/Security/DummyContext.php | DummyContext.clearContext | public function clearContext()
{
$this->roles = null;
$this->tokens = [];
$this->csrfProtectionToken = null;
$this->interceptedRequest = null;
$this->initialized = false;
} | php | public function clearContext()
{
$this->roles = null;
$this->tokens = [];
$this->csrfProtectionToken = null;
$this->interceptedRequest = null;
$this->initialized = false;
} | [
"public",
"function",
"clearContext",
"(",
")",
"{",
"$",
"this",
"->",
"roles",
"=",
"null",
";",
"$",
"this",
"->",
"tokens",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"csrfProtectionToken",
"=",
"null",
";",
"$",
"this",
"->",
"interceptedRequest",
"="... | Clears the security context.
@return void | [
"Clears",
"the",
"security",
"context",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/DummyContext.php#L247-L254 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php | RouterCachingService.getCachedMatchResults | public function getCachedMatchResults(RouteContext $routeContext)
{
$cachedResult = $this->routeCache->get($routeContext->getCacheEntryIdentifier());
if ($cachedResult !== false) {
$this->logger->debug(sprintf('Router route(): A cached Route with the cache identifier "%s" matched the request "%s (%s)".', $routeContext->getCacheEntryIdentifier(), $routeContext->getHttpRequest()->getUri(), $routeContext->getHttpRequest()->getMethod()));
}
return $cachedResult;
} | php | public function getCachedMatchResults(RouteContext $routeContext)
{
$cachedResult = $this->routeCache->get($routeContext->getCacheEntryIdentifier());
if ($cachedResult !== false) {
$this->logger->debug(sprintf('Router route(): A cached Route with the cache identifier "%s" matched the request "%s (%s)".', $routeContext->getCacheEntryIdentifier(), $routeContext->getHttpRequest()->getUri(), $routeContext->getHttpRequest()->getMethod()));
}
return $cachedResult;
} | [
"public",
"function",
"getCachedMatchResults",
"(",
"RouteContext",
"$",
"routeContext",
")",
"{",
"$",
"cachedResult",
"=",
"$",
"this",
"->",
"routeCache",
"->",
"get",
"(",
"$",
"routeContext",
"->",
"getCacheEntryIdentifier",
"(",
")",
")",
";",
"if",
"(",... | Checks the cache for the given RouteContext and returns the result or false if no matching ache entry was found
@param RouteContext $routeContext
@return array|boolean the cached route values or false if no cache entry was found | [
"Checks",
"the",
"cache",
"for",
"the",
"given",
"RouteContext",
"and",
"returns",
"the",
"result",
"or",
"false",
"if",
"no",
"matching",
"ache",
"entry",
"was",
"found"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php#L95-L103 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php | RouterCachingService.storeMatchResults | public function storeMatchResults(RouteContext $routeContext, array $matchResults, RouteTags $matchedTags = null)
{
if ($this->containsObject($matchResults)) {
return;
}
$tags = $this->generateRouteTags($routeContext->getHttpRequest()->getRelativePath(), $matchResults);
if ($matchedTags !== null) {
$tags = array_unique(array_merge($matchedTags->getTags(), $tags));
}
$this->routeCache->set($routeContext->getCacheEntryIdentifier(), $matchResults, $tags);
} | php | public function storeMatchResults(RouteContext $routeContext, array $matchResults, RouteTags $matchedTags = null)
{
if ($this->containsObject($matchResults)) {
return;
}
$tags = $this->generateRouteTags($routeContext->getHttpRequest()->getRelativePath(), $matchResults);
if ($matchedTags !== null) {
$tags = array_unique(array_merge($matchedTags->getTags(), $tags));
}
$this->routeCache->set($routeContext->getCacheEntryIdentifier(), $matchResults, $tags);
} | [
"public",
"function",
"storeMatchResults",
"(",
"RouteContext",
"$",
"routeContext",
",",
"array",
"$",
"matchResults",
",",
"RouteTags",
"$",
"matchedTags",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"containsObject",
"(",
"$",
"matchResults",
")",
... | Stores the $matchResults in the cache
@param RouteContext $routeContext
@param array $matchResults
@param RouteTags|null $matchedTags
@return void | [
"Stores",
"the",
"$matchResults",
"in",
"the",
"cache"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php#L113-L123 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php | RouterCachingService.getCachedResolvedUriConstraints | public function getCachedResolvedUriConstraints(ResolveContext $resolveContext)
{
$routeValues = $this->convertObjectsToHashes($resolveContext->getRouteValues());
if ($routeValues === null) {
return false;
}
return $this->resolveCache->get($this->buildResolveCacheIdentifier($resolveContext, $routeValues));
} | php | public function getCachedResolvedUriConstraints(ResolveContext $resolveContext)
{
$routeValues = $this->convertObjectsToHashes($resolveContext->getRouteValues());
if ($routeValues === null) {
return false;
}
return $this->resolveCache->get($this->buildResolveCacheIdentifier($resolveContext, $routeValues));
} | [
"public",
"function",
"getCachedResolvedUriConstraints",
"(",
"ResolveContext",
"$",
"resolveContext",
")",
"{",
"$",
"routeValues",
"=",
"$",
"this",
"->",
"convertObjectsToHashes",
"(",
"$",
"resolveContext",
"->",
"getRouteValues",
"(",
")",
")",
";",
"if",
"("... | Checks the cache for the given ResolveContext and returns the cached UriConstraints if a cache entry is found
@param ResolveContext $resolveContext
@return UriConstraints|boolean the cached URI or false if no cache entry was found | [
"Checks",
"the",
"cache",
"for",
"the",
"given",
"ResolveContext",
"and",
"returns",
"the",
"cached",
"UriConstraints",
"if",
"a",
"cache",
"entry",
"is",
"found"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php#L131-L138 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php | RouterCachingService.storeResolvedUriConstraints | public function storeResolvedUriConstraints(ResolveContext $resolveContext, UriConstraints $uriConstraints, RouteTags $resolvedTags = null)
{
$routeValues = $this->convertObjectsToHashes($resolveContext->getRouteValues());
if ($routeValues === null) {
return;
}
$cacheIdentifier = $this->buildResolveCacheIdentifier($resolveContext, $routeValues);
$tags = $this->generateRouteTags($uriConstraints->getPathConstraint(), $routeValues);
if ($resolvedTags !== null) {
$tags = array_unique(array_merge($resolvedTags->getTags(), $tags));
}
$this->resolveCache->set($cacheIdentifier, $uriConstraints, $tags);
} | php | public function storeResolvedUriConstraints(ResolveContext $resolveContext, UriConstraints $uriConstraints, RouteTags $resolvedTags = null)
{
$routeValues = $this->convertObjectsToHashes($resolveContext->getRouteValues());
if ($routeValues === null) {
return;
}
$cacheIdentifier = $this->buildResolveCacheIdentifier($resolveContext, $routeValues);
$tags = $this->generateRouteTags($uriConstraints->getPathConstraint(), $routeValues);
if ($resolvedTags !== null) {
$tags = array_unique(array_merge($resolvedTags->getTags(), $tags));
}
$this->resolveCache->set($cacheIdentifier, $uriConstraints, $tags);
} | [
"public",
"function",
"storeResolvedUriConstraints",
"(",
"ResolveContext",
"$",
"resolveContext",
",",
"UriConstraints",
"$",
"uriConstraints",
",",
"RouteTags",
"$",
"resolvedTags",
"=",
"null",
")",
"{",
"$",
"routeValues",
"=",
"$",
"this",
"->",
"convertObjects... | Stores the resolved UriConstraints in the cache together with the $routeValues
@param ResolveContext $resolveContext
@param UriConstraints $uriConstraints
@param RouteTags|null $resolvedTags
@return void | [
"Stores",
"the",
"resolved",
"UriConstraints",
"in",
"the",
"cache",
"together",
"with",
"the",
"$routeValues"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php#L148-L161 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php | RouterCachingService.flushCachesByTag | public function flushCachesByTag($tag)
{
$this->routeCache->flushByTag($tag);
$this->resolveCache->flushByTag($tag);
} | php | public function flushCachesByTag($tag)
{
$this->routeCache->flushByTag($tag);
$this->resolveCache->flushByTag($tag);
} | [
"public",
"function",
"flushCachesByTag",
"(",
"$",
"tag",
")",
"{",
"$",
"this",
"->",
"routeCache",
"->",
"flushByTag",
"(",
"$",
"tag",
")",
";",
"$",
"this",
"->",
"resolveCache",
"->",
"flushByTag",
"(",
"$",
"tag",
")",
";",
"}"
] | Flushes 'findMatchResults' and 'resolve' caches for the given $tag
@param string $tag
@return void | [
"Flushes",
"findMatchResults",
"and",
"resolve",
"caches",
"for",
"the",
"given",
"$tag"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php#L200-L204 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php | RouterCachingService.convertObjectsToHashes | protected function convertObjectsToHashes(array $routeValues)
{
foreach ($routeValues as &$value) {
if (is_object($value)) {
if ($value instanceof CacheAwareInterface) {
$identifier = $value->getCacheEntryIdentifier();
} else {
$identifier = $this->persistenceManager->getIdentifierByObject($value);
}
if ($identifier === null) {
return null;
}
$value = $identifier;
} elseif (is_array($value)) {
$value = $this->convertObjectsToHashes($value);
if ($value === null) {
return null;
}
}
}
return $routeValues;
} | php | protected function convertObjectsToHashes(array $routeValues)
{
foreach ($routeValues as &$value) {
if (is_object($value)) {
if ($value instanceof CacheAwareInterface) {
$identifier = $value->getCacheEntryIdentifier();
} else {
$identifier = $this->persistenceManager->getIdentifierByObject($value);
}
if ($identifier === null) {
return null;
}
$value = $identifier;
} elseif (is_array($value)) {
$value = $this->convertObjectsToHashes($value);
if ($value === null) {
return null;
}
}
}
return $routeValues;
} | [
"protected",
"function",
"convertObjectsToHashes",
"(",
"array",
"$",
"routeValues",
")",
"{",
"foreach",
"(",
"$",
"routeValues",
"as",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"$",
"value",
"in... | Recursively converts objects in an array to their identifiers
@param array $routeValues the array to be processed
@return array the modified array or NULL if $routeValues contain an object and its identifier could not be determined | [
"Recursively",
"converts",
"objects",
"in",
"an",
"array",
"to",
"their",
"identifiers"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php#L246-L267 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php | RouterCachingService.buildResolveCacheIdentifier | protected function buildResolveCacheIdentifier(ResolveContext $resolveContext, array $routeValues)
{
Arrays::sortKeysRecursively($routeValues);
return md5(sprintf('abs:%s|prefix:%s|routeValues:%s', $resolveContext->isForceAbsoluteUri() ? 1 : 0, $resolveContext->getUriPathPrefix(), trim(http_build_query($routeValues), '/')));
} | php | protected function buildResolveCacheIdentifier(ResolveContext $resolveContext, array $routeValues)
{
Arrays::sortKeysRecursively($routeValues);
return md5(sprintf('abs:%s|prefix:%s|routeValues:%s', $resolveContext->isForceAbsoluteUri() ? 1 : 0, $resolveContext->getUriPathPrefix(), trim(http_build_query($routeValues), '/')));
} | [
"protected",
"function",
"buildResolveCacheIdentifier",
"(",
"ResolveContext",
"$",
"resolveContext",
",",
"array",
"$",
"routeValues",
")",
"{",
"Arrays",
"::",
"sortKeysRecursively",
"(",
"$",
"routeValues",
")",
";",
"return",
"md5",
"(",
"sprintf",
"(",
"'abs:... | Generates the Resolve cache identifier for the given Request
@param ResolveContext $resolveContext
@param array $routeValues
@return string | [
"Generates",
"the",
"Resolve",
"cache",
"identifier",
"for",
"the",
"given",
"Request"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php#L276-L281 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php | RouterCachingService.extractUuids | protected function extractUuids(array $values)
{
$uuids = [];
foreach ($values as $value) {
if (is_string($value)) {
if (preg_match(UuidValidator::PATTERN_MATCH_UUID, $value) !== 0) {
$uuids[] = $value;
}
} elseif (is_array($value)) {
$uuids = array_merge($uuids, $this->extractUuids($value));
}
}
return $uuids;
} | php | protected function extractUuids(array $values)
{
$uuids = [];
foreach ($values as $value) {
if (is_string($value)) {
if (preg_match(UuidValidator::PATTERN_MATCH_UUID, $value) !== 0) {
$uuids[] = $value;
}
} elseif (is_array($value)) {
$uuids = array_merge($uuids, $this->extractUuids($value));
}
}
return $uuids;
} | [
"protected",
"function",
"extractUuids",
"(",
"array",
"$",
"values",
")",
"{",
"$",
"uuids",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"p... | Helper method to generate tags by taking all UUIDs contained
in the given $routeValues or $matchResults
@param array $values
@return array | [
"Helper",
"method",
"to",
"generate",
"tags",
"by",
"taking",
"all",
"UUIDs",
"contained",
"in",
"the",
"given",
"$routeValues",
"or",
"$matchResults"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/RouterCachingService.php#L290-L303 |
neos/flow-development-collection | Neos.Eel/Classes/FlowQuery/FlowQuery.php | FlowQuery.evaluateOperations | protected function evaluateOperations()
{
while ($op = array_shift($this->operations)) {
$operation = $this->operationResolver->resolveOperation($op['name'], $this->context);
$lastOperationResult = $operation->evaluate($this, $op['arguments']);
}
return $lastOperationResult;
} | php | protected function evaluateOperations()
{
while ($op = array_shift($this->operations)) {
$operation = $this->operationResolver->resolveOperation($op['name'], $this->context);
$lastOperationResult = $operation->evaluate($this, $op['arguments']);
}
return $lastOperationResult;
} | [
"protected",
"function",
"evaluateOperations",
"(",
")",
"{",
"while",
"(",
"$",
"op",
"=",
"array_shift",
"(",
"$",
"this",
"->",
"operations",
")",
")",
"{",
"$",
"operation",
"=",
"$",
"this",
"->",
"operationResolver",
"->",
"resolveOperation",
"(",
"$... | Evaluate operations
@return mixed the last operation result if the operation is a final operation, NULL otherwise | [
"Evaluate",
"operations"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/FlowQuery.php#L199-L206 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/Dto/RouteParameters.php | RouteParameters.withParameter | public function withParameter(string $parameterName, $parameterValue): self
{
if (!TypeHandling::isLiteral(gettype($parameterValue)) && (!$parameterValue instanceof CacheAwareInterface)) {
throw new \InvalidArgumentException(sprintf('Parameter values must be literal types or implement the CacheAwareInterface, given: "%s"', is_object($parameterValue) ? get_class($parameterValue) : gettype($parameterValue)), 1511194273);
}
$newParameters = $this->parameters;
$newParameters[$parameterName] = $parameterValue;
return new static($newParameters);
} | php | public function withParameter(string $parameterName, $parameterValue): self
{
if (!TypeHandling::isLiteral(gettype($parameterValue)) && (!$parameterValue instanceof CacheAwareInterface)) {
throw new \InvalidArgumentException(sprintf('Parameter values must be literal types or implement the CacheAwareInterface, given: "%s"', is_object($parameterValue) ? get_class($parameterValue) : gettype($parameterValue)), 1511194273);
}
$newParameters = $this->parameters;
$newParameters[$parameterName] = $parameterValue;
return new static($newParameters);
} | [
"public",
"function",
"withParameter",
"(",
"string",
"$",
"parameterName",
",",
"$",
"parameterValue",
")",
":",
"self",
"{",
"if",
"(",
"!",
"TypeHandling",
"::",
"isLiteral",
"(",
"gettype",
"(",
"$",
"parameterValue",
")",
")",
"&&",
"(",
"!",
"$",
"... | Create a new instance adding the given parameter
@param string $parameterName name of the parameter to add
@param bool|float|int|string|CacheAwareInterface $parameterValue value of the parameter, has to be a literal or an object implementing CacheAwareInterface
@return RouteParameters a new instance with the given parameters added | [
"Create",
"a",
"new",
"instance",
"adding",
"the",
"given",
"parameter"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/Dto/RouteParameters.php#L62-L70 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/SaltedMd5HashingStrategy.php | SaltedMd5HashingStrategy.generateSaltedMd5 | public static function generateSaltedMd5($clearString)
{
$salt = substr(md5(rand() . Utility\Algorithms::generateRandomString(23)), 0, rand(6, 10));
return (md5(md5($clearString) . $salt) . ',' . $salt);
} | php | public static function generateSaltedMd5($clearString)
{
$salt = substr(md5(rand() . Utility\Algorithms::generateRandomString(23)), 0, rand(6, 10));
return (md5(md5($clearString) . $salt) . ',' . $salt);
} | [
"public",
"static",
"function",
"generateSaltedMd5",
"(",
"$",
"clearString",
")",
"{",
"$",
"salt",
"=",
"substr",
"(",
"md5",
"(",
"rand",
"(",
")",
".",
"Utility",
"\\",
"Algorithms",
"::",
"generateRandomString",
"(",
"23",
")",
")",
",",
"0",
",",
... | Generates a salted md5 hash over the given string.
@param string $clearString The unencrypted string which is the subject to be hashed
@return string Salted hash and the salt, separated by a comma "," | [
"Generates",
"a",
"salted",
"md5",
"hash",
"over",
"the",
"given",
"string",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/SaltedMd5HashingStrategy.php#L28-L32 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/SaltedMd5HashingStrategy.php | SaltedMd5HashingStrategy.validateSaltedMd5 | public static function validateSaltedMd5($clearString, $hashedStringAndSalt)
{
if (strpos($hashedStringAndSalt, ',') === false) {
throw new \InvalidArgumentException('The hashed string must contain a salt, separated with comma from the hashed.', 1269872776);
}
list($passwordHash, $salt) = explode(',', $hashedStringAndSalt);
return (md5(md5($clearString) . $salt) === $passwordHash);
} | php | public static function validateSaltedMd5($clearString, $hashedStringAndSalt)
{
if (strpos($hashedStringAndSalt, ',') === false) {
throw new \InvalidArgumentException('The hashed string must contain a salt, separated with comma from the hashed.', 1269872776);
}
list($passwordHash, $salt) = explode(',', $hashedStringAndSalt);
return (md5(md5($clearString) . $salt) === $passwordHash);
} | [
"public",
"static",
"function",
"validateSaltedMd5",
"(",
"$",
"clearString",
",",
"$",
"hashedStringAndSalt",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"hashedStringAndSalt",
",",
"','",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExce... | Tests if the given string would produce the same hash given the specified salt.
Use this method to validate hashes generated with generateSlatedMd5().
@param string $clearString
@param string $hashedStringAndSalt
@return boolean true if the clear string matches, otherwise false
@throws \InvalidArgumentException | [
"Tests",
"if",
"the",
"given",
"string",
"would",
"produce",
"the",
"same",
"hash",
"given",
"the",
"specified",
"salt",
".",
"Use",
"this",
"method",
"to",
"validate",
"hashes",
"generated",
"with",
"generateSlatedMd5",
"()",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/SaltedMd5HashingStrategy.php#L43-L50 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.output | public function output(string $text, array $arguments = []): void
{
if ($arguments !== []) {
$text = vsprintf($text, $arguments);
}
$this->output->write($text);
} | php | public function output(string $text, array $arguments = []): void
{
if ($arguments !== []) {
$text = vsprintf($text, $arguments);
}
$this->output->write($text);
} | [
"public",
"function",
"output",
"(",
"string",
"$",
"text",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
":",
"void",
"{",
"if",
"(",
"$",
"arguments",
"!==",
"[",
"]",
")",
"{",
"$",
"text",
"=",
"vsprintf",
"(",
"$",
"text",
",",
"$",
... | Outputs specified text to the console window
You can specify arguments that will be passed to the text via sprintf
@see http://www.php.net/sprintf
@param string $text Text to output
@param array $arguments Optional arguments to use for sprintf
@return void | [
"Outputs",
"specified",
"text",
"to",
"the",
"console",
"window",
"You",
"can",
"specify",
"arguments",
"that",
"will",
"be",
"passed",
"to",
"the",
"text",
"via",
"sprintf",
"@see",
"http",
":",
"//",
"www",
".",
"php",
".",
"net",
"/",
"sprintf"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L95-L101 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.outputLine | public function outputLine(string $text = '', array $arguments = []): void
{
$this->output($text . PHP_EOL, $arguments);
} | php | public function outputLine(string $text = '', array $arguments = []): void
{
$this->output($text . PHP_EOL, $arguments);
} | [
"public",
"function",
"outputLine",
"(",
"string",
"$",
"text",
"=",
"''",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
":",
"void",
"{",
"$",
"this",
"->",
"output",
"(",
"$",
"text",
".",
"PHP_EOL",
",",
"$",
"arguments",
")",
";",
"}"
] | Outputs specified text to the console window and appends a line break
@param string $text Text to output
@param array $arguments Optional arguments to use for sprintf
@return void
@see output()
@see outputLines() | [
"Outputs",
"specified",
"text",
"to",
"the",
"console",
"window",
"and",
"appends",
"a",
"line",
"break"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L112-L115 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.outputFormatted | public function outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0): void
{
$lines = explode(PHP_EOL, $text);
foreach ($lines as $line) {
$formattedText = str_repeat(' ', $leftPadding) . wordwrap($line, $this->getMaximumLineLength() - $leftPadding, PHP_EOL . str_repeat(' ', $leftPadding), true);
$this->outputLine($formattedText, $arguments);
}
} | php | public function outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0): void
{
$lines = explode(PHP_EOL, $text);
foreach ($lines as $line) {
$formattedText = str_repeat(' ', $leftPadding) . wordwrap($line, $this->getMaximumLineLength() - $leftPadding, PHP_EOL . str_repeat(' ', $leftPadding), true);
$this->outputLine($formattedText, $arguments);
}
} | [
"public",
"function",
"outputFormatted",
"(",
"string",
"$",
"text",
"=",
"''",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
",",
"int",
"$",
"leftPadding",
"=",
"0",
")",
":",
"void",
"{",
"$",
"lines",
"=",
"explode",
"(",
"PHP_EOL",
",",
"$",
... | Formats the given text to fit into the maximum line length and outputs it to the
console window
@param string $text Text to output
@param array $arguments Optional arguments to use for sprintf
@param integer $leftPadding The number of spaces to use for indentation
@return void
@see outputLine() | [
"Formats",
"the",
"given",
"text",
"to",
"fit",
"into",
"the",
"maximum",
"line",
"length",
"and",
"outputs",
"it",
"to",
"the",
"console",
"window"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L127-L134 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.select | public function select($question, array $choices, $default = null, bool $multiSelect = false, int $attempts = null)
{
$question = new ChoiceQuestion($this->combineQuestion($question), $choices, $default);
$question
->setMaxAttempts($attempts)
->setMultiselect($multiSelect)
->setErrorMessage('Value "%s" is invalid');
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | php | public function select($question, array $choices, $default = null, bool $multiSelect = false, int $attempts = null)
{
$question = new ChoiceQuestion($this->combineQuestion($question), $choices, $default);
$question
->setMaxAttempts($attempts)
->setMultiselect($multiSelect)
->setErrorMessage('Value "%s" is invalid');
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | [
"public",
"function",
"select",
"(",
"$",
"question",
",",
"array",
"$",
"choices",
",",
"$",
"default",
"=",
"null",
",",
"bool",
"$",
"multiSelect",
"=",
"false",
",",
"int",
"$",
"attempts",
"=",
"null",
")",
"{",
"$",
"question",
"=",
"new",
"Cho... | Asks the user to select a value
@param string|array $question The question to ask. If an array each array item is turned into one line of a multi-line question
@param array $choices List of choices to pick from
@param mixed|null $default The default answer if the user enters nothing
@param boolean $multiSelect If true the result will be an array with the selected options. Multiple options can be given separated by commas
@param integer|null $attempts Max number of times to ask before giving up (null by default, which means infinite)
@return integer|string|array Either the value for indexed arrays, the key for associative arrays or an array for multiple selections
@throws \InvalidArgumentException | [
"Asks",
"the",
"user",
"to",
"select",
"a",
"value"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L163-L172 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.ask | public function ask($question, string $default = null)
{
$question = new Question($this->combineQuestion($question), $default);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | php | public function ask($question, string $default = null)
{
$question = new Question($this->combineQuestion($question), $default);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | [
"public",
"function",
"ask",
"(",
"$",
"question",
",",
"string",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"$",
"this",
"->",
"combineQuestion",
"(",
"$",
"question",
")",
",",
"$",
"default",
")",
";",
"re... | Asks a question to the user
@param string|array $question The question to ask. If an array each array item is turned into one line of a multi-line question
@param string $default The default answer if none is given by the user
@return mixed The user answer
@throws \RuntimeException If there is no data to read in the input stream | [
"Asks",
"a",
"question",
"to",
"the",
"user"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L182-L187 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.askConfirmation | public function askConfirmation($question, bool $default = true): bool
{
$question = new ConfirmationQuestion($this->combineQuestion($question), $default);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | php | public function askConfirmation($question, bool $default = true): bool
{
$question = new ConfirmationQuestion($this->combineQuestion($question), $default);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | [
"public",
"function",
"askConfirmation",
"(",
"$",
"question",
",",
"bool",
"$",
"default",
"=",
"true",
")",
":",
"bool",
"{",
"$",
"question",
"=",
"new",
"ConfirmationQuestion",
"(",
"$",
"this",
"->",
"combineQuestion",
"(",
"$",
"question",
")",
",",
... | Asks a confirmation to the user.
The question will be asked until the user answers by nothing, yes, or no.
@param string|array $question The question to ask. If an array each array item is turned into one line of a multi-line question
@param boolean $default The default answer if the user enters nothing
@return boolean true if the user has confirmed, false otherwise | [
"Asks",
"a",
"confirmation",
"to",
"the",
"user",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L198-L203 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.askHiddenResponse | public function askHiddenResponse($question, bool $fallback = true)
{
$question = new Question($this->combineQuestion($question));
$question
->setHidden(true)
->setHiddenFallback($fallback);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | php | public function askHiddenResponse($question, bool $fallback = true)
{
$question = new Question($this->combineQuestion($question));
$question
->setHidden(true)
->setHiddenFallback($fallback);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | [
"public",
"function",
"askHiddenResponse",
"(",
"$",
"question",
",",
"bool",
"$",
"fallback",
"=",
"true",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"$",
"this",
"->",
"combineQuestion",
"(",
"$",
"question",
")",
")",
";",
"$",
"question"... | Asks a question to the user, the response is hidden
@param string|array $question The question. If an array each array item is turned into one line of a multi-line question
@param Boolean $fallback In case the response can not be hidden, whether to fallback on non-hidden question or not
@return mixed The answer
@throws \RuntimeException In case the fallback is deactivated and the response can not be hidden | [
"Asks",
"a",
"question",
"to",
"the",
"user",
"the",
"response",
"is",
"hidden"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L213-L221 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.askAndValidate | public function askAndValidate($question, callable $validator, int $attempts = null, string $default = null)
{
$question = new Question($this->combineQuestion($question), $default);
$question
->setValidator($validator)
->setMaxAttempts($attempts);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | php | public function askAndValidate($question, callable $validator, int $attempts = null, string $default = null)
{
$question = new Question($this->combineQuestion($question), $default);
$question
->setValidator($validator)
->setMaxAttempts($attempts);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | [
"public",
"function",
"askAndValidate",
"(",
"$",
"question",
",",
"callable",
"$",
"validator",
",",
"int",
"$",
"attempts",
"=",
"null",
",",
"string",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"$",
"this",
... | Asks for a value and validates the response
The validator receives the data to validate. It must return the
validated data when the data is valid and throw an exception
otherwise.
@see https://symfony.com/doc/current/components/console/helpers/questionhelper.html#validating-the-answer
@param string|array $question The question to ask. If an array each array item is turned into one line of a multi-line question
@param callable $validator A PHP callback that gets a value and is expected to return the (transformed) value or throw an exception if it wasn't valid
@param integer|null $attempts Max number of times to ask before giving up (null by default, which means infinite)
@param string $default The default answer if none is given by the user
@return mixed The response
@throws \Exception When any of the validators return an error | [
"Asks",
"for",
"a",
"value",
"and",
"validates",
"the",
"response"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L238-L246 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.askHiddenResponseAndValidate | public function askHiddenResponseAndValidate($question, callable $validator, int $attempts = null, bool $fallback = true)
{
$question = new Question($this->combineQuestion($question));
$question
->setHidden(true)
->setHiddenFallback($fallback)
->setValidator($validator)
->setMaxAttempts($attempts);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | php | public function askHiddenResponseAndValidate($question, callable $validator, int $attempts = null, bool $fallback = true)
{
$question = new Question($this->combineQuestion($question));
$question
->setHidden(true)
->setHiddenFallback($fallback)
->setValidator($validator)
->setMaxAttempts($attempts);
return $this->getQuestionHelper()->ask($this->input, $this->output, $question);
} | [
"public",
"function",
"askHiddenResponseAndValidate",
"(",
"$",
"question",
",",
"callable",
"$",
"validator",
",",
"int",
"$",
"attempts",
"=",
"null",
",",
"bool",
"$",
"fallback",
"=",
"true",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"$",... | Asks for a value, hide and validates the response
The validator receives the data to validate. It must return the
validated data when the data is valid and throw an exception
otherwise.
@param string|array $question The question to ask. If an array each array item is turned into one line of a multi-line question
@param callable $validator A PHP callback that gets a value and is expected to return the (transformed) value or throw an exception if it wasn't valid
@param integer|null $attempts Max number of times to ask before giving up (null by default, which means infinite)
@param boolean $fallback In case the response can not be hidden, whether to fallback on non-hidden question or not
@return mixed The response
@throws \Exception When any of the validators return an error
@throws \RuntimeException In case the fallback is deactivated and the response can not be hidden | [
"Asks",
"for",
"a",
"value",
"hide",
"and",
"validates",
"the",
"response"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L263-L273 |
neos/flow-development-collection | Neos.Flow/Classes/Cli/ConsoleOutput.php | ConsoleOutput.getQuestionHelper | protected function getQuestionHelper(): QuestionHelper
{
if ($this->questionHelper === null) {
$this->questionHelper = new QuestionHelper();
$helperSet = new HelperSet([new FormatterHelper()]);
$this->questionHelper->setHelperSet($helperSet);
}
return $this->questionHelper;
} | php | protected function getQuestionHelper(): QuestionHelper
{
if ($this->questionHelper === null) {
$this->questionHelper = new QuestionHelper();
$helperSet = new HelperSet([new FormatterHelper()]);
$this->questionHelper->setHelperSet($helperSet);
}
return $this->questionHelper;
} | [
"protected",
"function",
"getQuestionHelper",
"(",
")",
":",
"QuestionHelper",
"{",
"if",
"(",
"$",
"this",
"->",
"questionHelper",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"questionHelper",
"=",
"new",
"QuestionHelper",
"(",
")",
";",
"$",
"helperSet",
... | Returns or initializes the symfony/console QuestionHelper
@return QuestionHelper | [
"Returns",
"or",
"initializes",
"the",
"symfony",
"/",
"console",
"QuestionHelper"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/ConsoleOutput.php#L358-L366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.