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.Log/Classes/Backend/FileBackend.php | FileBackend.append | public function append($message, $severity = LOG_INFO, $additionalData = null, $packageKey = null, $className = null, $methodName = null)
{
if ($severity > $this->severityThreshold) {
return;
}
if (function_exists('posix_getpid')) {
$processId = ' ' . str_pad(posix_getpid(), 10);
} else {
$processId = ' ';
}
$ipAddress = ($this->logIpAddress === true) ? str_pad((isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''), 15) : '';
$severityLabel = (isset($this->severityLabels[$severity])) ? $this->severityLabels[$severity] : 'UNKNOWN ';
$output = strftime('%y-%m-%d %H:%M:%S', time()) . $processId . ' ' . $ipAddress . $severityLabel . ' ' . str_pad($packageKey, 20) . ' ' . $message;
if ($this->logMessageOrigin === true && ($className !== null || $methodName !== null)) {
$output .= ' [logged in ' . $className . '::' . $methodName . '()]';
}
if (!empty($additionalData)) {
$output .= PHP_EOL . (new PlainTextFormatter($additionalData))->format();
}
if ($this->fileHandle !== false) {
fputs($this->fileHandle, $output . PHP_EOL);
}
} | php | public function append($message, $severity = LOG_INFO, $additionalData = null, $packageKey = null, $className = null, $methodName = null)
{
if ($severity > $this->severityThreshold) {
return;
}
if (function_exists('posix_getpid')) {
$processId = ' ' . str_pad(posix_getpid(), 10);
} else {
$processId = ' ';
}
$ipAddress = ($this->logIpAddress === true) ? str_pad((isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''), 15) : '';
$severityLabel = (isset($this->severityLabels[$severity])) ? $this->severityLabels[$severity] : 'UNKNOWN ';
$output = strftime('%y-%m-%d %H:%M:%S', time()) . $processId . ' ' . $ipAddress . $severityLabel . ' ' . str_pad($packageKey, 20) . ' ' . $message;
if ($this->logMessageOrigin === true && ($className !== null || $methodName !== null)) {
$output .= ' [logged in ' . $className . '::' . $methodName . '()]';
}
if (!empty($additionalData)) {
$output .= PHP_EOL . (new PlainTextFormatter($additionalData))->format();
}
if ($this->fileHandle !== false) {
fputs($this->fileHandle, $output . PHP_EOL);
}
} | [
"public",
"function",
"append",
"(",
"$",
"message",
",",
"$",
"severity",
"=",
"LOG_INFO",
",",
"$",
"additionalData",
"=",
"null",
",",
"$",
"packageKey",
"=",
"null",
",",
"$",
"className",
"=",
"null",
",",
"$",
"methodName",
"=",
"null",
")",
"{",... | Appends the given message along with the additional information into the log.
@param string $message The message to log
@param integer $severity One of the LOG_* constants
@param mixed $additionalData A variable containing more information about the event to be logged
@param string $packageKey Key of the package triggering the log (determined automatically if not specified)
@param string $className Name of the class triggering the log (determined automatically if not specified)
@param string $methodName Name of the method triggering the log (determined automatically if not specified)
@return void
@api | [
"Appends",
"the",
"given",
"message",
"along",
"with",
"the",
"additional",
"information",
"into",
"the",
"log",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow.Log/Classes/Backend/FileBackend.php#L227-L251 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php | CacheAdaptor.get | public function get($name)
{
if ($this->flowCache->has($name)) {
$this->flowCache->requireOnce($name);
}
return $this->flowCache->getWrapped($name);
} | php | public function get($name)
{
if ($this->flowCache->has($name)) {
$this->flowCache->requireOnce($name);
}
return $this->flowCache->getWrapped($name);
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"flowCache",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"$",
"this",
"->",
"flowCache",
"->",
"requireOnce",
"(",
"$",
"name",
")",
";",
"}",
"return",
"$",... | Gets an entry from the cache or NULL if the
entry does not exist.
@param string $name
@return string | [
"Gets",
"an",
"entry",
"from",
"the",
"cache",
"or",
"NULL",
"if",
"the",
"entry",
"does",
"not",
"exist",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php#L37-L44 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php | CacheAdaptor.set | public function set($name, $value)
{
// we need to strip the first line with the php header as the flow cache adds that again.
return $this->flowCache->set($name, substr($value, strpos($value, "\n") + 1));
} | php | public function set($name, $value)
{
// we need to strip the first line with the php header as the flow cache adds that again.
return $this->flowCache->set($name, substr($value, strpos($value, "\n") + 1));
} | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"// we need to strip the first line with the php header as the flow cache adds that again.",
"return",
"$",
"this",
"->",
"flowCache",
"->",
"set",
"(",
"$",
"name",
",",
"substr",
"(",
"$",... | Set or updates an entry identified by $name
into the cache.
@param string $name
@param string $value | [
"Set",
"or",
"updates",
"an",
"entry",
"identified",
"by",
"$name",
"into",
"the",
"cache",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php#L53-L57 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php | CacheAdaptor.flush | public function flush($name = null)
{
if ($name !== null) {
return $this->flowCache->remove($name);
} else {
return $this->flowCache->flush();
}
} | php | public function flush($name = null)
{
if ($name !== null) {
return $this->flowCache->remove($name);
} else {
return $this->flowCache->flush();
}
} | [
"public",
"function",
"flush",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"flowCache",
"->",
"remove",
"(",
"$",
"name",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this"... | Flushes the cache either by entry or flushes
the entire cache if no entry is provided.
@param string|null $name
@return bool|void | [
"Flushes",
"the",
"cache",
"either",
"by",
"entry",
"or",
"flushes",
"the",
"entire",
"cache",
"if",
"no",
"entry",
"is",
"provided",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php#L66-L73 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/HashService.php | HashService.generateHmac | public function generateHmac($string)
{
if (!is_string($string)) {
throw new InvalidArgumentForHashGenerationException('A hash can only be generated for a string, but "' . gettype($string) . '" was given.', 1255069587);
}
return hash_hmac('sha1', $string, $this->getEncryptionKey());
} | php | public function generateHmac($string)
{
if (!is_string($string)) {
throw new InvalidArgumentForHashGenerationException('A hash can only be generated for a string, but "' . gettype($string) . '" was given.', 1255069587);
}
return hash_hmac('sha1', $string, $this->getEncryptionKey());
} | [
"public",
"function",
"generateHmac",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"string",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentForHashGenerationException",
"(",
"'A hash can only be generated for a string, but \"'",
".",
"gettype",... | Generate a hash (HMAC) for a given string
@param string $string The string for which a hash should be generated
@return string The hash of the string
@throws InvalidArgumentForHashGenerationException if something else than a string was given as parameter | [
"Generate",
"a",
"hash",
"(",
"HMAC",
")",
"for",
"a",
"given",
"string"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/HashService.php#L75-L82 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/HashService.php | HashService.validateAndStripHmac | public function validateAndStripHmac($string)
{
if (!is_string($string)) {
throw new InvalidArgumentForHashGenerationException('A hash can only be validated for a string, but "' . gettype($string) . '" was given.', 1320829762);
}
if (strlen($string) < 40) {
throw new InvalidArgumentForHashGenerationException('A hashed string must contain at least 40 characters, the given string was only ' . strlen($string) . ' characters long.', 1320830276);
}
$stringWithoutHmac = substr($string, 0, -40);
if ($this->validateHmac($stringWithoutHmac, substr($string, -40)) !== true) {
throw new InvalidHashException('The given string was not appended with a valid HMAC.', 1320830018);
}
return $stringWithoutHmac;
} | php | public function validateAndStripHmac($string)
{
if (!is_string($string)) {
throw new InvalidArgumentForHashGenerationException('A hash can only be validated for a string, but "' . gettype($string) . '" was given.', 1320829762);
}
if (strlen($string) < 40) {
throw new InvalidArgumentForHashGenerationException('A hashed string must contain at least 40 characters, the given string was only ' . strlen($string) . ' characters long.', 1320830276);
}
$stringWithoutHmac = substr($string, 0, -40);
if ($this->validateHmac($stringWithoutHmac, substr($string, -40)) !== true) {
throw new InvalidHashException('The given string was not appended with a valid HMAC.', 1320830018);
}
return $stringWithoutHmac;
} | [
"public",
"function",
"validateAndStripHmac",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"string",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentForHashGenerationException",
"(",
"'A hash can only be validated for a string, but \"'",
".",
"g... | Tests if the last 40 characters of a given string $string
matches the HMAC of the rest of the string and, if true,
returns the string without the HMAC. In case of a HMAC
validation error, an exception is thrown.
@param string $string The string with the HMAC appended (in the format 'string<HMAC>')
@return string the original string without the HMAC, if validation was successful
@see validateHmac()
@throws InvalidArgumentForHashGenerationException if the given string is not well-formatted
@throws InvalidHashException if the hash did not fit to the data.
@todo Mark as API once it is more stable | [
"Tests",
"if",
"the",
"last",
"40",
"characters",
"of",
"a",
"given",
"string",
"$string",
"matches",
"the",
"HMAC",
"of",
"the",
"rest",
"of",
"the",
"string",
"and",
"if",
"true",
"returns",
"the",
"string",
"without",
"the",
"HMAC",
".",
"In",
"case",... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/HashService.php#L124-L137 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/HashService.php | HashService.hashPassword | public function hashPassword($password, $strategyIdentifier = 'default')
{
/** @var $passwordHashingStrategy PasswordHashingStrategyInterface */
list($passwordHashingStrategy, $strategyIdentifier) = $this->getPasswordHashingStrategyAndIdentifier($strategyIdentifier);
$hashedPasswordAndSalt = $passwordHashingStrategy->hashPassword($password, $this->getEncryptionKey());
return $strategyIdentifier . '=>' . $hashedPasswordAndSalt;
} | php | public function hashPassword($password, $strategyIdentifier = 'default')
{
/** @var $passwordHashingStrategy PasswordHashingStrategyInterface */
list($passwordHashingStrategy, $strategyIdentifier) = $this->getPasswordHashingStrategyAndIdentifier($strategyIdentifier);
$hashedPasswordAndSalt = $passwordHashingStrategy->hashPassword($password, $this->getEncryptionKey());
return $strategyIdentifier . '=>' . $hashedPasswordAndSalt;
} | [
"public",
"function",
"hashPassword",
"(",
"$",
"password",
",",
"$",
"strategyIdentifier",
"=",
"'default'",
")",
"{",
"/** @var $passwordHashingStrategy PasswordHashingStrategyInterface */",
"list",
"(",
"$",
"passwordHashingStrategy",
",",
"$",
"strategyIdentifier",
")",... | Hash a password using the configured password hashing strategy
@param string $password The cleartext password
@param string $strategyIdentifier An identifier for a configured strategy, uses default strategy if not specified
@return string A hashed password with salt (if used)
@api | [
"Hash",
"a",
"password",
"using",
"the",
"configured",
"password",
"hashing",
"strategy"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/HashService.php#L146-L152 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/HashService.php | HashService.validatePassword | public function validatePassword($password, $hashedPasswordAndSalt)
{
$strategyIdentifier = 'default';
if (strpos($hashedPasswordAndSalt, '=>') !== false) {
list($strategyIdentifier, $hashedPasswordAndSalt) = explode('=>', $hashedPasswordAndSalt, 2);
}
/** @var $passwordHashingStrategy PasswordHashingStrategyInterface */
list($passwordHashingStrategy, ) = $this->getPasswordHashingStrategyAndIdentifier($strategyIdentifier);
return $passwordHashingStrategy->validatePassword($password, $hashedPasswordAndSalt, $this->getEncryptionKey());
} | php | public function validatePassword($password, $hashedPasswordAndSalt)
{
$strategyIdentifier = 'default';
if (strpos($hashedPasswordAndSalt, '=>') !== false) {
list($strategyIdentifier, $hashedPasswordAndSalt) = explode('=>', $hashedPasswordAndSalt, 2);
}
/** @var $passwordHashingStrategy PasswordHashingStrategyInterface */
list($passwordHashingStrategy, ) = $this->getPasswordHashingStrategyAndIdentifier($strategyIdentifier);
return $passwordHashingStrategy->validatePassword($password, $hashedPasswordAndSalt, $this->getEncryptionKey());
} | [
"public",
"function",
"validatePassword",
"(",
"$",
"password",
",",
"$",
"hashedPasswordAndSalt",
")",
"{",
"$",
"strategyIdentifier",
"=",
"'default'",
";",
"if",
"(",
"strpos",
"(",
"$",
"hashedPasswordAndSalt",
",",
"'=>'",
")",
"!==",
"false",
")",
"{",
... | Validate a hashed password using the configured password hashing strategy
@param string $password The cleartext password
@param string $hashedPasswordAndSalt The hashed password with salt (if used) and an optional strategy identifier
@return boolean true if the given password matches the hashed password
@api | [
"Validate",
"a",
"hashed",
"password",
"using",
"the",
"configured",
"password",
"hashing",
"strategy"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/HashService.php#L162-L172 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/HashService.php | HashService.getPasswordHashingStrategyAndIdentifier | protected function getPasswordHashingStrategyAndIdentifier($strategyIdentifier = 'default')
{
if (isset($this->passwordHashingStrategies[$strategyIdentifier])) {
return [$this->passwordHashingStrategies[$strategyIdentifier], $strategyIdentifier];
}
if ($strategyIdentifier === 'default') {
if (!isset($this->strategySettings['default'])) {
throw new MissingConfigurationException('No default hashing strategy configured', 1320758427);
}
$strategyIdentifier = $this->strategySettings['default'];
}
if (!isset($this->strategySettings[$strategyIdentifier])) {
throw new MissingConfigurationException('No hashing strategy with identifier "' . $strategyIdentifier . '" configured', 1320758776);
}
$strategyObjectName = $this->strategySettings[$strategyIdentifier];
$this->passwordHashingStrategies[$strategyIdentifier] = $this->objectManager->get($strategyObjectName);
return [$this->passwordHashingStrategies[$strategyIdentifier], $strategyIdentifier];
} | php | protected function getPasswordHashingStrategyAndIdentifier($strategyIdentifier = 'default')
{
if (isset($this->passwordHashingStrategies[$strategyIdentifier])) {
return [$this->passwordHashingStrategies[$strategyIdentifier], $strategyIdentifier];
}
if ($strategyIdentifier === 'default') {
if (!isset($this->strategySettings['default'])) {
throw new MissingConfigurationException('No default hashing strategy configured', 1320758427);
}
$strategyIdentifier = $this->strategySettings['default'];
}
if (!isset($this->strategySettings[$strategyIdentifier])) {
throw new MissingConfigurationException('No hashing strategy with identifier "' . $strategyIdentifier . '" configured', 1320758776);
}
$strategyObjectName = $this->strategySettings[$strategyIdentifier];
$this->passwordHashingStrategies[$strategyIdentifier] = $this->objectManager->get($strategyObjectName);
return [$this->passwordHashingStrategies[$strategyIdentifier], $strategyIdentifier];
} | [
"protected",
"function",
"getPasswordHashingStrategyAndIdentifier",
"(",
"$",
"strategyIdentifier",
"=",
"'default'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"passwordHashingStrategies",
"[",
"$",
"strategyIdentifier",
"]",
")",
")",
"{",
"return",
"... | Get a password hashing strategy
@param string $strategyIdentifier
@return array<PasswordHashingStrategyInterface> and string
@throws MissingConfigurationException | [
"Get",
"a",
"password",
"hashing",
"strategy"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/HashService.php#L181-L200 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Cryptography/HashService.php | HashService.getEncryptionKey | protected function getEncryptionKey()
{
if ($this->encryptionKey === null) {
$this->encryptionKey = $this->cache->get('encryptionKey');
}
if ($this->encryptionKey === false && file_exists(FLOW_PATH_DATA . 'Persistent/EncryptionKey')) {
$this->encryptionKey = file_get_contents(FLOW_PATH_DATA . 'Persistent/EncryptionKey');
}
if ($this->encryptionKey === false) {
$this->encryptionKey = bin2hex(Utility\Algorithms::generateRandomBytes(48));
$this->cache->set('encryptionKey', $this->encryptionKey);
}
return $this->encryptionKey;
} | php | protected function getEncryptionKey()
{
if ($this->encryptionKey === null) {
$this->encryptionKey = $this->cache->get('encryptionKey');
}
if ($this->encryptionKey === false && file_exists(FLOW_PATH_DATA . 'Persistent/EncryptionKey')) {
$this->encryptionKey = file_get_contents(FLOW_PATH_DATA . 'Persistent/EncryptionKey');
}
if ($this->encryptionKey === false) {
$this->encryptionKey = bin2hex(Utility\Algorithms::generateRandomBytes(48));
$this->cache->set('encryptionKey', $this->encryptionKey);
}
return $this->encryptionKey;
} | [
"protected",
"function",
"getEncryptionKey",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"encryptionKey",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"encryptionKey",
"=",
"$",
"this",
"->",
"cache",
"->",
"get",
"(",
"'encryptionKey'",
")",
";",
"}",
... | Returns the encryption key from the persistent cache or Data/Persistent directory. If none exists, a new
encryption key will be generated and stored in the cache.
@return string The configured encryption key stored in Data/Persistent/EncryptionKey | [
"Returns",
"the",
"encryption",
"key",
"from",
"the",
"persistent",
"cache",
"or",
"Data",
"/",
"Persistent",
"directory",
".",
"If",
"none",
"exists",
"a",
"new",
"encryption",
"key",
"will",
"be",
"generated",
"and",
"stored",
"in",
"the",
"cache",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/HashService.php#L208-L221 |
neos/flow-development-collection | Neos.Flow/Classes/Error/AbstractExceptionHandler.php | AbstractExceptionHandler.handleException | public function handleException($exception)
{
// Ignore if the error is suppressed by using the shut-up operator @
if (error_reporting() === 0) {
return;
}
$this->renderingOptions = $this->resolveCustomRenderingOptions($exception);
if ($this->throwableStorage instanceof ThrowableStorageInterface && isset($this->renderingOptions['logException']) && $this->renderingOptions['logException']) {
$message = $this->throwableStorage->logThrowable($exception);
$this->logger->critical($message);
}
switch (PHP_SAPI) {
case 'cli':
$this->echoExceptionCli($exception);
break;
default:
$this->echoExceptionWeb($exception);
}
} | php | public function handleException($exception)
{
// Ignore if the error is suppressed by using the shut-up operator @
if (error_reporting() === 0) {
return;
}
$this->renderingOptions = $this->resolveCustomRenderingOptions($exception);
if ($this->throwableStorage instanceof ThrowableStorageInterface && isset($this->renderingOptions['logException']) && $this->renderingOptions['logException']) {
$message = $this->throwableStorage->logThrowable($exception);
$this->logger->critical($message);
}
switch (PHP_SAPI) {
case 'cli':
$this->echoExceptionCli($exception);
break;
default:
$this->echoExceptionWeb($exception);
}
} | [
"public",
"function",
"handleException",
"(",
"$",
"exception",
")",
"{",
"// Ignore if the error is suppressed by using the shut-up operator @",
"if",
"(",
"error_reporting",
"(",
")",
"===",
"0",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"renderingOptions",
... | Handles the given exception
@param \Throwable $exception The exception object
@return void | [
"Handles",
"the",
"given",
"exception"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Error/AbstractExceptionHandler.php#L119-L140 |
neos/flow-development-collection | Neos.Flow/Classes/Error/AbstractExceptionHandler.php | AbstractExceptionHandler.buildView | protected function buildView(\Throwable $exception, array $renderingOptions): ViewInterface
{
$statusCode = ($exception instanceof WithHttpStatusInterface) ? $exception->getStatusCode() : 500;
$referenceCode = ($exception instanceof WithReferenceCodeInterface) ? $exception->getReferenceCode() : null;
$statusMessage = ResponseInformationHelper::getStatusMessageByCode($statusCode);
$viewClassName = $renderingOptions['viewClassName'];
/** @var ViewInterface $view */
$view = $viewClassName::createWithOptions($renderingOptions['viewOptions']);
$view = $this->applyLegacyViewOptions($view, $renderingOptions);
$httpRequest = Request::createFromEnvironment();
$request = new ActionRequest($httpRequest);
$request->setControllerPackageKey('Neos.Flow');
$uriBuilder = new UriBuilder();
$uriBuilder->setRequest($request);
$view->setControllerContext(new ControllerContext(
$request,
new ActionResponse(),
new Arguments([]),
$uriBuilder
));
if (isset($renderingOptions['variables'])) {
$view->assignMultiple($renderingOptions['variables']);
}
$view->assignMultiple([
'exception' => $exception,
'renderingOptions' => $renderingOptions,
'statusCode' => $statusCode,
'statusMessage' => $statusMessage,
'referenceCode' => $referenceCode
]);
return $view;
} | php | protected function buildView(\Throwable $exception, array $renderingOptions): ViewInterface
{
$statusCode = ($exception instanceof WithHttpStatusInterface) ? $exception->getStatusCode() : 500;
$referenceCode = ($exception instanceof WithReferenceCodeInterface) ? $exception->getReferenceCode() : null;
$statusMessage = ResponseInformationHelper::getStatusMessageByCode($statusCode);
$viewClassName = $renderingOptions['viewClassName'];
/** @var ViewInterface $view */
$view = $viewClassName::createWithOptions($renderingOptions['viewOptions']);
$view = $this->applyLegacyViewOptions($view, $renderingOptions);
$httpRequest = Request::createFromEnvironment();
$request = new ActionRequest($httpRequest);
$request->setControllerPackageKey('Neos.Flow');
$uriBuilder = new UriBuilder();
$uriBuilder->setRequest($request);
$view->setControllerContext(new ControllerContext(
$request,
new ActionResponse(),
new Arguments([]),
$uriBuilder
));
if (isset($renderingOptions['variables'])) {
$view->assignMultiple($renderingOptions['variables']);
}
$view->assignMultiple([
'exception' => $exception,
'renderingOptions' => $renderingOptions,
'statusCode' => $statusCode,
'statusMessage' => $statusMessage,
'referenceCode' => $referenceCode
]);
return $view;
} | [
"protected",
"function",
"buildView",
"(",
"\\",
"Throwable",
"$",
"exception",
",",
"array",
"$",
"renderingOptions",
")",
":",
"ViewInterface",
"{",
"$",
"statusCode",
"=",
"(",
"$",
"exception",
"instanceof",
"WithHttpStatusInterface",
")",
"?",
"$",
"excepti... | Prepares a Fluid view for rendering the custom error page.
@param \Throwable $exception
@param array $renderingOptions Rendering options as defined in the settings
@return ViewInterface | [
"Prepares",
"a",
"Fluid",
"view",
"for",
"rendering",
"the",
"custom",
"error",
"page",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Error/AbstractExceptionHandler.php#L158-L194 |
neos/flow-development-collection | Neos.Flow/Classes/Error/AbstractExceptionHandler.php | AbstractExceptionHandler.applyLegacyViewOptions | protected function applyLegacyViewOptions(ViewInterface $view, array $renderingOptions): ViewInterface
{
if (isset($renderingOptions['templatePathAndFilename'])) {
ObjectAccess::setProperty($view, 'templatePathAndFilename', $renderingOptions['templatePathAndFilename']);
}
if (isset($renderingOptions['layoutRootPath'])) {
ObjectAccess::setProperty($view, 'layoutRootPath', $renderingOptions['layoutRootPath']);
}
if (isset($renderingOptions['partialRootPath'])) {
ObjectAccess::setProperty($view, 'partialRootPath', $renderingOptions['partialRootPath']);
}
if (isset($renderingOptions['format'])) {
ObjectAccess::setProperty($view, 'format', $renderingOptions['format']);
}
return $view;
} | php | protected function applyLegacyViewOptions(ViewInterface $view, array $renderingOptions): ViewInterface
{
if (isset($renderingOptions['templatePathAndFilename'])) {
ObjectAccess::setProperty($view, 'templatePathAndFilename', $renderingOptions['templatePathAndFilename']);
}
if (isset($renderingOptions['layoutRootPath'])) {
ObjectAccess::setProperty($view, 'layoutRootPath', $renderingOptions['layoutRootPath']);
}
if (isset($renderingOptions['partialRootPath'])) {
ObjectAccess::setProperty($view, 'partialRootPath', $renderingOptions['partialRootPath']);
}
if (isset($renderingOptions['format'])) {
ObjectAccess::setProperty($view, 'format', $renderingOptions['format']);
}
return $view;
} | [
"protected",
"function",
"applyLegacyViewOptions",
"(",
"ViewInterface",
"$",
"view",
",",
"array",
"$",
"renderingOptions",
")",
":",
"ViewInterface",
"{",
"if",
"(",
"isset",
"(",
"$",
"renderingOptions",
"[",
"'templatePathAndFilename'",
"]",
")",
")",
"{",
"... | Sets legacy "option" properties to the view for backwards compatibility.
@param ViewInterface $view
@param array $renderingOptions
@return ViewInterface | [
"Sets",
"legacy",
"option",
"properties",
"to",
"the",
"view",
"for",
"backwards",
"compatibility",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Error/AbstractExceptionHandler.php#L203-L219 |
neos/flow-development-collection | Neos.Flow/Classes/Error/AbstractExceptionHandler.php | AbstractExceptionHandler.resolveCustomRenderingOptions | protected function resolveCustomRenderingOptions(\Throwable $exception): array
{
$renderingOptions = [];
if (isset($this->options['defaultRenderingOptions'])) {
$renderingOptions = $this->options['defaultRenderingOptions'];
}
$renderingGroup = $this->resolveRenderingGroup($exception);
if ($renderingGroup !== null) {
$renderingOptions = Arrays::arrayMergeRecursiveOverrule($renderingOptions, $this->options['renderingGroups'][$renderingGroup]['options']);
$renderingOptions['renderingGroup'] = $renderingGroup;
}
return $renderingOptions;
} | php | protected function resolveCustomRenderingOptions(\Throwable $exception): array
{
$renderingOptions = [];
if (isset($this->options['defaultRenderingOptions'])) {
$renderingOptions = $this->options['defaultRenderingOptions'];
}
$renderingGroup = $this->resolveRenderingGroup($exception);
if ($renderingGroup !== null) {
$renderingOptions = Arrays::arrayMergeRecursiveOverrule($renderingOptions, $this->options['renderingGroups'][$renderingGroup]['options']);
$renderingOptions['renderingGroup'] = $renderingGroup;
}
return $renderingOptions;
} | [
"protected",
"function",
"resolveCustomRenderingOptions",
"(",
"\\",
"Throwable",
"$",
"exception",
")",
":",
"array",
"{",
"$",
"renderingOptions",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'defaultRenderingOptions'",
"]... | Checks if custom rendering rules apply to the given $exception and returns those.
@param \Throwable $exception
@return array the custom rendering options, or NULL if no custom rendering is defined for this exception | [
"Checks",
"if",
"custom",
"rendering",
"rules",
"apply",
"to",
"the",
"given",
"$exception",
"and",
"returns",
"those",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Error/AbstractExceptionHandler.php#L227-L239 |
neos/flow-development-collection | Neos.Flow/Classes/Error/AbstractExceptionHandler.php | AbstractExceptionHandler.echoExceptionCli | protected function echoExceptionCli(\Throwable $exception)
{
$response = new CliResponse();
$exceptionMessage = $this->renderSingleExceptionCli($exception);
$exceptionMessage = $this->renderNestedExceptonsCli($exception, $exceptionMessage);
if ($exception instanceof FlowException) {
$exceptionMessage .= PHP_EOL . 'Open <b>Data/Logs/Exceptions/' . $exception->getReferenceCode() . '.txt</b> for a full stack trace.' . PHP_EOL;
}
$response->setContent($exceptionMessage);
$response->send();
exit(1);
} | php | protected function echoExceptionCli(\Throwable $exception)
{
$response = new CliResponse();
$exceptionMessage = $this->renderSingleExceptionCli($exception);
$exceptionMessage = $this->renderNestedExceptonsCli($exception, $exceptionMessage);
if ($exception instanceof FlowException) {
$exceptionMessage .= PHP_EOL . 'Open <b>Data/Logs/Exceptions/' . $exception->getReferenceCode() . '.txt</b> for a full stack trace.' . PHP_EOL;
}
$response->setContent($exceptionMessage);
$response->send();
exit(1);
} | [
"protected",
"function",
"echoExceptionCli",
"(",
"\\",
"Throwable",
"$",
"exception",
")",
"{",
"$",
"response",
"=",
"new",
"CliResponse",
"(",
")",
";",
"$",
"exceptionMessage",
"=",
"$",
"this",
"->",
"renderSingleExceptionCli",
"(",
"$",
"exception",
")",... | Formats and echoes the exception and its previous exceptions (if any) for the command line
@param \Throwable $exception
@return void | [
"Formats",
"and",
"echoes",
"the",
"exception",
"and",
"its",
"previous",
"exceptions",
"(",
"if",
"any",
")",
"for",
"the",
"command",
"line"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Error/AbstractExceptionHandler.php#L273-L287 |
neos/flow-development-collection | Neos.Flow/Classes/Error/AbstractExceptionHandler.php | AbstractExceptionHandler.renderSingleExceptionCli | protected function renderSingleExceptionCli(\Throwable $exception): string
{
$exceptionMessageParts = $this->splitExceptionMessage($exception->getMessage());
$exceptionMessage = '<error><b>' . $exceptionMessageParts['subject'] . '</b></error>' . PHP_EOL;
if ($exceptionMessageParts['body'] !== '') {
$exceptionMessage .= wordwrap($exceptionMessageParts['body'], 73, PHP_EOL) . PHP_EOL;
}
$exceptionMessage .= PHP_EOL;
$exceptionMessage .= $this->renderExceptionDetailCli('Type', get_class($exception));
if ($exception->getCode()) {
$exceptionMessage .= $this->renderExceptionDetailCli('Code', $exception->getCode());
}
$exceptionMessage .= $this->renderExceptionDetailCli('File', str_replace(FLOW_PATH_ROOT, '', $exception->getFile()));
$exceptionMessage .= $this->renderExceptionDetailCli('Line', $exception->getLine());
return $exceptionMessage;
} | php | protected function renderSingleExceptionCli(\Throwable $exception): string
{
$exceptionMessageParts = $this->splitExceptionMessage($exception->getMessage());
$exceptionMessage = '<error><b>' . $exceptionMessageParts['subject'] . '</b></error>' . PHP_EOL;
if ($exceptionMessageParts['body'] !== '') {
$exceptionMessage .= wordwrap($exceptionMessageParts['body'], 73, PHP_EOL) . PHP_EOL;
}
$exceptionMessage .= PHP_EOL;
$exceptionMessage .= $this->renderExceptionDetailCli('Type', get_class($exception));
if ($exception->getCode()) {
$exceptionMessage .= $this->renderExceptionDetailCli('Code', $exception->getCode());
}
$exceptionMessage .= $this->renderExceptionDetailCli('File', str_replace(FLOW_PATH_ROOT, '', $exception->getFile()));
$exceptionMessage .= $this->renderExceptionDetailCli('Line', $exception->getLine());
return $exceptionMessage;
} | [
"protected",
"function",
"renderSingleExceptionCli",
"(",
"\\",
"Throwable",
"$",
"exception",
")",
":",
"string",
"{",
"$",
"exceptionMessageParts",
"=",
"$",
"this",
"->",
"splitExceptionMessage",
"(",
"$",
"exception",
"->",
"getMessage",
"(",
")",
")",
";",
... | Renders a single exception including message, code and affected file
@param \Throwable $exception
@return string | [
"Renders",
"a",
"single",
"exception",
"including",
"message",
"code",
"and",
"affected",
"file"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Error/AbstractExceptionHandler.php#L314-L331 |
neos/flow-development-collection | Neos.Flow/Classes/Error/AbstractExceptionHandler.php | AbstractExceptionHandler.renderExceptionDetailCli | protected function renderExceptionDetailCli(string $label, string $value): string
{
$result = ' <b>' . $label . ': </b>';
$result .= wordwrap($value, 75, PHP_EOL . str_repeat(' ', strlen($label) + 4), true);
$result .= PHP_EOL;
return $result;
} | php | protected function renderExceptionDetailCli(string $label, string $value): string
{
$result = ' <b>' . $label . ': </b>';
$result .= wordwrap($value, 75, PHP_EOL . str_repeat(' ', strlen($label) + 4), true);
$result .= PHP_EOL;
return $result;
} | [
"protected",
"function",
"renderExceptionDetailCli",
"(",
"string",
"$",
"label",
",",
"string",
"$",
"value",
")",
":",
"string",
"{",
"$",
"result",
"=",
"' <b>'",
".",
"$",
"label",
".",
"': </b>'",
";",
"$",
"result",
".=",
"wordwrap",
"(",
"$",
"va... | Renders the given $value word-wrapped and prefixed with $label
@param string $label
@param string $value
@return string | [
"Renders",
"the",
"given",
"$value",
"word",
"-",
"wrapped",
"and",
"prefixed",
"with",
"$label"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Error/AbstractExceptionHandler.php#L341-L347 |
neos/flow-development-collection | Neos.Flow/Classes/Error/AbstractExceptionHandler.php | AbstractExceptionHandler.splitExceptionMessage | protected function splitExceptionMessage(string $exceptionMessage): array
{
$body = '';
$pattern = '/
(?<= # Begin positive lookbehind.
[.!?]\s # Either an end of sentence punct,
| \n # or line break
)
(?<! # Begin negative lookbehind.
i\.E\.\s # Skip "i.E."
) # End negative lookbehind.
/ix';
$sentences = preg_split($pattern, $exceptionMessage, 2, PREG_SPLIT_NO_EMPTY);
if (!isset($sentences[1])) {
$subject = $exceptionMessage;
} else {
$subject = trim($sentences[0]);
$body = trim($sentences[1]);
}
return [
'subject' => $subject,
'body' => $body
];
} | php | protected function splitExceptionMessage(string $exceptionMessage): array
{
$body = '';
$pattern = '/
(?<= # Begin positive lookbehind.
[.!?]\s # Either an end of sentence punct,
| \n # or line break
)
(?<! # Begin negative lookbehind.
i\.E\.\s # Skip "i.E."
) # End negative lookbehind.
/ix';
$sentences = preg_split($pattern, $exceptionMessage, 2, PREG_SPLIT_NO_EMPTY);
if (!isset($sentences[1])) {
$subject = $exceptionMessage;
} else {
$subject = trim($sentences[0]);
$body = trim($sentences[1]);
}
return [
'subject' => $subject,
'body' => $body
];
} | [
"protected",
"function",
"splitExceptionMessage",
"(",
"string",
"$",
"exceptionMessage",
")",
":",
"array",
"{",
"$",
"body",
"=",
"''",
";",
"$",
"pattern",
"=",
"'/\n\t\t\t(?<= # Begin positive lookbehind.\n\t\t\t [.!?]\\s # Either an end of sentenc... | Splits the given string into subject and body according to following rules:
- If the string is empty or does not contain more than one sentence nor line breaks, the subject will be equal to the string and body will be an empty string
- Otherwise the subject is everything until the first line break or end of sentence, the body contains the rest
@param string $exceptionMessage
@return array in the format array('subject' => '<subject>', 'body' => '<body>'); | [
"Splits",
"the",
"given",
"string",
"into",
"subject",
"and",
"body",
"according",
"to",
"following",
"rules",
":",
"-",
"If",
"the",
"string",
"is",
"empty",
"or",
"does",
"not",
"contain",
"more",
"than",
"one",
"sentence",
"nor",
"line",
"breaks",
"the"... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Error/AbstractExceptionHandler.php#L357-L380 |
neos/flow-development-collection | Neos.Flow/Classes/Property/Exception.php | Exception.getStatusCode | public function getStatusCode()
{
$nestedException = $this->getPrevious();
if ($nestedException !== null && $nestedException instanceof \Neos\Flow\Exception) {
return $nestedException->getStatusCode();
}
return parent::getStatusCode();
} | php | public function getStatusCode()
{
$nestedException = $this->getPrevious();
if ($nestedException !== null && $nestedException instanceof \Neos\Flow\Exception) {
return $nestedException->getStatusCode();
}
return parent::getStatusCode();
} | [
"public",
"function",
"getStatusCode",
"(",
")",
"{",
"$",
"nestedException",
"=",
"$",
"this",
"->",
"getPrevious",
"(",
")",
";",
"if",
"(",
"$",
"nestedException",
"!==",
"null",
"&&",
"$",
"nestedException",
"instanceof",
"\\",
"Neos",
"\\",
"Flow",
"\... | Return the status code of the nested exception, if any.
@return integer | [
"Return",
"the",
"status",
"code",
"of",
"the",
"nested",
"exception",
"if",
"any",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Property/Exception.php#L26-L33 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/Core/Parser/Interceptor/ResourceInterceptor.php | ResourceInterceptor.setDefaultPackageKey | public function setDefaultPackageKey($defaultPackageKey)
{
if (!preg_match(Package::PATTERN_MATCH_PACKAGEKEY, $defaultPackageKey)) {
throw new \InvalidArgumentException('The given argument was not a valid package key.', 1277287099);
}
$this->defaultPackageKey = $defaultPackageKey;
} | php | public function setDefaultPackageKey($defaultPackageKey)
{
if (!preg_match(Package::PATTERN_MATCH_PACKAGEKEY, $defaultPackageKey)) {
throw new \InvalidArgumentException('The given argument was not a valid package key.', 1277287099);
}
$this->defaultPackageKey = $defaultPackageKey;
} | [
"public",
"function",
"setDefaultPackageKey",
"(",
"$",
"defaultPackageKey",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"Package",
"::",
"PATTERN_MATCH_PACKAGEKEY",
",",
"$",
"defaultPackageKey",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"... | Set the default package key to use for resource URIs.
@param string $defaultPackageKey
@return void
@throws \InvalidArgumentException | [
"Set",
"the",
"default",
"package",
"key",
"to",
"use",
"for",
"resource",
"URIs",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Parser/Interceptor/ResourceInterceptor.php#L76-L82 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/Core/Parser/Interceptor/ResourceInterceptor.php | ResourceInterceptor.process | public function process(NodeInterface $node, $interceptorPosition, ParsingState $parsingState)
{
/** @var $node TextNode */
if (strpos($node->getText(), 'Public/') === false) {
return $node;
}
$textParts = preg_split(self::PATTERN_SPLIT_AT_RESOURCE_URIS, $node->getText(), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
$node = new RootNode();
foreach ($textParts as $part) {
$matches = [];
if (preg_match(self::PATTERN_MATCH_RESOURCE_URI, $part, $matches)) {
$arguments = [
'path' => new TextNode($matches['Path'])
];
if ($this->defaultPackageKey !== null) {
$arguments['package'] = new TextNode($this->defaultPackageKey);
}
if (isset($matches['Package']) && preg_match(Package::PATTERN_MATCH_PACKAGEKEY, $matches['Package'])) {
$arguments['package'] = new TextNode($matches['Package']);
}
$resourceUriNode = new ResourceUriNode($arguments, $parsingState);
$node->addChildNode($resourceUriNode);
} else {
$textNode = new TextNode($part);
$node->addChildNode($textNode);
}
}
return $node;
} | php | public function process(NodeInterface $node, $interceptorPosition, ParsingState $parsingState)
{
/** @var $node TextNode */
if (strpos($node->getText(), 'Public/') === false) {
return $node;
}
$textParts = preg_split(self::PATTERN_SPLIT_AT_RESOURCE_URIS, $node->getText(), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
$node = new RootNode();
foreach ($textParts as $part) {
$matches = [];
if (preg_match(self::PATTERN_MATCH_RESOURCE_URI, $part, $matches)) {
$arguments = [
'path' => new TextNode($matches['Path'])
];
if ($this->defaultPackageKey !== null) {
$arguments['package'] = new TextNode($this->defaultPackageKey);
}
if (isset($matches['Package']) && preg_match(Package::PATTERN_MATCH_PACKAGEKEY, $matches['Package'])) {
$arguments['package'] = new TextNode($matches['Package']);
}
$resourceUriNode = new ResourceUriNode($arguments, $parsingState);
$node->addChildNode($resourceUriNode);
} else {
$textNode = new TextNode($part);
$node->addChildNode($textNode);
}
}
return $node;
} | [
"public",
"function",
"process",
"(",
"NodeInterface",
"$",
"node",
",",
"$",
"interceptorPosition",
",",
"ParsingState",
"$",
"parsingState",
")",
"{",
"/** @var $node TextNode */",
"if",
"(",
"strpos",
"(",
"$",
"node",
"->",
"getText",
"(",
")",
",",
"'Publ... | Looks for URIs pointing to package resources and in place of those adds
ViewHelperNode instances using the ResourceViewHelper.
@param NodeInterface $node
@param integer $interceptorPosition One of the INTERCEPT_* constants for the current interception point
@param ParsingState $parsingState the current parsing state. Not needed in this interceptor.
@return NodeInterface the modified node | [
"Looks",
"for",
"URIs",
"pointing",
"to",
"package",
"resources",
"and",
"in",
"place",
"of",
"those",
"adds",
"ViewHelperNode",
"instances",
"using",
"the",
"ResourceViewHelper",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Parser/Interceptor/ResourceInterceptor.php#L93-L124 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/ViewHelpers/RenderChildrenViewHelper.php | RenderChildrenViewHelper.addArgumentsToTemplateVariableContainer | protected function addArgumentsToTemplateVariableContainer(array $arguments)
{
$templateVariableContainer = $this->getWidgetRenderingContext()->getVariableProvider();
foreach ($arguments as $identifier => $value) {
$templateVariableContainer->add($identifier, $value);
}
} | php | protected function addArgumentsToTemplateVariableContainer(array $arguments)
{
$templateVariableContainer = $this->getWidgetRenderingContext()->getVariableProvider();
foreach ($arguments as $identifier => $value) {
$templateVariableContainer->add($identifier, $value);
}
} | [
"protected",
"function",
"addArgumentsToTemplateVariableContainer",
"(",
"array",
"$",
"arguments",
")",
"{",
"$",
"templateVariableContainer",
"=",
"$",
"this",
"->",
"getWidgetRenderingContext",
"(",
")",
"->",
"getVariableProvider",
"(",
")",
";",
"foreach",
"(",
... | Add the given arguments to the TemplateVariableContainer of the widget.
@param array $arguments
@return void | [
"Add",
"the",
"given",
"arguments",
"to",
"the",
"TemplateVariableContainer",
"of",
"the",
"widget",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/RenderChildrenViewHelper.php#L115-L121 |
neos/flow-development-collection | Neos.Flow/Classes/Security/Authentication/AuthenticationProviderResolver.php | AuthenticationProviderResolver.resolveProviderClass | public function resolveProviderClass($providerName)
{
$className = $this->objectManager->getClassNameByObjectName($providerName);
if ($className !== false) {
return $className;
}
$className = $this->objectManager->getClassNameByObjectName('Neos\Flow\Security\Authentication\Provider\\' . $providerName);
if ($className !== false) {
return $className;
}
throw new NoAuthenticationProviderFoundException('An authentication provider with the name "' . $providerName . '" could not be resolved.', 1217154134);
} | php | public function resolveProviderClass($providerName)
{
$className = $this->objectManager->getClassNameByObjectName($providerName);
if ($className !== false) {
return $className;
}
$className = $this->objectManager->getClassNameByObjectName('Neos\Flow\Security\Authentication\Provider\\' . $providerName);
if ($className !== false) {
return $className;
}
throw new NoAuthenticationProviderFoundException('An authentication provider with the name "' . $providerName . '" could not be resolved.', 1217154134);
} | [
"public",
"function",
"resolveProviderClass",
"(",
"$",
"providerName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"objectManager",
"->",
"getClassNameByObjectName",
"(",
"$",
"providerName",
")",
";",
"if",
"(",
"$",
"className",
"!==",
"false",
")",... | Resolves the class name of an authentication provider. If a valid provider class name is given, it is just returned.
@param string $providerName The (short) name of the provider
@return string The object name of the authentication provider
@throws NoAuthenticationProviderFoundException | [
"Resolves",
"the",
"class",
"name",
"of",
"an",
"authentication",
"provider",
".",
"If",
"a",
"valid",
"provider",
"class",
"name",
"is",
"given",
"it",
"is",
"just",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Authentication/AuthenticationProviderResolver.php#L47-L60 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CoreCommandController.php | CoreCommandController.compileCommand | public function compileCommand(bool $force = false)
{
/** @var VariableFrontend $objectConfigurationCache */
$objectConfigurationCache = $this->cacheManager->getCache('Flow_Object_Configuration');
if ($force === false) {
if ($objectConfigurationCache->has('allCompiledCodeUpToDate')) {
return;
}
}
/** @var PhpFrontend $classesCache */
$classesCache = $this->cacheManager->getCache('Flow_Object_Classes');
$logger = $this->objectManager->get(PsrLoggerFactoryInterface::class)->get('systemLogger');
$this->proxyClassCompiler->injectClassesCache($classesCache);
$this->aopProxyClassBuilder->injectObjectConfigurationCache($objectConfigurationCache);
$this->aopProxyClassBuilder->injectLogger($logger);
$this->dependencyInjectionProxyClassBuilder->injectLogger($logger);
$this->aopProxyClassBuilder->build();
$this->dependencyInjectionProxyClassBuilder->build();
$classCount = $this->proxyClassCompiler->compile();
$dataTemporaryPath = $this->environment->getPathToTemporaryDirectory();
Files::createDirectoryRecursively($dataTemporaryPath);
file_put_contents($dataTemporaryPath . 'AvailableProxyClasses.php', $this->proxyClassCompiler->getStoredProxyClassMap());
$objectConfigurationCache->set('allCompiledCodeUpToDate', true);
$classesCacheBackend = $classesCache->getBackend();
if ($this->bootstrap->getContext()->isProduction() && $classesCacheBackend instanceof FreezableBackendInterface) {
/** @var FreezableBackendInterface $backend */
$backend = $classesCache->getBackend();
$backend->freeze();
}
$this->emitFinishedCompilationRun($classCount);
} | php | public function compileCommand(bool $force = false)
{
/** @var VariableFrontend $objectConfigurationCache */
$objectConfigurationCache = $this->cacheManager->getCache('Flow_Object_Configuration');
if ($force === false) {
if ($objectConfigurationCache->has('allCompiledCodeUpToDate')) {
return;
}
}
/** @var PhpFrontend $classesCache */
$classesCache = $this->cacheManager->getCache('Flow_Object_Classes');
$logger = $this->objectManager->get(PsrLoggerFactoryInterface::class)->get('systemLogger');
$this->proxyClassCompiler->injectClassesCache($classesCache);
$this->aopProxyClassBuilder->injectObjectConfigurationCache($objectConfigurationCache);
$this->aopProxyClassBuilder->injectLogger($logger);
$this->dependencyInjectionProxyClassBuilder->injectLogger($logger);
$this->aopProxyClassBuilder->build();
$this->dependencyInjectionProxyClassBuilder->build();
$classCount = $this->proxyClassCompiler->compile();
$dataTemporaryPath = $this->environment->getPathToTemporaryDirectory();
Files::createDirectoryRecursively($dataTemporaryPath);
file_put_contents($dataTemporaryPath . 'AvailableProxyClasses.php', $this->proxyClassCompiler->getStoredProxyClassMap());
$objectConfigurationCache->set('allCompiledCodeUpToDate', true);
$classesCacheBackend = $classesCache->getBackend();
if ($this->bootstrap->getContext()->isProduction() && $classesCacheBackend instanceof FreezableBackendInterface) {
/** @var FreezableBackendInterface $backend */
$backend = $classesCache->getBackend();
$backend->freeze();
}
$this->emitFinishedCompilationRun($classCount);
} | [
"public",
"function",
"compileCommand",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
"{",
"/** @var VariableFrontend $objectConfigurationCache */",
"$",
"objectConfigurationCache",
"=",
"$",
"this",
"->",
"cacheManager",
"->",
"getCache",
"(",
"'Flow_Object_Configuration... | Explicitly compile proxy classes
The compile command triggers the proxy class compilation.
Although a compilation run is triggered automatically by Flow, there might
be cases in a production context where a manual compile run is needed.
@Flow\Internal
@param boolean $force If set, classes will be compiled even though the cache says that everything is up to date.
@return void | [
"Explicitly",
"compile",
"proxy",
"classes"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CoreCommandController.php#L181-L219 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CoreCommandController.php | CoreCommandController.migrateCommand | public function migrateCommand(string $package, bool $status = false, string $packagesPath = null, string $version = null, bool $verbose = false, bool $force = false)
{
// This command will never be really called. It rather acts as a stub for rendering the
// documentation for this command. In reality, the "flow" command line script will already
// check if this command is supposed to be called and invoke the migrate script
// directly.
} | php | public function migrateCommand(string $package, bool $status = false, string $packagesPath = null, string $version = null, bool $verbose = false, bool $force = false)
{
// This command will never be really called. It rather acts as a stub for rendering the
// documentation for this command. In reality, the "flow" command line script will already
// check if this command is supposed to be called and invoke the migrate script
// directly.
} | [
"public",
"function",
"migrateCommand",
"(",
"string",
"$",
"package",
",",
"bool",
"$",
"status",
"=",
"false",
",",
"string",
"$",
"packagesPath",
"=",
"null",
",",
"string",
"$",
"version",
"=",
"null",
",",
"bool",
"$",
"verbose",
"=",
"false",
",",
... | Migrate source files as needed
This will apply pending code migrations defined in packages to the
specified package.
For every migration that has been run, it will create a commit in
the package. This allows for easy inspection, rollback and use of
the fixed code.
If the affected package contains local changes or is not part of
a git repository, the migration will be skipped. With the --force
flag this behavior can be changed, but changes will only be committed
if the working copy was clean before applying the migration.
@param string $package The key of the package to migrate
@param boolean $status Show the migration status, do not run migrations
@param string $packagesPath If set, use the given path as base when looking for packages
@param string $version If set, execute only the migration with the given version (e.g. "20150119114100")
@param boolean $verbose If set, notes and skipped migrations will be rendered
@param boolean $force By default packages that are not under version control or contain local changes are skipped. With this flag set changes are applied anyways (changes are not committed if there are local changes though)
@return void
@see neos.flow:doctrine:migrate | [
"Migrate",
"source",
"files",
"as",
"needed"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CoreCommandController.php#L263-L269 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CoreCommandController.php | CoreCommandController.shellCommand | public function shellCommand()
{
if (!function_exists('readline_read_history')) {
$this->outputLine('Interactive Shell is not available on this system!');
$this->quit(1);
}
$subProcess = false;
$pipes = [];
$historyPathAndFilename = getenv('HOME') . '/.flow_' . md5(FLOW_PATH_ROOT);
readline_read_history($historyPathAndFilename);
readline_completion_function([$this, 'autocomplete']);
echo "Flow Interactive Shell\n\n";
while (true) {
$commandLine = readline('Flow > ');
if ($commandLine === '') {
echo "\n";
break;
}
readline_add_history($commandLine);
readline_write_history($historyPathAndFilename);
$request = $this->requestBuilder->build($commandLine);
$response = new Response();
$command = $request->getCommand();
if ($request === false || $command->getCommandIdentifier() === false) {
echo "Bad command\n";
continue;
}
if ($this->bootstrap->isCompiletimeCommand($command->getCommandIdentifier())) {
$this->dispatcher->dispatch($request, $response);
$response->send();
if (is_resource($subProcess)) {
$this->quitSubProcess($subProcess, $pipes);
}
} else {
if (is_resource($subProcess)) {
$subProcessStatus = proc_get_status($subProcess);
if ($subProcessStatus['running'] === false) {
proc_close($subProcess);
}
};
if (!is_resource($subProcess)) {
list($subProcess, $pipes) = $this->launchSubProcess();
if ($subProcess === false || !is_array($pipes)) {
echo "Failed launching the shell sub process for executing the runtime command.\n";
continue;
}
$this->echoSubProcessResponse($pipes);
}
fwrite($pipes[0], $commandLine . "\n");
fflush($pipes[0]);
$this->echoSubProcessResponse($pipes);
if ($command->isFlushingCaches()) {
$this->quitSubProcess($subProcess, $pipes);
}
}
}
if (is_resource($subProcess)) {
$this->quitSubProcess($subProcess, $pipes);
}
echo "Bye!\n";
} | php | public function shellCommand()
{
if (!function_exists('readline_read_history')) {
$this->outputLine('Interactive Shell is not available on this system!');
$this->quit(1);
}
$subProcess = false;
$pipes = [];
$historyPathAndFilename = getenv('HOME') . '/.flow_' . md5(FLOW_PATH_ROOT);
readline_read_history($historyPathAndFilename);
readline_completion_function([$this, 'autocomplete']);
echo "Flow Interactive Shell\n\n";
while (true) {
$commandLine = readline('Flow > ');
if ($commandLine === '') {
echo "\n";
break;
}
readline_add_history($commandLine);
readline_write_history($historyPathAndFilename);
$request = $this->requestBuilder->build($commandLine);
$response = new Response();
$command = $request->getCommand();
if ($request === false || $command->getCommandIdentifier() === false) {
echo "Bad command\n";
continue;
}
if ($this->bootstrap->isCompiletimeCommand($command->getCommandIdentifier())) {
$this->dispatcher->dispatch($request, $response);
$response->send();
if (is_resource($subProcess)) {
$this->quitSubProcess($subProcess, $pipes);
}
} else {
if (is_resource($subProcess)) {
$subProcessStatus = proc_get_status($subProcess);
if ($subProcessStatus['running'] === false) {
proc_close($subProcess);
}
};
if (!is_resource($subProcess)) {
list($subProcess, $pipes) = $this->launchSubProcess();
if ($subProcess === false || !is_array($pipes)) {
echo "Failed launching the shell sub process for executing the runtime command.\n";
continue;
}
$this->echoSubProcessResponse($pipes);
}
fwrite($pipes[0], $commandLine . "\n");
fflush($pipes[0]);
$this->echoSubProcessResponse($pipes);
if ($command->isFlushingCaches()) {
$this->quitSubProcess($subProcess, $pipes);
}
}
}
if (is_resource($subProcess)) {
$this->quitSubProcess($subProcess, $pipes);
}
echo "Bye!\n";
} | [
"public",
"function",
"shellCommand",
"(",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'readline_read_history'",
")",
")",
"{",
"$",
"this",
"->",
"outputLine",
"(",
"'Interactive Shell is not available on this system!'",
")",
";",
"$",
"this",
"->",
"quit"... | Run the interactive Shell
The shell command runs Flow's interactive shell. This shell allows for
entering commands like through the regular command line interface but
additionally supports autocompletion and a user-based command history.
@return void | [
"Run",
"the",
"interactive",
"Shell"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CoreCommandController.php#L280-L350 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CoreCommandController.php | CoreCommandController.launchSubProcess | protected function launchSubProcess(): array
{
$systemCommand = 'FLOW_ROOTPATH=' . FLOW_PATH_ROOT . ' FLOW_PATH_TEMPORARY_BASE=' . FLOW_PATH_TEMPORARY_BASE . ' ' . 'FLOW_CONTEXT=' . $this->bootstrap->getContext() . ' ' . PHP_BINARY . ' -c ' . php_ini_loaded_file() . ' ' . FLOW_PATH_FLOW . 'Scripts/flow.php' . ' --start-slave';
$descriptorSpecification = [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'a']];
$subProcess = proc_open($systemCommand, $descriptorSpecification, $pipes);
if (!is_resource($subProcess)) {
throw new \RuntimeException('Could not execute sub process.');
}
$read = [$pipes[1]];
$write = null;
$except = null;
$readTimeout = 30;
stream_select($read, $write, $except, $readTimeout);
$subProcessStatus = proc_get_status($subProcess);
return ($subProcessStatus['running'] === true) ? [$subProcess, $pipes] : false;
} | php | protected function launchSubProcess(): array
{
$systemCommand = 'FLOW_ROOTPATH=' . FLOW_PATH_ROOT . ' FLOW_PATH_TEMPORARY_BASE=' . FLOW_PATH_TEMPORARY_BASE . ' ' . 'FLOW_CONTEXT=' . $this->bootstrap->getContext() . ' ' . PHP_BINARY . ' -c ' . php_ini_loaded_file() . ' ' . FLOW_PATH_FLOW . 'Scripts/flow.php' . ' --start-slave';
$descriptorSpecification = [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'a']];
$subProcess = proc_open($systemCommand, $descriptorSpecification, $pipes);
if (!is_resource($subProcess)) {
throw new \RuntimeException('Could not execute sub process.');
}
$read = [$pipes[1]];
$write = null;
$except = null;
$readTimeout = 30;
stream_select($read, $write, $except, $readTimeout);
$subProcessStatus = proc_get_status($subProcess);
return ($subProcessStatus['running'] === true) ? [$subProcess, $pipes] : false;
} | [
"protected",
"function",
"launchSubProcess",
"(",
")",
":",
"array",
"{",
"$",
"systemCommand",
"=",
"'FLOW_ROOTPATH='",
".",
"FLOW_PATH_ROOT",
".",
"' FLOW_PATH_TEMPORARY_BASE='",
".",
"FLOW_PATH_TEMPORARY_BASE",
".",
"' '",
".",
"'FLOW_CONTEXT='",
".",
"$",
"this",
... | Launch sub process
@return array The new sub process and its STDIN, STDOUT, STDERR pipes – or false if an error occurred.
@throws \RuntimeException | [
"Launch",
"sub",
"process"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CoreCommandController.php#L370-L388 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CoreCommandController.php | CoreCommandController.echoSubProcessResponse | protected function echoSubProcessResponse(array $pipes)
{
while (feof($pipes[1]) === false) {
$responseLine = fgets($pipes[1]);
if (trim($responseLine) === 'READY' || $responseLine === false) {
break;
}
echo($responseLine);
}
} | php | protected function echoSubProcessResponse(array $pipes)
{
while (feof($pipes[1]) === false) {
$responseLine = fgets($pipes[1]);
if (trim($responseLine) === 'READY' || $responseLine === false) {
break;
}
echo($responseLine);
}
} | [
"protected",
"function",
"echoSubProcessResponse",
"(",
"array",
"$",
"pipes",
")",
"{",
"while",
"(",
"feof",
"(",
"$",
"pipes",
"[",
"1",
"]",
")",
"===",
"false",
")",
"{",
"$",
"responseLine",
"=",
"fgets",
"(",
"$",
"pipes",
"[",
"1",
"]",
")",
... | Echoes the currently pending response from the sub process
@param array $pipes
@return void | [
"Echoes",
"the",
"currently",
"pending",
"response",
"from",
"the",
"sub",
"process"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CoreCommandController.php#L396-L405 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CoreCommandController.php | CoreCommandController.quitSubProcess | protected function quitSubProcess($subProcess, array $pipes)
{
fwrite($pipes[0], "QUIT\n");
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($subProcess);
} | php | protected function quitSubProcess($subProcess, array $pipes)
{
fwrite($pipes[0], "QUIT\n");
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($subProcess);
} | [
"protected",
"function",
"quitSubProcess",
"(",
"$",
"subProcess",
",",
"array",
"$",
"pipes",
")",
"{",
"fwrite",
"(",
"$",
"pipes",
"[",
"0",
"]",
",",
"\"QUIT\\n\"",
")",
";",
"fclose",
"(",
"$",
"pipes",
"[",
"0",
"]",
")",
";",
"fclose",
"(",
... | Cleanly terminates the given sub process
@param resource $subProcess The sub process to quite
@param array $pipes The current STDIN, STDOUT and STDERR pipes
@return void | [
"Cleanly",
"terminates",
"the",
"given",
"sub",
"process"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CoreCommandController.php#L414-L421 |
neos/flow-development-collection | Neos.Flow/Classes/Command/CoreCommandController.php | CoreCommandController.autocomplete | protected function autocomplete(string $partialCommand, int $index): array
{
// @TODO Add more functionality by parsing the current buffer with readline_info()
// @TODO Filter file system elements (if possible at all)
$suggestions = [];
$availableCommands = $this->bootstrap->getObjectManager()
->get(CommandManager::class)
->getAvailableCommands();
/** @var $command Command */
foreach ($availableCommands as $command) {
if ($command->isInternal() === false) {
$suggestions[] = $command->getCommandIdentifier();
}
}
return $suggestions;
} | php | protected function autocomplete(string $partialCommand, int $index): array
{
// @TODO Add more functionality by parsing the current buffer with readline_info()
// @TODO Filter file system elements (if possible at all)
$suggestions = [];
$availableCommands = $this->bootstrap->getObjectManager()
->get(CommandManager::class)
->getAvailableCommands();
/** @var $command Command */
foreach ($availableCommands as $command) {
if ($command->isInternal() === false) {
$suggestions[] = $command->getCommandIdentifier();
}
}
return $suggestions;
} | [
"protected",
"function",
"autocomplete",
"(",
"string",
"$",
"partialCommand",
",",
"int",
"$",
"index",
")",
":",
"array",
"{",
"// @TODO Add more functionality by parsing the current buffer with readline_info()",
"// @TODO Filter file system elements (if possible at all)",
"$",
... | Returns autocomplete suggestions on hitting the TAB key.
@param string $partialCommand The current (partial) command where the TAB key was hit
@param integer $index The cursor index at the current (partial) command
@return array | [
"Returns",
"autocomplete",
"suggestions",
"on",
"hitting",
"the",
"TAB",
"key",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/CoreCommandController.php#L430-L449 |
neos/flow-development-collection | Neos.Eel/Classes/ProtectedContext.php | ProtectedContext.call | public function call($method, array $arguments = [])
{
if ($this->value === null || isset($this->whitelist[$method]) || isset($this->whitelist['*']) || ($this->value instanceof ProtectedContextAwareInterface && $this->value->allowsCallOfMethod($method))) {
return parent::call($method, $arguments);
}
throw new NotAllowedException('Method "' . $method . '" is not callable in untrusted context', 1369043080);
} | php | public function call($method, array $arguments = [])
{
if ($this->value === null || isset($this->whitelist[$method]) || isset($this->whitelist['*']) || ($this->value instanceof ProtectedContextAwareInterface && $this->value->allowsCallOfMethod($method))) {
return parent::call($method, $arguments);
}
throw new NotAllowedException('Method "' . $method . '" is not callable in untrusted context', 1369043080);
} | [
"public",
"function",
"call",
"(",
"$",
"method",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
"||",
"isset",
"(",
"$",
"this",
"->",
"whitelist",
"[",
"$",
"method",
"]",
")",
"||... | Call a method if in whitelist
@param string $method
@param array $arguments
@return mixed|void
@throws NotAllowedException | [
"Call",
"a",
"method",
"if",
"in",
"whitelist"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/ProtectedContext.php#L39-L45 |
neos/flow-development-collection | Neos.Eel/Classes/ProtectedContext.php | ProtectedContext.getAndWrap | public function getAndWrap($path = null)
{
// There are some cases where the $path is a ProtectedContext, especially when doing s.th. like
// foo()[myOffset]. In this case we need to unwrap it.
if ($path instanceof ProtectedContext) {
$path = $path->unwrap();
}
$context = parent::getAndWrap($path);
if ($context instanceof ProtectedContext && isset($this->whitelist[$path]) && is_array($this->whitelist[$path])) {
$context->whitelist = $this->whitelist[$path];
}
return $context;
} | php | public function getAndWrap($path = null)
{
// There are some cases where the $path is a ProtectedContext, especially when doing s.th. like
// foo()[myOffset]. In this case we need to unwrap it.
if ($path instanceof ProtectedContext) {
$path = $path->unwrap();
}
$context = parent::getAndWrap($path);
if ($context instanceof ProtectedContext && isset($this->whitelist[$path]) && is_array($this->whitelist[$path])) {
$context->whitelist = $this->whitelist[$path];
}
return $context;
} | [
"public",
"function",
"getAndWrap",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"// There are some cases where the $path is a ProtectedContext, especially when doing s.th. like",
"// foo()[myOffset]. In this case we need to unwrap it.",
"if",
"(",
"$",
"path",
"instanceof",
"Protected... | Get a value by path and wrap it into another context
The whitelist for the given path is applied to the new context.
@param string $path
@return Context The wrapped value | [
"Get",
"a",
"value",
"by",
"path",
"and",
"wrap",
"it",
"into",
"another",
"context"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/ProtectedContext.php#L55-L68 |
neos/flow-development-collection | Neos.Eel/Classes/ProtectedContext.php | ProtectedContext.whitelist | public function whitelist($pathOrMethods)
{
if (!is_array($pathOrMethods)) {
$pathOrMethods = [$pathOrMethods];
}
foreach ($pathOrMethods as $pathOrMethod) {
$parts = explode('.', $pathOrMethod);
$current = &$this->whitelist;
$count = count($parts);
for ($i = 0; $i < $count; $i++) {
if ($i === $count - 1) {
$current[$parts[$i]] = true;
} else {
$current[$parts[$i]] = [];
$current = &$current[$parts[$i]];
}
}
}
} | php | public function whitelist($pathOrMethods)
{
if (!is_array($pathOrMethods)) {
$pathOrMethods = [$pathOrMethods];
}
foreach ($pathOrMethods as $pathOrMethod) {
$parts = explode('.', $pathOrMethod);
$current = &$this->whitelist;
$count = count($parts);
for ($i = 0; $i < $count; $i++) {
if ($i === $count - 1) {
$current[$parts[$i]] = true;
} else {
$current[$parts[$i]] = [];
$current = &$current[$parts[$i]];
}
}
}
} | [
"public",
"function",
"whitelist",
"(",
"$",
"pathOrMethods",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"pathOrMethods",
")",
")",
"{",
"$",
"pathOrMethods",
"=",
"[",
"$",
"pathOrMethods",
"]",
";",
"}",
"foreach",
"(",
"$",
"pathOrMethods",
"as",... | Whitelist the given method (or array of methods) for calls
Method can be whitelisted on the root level of the context or
for arbitrary paths. A special method "*" will allow all methods
to be called.
Examples:
$context->whitelist('myMethod');
$context->whitelist('*');
$context->whitelist(array('String.*', 'Array.reverse'));
@param array|string $pathOrMethods
@return void | [
"Whitelist",
"the",
"given",
"method",
"(",
"or",
"array",
"of",
"methods",
")",
"for",
"calls"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/ProtectedContext.php#L88-L106 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php | DynamicRoutePart.matchWithParameters | final public function matchWithParameters(&$routePath, RouteParameters $parameters)
{
$this->value = null;
$this->parameters = $parameters;
if ($this->name === null || $this->name === '') {
return false;
}
$valueToMatch = $this->findValueToMatch($routePath);
$matchResult = $this->matchValue($valueToMatch);
if ($matchResult !== true && !($matchResult instanceof MatchResult)) {
return $matchResult;
}
$this->removeMatchingPortionFromRequestPath($routePath, $valueToMatch);
return $matchResult;
} | php | final public function matchWithParameters(&$routePath, RouteParameters $parameters)
{
$this->value = null;
$this->parameters = $parameters;
if ($this->name === null || $this->name === '') {
return false;
}
$valueToMatch = $this->findValueToMatch($routePath);
$matchResult = $this->matchValue($valueToMatch);
if ($matchResult !== true && !($matchResult instanceof MatchResult)) {
return $matchResult;
}
$this->removeMatchingPortionFromRequestPath($routePath, $valueToMatch);
return $matchResult;
} | [
"final",
"public",
"function",
"matchWithParameters",
"(",
"&",
"$",
"routePath",
",",
"RouteParameters",
"$",
"parameters",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"$",
"this",
"->",
"parameters",
"=",
"$",
"parameters",
";",
"if",
"(",
... | Checks whether this Dynamic Route Part corresponds to the given $routePath.
On successful match this method sets $this->value to the corresponding uriPart
and shortens $routePath respectively.
@param string $routePath The request path to be matched - without query parameters, host and fragment.
@param RouteParameters $parameters Routing parameters that will be stored in $this->parameters and can be evaluated in sub classes
@return bool|MatchResult true or an instance of MatchResult if Route Part matched $routePath, otherwise false. | [
"Checks",
"whether",
"this",
"Dynamic",
"Route",
"Part",
"corresponds",
"to",
"the",
"given",
"$routePath",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php#L86-L100 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php | DynamicRoutePart.findValueToMatch | protected function findValueToMatch($routePath)
{
if (!isset($routePath) || $routePath === '' || $routePath[0] === '/') {
return '';
}
$valueToMatch = $routePath;
if ($this->splitString !== '') {
$splitStringPosition = strpos($valueToMatch, $this->splitString);
if ($splitStringPosition !== false) {
$valueToMatch = substr($valueToMatch, 0, $splitStringPosition);
}
}
if (strpos($valueToMatch, '/') !== false) {
return '';
}
return $valueToMatch;
} | php | protected function findValueToMatch($routePath)
{
if (!isset($routePath) || $routePath === '' || $routePath[0] === '/') {
return '';
}
$valueToMatch = $routePath;
if ($this->splitString !== '') {
$splitStringPosition = strpos($valueToMatch, $this->splitString);
if ($splitStringPosition !== false) {
$valueToMatch = substr($valueToMatch, 0, $splitStringPosition);
}
}
if (strpos($valueToMatch, '/') !== false) {
return '';
}
return $valueToMatch;
} | [
"protected",
"function",
"findValueToMatch",
"(",
"$",
"routePath",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"routePath",
")",
"||",
"$",
"routePath",
"===",
"''",
"||",
"$",
"routePath",
"[",
"0",
"]",
"===",
"'/'",
")",
"{",
"return",
"''",
";"... | Returns the first part of $routePath.
If a split string is set, only the first part of the value until location of the splitString is returned.
This method can be overridden by custom RoutePartHandlers to implement custom matching mechanisms.
@param string $routePath The request path to be matched
@return string value to match, or an empty string if $routePath is empty or split string was not found
@api | [
"Returns",
"the",
"first",
"part",
"of",
"$routePath",
".",
"If",
"a",
"split",
"string",
"is",
"set",
"only",
"the",
"first",
"part",
"of",
"the",
"value",
"until",
"location",
"of",
"the",
"splitString",
"is",
"returned",
".",
"This",
"method",
"can",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php#L111-L127 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php | DynamicRoutePart.removeMatchingPortionFromRequestPath | protected function removeMatchingPortionFromRequestPath(&$routePath, $valueToMatch)
{
if ($valueToMatch !== null && $valueToMatch !== '') {
$routePath = substr($routePath, strlen($valueToMatch));
}
} | php | protected function removeMatchingPortionFromRequestPath(&$routePath, $valueToMatch)
{
if ($valueToMatch !== null && $valueToMatch !== '') {
$routePath = substr($routePath, strlen($valueToMatch));
}
} | [
"protected",
"function",
"removeMatchingPortionFromRequestPath",
"(",
"&",
"$",
"routePath",
",",
"$",
"valueToMatch",
")",
"{",
"if",
"(",
"$",
"valueToMatch",
"!==",
"null",
"&&",
"$",
"valueToMatch",
"!==",
"''",
")",
"{",
"$",
"routePath",
"=",
"substr",
... | Removes matching part from $routePath.
This method can be overridden by custom RoutePartHandlers to implement custom matching mechanisms.
@param string $routePath The request path to be matched
@param string $valueToMatch The matching value
@return void
@api | [
"Removes",
"matching",
"part",
"from",
"$routePath",
".",
"This",
"method",
"can",
"be",
"overridden",
"by",
"custom",
"RoutePartHandlers",
"to",
"implement",
"custom",
"matching",
"mechanisms",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php#L155-L160 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php | DynamicRoutePart.resolve | final public function resolve(array &$routeValues)
{
$this->value = null;
if ($this->name === null || $this->name === '') {
return false;
}
$valueToResolve = $this->findValueToResolve($routeValues);
$resolveResult = $this->resolveValue($valueToResolve);
if (!$resolveResult) {
return false;
}
$routeValues = Arrays::unsetValueByPath($routeValues, $this->name);
return $resolveResult;
} | php | final public function resolve(array &$routeValues)
{
$this->value = null;
if ($this->name === null || $this->name === '') {
return false;
}
$valueToResolve = $this->findValueToResolve($routeValues);
$resolveResult = $this->resolveValue($valueToResolve);
if (!$resolveResult) {
return false;
}
$routeValues = Arrays::unsetValueByPath($routeValues, $this->name);
return $resolveResult;
} | [
"final",
"public",
"function",
"resolve",
"(",
"array",
"&",
"$",
"routeValues",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"name",
"===",
"null",
"||",
"$",
"this",
"->",
"name",
"===",
"''",
")",
"{",
... | Checks whether $routeValues contains elements which correspond to this Dynamic Route Part.
If a corresponding element is found in $routeValues, this element is removed from the array.
@param array $routeValues An array with key/value pairs to be resolved by Dynamic Route Parts.
@return bool|ResolveResult true or an instance of ResolveResult if current Route Part could be resolved, otherwise false | [
"Checks",
"whether",
"$routeValues",
"contains",
"elements",
"which",
"correspond",
"to",
"this",
"Dynamic",
"Route",
"Part",
".",
"If",
"a",
"corresponding",
"element",
"is",
"found",
"in",
"$routeValues",
"this",
"element",
"is",
"removed",
"from",
"the",
"arr... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php#L169-L182 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php | DynamicRoutePart.findValueToResolve | protected function findValueToResolve(array $routeValues)
{
if ($this->name === null || $this->name === '') {
return null;
}
return ObjectAccess::getPropertyPath($routeValues, $this->name);
} | php | protected function findValueToResolve(array $routeValues)
{
if ($this->name === null || $this->name === '') {
return null;
}
return ObjectAccess::getPropertyPath($routeValues, $this->name);
} | [
"protected",
"function",
"findValueToResolve",
"(",
"array",
"$",
"routeValues",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"name",
"===",
"null",
"||",
"$",
"this",
"->",
"name",
"===",
"''",
")",
"{",
"return",
"null",
";",
"}",
"return",
"ObjectAccess",
... | Returns the route value of the current route part.
This method can be overridden by custom RoutePartHandlers to implement custom resolving mechanisms.
@param array $routeValues An array with key/value pairs to be resolved by Dynamic Route Parts.
@return string|array value to resolve.
@api | [
"Returns",
"the",
"route",
"value",
"of",
"the",
"current",
"route",
"part",
".",
"This",
"method",
"can",
"be",
"overridden",
"by",
"custom",
"RoutePartHandlers",
"to",
"implement",
"custom",
"resolving",
"mechanisms",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php#L192-L198 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php | DynamicRoutePart.resolveValue | protected function resolveValue($value)
{
if ($value === null) {
return false;
}
if (is_object($value)) {
$value = $this->persistenceManager->getIdentifierByObject($value);
if ($value === null || (!is_string($value) && !is_integer($value))) {
return false;
}
}
$resolvedValue = rawurlencode($value);
if ($this->lowerCase) {
$resolvedValue = strtolower($resolvedValue);
}
return new ResolveResult($resolvedValue);
} | php | protected function resolveValue($value)
{
if ($value === null) {
return false;
}
if (is_object($value)) {
$value = $this->persistenceManager->getIdentifierByObject($value);
if ($value === null || (!is_string($value) && !is_integer($value))) {
return false;
}
}
$resolvedValue = rawurlencode($value);
if ($this->lowerCase) {
$resolvedValue = strtolower($resolvedValue);
}
return new ResolveResult($resolvedValue);
} | [
"protected",
"function",
"resolveValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"... | Checks, whether given value can be resolved and if so, sets $this->value to the resolved value.
If $value is empty, this method checks whether a default value exists.
This method can be overridden by custom RoutePartHandlers to implement custom resolving mechanisms.
@param mixed $value value to resolve
@return boolean|ResolveResult An instance of ResolveResult if value could be resolved successfully, otherwise false.
@api | [
"Checks",
"whether",
"given",
"value",
"can",
"be",
"resolved",
"and",
"if",
"so",
"sets",
"$this",
"-",
">",
"value",
"to",
"the",
"resolved",
"value",
".",
"If",
"$value",
"is",
"empty",
"this",
"method",
"checks",
"whether",
"a",
"default",
"value",
"... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/DynamicRoutePart.php#L209-L225 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/ViewHelpers/Format/IdentifierViewHelper.php | IdentifierViewHelper.render | public function render()
{
$value = $this->arguments['value'];
if ($value === null) {
$value = $this->renderChildren();
}
if ($value === null) {
return null;
}
if (!is_object($value)) {
throw new ViewHelper\Exception('f:format.identifier expects an object, ' . gettype($value) . ' given.', 1337700024);
}
return $this->persistenceManager->getIdentifierByObject($value);
} | php | public function render()
{
$value = $this->arguments['value'];
if ($value === null) {
$value = $this->renderChildren();
}
if ($value === null) {
return null;
}
if (!is_object($value)) {
throw new ViewHelper\Exception('f:format.identifier expects an object, ' . gettype($value) . ' given.', 1337700024);
}
return $this->persistenceManager->getIdentifierByObject($value);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"arguments",
"[",
"'value'",
"]",
";",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"renderChildren",
"(",
")",
";",
"... | Outputs the identifier of the specified object
@return mixed the identifier of $value, usually the UUID
@throws ViewHelper\Exception if the given value is no object
@api | [
"Outputs",
"the",
"identifier",
"of",
"the",
"specified",
"object"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/Format/IdentifierViewHelper.php#L81-L95 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/ViewHelpers/Format/IdentifierViewHelper.php | IdentifierViewHelper.compile | public function compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)
{
$valueVariableName = $compiler->variableName('value');
$initializationPhpCode .= sprintf('%1$s = (%2$s[\'value\'] !== null ? %2$s[\'value\'] : %3$s());', $valueVariableName, $argumentsName, $closureName) . chr(10);
$initializationPhpCode .= sprintf('if (!is_object(%1$s) && %1$s !== null) { throw new \Neos\FluidAdaptor\Core\ViewHelper\Exception(\'f:format.identifier expects an object, \' . gettype(%1$s) . \' given.\', 1337700024); }', $valueVariableName) . chr(10);
return sprintf(
'%1$s === null ? null : $renderingContext->getObjectManager()->get(\Neos\Flow\Persistence\PersistenceManagerInterface::class)->getIdentifierByObject(%1$s)',
$valueVariableName
);
} | php | public function compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)
{
$valueVariableName = $compiler->variableName('value');
$initializationPhpCode .= sprintf('%1$s = (%2$s[\'value\'] !== null ? %2$s[\'value\'] : %3$s());', $valueVariableName, $argumentsName, $closureName) . chr(10);
$initializationPhpCode .= sprintf('if (!is_object(%1$s) && %1$s !== null) { throw new \Neos\FluidAdaptor\Core\ViewHelper\Exception(\'f:format.identifier expects an object, \' . gettype(%1$s) . \' given.\', 1337700024); }', $valueVariableName) . chr(10);
return sprintf(
'%1$s === null ? null : $renderingContext->getObjectManager()->get(\Neos\Flow\Persistence\PersistenceManagerInterface::class)->getIdentifierByObject(%1$s)',
$valueVariableName
);
} | [
"public",
"function",
"compile",
"(",
"$",
"argumentsName",
",",
"$",
"closureName",
",",
"&",
"$",
"initializationPhpCode",
",",
"ViewHelperNode",
"$",
"node",
",",
"TemplateCompiler",
"$",
"compiler",
")",
"{",
"$",
"valueVariableName",
"=",
"$",
"compiler",
... | Directly compile to code for the template cache.
@param string $argumentsName
@param string $closureName
@param string $initializationPhpCode
@param ViewHelperNode $node
@param TemplateCompiler $compiler
@return string | [
"Directly",
"compile",
"to",
"code",
"for",
"the",
"template",
"cache",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/Format/IdentifierViewHelper.php#L107-L117 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Response.php | Response.setStatus | public function setStatus($code, $message = null)
{
if (!is_int($code)) {
throw new \InvalidArgumentException('The HTTP status code must be of type integer, ' . gettype($code) . ' given.', 1220526013);
}
if ($message === null) {
$message = ResponseInformationHelper::getStatusMessageByCode($code);
}
$this->statusCode = $code;
$this->statusMessage = ($message === null) ? ResponseInformationHelper::getStatusMessageByCode($code) : $message;
return $this;
} | php | public function setStatus($code, $message = null)
{
if (!is_int($code)) {
throw new \InvalidArgumentException('The HTTP status code must be of type integer, ' . gettype($code) . ' given.', 1220526013);
}
if ($message === null) {
$message = ResponseInformationHelper::getStatusMessageByCode($code);
}
$this->statusCode = $code;
$this->statusMessage = ($message === null) ? ResponseInformationHelper::getStatusMessageByCode($code) : $message;
return $this;
} | [
"public",
"function",
"setStatus",
"(",
"$",
"code",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"code",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The HTTP status code must be of type integer, '... | Sets the HTTP status code and (optionally) a customized message.
@param integer $code The status code
@param string $message If specified, this message is sent instead of the standard message
@return Response This response, for method chaining
@throws \InvalidArgumentException if the specified status code is not valid
@deprecated Since Flow 5.1, use withStatus
@see withStatus() | [
"Sets",
"the",
"HTTP",
"status",
"code",
"and",
"(",
"optionally",
")",
"a",
"customized",
"message",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Response.php#L140-L151 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Response.php | Response.setNow | public function setNow(\DateTime $now)
{
$this->now = clone $now;
$this->now->setTimezone(new \DateTimeZone('UTC'));
$this->headers->set('Date', $this->now);
} | php | public function setNow(\DateTime $now)
{
$this->now = clone $now;
$this->now->setTimezone(new \DateTimeZone('UTC'));
$this->headers->set('Date', $this->now);
} | [
"public",
"function",
"setNow",
"(",
"\\",
"DateTime",
"$",
"now",
")",
"{",
"$",
"this",
"->",
"now",
"=",
"clone",
"$",
"now",
";",
"$",
"this",
"->",
"now",
"->",
"setTimezone",
"(",
"new",
"\\",
"DateTimeZone",
"(",
"'UTC'",
")",
")",
";",
"$",... | Sets the current point in time.
This date / time is used internally for comparisons in order to determine the
freshness of this response. By default this DateTime object is set automatically
through dependency injection, configured in the Objects.yaml of the Flow package.
Unless you are mocking the current time in a test, there is probably no need
to use this function. Also note that this method must be called before any
of the Response methods are used and it must not be called a second time.
@param \DateTime $now The current point in time
@return void
@deprecated Since Flow 5.1, directly set the "Date" header
@see withHeader() | [
"Sets",
"the",
"current",
"point",
"in",
"time",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Response.php#L204-L209 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Response.php | Response.getAge | public function getAge()
{
if ($this->headers->has('Age')) {
return $this->headers->get('Age');
} else {
$dateTimestamp = $this->headers->get('Date')->getTimestamp();
$nowTimestamp = $this->now->getTimestamp();
return ($nowTimestamp > $dateTimestamp) ? ($nowTimestamp - $dateTimestamp) : 0;
}
} | php | public function getAge()
{
if ($this->headers->has('Age')) {
return $this->headers->get('Age');
} else {
$dateTimestamp = $this->headers->get('Date')->getTimestamp();
$nowTimestamp = $this->now->getTimestamp();
return ($nowTimestamp > $dateTimestamp) ? ($nowTimestamp - $dateTimestamp) : 0;
}
} | [
"public",
"function",
"getAge",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"headers",
"->",
"has",
"(",
"'Age'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"headers",
"->",
"get",
"(",
"'Age'",
")",
";",
"}",
"else",
"{",
"$",
"dateTimestamp",
... | Returns the age of this responds in seconds.
The age is determined either by an explicitly set Age header or by the
difference between Date and "now".
Note that, according to RFC 2616 / 13.2.3, the presence of an Age header implies
that the response is not first-hand. You should therefore only explicitly set
an Age header if this is the case.
@return integer The age in seconds
@deprecated Since Flow 5.1, directly get the Age header
@see getHeader() | [
"Returns",
"the",
"age",
"of",
"this",
"responds",
"in",
"seconds",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Response.php#L330-L339 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Response.php | Response.makeStandardsCompliant | public function makeStandardsCompliant(Request $request)
{
if ($request->hasHeader('If-Modified-Since') && $this->headers->has('Last-Modified') && $this->statusCode === 200) {
$ifModifiedSinceDate = $request->getHeader('If-Modified-Since');
$lastModifiedDate = $this->headers->get('Last-Modified');
if ($lastModifiedDate <= $ifModifiedSinceDate) {
$this->setStatus(304);
$this->content = '';
}
} elseif ($request->hasHeader('If-Unmodified-Since') && $this->headers->has('Last-Modified')
&& (($this->statusCode >= 200 && $this->statusCode <= 299) || $this->statusCode === 412)) {
$unmodifiedSinceDate = $request->getHeader('If-Unmodified-Since');
$lastModifiedDate = $this->headers->get('Last-Modified');
if ($lastModifiedDate > $unmodifiedSinceDate) {
$this->setStatus(412);
}
}
if (in_array($this->statusCode, [100, 101, 204, 304])) {
$this->content = '';
}
if ($this->headers->getCacheControlDirective('no-cache') !== null
|| $this->headers->has('Expires')) {
$this->headers->removeCacheControlDirective('max-age');
}
if ($request->getMethod() === 'HEAD') {
if (!$this->headers->has('Content-Length')) {
$this->headers->set('Content-Length', strlen($this->content));
}
$this->content = '';
}
if (!$this->headers->has('Content-Length')) {
$this->headers->set('Content-Length', strlen($this->content));
}
if ($this->headers->has('Transfer-Encoding')) {
$this->headers->remove('Content-Length');
}
} | php | public function makeStandardsCompliant(Request $request)
{
if ($request->hasHeader('If-Modified-Since') && $this->headers->has('Last-Modified') && $this->statusCode === 200) {
$ifModifiedSinceDate = $request->getHeader('If-Modified-Since');
$lastModifiedDate = $this->headers->get('Last-Modified');
if ($lastModifiedDate <= $ifModifiedSinceDate) {
$this->setStatus(304);
$this->content = '';
}
} elseif ($request->hasHeader('If-Unmodified-Since') && $this->headers->has('Last-Modified')
&& (($this->statusCode >= 200 && $this->statusCode <= 299) || $this->statusCode === 412)) {
$unmodifiedSinceDate = $request->getHeader('If-Unmodified-Since');
$lastModifiedDate = $this->headers->get('Last-Modified');
if ($lastModifiedDate > $unmodifiedSinceDate) {
$this->setStatus(412);
}
}
if (in_array($this->statusCode, [100, 101, 204, 304])) {
$this->content = '';
}
if ($this->headers->getCacheControlDirective('no-cache') !== null
|| $this->headers->has('Expires')) {
$this->headers->removeCacheControlDirective('max-age');
}
if ($request->getMethod() === 'HEAD') {
if (!$this->headers->has('Content-Length')) {
$this->headers->set('Content-Length', strlen($this->content));
}
$this->content = '';
}
if (!$this->headers->has('Content-Length')) {
$this->headers->set('Content-Length', strlen($this->content));
}
if ($this->headers->has('Transfer-Encoding')) {
$this->headers->remove('Content-Length');
}
} | [
"public",
"function",
"makeStandardsCompliant",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"hasHeader",
"(",
"'If-Modified-Since'",
")",
"&&",
"$",
"this",
"->",
"headers",
"->",
"has",
"(",
"'Last-Modified'",
")",
"&&",
"$",
... | Analyzes this response, considering the given request and makes additions
or removes certain headers in order to make the response compliant to
RFC 2616 and related standards.
It is recommended to call this method before the response is sent and Flow
does so by default in its built-in HTTP request handler.
@param Request $request The corresponding request
@return void
@deprecated Since Flow 5.1, use ResponseInformationHelper::makeStandardsCompliant
@see ResponseInformationHelper::makeStandardsCompliant() | [
"Analyzes",
"this",
"response",
"considering",
"the",
"given",
"request",
"and",
"makes",
"additions",
"or",
"removes",
"certain",
"headers",
"in",
"order",
"to",
"make",
"the",
"response",
"compliant",
"to",
"RFC",
"2616",
"and",
"related",
"standards",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Response.php#L462-L503 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Response.php | Response.sendHeaders | public function sendHeaders()
{
if (headers_sent() === true) {
return;
}
foreach ($this->renderHeaders() as $header) {
header($header, false);
}
foreach ($this->headers->getCookies() as $cookie) {
header('Set-Cookie: ' . $cookie, false);
}
} | php | public function sendHeaders()
{
if (headers_sent() === true) {
return;
}
foreach ($this->renderHeaders() as $header) {
header($header, false);
}
foreach ($this->headers->getCookies() as $cookie) {
header('Set-Cookie: ' . $cookie, false);
}
} | [
"public",
"function",
"sendHeaders",
"(",
")",
"{",
"if",
"(",
"headers_sent",
"(",
")",
"===",
"true",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"renderHeaders",
"(",
")",
"as",
"$",
"header",
")",
"{",
"header",
"(",
"$",
"... | Sends the HTTP headers.
If headers have been sent previously, this method fails silently.
@return void
@codeCoverageIgnore
@deprecated Since Flow 5.1, without replacement
TODO: Make private after deprecation period | [
"Sends",
"the",
"HTTP",
"headers",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Response.php#L515-L526 |
neos/flow-development-collection | Neos.Flow/Classes/Http/Response.php | Response.withStatus | public function withStatus($code, $reasonPhrase = '')
{
$newResponse = clone $this;
$newResponse->setStatus($code, ($reasonPhrase === '' ? null : $reasonPhrase));
return $newResponse;
} | php | public function withStatus($code, $reasonPhrase = '')
{
$newResponse = clone $this;
$newResponse->setStatus($code, ($reasonPhrase === '' ? null : $reasonPhrase));
return $newResponse;
} | [
"public",
"function",
"withStatus",
"(",
"$",
"code",
",",
"$",
"reasonPhrase",
"=",
"''",
")",
"{",
"$",
"newResponse",
"=",
"clone",
"$",
"this",
";",
"$",
"newResponse",
"->",
"setStatus",
"(",
"$",
"code",
",",
"(",
"$",
"reasonPhrase",
"===",
"''"... | Return an instance with the specified status code and, optionally, reason phrase.
If no reason phrase is specified, implementations MAY choose to default
to the RFC 7231 or IANA recommended reason phrase for the response's
status code.
This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that has the
updated status and reason phrase.
@link http://tools.ietf.org/html/rfc7231#section-6
@link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
@param int $code The 3-digit integer result code to set.
@param string $reasonPhrase The reason phrase to use with the
provided status code; if none is provided, implementations MAY
use the defaults as suggested in the HTTP specification.
@return self
@throws \InvalidArgumentException For invalid status code arguments.
@api PSR-7 | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"status",
"code",
"and",
"optionally",
"reason",
"phrase",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/Response.php#L591-L596 |
neos/flow-development-collection | Neos.Flow/Classes/Core/Booting/Sequence.php | Sequence.removeStep | public function removeStep(string $stepIdentifier)
{
$removedOccurrences = 0;
foreach ($this->steps as $previousStepIdentifier => $steps) {
foreach ($steps as $step) {
if ($step->getIdentifier() === $stepIdentifier) {
unset($this->steps[$previousStepIdentifier][$stepIdentifier]);
$removedOccurrences++;
}
}
}
if ($removedOccurrences === 0) {
throw new FlowException(sprintf('Cannot remove sequence step with identifier "%s" because no such step exists in the given sequence.', $stepIdentifier), 1322591669);
}
} | php | public function removeStep(string $stepIdentifier)
{
$removedOccurrences = 0;
foreach ($this->steps as $previousStepIdentifier => $steps) {
foreach ($steps as $step) {
if ($step->getIdentifier() === $stepIdentifier) {
unset($this->steps[$previousStepIdentifier][$stepIdentifier]);
$removedOccurrences++;
}
}
}
if ($removedOccurrences === 0) {
throw new FlowException(sprintf('Cannot remove sequence step with identifier "%s" because no such step exists in the given sequence.', $stepIdentifier), 1322591669);
}
} | [
"public",
"function",
"removeStep",
"(",
"string",
"$",
"stepIdentifier",
")",
"{",
"$",
"removedOccurrences",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"steps",
"as",
"$",
"previousStepIdentifier",
"=>",
"$",
"steps",
")",
"{",
"foreach",
"(",
"$"... | Removes all occurrences of the specified step from this sequence
@param string $stepIdentifier
@return void
@throws FlowException | [
"Removes",
"all",
"occurrences",
"of",
"the",
"specified",
"step",
"from",
"this",
"sequence"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Core/Booting/Sequence.php#L64-L78 |
neos/flow-development-collection | Neos.Flow/Classes/Core/Booting/Sequence.php | Sequence.invokeStep | protected function invokeStep(Step $step, Bootstrap $bootstrap)
{
$bootstrap->getSignalSlotDispatcher()->dispatch(__CLASS__, 'beforeInvokeStep', [$step, $this->identifier]);
$identifier = $step->getIdentifier();
$step($bootstrap);
$bootstrap->getSignalSlotDispatcher()->dispatch(__CLASS__, 'afterInvokeStep', [$step, $this->identifier]);
if (isset($this->steps[$identifier])) {
foreach ($this->steps[$identifier] as $followingStep) {
$this->invokeStep($followingStep, $bootstrap);
}
}
} | php | protected function invokeStep(Step $step, Bootstrap $bootstrap)
{
$bootstrap->getSignalSlotDispatcher()->dispatch(__CLASS__, 'beforeInvokeStep', [$step, $this->identifier]);
$identifier = $step->getIdentifier();
$step($bootstrap);
$bootstrap->getSignalSlotDispatcher()->dispatch(__CLASS__, 'afterInvokeStep', [$step, $this->identifier]);
if (isset($this->steps[$identifier])) {
foreach ($this->steps[$identifier] as $followingStep) {
$this->invokeStep($followingStep, $bootstrap);
}
}
} | [
"protected",
"function",
"invokeStep",
"(",
"Step",
"$",
"step",
",",
"Bootstrap",
"$",
"bootstrap",
")",
"{",
"$",
"bootstrap",
"->",
"getSignalSlotDispatcher",
"(",
")",
"->",
"dispatch",
"(",
"__CLASS__",
",",
"'beforeInvokeStep'",
",",
"[",
"$",
"step",
... | Invokes a single step of this sequence and also invokes all steps registered
to be executed after the given step.
@param Step $step The step to invoke
@param \Neos\Flow\Core\Bootstrap $bootstrap
@return void | [
"Invokes",
"a",
"single",
"step",
"of",
"this",
"sequence",
"and",
"also",
"invokes",
"all",
"steps",
"registered",
"to",
"be",
"executed",
"after",
"the",
"given",
"step",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Core/Booting/Sequence.php#L103-L114 |
neos/flow-development-collection | Neos.Flow/Classes/Package.php | Package.boot | public function boot(Core\Bootstrap $bootstrap)
{
$context = $bootstrap->getContext();
if (PHP_SAPI === 'cli') {
$bootstrap->registerRequestHandler(new Cli\SlaveRequestHandler($bootstrap));
$bootstrap->registerRequestHandler(new Cli\CommandRequestHandler($bootstrap));
} else {
$bootstrap->registerRequestHandler(new Http\RequestHandler($bootstrap));
}
if ($context->isTesting()) {
$bootstrap->registerRequestHandler(new Tests\FunctionalTestRequestHandler($bootstrap));
}
$bootstrap->registerCompiletimeCommand('neos.flow:core:*');
$bootstrap->registerCompiletimeCommand('neos.flow:cache:flush');
$bootstrap->registerCompiletimeCommand('neos.flow:package:rescan');
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(Mvc\Dispatcher::class, 'afterControllerInvocation', function ($request) use ($bootstrap) {
if ($bootstrap->getObjectManager()->has(Persistence\PersistenceManagerInterface::class)) {
if (!$request instanceof Mvc\ActionRequest || SecurityHelper::hasSafeMethod($request->getHttpRequest()) !== true) {
$bootstrap->getObjectManager()->get(Persistence\PersistenceManagerInterface::class)->persistAll();
} elseif (SecurityHelper::hasSafeMethod($request->getHttpRequest())) {
$bootstrap->getObjectManager()->get(Persistence\PersistenceManagerInterface::class)->persistAll(true);
}
}
});
$dispatcher->connect(Cli\SlaveRequestHandler::class, 'dispatchedCommandLineSlaveRequest', Persistence\PersistenceManagerInterface::class, 'persistAll');
if (!$context->isProduction()) {
$dispatcher->connect(Core\Booting\Sequence::class, 'afterInvokeStep', function (Step $step) use ($bootstrap, $dispatcher) {
if ($step->getIdentifier() === 'neos.flow:resources') {
$publicResourcesFileMonitor = Monitor\FileMonitor::createFileMonitorAtBoot('Flow_PublicResourcesFiles', $bootstrap);
/** @var PackageManager $packageManager */
$packageManager = $bootstrap->getEarlyInstance(Package\PackageManager::class);
foreach ($packageManager->getFlowPackages() as $packageKey => $package) {
if ($packageManager->isPackageFrozen($packageKey)) {
continue;
}
$publicResourcesPath = $package->getResourcesPath() . 'Public/';
if (is_dir($publicResourcesPath)) {
$publicResourcesFileMonitor->monitorDirectory($publicResourcesPath);
}
}
$publicResourcesFileMonitor->detectChanges();
$publicResourcesFileMonitor->shutdownObject();
}
});
$publishResources = function ($identifier) use ($bootstrap) {
if ($identifier !== 'Flow_PublicResourcesFiles') {
return;
}
$objectManager = $bootstrap->getObjectManager();
$resourceManager = $objectManager->get(ResourceManager::class);
$resourceManager->getCollection(ResourceManager::DEFAULT_STATIC_COLLECTION_NAME)->publish();
};
$dispatcher->connect(Monitor\FileMonitor::class, 'filesHaveChanged', $publishResources);
$dispatcher->connect(Monitor\FileMonitor::class, 'filesHaveChanged', Cache\CacheManager::class, 'flushSystemCachesByChangedFiles');
}
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', Configuration\ConfigurationManager::class, 'shutdown');
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', ObjectManagement\ObjectManagerInterface::class, 'shutdown');
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', Reflection\ReflectionService::class, 'saveToCache');
$dispatcher->connect(Command\CoreCommandController::class, 'finishedCompilationRun', Security\Authorization\Privilege\Method\MethodPrivilegePointcutFilter::class, 'savePolicyCache');
$dispatcher->connect(Security\Authentication\AuthenticationProviderManager::class, 'authenticatedToken', function () use ($bootstrap) {
$session = $bootstrap->getObjectManager()->get(Session\SessionInterface::class);
if ($session->isStarted()) {
$session->renewId();
}
});
$dispatcher->connect(Tests\FunctionalTestCase::class, 'functionalTestTearDown', Mvc\Routing\RouterCachingService::class, 'flushCaches');
$dispatcher->connect(Configuration\ConfigurationManager::class, 'configurationManagerReady', function (Configuration\ConfigurationManager $configurationManager) {
$configurationManager->registerConfigurationType('Views', Configuration\ConfigurationManager::CONFIGURATION_PROCESSING_TYPE_APPEND);
});
$dispatcher->connect(Command\CacheCommandController::class, 'warmupCaches', Configuration\ConfigurationManager::class, 'warmup');
$dispatcher->connect(Package\PackageManager::class, 'packageStatesUpdated', function () use ($dispatcher, $bootstrap) {
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', function () use ($bootstrap) {
$bootstrap->getObjectManager()->get(Cache\CacheManager::class)->flushCaches();
});
});
$dispatcher->connect(Persistence\Doctrine\EntityManagerFactory::class, 'beforeDoctrineEntityManagerCreation', Persistence\Doctrine\EntityManagerConfiguration::class, 'configureEntityManager');
$dispatcher->connect(Persistence\Doctrine\EntityManagerFactory::class, 'afterDoctrineEntityManagerCreation', Persistence\Doctrine\EntityManagerConfiguration::class, 'enhanceEntityManager');
$dispatcher->connect(Persistence\Doctrine\PersistenceManager::class, 'allObjectsPersisted', ResourceRepository::class, 'resetAfterPersistingChanges');
$dispatcher->connect(Persistence\Generic\PersistenceManager::class, 'allObjectsPersisted', ResourceRepository::class, 'resetAfterPersistingChanges');
$dispatcher->connect(AuthenticationProviderManager::class, 'successfullyAuthenticated', Context::class, 'refreshRoles');
$dispatcher->connect(AuthenticationProviderManager::class, 'loggedOut', Context::class, 'refreshTokens');
} | php | public function boot(Core\Bootstrap $bootstrap)
{
$context = $bootstrap->getContext();
if (PHP_SAPI === 'cli') {
$bootstrap->registerRequestHandler(new Cli\SlaveRequestHandler($bootstrap));
$bootstrap->registerRequestHandler(new Cli\CommandRequestHandler($bootstrap));
} else {
$bootstrap->registerRequestHandler(new Http\RequestHandler($bootstrap));
}
if ($context->isTesting()) {
$bootstrap->registerRequestHandler(new Tests\FunctionalTestRequestHandler($bootstrap));
}
$bootstrap->registerCompiletimeCommand('neos.flow:core:*');
$bootstrap->registerCompiletimeCommand('neos.flow:cache:flush');
$bootstrap->registerCompiletimeCommand('neos.flow:package:rescan');
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(Mvc\Dispatcher::class, 'afterControllerInvocation', function ($request) use ($bootstrap) {
if ($bootstrap->getObjectManager()->has(Persistence\PersistenceManagerInterface::class)) {
if (!$request instanceof Mvc\ActionRequest || SecurityHelper::hasSafeMethod($request->getHttpRequest()) !== true) {
$bootstrap->getObjectManager()->get(Persistence\PersistenceManagerInterface::class)->persistAll();
} elseif (SecurityHelper::hasSafeMethod($request->getHttpRequest())) {
$bootstrap->getObjectManager()->get(Persistence\PersistenceManagerInterface::class)->persistAll(true);
}
}
});
$dispatcher->connect(Cli\SlaveRequestHandler::class, 'dispatchedCommandLineSlaveRequest', Persistence\PersistenceManagerInterface::class, 'persistAll');
if (!$context->isProduction()) {
$dispatcher->connect(Core\Booting\Sequence::class, 'afterInvokeStep', function (Step $step) use ($bootstrap, $dispatcher) {
if ($step->getIdentifier() === 'neos.flow:resources') {
$publicResourcesFileMonitor = Monitor\FileMonitor::createFileMonitorAtBoot('Flow_PublicResourcesFiles', $bootstrap);
/** @var PackageManager $packageManager */
$packageManager = $bootstrap->getEarlyInstance(Package\PackageManager::class);
foreach ($packageManager->getFlowPackages() as $packageKey => $package) {
if ($packageManager->isPackageFrozen($packageKey)) {
continue;
}
$publicResourcesPath = $package->getResourcesPath() . 'Public/';
if (is_dir($publicResourcesPath)) {
$publicResourcesFileMonitor->monitorDirectory($publicResourcesPath);
}
}
$publicResourcesFileMonitor->detectChanges();
$publicResourcesFileMonitor->shutdownObject();
}
});
$publishResources = function ($identifier) use ($bootstrap) {
if ($identifier !== 'Flow_PublicResourcesFiles') {
return;
}
$objectManager = $bootstrap->getObjectManager();
$resourceManager = $objectManager->get(ResourceManager::class);
$resourceManager->getCollection(ResourceManager::DEFAULT_STATIC_COLLECTION_NAME)->publish();
};
$dispatcher->connect(Monitor\FileMonitor::class, 'filesHaveChanged', $publishResources);
$dispatcher->connect(Monitor\FileMonitor::class, 'filesHaveChanged', Cache\CacheManager::class, 'flushSystemCachesByChangedFiles');
}
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', Configuration\ConfigurationManager::class, 'shutdown');
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', ObjectManagement\ObjectManagerInterface::class, 'shutdown');
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', Reflection\ReflectionService::class, 'saveToCache');
$dispatcher->connect(Command\CoreCommandController::class, 'finishedCompilationRun', Security\Authorization\Privilege\Method\MethodPrivilegePointcutFilter::class, 'savePolicyCache');
$dispatcher->connect(Security\Authentication\AuthenticationProviderManager::class, 'authenticatedToken', function () use ($bootstrap) {
$session = $bootstrap->getObjectManager()->get(Session\SessionInterface::class);
if ($session->isStarted()) {
$session->renewId();
}
});
$dispatcher->connect(Tests\FunctionalTestCase::class, 'functionalTestTearDown', Mvc\Routing\RouterCachingService::class, 'flushCaches');
$dispatcher->connect(Configuration\ConfigurationManager::class, 'configurationManagerReady', function (Configuration\ConfigurationManager $configurationManager) {
$configurationManager->registerConfigurationType('Views', Configuration\ConfigurationManager::CONFIGURATION_PROCESSING_TYPE_APPEND);
});
$dispatcher->connect(Command\CacheCommandController::class, 'warmupCaches', Configuration\ConfigurationManager::class, 'warmup');
$dispatcher->connect(Package\PackageManager::class, 'packageStatesUpdated', function () use ($dispatcher, $bootstrap) {
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', function () use ($bootstrap) {
$bootstrap->getObjectManager()->get(Cache\CacheManager::class)->flushCaches();
});
});
$dispatcher->connect(Persistence\Doctrine\EntityManagerFactory::class, 'beforeDoctrineEntityManagerCreation', Persistence\Doctrine\EntityManagerConfiguration::class, 'configureEntityManager');
$dispatcher->connect(Persistence\Doctrine\EntityManagerFactory::class, 'afterDoctrineEntityManagerCreation', Persistence\Doctrine\EntityManagerConfiguration::class, 'enhanceEntityManager');
$dispatcher->connect(Persistence\Doctrine\PersistenceManager::class, 'allObjectsPersisted', ResourceRepository::class, 'resetAfterPersistingChanges');
$dispatcher->connect(Persistence\Generic\PersistenceManager::class, 'allObjectsPersisted', ResourceRepository::class, 'resetAfterPersistingChanges');
$dispatcher->connect(AuthenticationProviderManager::class, 'successfullyAuthenticated', Context::class, 'refreshRoles');
$dispatcher->connect(AuthenticationProviderManager::class, 'loggedOut', Context::class, 'refreshTokens');
} | [
"public",
"function",
"boot",
"(",
"Core",
"\\",
"Bootstrap",
"$",
"bootstrap",
")",
"{",
"$",
"context",
"=",
"$",
"bootstrap",
"->",
"getContext",
"(",
")",
";",
"if",
"(",
"PHP_SAPI",
"===",
"'cli'",
")",
"{",
"$",
"bootstrap",
"->",
"registerRequestH... | Invokes custom PHP code directly after the package manager has been initialized.
@param Core\Bootstrap $bootstrap The current bootstrap
@return void | [
"Invokes",
"custom",
"PHP",
"code",
"directly",
"after",
"the",
"package",
"manager",
"has",
"been",
"initialized",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Package.php#L39-L140 |
neos/flow-development-collection | Neos.Flow/Classes/Command/ResourceCommandController.php | ResourceCommandController.publishCommand | public function publishCommand(string $collection = null)
{
try {
if ($collection === null) {
$collections = $this->resourceManager->getCollections();
} else {
$collections = [];
$collections[$collection] = $this->resourceManager->getCollection($collection);
if ($collections[$collection] === null) {
$this->outputLine('Collection "%s" does not exist.', [$collection]);
$this->quit(1);
}
}
foreach ($collections as $collection) {
try {
/** @var CollectionInterface $collection */
$this->outputLine('Publishing resources of collection "%s"', [$collection->getName()]);
$target = $collection->getTarget();
$target->publishCollection($collection, function ($iteration) {
$this->clearState($iteration);
});
} catch (Exception $exception) {
$message = sprintf(
'An error occurred while publishing the collection "%s": %s (Exception code: %u): %s',
$collection->getName(),
get_class($exception),
$exception->getCode(),
$exception->getMessage()
);
$this->messageCollector->append($message);
}
}
if ($this->messageCollector->hasMessages()) {
$this->outputLine();
$this->outputLine('The resources were published, but a few inconsistencies were detected. You can check and probably fix the integrity of the resource registry by using the resource:clean command.');
$this->messageCollector->flush(function (Message $notification) {
$this->outputLine($notification->getSeverity() . ': ' . $notification->getMessage());
});
}
} catch (Exception $exception) {
$this->outputLine();
$this->outputLine('An error occurred while publishing resources (see full description below). You can check and probably fix the integrity of the resource registry by using the resource:clean command.');
$this->outputLine('%s (Exception code: %s)', [get_class($exception), $exception->getCode()]);
$this->outputLine($exception->getMessage());
$this->quit(1);
}
} | php | public function publishCommand(string $collection = null)
{
try {
if ($collection === null) {
$collections = $this->resourceManager->getCollections();
} else {
$collections = [];
$collections[$collection] = $this->resourceManager->getCollection($collection);
if ($collections[$collection] === null) {
$this->outputLine('Collection "%s" does not exist.', [$collection]);
$this->quit(1);
}
}
foreach ($collections as $collection) {
try {
/** @var CollectionInterface $collection */
$this->outputLine('Publishing resources of collection "%s"', [$collection->getName()]);
$target = $collection->getTarget();
$target->publishCollection($collection, function ($iteration) {
$this->clearState($iteration);
});
} catch (Exception $exception) {
$message = sprintf(
'An error occurred while publishing the collection "%s": %s (Exception code: %u): %s',
$collection->getName(),
get_class($exception),
$exception->getCode(),
$exception->getMessage()
);
$this->messageCollector->append($message);
}
}
if ($this->messageCollector->hasMessages()) {
$this->outputLine();
$this->outputLine('The resources were published, but a few inconsistencies were detected. You can check and probably fix the integrity of the resource registry by using the resource:clean command.');
$this->messageCollector->flush(function (Message $notification) {
$this->outputLine($notification->getSeverity() . ': ' . $notification->getMessage());
});
}
} catch (Exception $exception) {
$this->outputLine();
$this->outputLine('An error occurred while publishing resources (see full description below). You can check and probably fix the integrity of the resource registry by using the resource:clean command.');
$this->outputLine('%s (Exception code: %s)', [get_class($exception), $exception->getCode()]);
$this->outputLine($exception->getMessage());
$this->quit(1);
}
} | [
"public",
"function",
"publishCommand",
"(",
"string",
"$",
"collection",
"=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"collection",
"===",
"null",
")",
"{",
"$",
"collections",
"=",
"$",
"this",
"->",
"resourceManager",
"->",
"getCollections",
"(",
... | Publish resources
This command publishes the resources of the given or - if none was specified, all - resource collections
to their respective configured publishing targets.
@param string $collection If specified, only resources of this collection are published. Example: 'persistent'
@return void | [
"Publish",
"resources"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/ResourceCommandController.php#L82-L130 |
neos/flow-development-collection | Neos.Flow/Classes/Command/ResourceCommandController.php | ResourceCommandController.copyCommand | public function copyCommand(string $sourceCollection, string $targetCollection, bool $publish = false)
{
$sourceCollectionName = $sourceCollection;
$sourceCollection = $this->resourceManager->getCollection($sourceCollectionName);
if ($sourceCollection === null) {
$this->outputLine('The source collection "%s" does not exist.', [$sourceCollectionName]);
$this->quit(1);
}
$targetCollectionName = $targetCollection;
$targetCollection = $this->resourceManager->getCollection($targetCollection);
if ($targetCollection === null) {
$this->outputLine('The target collection "%s" does not exist.', [$targetCollectionName]);
$this->quit(1);
}
if (!empty($targetCollection->getObjects())) {
$this->outputLine('The target collection "%s" is not empty.', [$targetCollectionName]);
$this->quit(1);
}
$this->outputLine('Copying resource objects from collection "%s" to collection "%s" ...', [$sourceCollectionName, $targetCollectionName]);
$this->outputLine();
$this->output->progressStart();
foreach ($sourceCollection->getObjects() as $resource) {
/** @var \Neos\Flow\ResourceManagement\Storage\StorageObject $resource */
$this->output->progressAdvance();
$targetCollection->importResource($resource->getStream());
}
$this->output->progressFinish();
$this->outputLine();
if ($publish) {
$this->outputLine('Publishing copied resources to the target "%s" ...', [$targetCollection->getTarget()->getName()]);
$targetCollection->getTarget()->publishCollection($sourceCollection);
}
$this->outputLine('Done.');
$this->outputLine('Hint: If you want to use the target collection as a replacement for your current one, you can now modify your settings accordingly.');
} | php | public function copyCommand(string $sourceCollection, string $targetCollection, bool $publish = false)
{
$sourceCollectionName = $sourceCollection;
$sourceCollection = $this->resourceManager->getCollection($sourceCollectionName);
if ($sourceCollection === null) {
$this->outputLine('The source collection "%s" does not exist.', [$sourceCollectionName]);
$this->quit(1);
}
$targetCollectionName = $targetCollection;
$targetCollection = $this->resourceManager->getCollection($targetCollection);
if ($targetCollection === null) {
$this->outputLine('The target collection "%s" does not exist.', [$targetCollectionName]);
$this->quit(1);
}
if (!empty($targetCollection->getObjects())) {
$this->outputLine('The target collection "%s" is not empty.', [$targetCollectionName]);
$this->quit(1);
}
$this->outputLine('Copying resource objects from collection "%s" to collection "%s" ...', [$sourceCollectionName, $targetCollectionName]);
$this->outputLine();
$this->output->progressStart();
foreach ($sourceCollection->getObjects() as $resource) {
/** @var \Neos\Flow\ResourceManagement\Storage\StorageObject $resource */
$this->output->progressAdvance();
$targetCollection->importResource($resource->getStream());
}
$this->output->progressFinish();
$this->outputLine();
if ($publish) {
$this->outputLine('Publishing copied resources to the target "%s" ...', [$targetCollection->getTarget()->getName()]);
$targetCollection->getTarget()->publishCollection($sourceCollection);
}
$this->outputLine('Done.');
$this->outputLine('Hint: If you want to use the target collection as a replacement for your current one, you can now modify your settings accordingly.');
} | [
"public",
"function",
"copyCommand",
"(",
"string",
"$",
"sourceCollection",
",",
"string",
"$",
"targetCollection",
",",
"bool",
"$",
"publish",
"=",
"false",
")",
"{",
"$",
"sourceCollectionName",
"=",
"$",
"sourceCollection",
";",
"$",
"sourceCollection",
"="... | Copy resources
This command copies all resources from one collection to another storage identified by name.
The target storage must be empty and must not be identical to the current storage of the collection.
This command merely copies the binary data from one storage to another, it does not change the related
PersistentResource objects in the database in any way. Since the PersistentResource objects in the database refer to a
collection name, you can use this command for migrating from one storage to another my configuring
the new storage with the name of the old storage collection after the resources have been copied.
@param string $sourceCollection The name of the collection you want to copy the assets from
@param string $targetCollection The name of the collection you want to copy the assets to
@param boolean $publish If enabled, the target collection will be published after the resources have been copied
@return void | [
"Copy",
"resources"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/ResourceCommandController.php#L148-L188 |
neos/flow-development-collection | Neos.Flow/Classes/Command/ResourceCommandController.php | ResourceCommandController.cleanCommand | public function cleanCommand()
{
$this->outputLine('Checking if resource data exists for all known resource objects ...');
$this->outputLine();
$mediaPackagePresent = $this->packageManager->isPackageAvailable('Neos.Media');
$resourcesCount = $this->resourceRepository->countAll();
$this->output->progressStart($resourcesCount);
$brokenResources = [];
$relatedAssets = new \SplObjectStorage();
$relatedThumbnails = new \SplObjectStorage();
$iterator = $this->resourceRepository->findAllIterator();
foreach ($this->resourceRepository->iterate($iterator, function ($iteration) {
$this->clearState($iteration);
}) as $resource) {
$this->output->progressAdvance(1);
/* @var PersistentResource $resource */
$stream = $resource->getStream();
if (!is_resource($stream)) {
$brokenResources[] = $resource->getSha1();
}
}
$this->output->progressFinish();
$this->outputLine();
if ($mediaPackagePresent && count($brokenResources) > 0) {
/* @var AssetRepository $assetRepository */
$assetRepository = $this->objectManager->get(AssetRepository::class);
/* @var ThumbnailRepository $thumbnailRepository */
$thumbnailRepository = $this->objectManager->get(ThumbnailRepository::class);
foreach ($brokenResources as $key => $resourceSha1) {
$resource = $this->resourceRepository->findOneBySha1($resourceSha1);
$brokenResources[$key] = $resource;
$assets = $assetRepository->findByResource($resource);
if ($assets !== null) {
$relatedAssets[$resource] = $assets;
}
$thumbnails = $thumbnailRepository->findByResource($resource);
if ($assets !== null) {
$relatedThumbnails[$resource] = $thumbnails;
}
}
}
if (count($brokenResources) > 0) {
$this->outputLine('<b>Found %s broken resource(s):</b>', [count($brokenResources)]);
$this->outputLine();
foreach ($brokenResources as $resource) {
$this->outputLine('%s (%s) from "%s" collection', [$resource->getFilename(), $resource->getSha1(), $resource->getCollectionName()]);
if (isset($relatedAssets[$resource])) {
foreach ($relatedAssets[$resource] as $asset) {
$this->outputLine(' -> %s (%s)', [get_class($asset), $asset->getIdentifier()]);
}
}
}
$response = null;
while (!in_array($response, ['y', 'n', 'c'])) {
$response = $this->output->ask('<comment>Do you want to remove all broken resource objects and related assets from the database? (y/n/c) </comment>');
}
switch ($response) {
case 'y':
$brokenAssetCounter = 0;
$brokenThumbnailCounter = 0;
foreach ($brokenResources as $sha1 => $resource) {
$this->outputLine('- delete %s (%s) from "%s" collection', [
$resource->getFilename(),
$resource->getSha1(),
$resource->getCollectionName()
]);
$resource->disableLifecycleEvents();
$this->resourceRepository->remove($resource);
if (isset($relatedAssets[$resource])) {
foreach ($relatedAssets[$resource] as $asset) {
$assetRepository->removeWithoutUsageChecks($asset);
$brokenAssetCounter++;
}
}
if (isset($relatedThumbnails[$resource])) {
foreach ($relatedThumbnails[$resource] as $thumbnail) {
$thumbnailRepository->remove($thumbnail);
$brokenThumbnailCounter++;
}
}
$this->persistenceManager->persistAll();
}
$brokenResourcesCounter = count($brokenResources);
if ($brokenResourcesCounter > 0) {
$this->outputLine('Removed %s resource object(s) from the database.', [$brokenResourcesCounter]);
}
if ($brokenAssetCounter > 0) {
$this->outputLine('Removed %s asset object(s) from the database.', [$brokenAssetCounter]);
}
if ($brokenThumbnailCounter > 0) {
$this->outputLine('Removed %s thumbnail object(s) from the database.', [$brokenThumbnailCounter]);
}
break;
case 'n':
$this->outputLine('Did not delete any resource objects.');
break;
case 'c':
$this->outputLine('Stopping. Did not delete any resource objects.');
$this->quit(0);
break;
}
}
} | php | public function cleanCommand()
{
$this->outputLine('Checking if resource data exists for all known resource objects ...');
$this->outputLine();
$mediaPackagePresent = $this->packageManager->isPackageAvailable('Neos.Media');
$resourcesCount = $this->resourceRepository->countAll();
$this->output->progressStart($resourcesCount);
$brokenResources = [];
$relatedAssets = new \SplObjectStorage();
$relatedThumbnails = new \SplObjectStorage();
$iterator = $this->resourceRepository->findAllIterator();
foreach ($this->resourceRepository->iterate($iterator, function ($iteration) {
$this->clearState($iteration);
}) as $resource) {
$this->output->progressAdvance(1);
/* @var PersistentResource $resource */
$stream = $resource->getStream();
if (!is_resource($stream)) {
$brokenResources[] = $resource->getSha1();
}
}
$this->output->progressFinish();
$this->outputLine();
if ($mediaPackagePresent && count($brokenResources) > 0) {
/* @var AssetRepository $assetRepository */
$assetRepository = $this->objectManager->get(AssetRepository::class);
/* @var ThumbnailRepository $thumbnailRepository */
$thumbnailRepository = $this->objectManager->get(ThumbnailRepository::class);
foreach ($brokenResources as $key => $resourceSha1) {
$resource = $this->resourceRepository->findOneBySha1($resourceSha1);
$brokenResources[$key] = $resource;
$assets = $assetRepository->findByResource($resource);
if ($assets !== null) {
$relatedAssets[$resource] = $assets;
}
$thumbnails = $thumbnailRepository->findByResource($resource);
if ($assets !== null) {
$relatedThumbnails[$resource] = $thumbnails;
}
}
}
if (count($brokenResources) > 0) {
$this->outputLine('<b>Found %s broken resource(s):</b>', [count($brokenResources)]);
$this->outputLine();
foreach ($brokenResources as $resource) {
$this->outputLine('%s (%s) from "%s" collection', [$resource->getFilename(), $resource->getSha1(), $resource->getCollectionName()]);
if (isset($relatedAssets[$resource])) {
foreach ($relatedAssets[$resource] as $asset) {
$this->outputLine(' -> %s (%s)', [get_class($asset), $asset->getIdentifier()]);
}
}
}
$response = null;
while (!in_array($response, ['y', 'n', 'c'])) {
$response = $this->output->ask('<comment>Do you want to remove all broken resource objects and related assets from the database? (y/n/c) </comment>');
}
switch ($response) {
case 'y':
$brokenAssetCounter = 0;
$brokenThumbnailCounter = 0;
foreach ($brokenResources as $sha1 => $resource) {
$this->outputLine('- delete %s (%s) from "%s" collection', [
$resource->getFilename(),
$resource->getSha1(),
$resource->getCollectionName()
]);
$resource->disableLifecycleEvents();
$this->resourceRepository->remove($resource);
if (isset($relatedAssets[$resource])) {
foreach ($relatedAssets[$resource] as $asset) {
$assetRepository->removeWithoutUsageChecks($asset);
$brokenAssetCounter++;
}
}
if (isset($relatedThumbnails[$resource])) {
foreach ($relatedThumbnails[$resource] as $thumbnail) {
$thumbnailRepository->remove($thumbnail);
$brokenThumbnailCounter++;
}
}
$this->persistenceManager->persistAll();
}
$brokenResourcesCounter = count($brokenResources);
if ($brokenResourcesCounter > 0) {
$this->outputLine('Removed %s resource object(s) from the database.', [$brokenResourcesCounter]);
}
if ($brokenAssetCounter > 0) {
$this->outputLine('Removed %s asset object(s) from the database.', [$brokenAssetCounter]);
}
if ($brokenThumbnailCounter > 0) {
$this->outputLine('Removed %s thumbnail object(s) from the database.', [$brokenThumbnailCounter]);
}
break;
case 'n':
$this->outputLine('Did not delete any resource objects.');
break;
case 'c':
$this->outputLine('Stopping. Did not delete any resource objects.');
$this->quit(0);
break;
}
}
} | [
"public",
"function",
"cleanCommand",
"(",
")",
"{",
"$",
"this",
"->",
"outputLine",
"(",
"'Checking if resource data exists for all known resource objects ...'",
")",
";",
"$",
"this",
"->",
"outputLine",
"(",
")",
";",
"$",
"mediaPackagePresent",
"=",
"$",
"this"... | Clean up resource registry
This command checks the resource registry (that is the database tables) for orphaned resource objects which don't
seem to have any corresponding data anymore (for example: the file in Data/Persistent/Resources has been deleted
without removing the related PersistentResource object).
If the Neos.Media package is active, this command will also detect any assets referring to broken resources
and will remove the respective Asset object from the database when the broken resource is removed.
This command will ask you interactively what to do before deleting anything.
@return void | [
"Clean",
"up",
"resource",
"registry"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Command/ResourceCommandController.php#L204-L315 |
neos/flow-development-collection | Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetController.php | AbstractWidgetController.processRequest | public function processRequest(RequestInterface $request, ResponseInterface $response)
{
/** @var $request \Neos\Flow\Mvc\ActionRequest */
/** @var $widgetContext WidgetContext */
$widgetContext = $request->getInternalArgument('__widgetContext');
if ($widgetContext === null) {
throw new WidgetContextNotFoundException('The widget context could not be found in the request.', 1307450180);
}
$this->widgetConfiguration = $widgetContext->getWidgetConfiguration();
parent::processRequest($request, $response);
} | php | public function processRequest(RequestInterface $request, ResponseInterface $response)
{
/** @var $request \Neos\Flow\Mvc\ActionRequest */
/** @var $widgetContext WidgetContext */
$widgetContext = $request->getInternalArgument('__widgetContext');
if ($widgetContext === null) {
throw new WidgetContextNotFoundException('The widget context could not be found in the request.', 1307450180);
}
$this->widgetConfiguration = $widgetContext->getWidgetConfiguration();
parent::processRequest($request, $response);
} | [
"public",
"function",
"processRequest",
"(",
"RequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"/** @var $request \\Neos\\Flow\\Mvc\\ActionRequest */",
"/** @var $widgetContext WidgetContext */",
"$",
"widgetContext",
"=",
"$",
"request",
... | Handles a request. The result output is returned by altering the given response.
@param RequestInterface $request The request object
@param ResponseInterface $response The response, modified by this handler
@return void
@throws WidgetContextNotFoundException
@api | [
"Handles",
"a",
"request",
".",
"The",
"result",
"output",
"is",
"returned",
"by",
"altering",
"the",
"given",
"response",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetController.php#L45-L55 |
neos/flow-development-collection | Neos.Flow/Classes/Http/RequestHandler.php | RequestHandler.handleRequest | public function handleRequest()
{
// Create the request very early so the ResourceManagement has a chance to grab it:
$request = Request::createFromEnvironment();
$response = new Response();
$this->componentContext = new ComponentContext($request, $response);
$this->boot();
$this->resolveDependencies();
$response = $this->addPoweredByHeader($response);
$this->componentContext->replaceHttpResponse($response);
$baseUriSetting = $this->bootstrap->getObjectManager()->get(ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.http.baseUri');
if (!empty($baseUriSetting)) {
$baseUri = new Uri($baseUriSetting);
$request = $request->withAttribute(Request::ATTRIBUTE_BASE_URI, $baseUri);
$this->componentContext->replaceHttpRequest($request);
}
$this->baseComponentChain->handle($this->componentContext);
$response = $this->baseComponentChain->getResponse();
$response->send();
$this->bootstrap->shutdown(Bootstrap::RUNLEVEL_RUNTIME);
$this->exit->__invoke();
} | php | public function handleRequest()
{
// Create the request very early so the ResourceManagement has a chance to grab it:
$request = Request::createFromEnvironment();
$response = new Response();
$this->componentContext = new ComponentContext($request, $response);
$this->boot();
$this->resolveDependencies();
$response = $this->addPoweredByHeader($response);
$this->componentContext->replaceHttpResponse($response);
$baseUriSetting = $this->bootstrap->getObjectManager()->get(ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.http.baseUri');
if (!empty($baseUriSetting)) {
$baseUri = new Uri($baseUriSetting);
$request = $request->withAttribute(Request::ATTRIBUTE_BASE_URI, $baseUri);
$this->componentContext->replaceHttpRequest($request);
}
$this->baseComponentChain->handle($this->componentContext);
$response = $this->baseComponentChain->getResponse();
$response->send();
$this->bootstrap->shutdown(Bootstrap::RUNLEVEL_RUNTIME);
$this->exit->__invoke();
} | [
"public",
"function",
"handleRequest",
"(",
")",
"{",
"// Create the request very early so the ResourceManagement has a chance to grab it:",
"$",
"request",
"=",
"Request",
"::",
"createFromEnvironment",
"(",
")",
";",
"$",
"response",
"=",
"new",
"Response",
"(",
")",
... | Handles a HTTP request
@return void | [
"Handles",
"a",
"HTTP",
"request"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/RequestHandler.php#L91-L116 |
neos/flow-development-collection | Neos.Flow/Classes/Http/RequestHandler.php | RequestHandler.resolveDependencies | protected function resolveDependencies()
{
$objectManager = $this->bootstrap->getObjectManager();
$this->baseComponentChain = $objectManager->get(ComponentChain::class);
} | php | protected function resolveDependencies()
{
$objectManager = $this->bootstrap->getObjectManager();
$this->baseComponentChain = $objectManager->get(ComponentChain::class);
} | [
"protected",
"function",
"resolveDependencies",
"(",
")",
"{",
"$",
"objectManager",
"=",
"$",
"this",
"->",
"bootstrap",
"->",
"getObjectManager",
"(",
")",
";",
"$",
"this",
"->",
"baseComponentChain",
"=",
"$",
"objectManager",
"->",
"get",
"(",
"ComponentC... | Resolves a few dependencies of this request handler which can't be resolved
automatically due to the early stage of the boot process this request handler
is invoked at.
@return void | [
"Resolves",
"a",
"few",
"dependencies",
"of",
"this",
"request",
"handler",
"which",
"can",
"t",
"be",
"resolved",
"automatically",
"due",
"to",
"the",
"early",
"stage",
"of",
"the",
"boot",
"process",
"this",
"request",
"handler",
"is",
"invoked",
"at",
"."... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/RequestHandler.php#L158-L162 |
neos/flow-development-collection | Neos.Flow/Classes/Http/RequestHandler.php | RequestHandler.addPoweredByHeader | protected function addPoweredByHeader(ResponseInterface $response): ResponseInterface
{
$token = static::prepareApplicationToken($this->bootstrap->getObjectManager());
if ($token === '') {
return $response;
}
return $response->withAddedHeader('X-Flow-Powered', $token);
} | php | protected function addPoweredByHeader(ResponseInterface $response): ResponseInterface
{
$token = static::prepareApplicationToken($this->bootstrap->getObjectManager());
if ($token === '') {
return $response;
}
return $response->withAddedHeader('X-Flow-Powered', $token);
} | [
"protected",
"function",
"addPoweredByHeader",
"(",
"ResponseInterface",
"$",
"response",
")",
":",
"ResponseInterface",
"{",
"$",
"token",
"=",
"static",
"::",
"prepareApplicationToken",
"(",
"$",
"this",
"->",
"bootstrap",
"->",
"getObjectManager",
"(",
")",
")"... | Adds an HTTP header to the Response which indicates that the application is powered by Flow.
@param ResponseInterface $response
@return ResponseInterface
@throws \Neos\Flow\Exception | [
"Adds",
"an",
"HTTP",
"header",
"to",
"the",
"Response",
"which",
"indicates",
"that",
"the",
"application",
"is",
"powered",
"by",
"Flow",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/RequestHandler.php#L171-L179 |
neos/flow-development-collection | Neos.Flow/Classes/Http/RequestHandler.php | RequestHandler.prepareApplicationToken | public static function prepareApplicationToken(ObjectManagerInterface $objectManager): string
{
$configurationManager = $objectManager->get(ConfigurationManager::class);
$tokenSetting = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.http.applicationToken');
if (!in_array($tokenSetting, ['ApplicationName', 'MinorVersion', 'MajorVersion'])) {
return '';
}
$applicationPackageKey = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.core.applicationPackageKey');
$applicationName = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.core.applicationName');
$applicationIsNotFlow = ($applicationPackageKey !== 'Neos.Flow');
if ($tokenSetting === 'ApplicationName') {
return 'Flow' . ($applicationIsNotFlow ? ' ' . $applicationName : '');
}
$packageManager = $objectManager->get(PackageManager::class);
$flowPackage = $packageManager->getPackage('Neos.Flow');
$applicationPackage = $applicationIsNotFlow ? $packageManager->getPackage($applicationPackageKey) : null;
// At this point the $tokenSetting must be either "MinorVersion" or "MajorVersion" so lets use it.
$versionRenderer = 'render' . $tokenSetting;
$flowVersion = static::$versionRenderer($flowPackage->getInstalledVersion());
$applicationVersion = $applicationIsNotFlow ? static::$versionRenderer($applicationPackage->getInstalledVersion()) : null;
return 'Flow/' . ($flowVersion ?: 'dev') . ($applicationIsNotFlow ? ' ' . $applicationName . '/' . ($applicationVersion ?: 'dev') : '');
} | php | public static function prepareApplicationToken(ObjectManagerInterface $objectManager): string
{
$configurationManager = $objectManager->get(ConfigurationManager::class);
$tokenSetting = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.http.applicationToken');
if (!in_array($tokenSetting, ['ApplicationName', 'MinorVersion', 'MajorVersion'])) {
return '';
}
$applicationPackageKey = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.core.applicationPackageKey');
$applicationName = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.core.applicationName');
$applicationIsNotFlow = ($applicationPackageKey !== 'Neos.Flow');
if ($tokenSetting === 'ApplicationName') {
return 'Flow' . ($applicationIsNotFlow ? ' ' . $applicationName : '');
}
$packageManager = $objectManager->get(PackageManager::class);
$flowPackage = $packageManager->getPackage('Neos.Flow');
$applicationPackage = $applicationIsNotFlow ? $packageManager->getPackage($applicationPackageKey) : null;
// At this point the $tokenSetting must be either "MinorVersion" or "MajorVersion" so lets use it.
$versionRenderer = 'render' . $tokenSetting;
$flowVersion = static::$versionRenderer($flowPackage->getInstalledVersion());
$applicationVersion = $applicationIsNotFlow ? static::$versionRenderer($applicationPackage->getInstalledVersion()) : null;
return 'Flow/' . ($flowVersion ?: 'dev') . ($applicationIsNotFlow ? ' ' . $applicationName . '/' . ($applicationVersion ?: 'dev') : '');
} | [
"public",
"static",
"function",
"prepareApplicationToken",
"(",
"ObjectManagerInterface",
"$",
"objectManager",
")",
":",
"string",
"{",
"$",
"configurationManager",
"=",
"$",
"objectManager",
"->",
"get",
"(",
"ConfigurationManager",
"::",
"class",
")",
";",
"$",
... | Generate an application information header for the response based on settings and package versions.
Will statically compile in production for performance benefits.
@param ObjectManagerInterface $objectManager
@return string
@throws \Neos\Flow\Configuration\Exception\InvalidConfigurationTypeException
@Flow\CompileStatic | [
"Generate",
"an",
"application",
"information",
"header",
"for",
"the",
"response",
"based",
"on",
"settings",
"and",
"package",
"versions",
".",
"Will",
"statically",
"compile",
"in",
"production",
"for",
"performance",
"benefits",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Http/RequestHandler.php#L214-L242 |
neos/flow-development-collection | Neos.Flow/Classes/Property/TypeConverter/SessionConverter.php | SessionConverter.canConvertFrom | public function canConvertFrom($source, $targetType)
{
return (preg_match(self::PATTERN_MATCH_SESSIONIDENTIFIER, $source) === 1) && ($targetType === $this->targetType);
} | php | public function canConvertFrom($source, $targetType)
{
return (preg_match(self::PATTERN_MATCH_SESSIONIDENTIFIER, $source) === 1) && ($targetType === $this->targetType);
} | [
"public",
"function",
"canConvertFrom",
"(",
"$",
"source",
",",
"$",
"targetType",
")",
"{",
"return",
"(",
"preg_match",
"(",
"self",
"::",
"PATTERN_MATCH_SESSIONIDENTIFIER",
",",
"$",
"source",
")",
"===",
"1",
")",
"&&",
"(",
"$",
"targetType",
"===",
... | This implementation always returns true for this method.
@param mixed $source the source data
@param string $targetType the type to convert to.
@return boolean true if this TypeConverter can convert from $source to $targetType, false otherwise.
@api | [
"This",
"implementation",
"always",
"returns",
"true",
"for",
"this",
"method",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Property/TypeConverter/SessionConverter.php#L64-L67 |
neos/flow-development-collection | Neos.Flow/Classes/Property/TypeConverter/SessionConverter.php | SessionConverter.convertFrom | public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
{
return $this->sessionManager->getSession($source);
} | php | public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
{
return $this->sessionManager->getSession($source);
} | [
"public",
"function",
"convertFrom",
"(",
"$",
"source",
",",
"$",
"targetType",
",",
"array",
"$",
"convertedChildProperties",
"=",
"[",
"]",
",",
"PropertyMappingConfigurationInterface",
"$",
"configuration",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",... | Convert a session identifier from $source to a Session object
@param string $source
@param string $targetType
@param array $convertedChildProperties
@param PropertyMappingConfigurationInterface $configuration
@return object the target type
@throws InvalidTargetException
@throws \InvalidArgumentException | [
"Convert",
"a",
"session",
"identifier",
"from",
"$source",
"to",
"a",
"Session",
"object"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Property/TypeConverter/SessionConverter.php#L80-L83 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.setObjects | public function setObjects(array $objects)
{
$this->objects = $objects;
$this->objects[ObjectManagerInterface::class]['i'] = $this;
$this->objects[get_class($this)]['i'] = $this;
} | php | public function setObjects(array $objects)
{
$this->objects = $objects;
$this->objects[ObjectManagerInterface::class]['i'] = $this;
$this->objects[get_class($this)]['i'] = $this;
} | [
"public",
"function",
"setObjects",
"(",
"array",
"$",
"objects",
")",
"{",
"$",
"this",
"->",
"objects",
"=",
"$",
"objects",
";",
"$",
"this",
"->",
"objects",
"[",
"ObjectManagerInterface",
"::",
"class",
"]",
"[",
"'i'",
"]",
"=",
"$",
"this",
";",... | Sets the objects array
@param array $objects An array of object names and some information about each registered object (scope, lower cased name etc.)
@return void | [
"Sets",
"the",
"objects",
"array"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L100-L105 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.isRegistered | public function isRegistered($objectName)
{
if (isset($this->objects[$objectName])) {
return true;
}
if ($objectName[0] === '\\') {
throw new \InvalidArgumentException('Object names must not start with a backslash ("' . $objectName . '")', 1270827335);
}
return false;
} | php | public function isRegistered($objectName)
{
if (isset($this->objects[$objectName])) {
return true;
}
if ($objectName[0] === '\\') {
throw new \InvalidArgumentException('Object names must not start with a backslash ("' . $objectName . '")', 1270827335);
}
return false;
} | [
"public",
"function",
"isRegistered",
"(",
"$",
"objectName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"objectName",
"[",
"0",
"]",
"===... | Returns true if an object with the given name is registered
@param string $objectName Name of the object
@return boolean true if the object has been registered, otherwise false
@throws \InvalidArgumentException
@api | [
"Returns",
"true",
"if",
"an",
"object",
"with",
"the",
"given",
"name",
"is",
"registered"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L137-L147 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.registerShutdownObject | public function registerShutdownObject($object, $shutdownLifecycleMethodName)
{
if (strpos(get_class($object), 'Neos\Flow\\') === 0) {
$this->internalShutdownObjects[$object] = $shutdownLifecycleMethodName;
} else {
$this->shutdownObjects[$object] = $shutdownLifecycleMethodName;
}
} | php | public function registerShutdownObject($object, $shutdownLifecycleMethodName)
{
if (strpos(get_class($object), 'Neos\Flow\\') === 0) {
$this->internalShutdownObjects[$object] = $shutdownLifecycleMethodName;
} else {
$this->shutdownObjects[$object] = $shutdownLifecycleMethodName;
}
} | [
"public",
"function",
"registerShutdownObject",
"(",
"$",
"object",
",",
"$",
"shutdownLifecycleMethodName",
")",
"{",
"if",
"(",
"strpos",
"(",
"get_class",
"(",
"$",
"object",
")",
",",
"'Neos\\Flow\\\\'",
")",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"i... | Registers the passed shutdown lifecycle method for the given object
@param object $object The object to register the shutdown method for
@param string $shutdownLifecycleMethodName The method name of the shutdown method to be called
@return void
@api | [
"Registers",
"the",
"passed",
"shutdown",
"lifecycle",
"method",
"for",
"the",
"given",
"object"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L169-L176 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.get | public function get($objectName)
{
// XXX: This is a b/c fix for the deprecation of doctrine ObjectManager. Remove this with Flow 6.0
if ($objectName === \Doctrine\Common\Persistence\ObjectManager::class) {
$objectName = \Doctrine\ORM\EntityManagerInterface::class;
}
if (func_num_args() > 1 && isset($this->objects[$objectName]) && $this->objects[$objectName]['s'] !== ObjectConfiguration::SCOPE_PROTOTYPE) {
throw new \InvalidArgumentException('You cannot provide constructor arguments for singleton objects via get(). If you need to pass arguments to the constructor, define them in the Objects.yaml configuration.', 1298049934);
}
if (isset($this->objects[$objectName]['i'])) {
return $this->objects[$objectName]['i'];
}
if (isset($this->objects[$objectName]['f'])) {
if ($this->objects[$objectName]['s'] === ObjectConfiguration::SCOPE_PROTOTYPE) {
return $this->buildObjectByFactory($objectName);
}
$this->objects[$objectName]['i'] = $this->buildObjectByFactory($objectName);
return $this->objects[$objectName]['i'];
}
$className = $this->getClassNameByObjectName($objectName);
if ($className === false) {
$hint = ($objectName[0] === '\\') ? ' Hint: You specified an object name with a leading backslash!' : '';
throw new Exception\UnknownObjectException('Object "' . $objectName . '" is not registered.' . $hint, 1264589155);
}
if (!isset($this->objects[$objectName]) || $this->objects[$objectName]['s'] === ObjectConfiguration::SCOPE_PROTOTYPE) {
return $this->instantiateClass($className, array_slice(func_get_args(), 1));
}
$this->objects[$objectName]['i'] = $this->instantiateClass($className, []);
return $this->objects[$objectName]['i'];
} | php | public function get($objectName)
{
// XXX: This is a b/c fix for the deprecation of doctrine ObjectManager. Remove this with Flow 6.0
if ($objectName === \Doctrine\Common\Persistence\ObjectManager::class) {
$objectName = \Doctrine\ORM\EntityManagerInterface::class;
}
if (func_num_args() > 1 && isset($this->objects[$objectName]) && $this->objects[$objectName]['s'] !== ObjectConfiguration::SCOPE_PROTOTYPE) {
throw new \InvalidArgumentException('You cannot provide constructor arguments for singleton objects via get(). If you need to pass arguments to the constructor, define them in the Objects.yaml configuration.', 1298049934);
}
if (isset($this->objects[$objectName]['i'])) {
return $this->objects[$objectName]['i'];
}
if (isset($this->objects[$objectName]['f'])) {
if ($this->objects[$objectName]['s'] === ObjectConfiguration::SCOPE_PROTOTYPE) {
return $this->buildObjectByFactory($objectName);
}
$this->objects[$objectName]['i'] = $this->buildObjectByFactory($objectName);
return $this->objects[$objectName]['i'];
}
$className = $this->getClassNameByObjectName($objectName);
if ($className === false) {
$hint = ($objectName[0] === '\\') ? ' Hint: You specified an object name with a leading backslash!' : '';
throw new Exception\UnknownObjectException('Object "' . $objectName . '" is not registered.' . $hint, 1264589155);
}
if (!isset($this->objects[$objectName]) || $this->objects[$objectName]['s'] === ObjectConfiguration::SCOPE_PROTOTYPE) {
return $this->instantiateClass($className, array_slice(func_get_args(), 1));
}
$this->objects[$objectName]['i'] = $this->instantiateClass($className, []);
return $this->objects[$objectName]['i'];
} | [
"public",
"function",
"get",
"(",
"$",
"objectName",
")",
"{",
"// XXX: This is a b/c fix for the deprecation of doctrine ObjectManager. Remove this with Flow 6.0",
"if",
"(",
"$",
"objectName",
"===",
"\\",
"Doctrine",
"\\",
"Common",
"\\",
"Persistence",
"\\",
"ObjectMana... | Returns a fresh or existing instance of the object specified by $objectName.
@param string $objectName The name of the object to return an instance of
@return object The object instance
@throws Exception\UnknownObjectException if an object with the given name does not exist
@throws \InvalidArgumentException
@api | [
"Returns",
"a",
"fresh",
"or",
"existing",
"instance",
"of",
"the",
"object",
"specified",
"by",
"$objectName",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L187-L223 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.getScope | public function getScope($objectName)
{
if (!isset($this->objects[$objectName])) {
$hint = ($objectName[0] === '\\') ? ' Hint: You specified an object name with a leading backslash!' : '';
throw new Exception\UnknownObjectException('Object "' . $objectName . '" is not registered.' . $hint, 1265367590);
}
return $this->objects[$objectName]['s'];
} | php | public function getScope($objectName)
{
if (!isset($this->objects[$objectName])) {
$hint = ($objectName[0] === '\\') ? ' Hint: You specified an object name with a leading backslash!' : '';
throw new Exception\UnknownObjectException('Object "' . $objectName . '" is not registered.' . $hint, 1265367590);
}
return $this->objects[$objectName]['s'];
} | [
"public",
"function",
"getScope",
"(",
"$",
"objectName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
")",
")",
"{",
"$",
"hint",
"=",
"(",
"$",
"objectName",
"[",
"0",
"]",
"===",
"'\\\\'",
... | Returns the scope of the specified object.
@param string $objectName The object name
@return integer One of the Configuration::SCOPE_ constants
@throws Exception\UnknownObjectException
@api | [
"Returns",
"the",
"scope",
"of",
"the",
"specified",
"object",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L233-L240 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.getCaseSensitiveObjectName | public function getCaseSensitiveObjectName($caseInsensitiveObjectName)
{
$lowerCasedObjectName = ltrim(strtolower($caseInsensitiveObjectName), '\\');
if (isset($this->cachedLowerCasedObjectNames[$lowerCasedObjectName])) {
return $this->cachedLowerCasedObjectNames[$lowerCasedObjectName];
}
foreach ($this->objects as $objectName => $information) {
if (isset($information['l']) && $information['l'] === $lowerCasedObjectName) {
$this->cachedLowerCasedObjectNames[$lowerCasedObjectName] = $objectName;
return $objectName;
}
}
return false;
} | php | public function getCaseSensitiveObjectName($caseInsensitiveObjectName)
{
$lowerCasedObjectName = ltrim(strtolower($caseInsensitiveObjectName), '\\');
if (isset($this->cachedLowerCasedObjectNames[$lowerCasedObjectName])) {
return $this->cachedLowerCasedObjectNames[$lowerCasedObjectName];
}
foreach ($this->objects as $objectName => $information) {
if (isset($information['l']) && $information['l'] === $lowerCasedObjectName) {
$this->cachedLowerCasedObjectNames[$lowerCasedObjectName] = $objectName;
return $objectName;
}
}
return false;
} | [
"public",
"function",
"getCaseSensitiveObjectName",
"(",
"$",
"caseInsensitiveObjectName",
")",
"{",
"$",
"lowerCasedObjectName",
"=",
"ltrim",
"(",
"strtolower",
"(",
"$",
"caseInsensitiveObjectName",
")",
",",
"'\\\\'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
... | Returns the case sensitive object name of an object specified by a
case insensitive object name. If no object of that name exists,
false is returned.
In general, the case sensitive variant is used everywhere in Flow,
however there might be special situations in which the
case sensitive name is not available. This method helps you in these
rare cases.
@param string $caseInsensitiveObjectName The object name in lower-, upper- or mixed case
@return mixed Either the mixed case object name or false if no object of that name was found.
@api | [
"Returns",
"the",
"case",
"sensitive",
"object",
"name",
"of",
"an",
"object",
"specified",
"by",
"a",
"case",
"insensitive",
"object",
"name",
".",
"If",
"no",
"object",
"of",
"that",
"name",
"exists",
"false",
"is",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L256-L271 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.getObjectNameByClassName | public function getObjectNameByClassName($className)
{
if (isset($this->objects[$className]) && (!isset($this->objects[$className]['c']) || $this->objects[$className]['c'] === $className)) {
return $className;
}
foreach ($this->objects as $objectName => $information) {
if (isset($information['c']) && $information['c'] === $className) {
return $objectName;
}
}
if ($className[0] === '\\') {
throw new \InvalidArgumentException('Class names must not start with a backslash ("' . $className . '")', 1270826088);
}
return false;
} | php | public function getObjectNameByClassName($className)
{
if (isset($this->objects[$className]) && (!isset($this->objects[$className]['c']) || $this->objects[$className]['c'] === $className)) {
return $className;
}
foreach ($this->objects as $objectName => $information) {
if (isset($information['c']) && $information['c'] === $className) {
return $objectName;
}
}
if ($className[0] === '\\') {
throw new \InvalidArgumentException('Class names must not start with a backslash ("' . $className . '")', 1270826088);
}
return false;
} | [
"public",
"function",
"getObjectNameByClassName",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"className",
"]",
")",
"&&",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"className"... | Returns the object name corresponding to a given class name.
@param string $className The class name
@return string The object name corresponding to the given class name or false if no object is configured to use that class
@throws \InvalidArgumentException
@api | [
"Returns",
"the",
"object",
"name",
"corresponding",
"to",
"a",
"given",
"class",
"name",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L281-L297 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.getClassNameByObjectName | public function getClassNameByObjectName($objectName)
{
if (!isset($this->objects[$objectName])) {
return (class_exists($objectName)) ? $objectName : false;
}
return (isset($this->objects[$objectName]['c']) ? $this->objects[$objectName]['c'] : $objectName);
} | php | public function getClassNameByObjectName($objectName)
{
if (!isset($this->objects[$objectName])) {
return (class_exists($objectName)) ? $objectName : false;
}
return (isset($this->objects[$objectName]['c']) ? $this->objects[$objectName]['c'] : $objectName);
} | [
"public",
"function",
"getClassNameByObjectName",
"(",
"$",
"objectName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
")",
")",
"{",
"return",
"(",
"class_exists",
"(",
"$",
"objectName",
")",
")",
... | Returns the implementation class name for the specified object
@param string $objectName The object name
@return string The class name corresponding to the given object name or false if no such object is registered
@api | [
"Returns",
"the",
"implementation",
"class",
"name",
"for",
"the",
"specified",
"object"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L306-L312 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.getPackageKeyByObjectName | public function getPackageKeyByObjectName($objectName)
{
return (isset($this->objects[$objectName]) ? $this->objects[$objectName]['p'] : false);
} | php | public function getPackageKeyByObjectName($objectName)
{
return (isset($this->objects[$objectName]) ? $this->objects[$objectName]['p'] : false);
} | [
"public",
"function",
"getPackageKeyByObjectName",
"(",
"$",
"objectName",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
")",
"?",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
"[",
"'p'",
... | Returns the key of the package the specified object is contained in.
@param string $objectName The object name
@return string The package key or false if no such object exists
@api | [
"Returns",
"the",
"key",
"of",
"the",
"package",
"the",
"specified",
"object",
"is",
"contained",
"in",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L321-L324 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.setInstance | public function setInstance($objectName, $instance)
{
if (!isset($this->objects[$objectName])) {
if (!class_exists($objectName, false)) {
throw new Exception\UnknownObjectException('Cannot set instance of object "' . $objectName . '" because the object or class name is unknown to the Object Manager.', 1265370539);
} else {
throw new Exception\WrongScopeException('Cannot set instance of class "' . $objectName . '" because no matching object configuration was found. Classes which exist but are not registered are considered to be of scope prototype. However, setInstance() only accepts "session" and "singleton" instances. Check your object configuration and class name spellings.', 12653705341);
}
}
if ($this->objects[$objectName]['s'] === ObjectConfiguration::SCOPE_PROTOTYPE) {
throw new Exception\WrongScopeException('Cannot set instance of object "' . $objectName . '" because it is of scope prototype. Only session and singleton instances can be set.', 1265370540);
}
$this->objects[$objectName]['i'] = $instance;
} | php | public function setInstance($objectName, $instance)
{
if (!isset($this->objects[$objectName])) {
if (!class_exists($objectName, false)) {
throw new Exception\UnknownObjectException('Cannot set instance of object "' . $objectName . '" because the object or class name is unknown to the Object Manager.', 1265370539);
} else {
throw new Exception\WrongScopeException('Cannot set instance of class "' . $objectName . '" because no matching object configuration was found. Classes which exist but are not registered are considered to be of scope prototype. However, setInstance() only accepts "session" and "singleton" instances. Check your object configuration and class name spellings.', 12653705341);
}
}
if ($this->objects[$objectName]['s'] === ObjectConfiguration::SCOPE_PROTOTYPE) {
throw new Exception\WrongScopeException('Cannot set instance of object "' . $objectName . '" because it is of scope prototype. Only session and singleton instances can be set.', 1265370540);
}
$this->objects[$objectName]['i'] = $instance;
} | [
"public",
"function",
"setInstance",
"(",
"$",
"objectName",
",",
"$",
"instance",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
")",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"objectName... | Sets the instance of the given object
Objects of scope sessions are assumed to be the real session object, not the
lazy loading proxy.
@param string $objectName The object name
@param object $instance A prebuilt instance
@return void
@throws Exception\WrongScopeException
@throws Exception\UnknownObjectException | [
"Sets",
"the",
"instance",
"of",
"the",
"given",
"object"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L338-L351 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.getInstance | public function getInstance($objectName)
{
return isset($this->objects[$objectName]['i']) ? $this->objects[$objectName]['i'] : null;
} | php | public function getInstance($objectName)
{
return isset($this->objects[$objectName]['i']) ? $this->objects[$objectName]['i'] : null;
} | [
"public",
"function",
"getInstance",
"(",
"$",
"objectName",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
"[",
"'i'",
"]",
")",
"?",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
"[",
"'i'"... | Returns the instance of the specified object or NULL if no instance has been
registered yet.
@param string $objectName The object name
@return object The object or NULL | [
"Returns",
"the",
"instance",
"of",
"the",
"specified",
"object",
"or",
"NULL",
"if",
"no",
"instance",
"has",
"been",
"registered",
"yet",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L372-L375 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.getLazyDependencyByHash | public function getLazyDependencyByHash($hash, &$propertyReferenceVariable)
{
if (!isset($this->dependencyProxies[$hash])) {
return null;
}
$this->dependencyProxies[$hash]->_addPropertyVariable($propertyReferenceVariable);
return $this->dependencyProxies[$hash];
} | php | public function getLazyDependencyByHash($hash, &$propertyReferenceVariable)
{
if (!isset($this->dependencyProxies[$hash])) {
return null;
}
$this->dependencyProxies[$hash]->_addPropertyVariable($propertyReferenceVariable);
return $this->dependencyProxies[$hash];
} | [
"public",
"function",
"getLazyDependencyByHash",
"(",
"$",
"hash",
",",
"&",
"$",
"propertyReferenceVariable",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"dependencyProxies",
"[",
"$",
"hash",
"]",
")",
")",
"{",
"return",
"null",
";",
"}... | This method is used internally to retrieve either an actual (singleton) instance
of the specified dependency or, if no instance exists yet, a Dependency Proxy
object which automatically triggers the creation of an instance as soon as
it is used the first time.
Internally used by the injectProperties method of generated proxy classes.
@param string $hash
@param mixed &$propertyReferenceVariable Reference of the variable to inject into once the proxy is activated
@return mixed | [
"This",
"method",
"is",
"used",
"internally",
"to",
"retrieve",
"either",
"an",
"actual",
"(",
"singleton",
")",
"instance",
"of",
"the",
"specified",
"dependency",
"or",
"if",
"no",
"instance",
"exists",
"yet",
"a",
"Dependency",
"Proxy",
"object",
"which",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L389-L396 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.createLazyDependency | public function createLazyDependency($hash, &$propertyReferenceVariable, $className, \Closure $builder)
{
$this->dependencyProxies[$hash] = new DependencyProxy($className, $builder);
$this->dependencyProxies[$hash]->_addPropertyVariable($propertyReferenceVariable);
return $this->dependencyProxies[$hash];
} | php | public function createLazyDependency($hash, &$propertyReferenceVariable, $className, \Closure $builder)
{
$this->dependencyProxies[$hash] = new DependencyProxy($className, $builder);
$this->dependencyProxies[$hash]->_addPropertyVariable($propertyReferenceVariable);
return $this->dependencyProxies[$hash];
} | [
"public",
"function",
"createLazyDependency",
"(",
"$",
"hash",
",",
"&",
"$",
"propertyReferenceVariable",
",",
"$",
"className",
",",
"\\",
"Closure",
"$",
"builder",
")",
"{",
"$",
"this",
"->",
"dependencyProxies",
"[",
"$",
"hash",
"]",
"=",
"new",
"D... | Creates a new DependencyProxy class for a dependency built through code
identified through "hash" for a dependency of class $className. The
closure in $builder contains code for actually creating the dependency
instance once it needs to be materialized.
Internally used by the injectProperties method of generated proxy classes.
@param string $hash An md5 hash over the code needed to actually build the dependency instance
@param string &$propertyReferenceVariable A first variable where the dependency needs to be injected into
@param string $className Name of the class of the dependency which eventually will be instantiated
@param \Closure $builder An anonymous function which creates the instance to be injected
@return DependencyProxy | [
"Creates",
"a",
"new",
"DependencyProxy",
"class",
"for",
"a",
"dependency",
"built",
"through",
"code",
"identified",
"through",
"hash",
"for",
"a",
"dependency",
"of",
"class",
"$className",
".",
"The",
"closure",
"in",
"$builder",
"contains",
"code",
"for",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L412-L417 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.getSessionInstances | public function getSessionInstances()
{
$sessionObjects = [];
foreach ($this->objects as $information) {
if (isset($information['i']) && $information['s'] === ObjectConfiguration::SCOPE_SESSION) {
$sessionObjects[] = $information['i'];
}
}
return $sessionObjects;
} | php | public function getSessionInstances()
{
$sessionObjects = [];
foreach ($this->objects as $information) {
if (isset($information['i']) && $information['s'] === ObjectConfiguration::SCOPE_SESSION) {
$sessionObjects[] = $information['i'];
}
}
return $sessionObjects;
} | [
"public",
"function",
"getSessionInstances",
"(",
")",
"{",
"$",
"sessionObjects",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"objects",
"as",
"$",
"information",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"information",
"[",
"'i'",
"]",
")",
... | Returns all instances of objects with scope session
@return array | [
"Returns",
"all",
"instances",
"of",
"objects",
"with",
"scope",
"session"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L440-L449 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.shutdown | public function shutdown()
{
$this->callShutdownMethods($this->shutdownObjects);
$securityContext = $this->get(Context::class);
/** @var Context $securityContext */
if ($securityContext->isInitialized()) {
$this->get(Context::class)->withoutAuthorizationChecks(function () {
$this->callShutdownMethods($this->internalShutdownObjects);
});
} else {
$this->callShutdownMethods($this->internalShutdownObjects);
}
} | php | public function shutdown()
{
$this->callShutdownMethods($this->shutdownObjects);
$securityContext = $this->get(Context::class);
/** @var Context $securityContext */
if ($securityContext->isInitialized()) {
$this->get(Context::class)->withoutAuthorizationChecks(function () {
$this->callShutdownMethods($this->internalShutdownObjects);
});
} else {
$this->callShutdownMethods($this->internalShutdownObjects);
}
} | [
"public",
"function",
"shutdown",
"(",
")",
"{",
"$",
"this",
"->",
"callShutdownMethods",
"(",
"$",
"this",
"->",
"shutdownObjects",
")",
";",
"$",
"securityContext",
"=",
"$",
"this",
"->",
"get",
"(",
"Context",
"::",
"class",
")",
";",
"/** @var Contex... | Shuts down this Object Container by calling the shutdown methods of all
object instances which were configured to be shut down.
@return void | [
"Shuts",
"down",
"this",
"Object",
"Container",
"by",
"calling",
"the",
"shutdown",
"methods",
"of",
"all",
"object",
"instances",
"which",
"were",
"configured",
"to",
"be",
"shut",
"down",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L457-L470 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.buildObjectByFactory | protected function buildObjectByFactory($objectName)
{
$configurationManager = $this->get(ConfigurationManager::class);
$factory = $this->get($this->objects[$objectName]['f'][0]);
$factoryMethodName = $this->objects[$objectName]['f'][1];
$factoryMethodArguments = [];
foreach ($this->objects[$objectName]['fa'] as $index => $argumentInformation) {
switch ($argumentInformation['t']) {
case ObjectConfigurationArgument::ARGUMENT_TYPES_SETTING:
$factoryMethodArguments[$index] = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $argumentInformation['v']);
break;
case ObjectConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE:
$factoryMethodArguments[$index] = $argumentInformation['v'];
break;
case ObjectConfigurationArgument::ARGUMENT_TYPES_OBJECT:
$factoryMethodArguments[$index] = $this->get($argumentInformation['v']);
break;
}
}
if (count($factoryMethodArguments) === 0) {
return $factory->$factoryMethodName();
} else {
return call_user_func_array([$factory, $factoryMethodName], $factoryMethodArguments);
}
} | php | protected function buildObjectByFactory($objectName)
{
$configurationManager = $this->get(ConfigurationManager::class);
$factory = $this->get($this->objects[$objectName]['f'][0]);
$factoryMethodName = $this->objects[$objectName]['f'][1];
$factoryMethodArguments = [];
foreach ($this->objects[$objectName]['fa'] as $index => $argumentInformation) {
switch ($argumentInformation['t']) {
case ObjectConfigurationArgument::ARGUMENT_TYPES_SETTING:
$factoryMethodArguments[$index] = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $argumentInformation['v']);
break;
case ObjectConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE:
$factoryMethodArguments[$index] = $argumentInformation['v'];
break;
case ObjectConfigurationArgument::ARGUMENT_TYPES_OBJECT:
$factoryMethodArguments[$index] = $this->get($argumentInformation['v']);
break;
}
}
if (count($factoryMethodArguments) === 0) {
return $factory->$factoryMethodName();
} else {
return call_user_func_array([$factory, $factoryMethodName], $factoryMethodArguments);
}
} | [
"protected",
"function",
"buildObjectByFactory",
"(",
"$",
"objectName",
")",
"{",
"$",
"configurationManager",
"=",
"$",
"this",
"->",
"get",
"(",
"ConfigurationManager",
"::",
"class",
")",
";",
"$",
"factory",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"t... | Invokes the Factory defined in the object configuration of the specified object in order
to build an instance. Arguments which were defined in the object configuration are
passed to the factory method.
@param string $objectName Name of the object to build
@return object The built object | [
"Invokes",
"the",
"Factory",
"defined",
"in",
"the",
"object",
"configuration",
"of",
"the",
"specified",
"object",
"in",
"order",
"to",
"build",
"an",
"instance",
".",
"Arguments",
"which",
"were",
"defined",
"in",
"the",
"object",
"configuration",
"are",
"pa... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L503-L529 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.instantiateClass | protected function instantiateClass($className, array $arguments)
{
if (isset($this->classesBeingInstantiated[$className])) {
throw new Exception\CannotBuildObjectException('Circular dependency detected while trying to instantiate class "' . $className . '".', 1168505928);
}
try {
$object = ObjectAccess::instantiateClass($className, $arguments);
unset($this->classesBeingInstantiated[$className]);
return $object;
} catch (\Exception $exception) {
unset($this->classesBeingInstantiated[$className]);
throw $exception;
}
} | php | protected function instantiateClass($className, array $arguments)
{
if (isset($this->classesBeingInstantiated[$className])) {
throw new Exception\CannotBuildObjectException('Circular dependency detected while trying to instantiate class "' . $className . '".', 1168505928);
}
try {
$object = ObjectAccess::instantiateClass($className, $arguments);
unset($this->classesBeingInstantiated[$className]);
return $object;
} catch (\Exception $exception) {
unset($this->classesBeingInstantiated[$className]);
throw $exception;
}
} | [
"protected",
"function",
"instantiateClass",
"(",
"$",
"className",
",",
"array",
"$",
"arguments",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"classesBeingInstantiated",
"[",
"$",
"className",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"\... | Speed optimized alternative to ReflectionClass::newInstanceArgs()
@param string $className Name of the class to instantiate
@param array $arguments Arguments to pass to the constructor
@return object The object
@throws Exception\CannotBuildObjectException
@throws \Exception | [
"Speed",
"optimized",
"alternative",
"to",
"ReflectionClass",
"::",
"newInstanceArgs",
"()"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L540-L554 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/ObjectManager.php | ObjectManager.callShutdownMethods | protected function callShutdownMethods(\SplObjectStorage $shutdownObjects)
{
foreach ($shutdownObjects as $object) {
$methodName = $shutdownObjects[$object];
$object->$methodName();
}
} | php | protected function callShutdownMethods(\SplObjectStorage $shutdownObjects)
{
foreach ($shutdownObjects as $object) {
$methodName = $shutdownObjects[$object];
$object->$methodName();
}
} | [
"protected",
"function",
"callShutdownMethods",
"(",
"\\",
"SplObjectStorage",
"$",
"shutdownObjects",
")",
"{",
"foreach",
"(",
"$",
"shutdownObjects",
"as",
"$",
"object",
")",
"{",
"$",
"methodName",
"=",
"$",
"shutdownObjects",
"[",
"$",
"object",
"]",
";"... | Executes the methods of the provided objects.
@param \SplObjectStorage $shutdownObjects
@return void | [
"Executes",
"the",
"methods",
"of",
"the",
"provided",
"objects",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/ObjectManager.php#L562-L568 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Repository.php | Repository.add | public function add($object)
{
if (!is_object($object) || !($object instanceof $this->objectType)) {
$type = (is_object($object) ? get_class($object) : gettype($object));
throw new IllegalObjectTypeException('The value given to add() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->objectType . ' instances.', 1517408062);
}
$this->entityManager->persist($object);
} | php | public function add($object)
{
if (!is_object($object) || !($object instanceof $this->objectType)) {
$type = (is_object($object) ? get_class($object) : gettype($object));
throw new IllegalObjectTypeException('The value given to add() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->objectType . ' instances.', 1517408062);
}
$this->entityManager->persist($object);
} | [
"public",
"function",
"add",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
"||",
"!",
"(",
"$",
"object",
"instanceof",
"$",
"this",
"->",
"objectType",
")",
")",
"{",
"$",
"type",
"=",
"(",
"is_object",
"(",
... | Adds an object to this repository.
@param object $object The object to add
@return void
@throws IllegalObjectTypeException
@api | [
"Adds",
"an",
"object",
"to",
"this",
"repository",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Repository.php#L94-L101 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Repository.php | Repository.remove | public function remove($object)
{
if (!is_object($object) || !($object instanceof $this->objectType)) {
$type = (is_object($object) ? get_class($object) : gettype($object));
throw new IllegalObjectTypeException('The value given to remove() was ' . $type . ' , however the ' . get_class($this) . ' can only handle ' . $this->objectType . ' instances.', 1517408067);
}
$this->entityManager->remove($object);
} | php | public function remove($object)
{
if (!is_object($object) || !($object instanceof $this->objectType)) {
$type = (is_object($object) ? get_class($object) : gettype($object));
throw new IllegalObjectTypeException('The value given to remove() was ' . $type . ' , however the ' . get_class($this) . ' can only handle ' . $this->objectType . ' instances.', 1517408067);
}
$this->entityManager->remove($object);
} | [
"public",
"function",
"remove",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
"||",
"!",
"(",
"$",
"object",
"instanceof",
"$",
"this",
"->",
"objectType",
")",
")",
"{",
"$",
"type",
"=",
"(",
"is_object",
"("... | Removes an object from this repository.
@param object $object The object to remove
@return void
@throws IllegalObjectTypeException
@api | [
"Removes",
"an",
"object",
"from",
"this",
"repository",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Repository.php#L111-L118 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Repository.php | Repository.createQuery | public function createQuery()
{
$query = new Query($this->objectType);
if ($this->defaultOrderings) {
$query->setOrderings($this->defaultOrderings);
}
return $query;
} | php | public function createQuery()
{
$query = new Query($this->objectType);
if ($this->defaultOrderings) {
$query->setOrderings($this->defaultOrderings);
}
return $query;
} | [
"public",
"function",
"createQuery",
"(",
")",
"{",
"$",
"query",
"=",
"new",
"Query",
"(",
"$",
"this",
"->",
"objectType",
")",
";",
"if",
"(",
"$",
"this",
"->",
"defaultOrderings",
")",
"{",
"$",
"query",
"->",
"setOrderings",
"(",
"$",
"this",
"... | Returns a query for objects of this repository
@return Query
@api | [
"Returns",
"a",
"query",
"for",
"objects",
"of",
"this",
"repository"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Repository.php#L187-L194 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/Repository.php | Repository.update | public function update($object)
{
if (!($object instanceof $this->objectType)) {
throw new IllegalObjectTypeException('The modified object given to update() was not of the type (' . $this->objectType . ') this repository manages.', 1249479625);
}
$this->persistenceManager->update($object);
} | php | public function update($object)
{
if (!($object instanceof $this->objectType)) {
throw new IllegalObjectTypeException('The modified object given to update() was not of the type (' . $this->objectType . ') this repository manages.', 1249479625);
}
$this->persistenceManager->update($object);
} | [
"public",
"function",
"update",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"object",
"instanceof",
"$",
"this",
"->",
"objectType",
")",
")",
"{",
"throw",
"new",
"IllegalObjectTypeException",
"(",
"'The modified object given to update() was not of th... | Schedules a modified object for persistence.
@param object $object The modified object
@return void
@throws IllegalObjectTypeException
@api | [
"Schedules",
"a",
"modified",
"object",
"for",
"persistence",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/Repository.php#L258-L264 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php | CompileTimeObjectManager.initialize | public function initialize(array $packages)
{
$this->registeredClassNames = $this->registerClassFiles($packages);
$this->reflectionService->buildReflectionData($this->registeredClassNames);
$rawCustomObjectConfigurations = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_OBJECTS);
$configurationBuilder = new ConfigurationBuilder();
$configurationBuilder->injectReflectionService($this->reflectionService);
$configurationBuilder->injectLogger($this->logger);
$this->objectConfigurations = $configurationBuilder->buildObjectConfigurations($this->registeredClassNames, $rawCustomObjectConfigurations);
$this->setObjects($this->buildObjectsArray());
} | php | public function initialize(array $packages)
{
$this->registeredClassNames = $this->registerClassFiles($packages);
$this->reflectionService->buildReflectionData($this->registeredClassNames);
$rawCustomObjectConfigurations = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_OBJECTS);
$configurationBuilder = new ConfigurationBuilder();
$configurationBuilder->injectReflectionService($this->reflectionService);
$configurationBuilder->injectLogger($this->logger);
$this->objectConfigurations = $configurationBuilder->buildObjectConfigurations($this->registeredClassNames, $rawCustomObjectConfigurations);
$this->setObjects($this->buildObjectsArray());
} | [
"public",
"function",
"initialize",
"(",
"array",
"$",
"packages",
")",
"{",
"$",
"this",
"->",
"registeredClassNames",
"=",
"$",
"this",
"->",
"registerClassFiles",
"(",
"$",
"packages",
")",
";",
"$",
"this",
"->",
"reflectionService",
"->",
"buildReflection... | Initializes the the object configurations and some other parts of this Object Manager.
@param PackageInterface[] $packages An array of active packages to consider
@return void | [
"Initializes",
"the",
"the",
"object",
"configurations",
"and",
"some",
"other",
"parts",
"of",
"this",
"Object",
"Manager",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php#L125-L139 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php | CompileTimeObjectManager.setInstance | public function setInstance($objectName, $instance)
{
if ($this->registeredClassNames === []) {
$this->objects[$objectName]['i'] = $instance;
} else {
parent::setInstance($objectName, $instance);
}
} | php | public function setInstance($objectName, $instance)
{
if ($this->registeredClassNames === []) {
$this->objects[$objectName]['i'] = $instance;
} else {
parent::setInstance($objectName, $instance);
}
} | [
"public",
"function",
"setInstance",
"(",
"$",
"objectName",
",",
"$",
"instance",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"registeredClassNames",
"===",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
"[",
"'i'",
"]",
... | Sets the instance of the given object
In the Compile Time Object Manager it is even allowed to set instances of not-yet-known objects as long as the Object
Manager is not initialized, because some few parts need an object registry even before the Object Manager is fully
functional.
@param string $objectName The object name
@param object $instance A prebuilt instance
@return void | [
"Sets",
"the",
"instance",
"of",
"the",
"given",
"object"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php#L152-L159 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php | CompileTimeObjectManager.getClassNamesByScope | public function getClassNamesByScope($scope)
{
if (!isset($this->cachedClassNamesByScope[$scope])) {
foreach ($this->objects as $objectName => $information) {
if ($information['s'] === $scope) {
if (isset($information['c'])) {
$this->cachedClassNamesByScope[$scope][] = $information['c'];
} else {
$this->cachedClassNamesByScope[$scope][] = $objectName;
}
}
}
}
return $this->cachedClassNamesByScope[$scope];
} | php | public function getClassNamesByScope($scope)
{
if (!isset($this->cachedClassNamesByScope[$scope])) {
foreach ($this->objects as $objectName => $information) {
if ($information['s'] === $scope) {
if (isset($information['c'])) {
$this->cachedClassNamesByScope[$scope][] = $information['c'];
} else {
$this->cachedClassNamesByScope[$scope][] = $objectName;
}
}
}
}
return $this->cachedClassNamesByScope[$scope];
} | [
"public",
"function",
"getClassNamesByScope",
"(",
"$",
"scope",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cachedClassNamesByScope",
"[",
"$",
"scope",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"objects",
"as",
"$",
"obje... | Returns a list of class names, which are configured with the given scope
@param integer $scope One of the ObjectConfiguration::SCOPE_ constants
@return array An array of class names configured with the given scope | [
"Returns",
"a",
"list",
"of",
"class",
"names",
"which",
"are",
"configured",
"with",
"the",
"given",
"scope"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php#L177-L191 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php | CompileTimeObjectManager.registerClassFiles | protected function registerClassFiles(array $packages)
{
$includeClassesConfiguration = [];
if (isset($this->allSettings['Neos']['Flow']['object']['includeClasses'])) {
if (!is_array($this->allSettings['Neos']['Flow']['object']['includeClasses'])) {
throw new InvalidConfigurationTypeException('The setting "Neos.Flow.object.includeClasses" is invalid, it must be an array if set. Check the syntax in the YAML file.', 1422357285);
}
$includeClassesConfiguration = $this->allSettings['Neos']['Flow']['object']['includeClasses'];
}
$availableClassNames = ['' => ['DateTime']];
$shouldRegisterFunctionalTestClasses = (bool)($this->allSettings['Neos']['Flow']['object']['registerFunctionalTestClasses'] ?? false);
/** @var \Neos\Flow\Package\PackageInterface $package */
foreach ($packages as $packageKey => $package) {
$packageType = (string)$package->getComposerManifest('type');
if (ComposerUtility::isFlowPackageType($packageType) || isset($includeClassesConfiguration[$packageKey])) {
foreach ($package->getClassFiles() as $fullClassName => $path) {
if (substr($fullClassName, -9, 9) !== 'Exception') {
$availableClassNames[$packageKey][] = $fullClassName;
}
}
if ($package instanceof FlowPackageInterface && $shouldRegisterFunctionalTestClasses) {
foreach ($package->getFunctionalTestsClassFiles() as $fullClassName => $path) {
if (substr($fullClassName, -9, 9) !== 'Exception') {
$availableClassNames[$packageKey][] = $fullClassName;
}
}
}
if (isset($availableClassNames[$packageKey]) && is_array($availableClassNames[$packageKey])) {
$availableClassNames[$packageKey] = array_unique($availableClassNames[$packageKey]);
}
}
}
return $this->filterClassNamesFromConfiguration($availableClassNames, $includeClassesConfiguration);
} | php | protected function registerClassFiles(array $packages)
{
$includeClassesConfiguration = [];
if (isset($this->allSettings['Neos']['Flow']['object']['includeClasses'])) {
if (!is_array($this->allSettings['Neos']['Flow']['object']['includeClasses'])) {
throw new InvalidConfigurationTypeException('The setting "Neos.Flow.object.includeClasses" is invalid, it must be an array if set. Check the syntax in the YAML file.', 1422357285);
}
$includeClassesConfiguration = $this->allSettings['Neos']['Flow']['object']['includeClasses'];
}
$availableClassNames = ['' => ['DateTime']];
$shouldRegisterFunctionalTestClasses = (bool)($this->allSettings['Neos']['Flow']['object']['registerFunctionalTestClasses'] ?? false);
/** @var \Neos\Flow\Package\PackageInterface $package */
foreach ($packages as $packageKey => $package) {
$packageType = (string)$package->getComposerManifest('type');
if (ComposerUtility::isFlowPackageType($packageType) || isset($includeClassesConfiguration[$packageKey])) {
foreach ($package->getClassFiles() as $fullClassName => $path) {
if (substr($fullClassName, -9, 9) !== 'Exception') {
$availableClassNames[$packageKey][] = $fullClassName;
}
}
if ($package instanceof FlowPackageInterface && $shouldRegisterFunctionalTestClasses) {
foreach ($package->getFunctionalTestsClassFiles() as $fullClassName => $path) {
if (substr($fullClassName, -9, 9) !== 'Exception') {
$availableClassNames[$packageKey][] = $fullClassName;
}
}
}
if (isset($availableClassNames[$packageKey]) && is_array($availableClassNames[$packageKey])) {
$availableClassNames[$packageKey] = array_unique($availableClassNames[$packageKey]);
}
}
}
return $this->filterClassNamesFromConfiguration($availableClassNames, $includeClassesConfiguration);
} | [
"protected",
"function",
"registerClassFiles",
"(",
"array",
"$",
"packages",
")",
"{",
"$",
"includeClassesConfiguration",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"allSettings",
"[",
"'Neos'",
"]",
"[",
"'Flow'",
"]",
"[",
"'object... | Traverses through all class files of the active packages and registers collects the class names as
"all available class names". If the respective Flow settings say so, also function test classes
are registered.
For performance reasons this function ignores classes whose name ends with "Exception".
@param array $packages A list of packages to consider
@return array A list of class names which were discovered in the given packages
@throws InvalidConfigurationTypeException | [
"Traverses",
"through",
"all",
"class",
"files",
"of",
"the",
"active",
"packages",
"and",
"registers",
"collects",
"the",
"class",
"names",
"as",
"all",
"available",
"class",
"names",
".",
"If",
"the",
"respective",
"Flow",
"settings",
"say",
"so",
"also",
... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php#L205-L242 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php | CompileTimeObjectManager.applyClassFilterConfiguration | protected function applyClassFilterConfiguration($classNames, $filterConfiguration)
{
foreach ($filterConfiguration as $packageKey => $filterExpressions) {
if (!array_key_exists($packageKey, $classNames)) {
$this->logger->debug('The package "' . $packageKey . '" specified in the setting "Neos.Flow.object.includeClasses" was either excluded or is not loaded.');
continue;
}
if (!is_array($filterExpressions)) {
throw new InvalidConfigurationTypeException('The value given for setting "Neos.Flow.object.includeClasses.\'' . $packageKey . '\'" is invalid. It should be an array of expressions. Check the syntax in the YAML file.', 1422357272);
}
$classesForPackageUnderInspection = $classNames[$packageKey];
$classNames[$packageKey] = [];
foreach ($filterExpressions as $filterExpression) {
$classesForPackageUnderInspection = array_filter(
$classesForPackageUnderInspection,
function ($className) use ($filterExpression) {
$match = preg_match('/' . $filterExpression . '/', $className);
return $match === 1;
}
);
$classNames[$packageKey] = array_merge($classNames[$packageKey], $classesForPackageUnderInspection);
$classesForPackageUnderInspection = $classNames[$packageKey];
}
if ($classNames[$packageKey] === []) {
unset($classNames[$packageKey]);
}
}
return $classNames;
} | php | protected function applyClassFilterConfiguration($classNames, $filterConfiguration)
{
foreach ($filterConfiguration as $packageKey => $filterExpressions) {
if (!array_key_exists($packageKey, $classNames)) {
$this->logger->debug('The package "' . $packageKey . '" specified in the setting "Neos.Flow.object.includeClasses" was either excluded or is not loaded.');
continue;
}
if (!is_array($filterExpressions)) {
throw new InvalidConfigurationTypeException('The value given for setting "Neos.Flow.object.includeClasses.\'' . $packageKey . '\'" is invalid. It should be an array of expressions. Check the syntax in the YAML file.', 1422357272);
}
$classesForPackageUnderInspection = $classNames[$packageKey];
$classNames[$packageKey] = [];
foreach ($filterExpressions as $filterExpression) {
$classesForPackageUnderInspection = array_filter(
$classesForPackageUnderInspection,
function ($className) use ($filterExpression) {
$match = preg_match('/' . $filterExpression . '/', $className);
return $match === 1;
}
);
$classNames[$packageKey] = array_merge($classNames[$packageKey], $classesForPackageUnderInspection);
$classesForPackageUnderInspection = $classNames[$packageKey];
}
if ($classNames[$packageKey] === []) {
unset($classNames[$packageKey]);
}
}
return $classNames;
} | [
"protected",
"function",
"applyClassFilterConfiguration",
"(",
"$",
"classNames",
",",
"$",
"filterConfiguration",
")",
"{",
"foreach",
"(",
"$",
"filterConfiguration",
"as",
"$",
"packageKey",
"=>",
"$",
"filterExpressions",
")",
"{",
"if",
"(",
"!",
"array_key_e... | Filters the classnames available for object management by filter expressions that includes classes.
@param array $classNames All classnames per package
@param array $filterConfiguration The filter configuration to apply
@return array the remaining class
@throws InvalidConfigurationTypeException | [
"Filters",
"the",
"classnames",
"available",
"for",
"object",
"management",
"by",
"filter",
"expressions",
"that",
"includes",
"classes",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php#L268-L300 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php | CompileTimeObjectManager.buildObjectsArray | protected function buildObjectsArray()
{
$objects = [];
foreach ($this->objectConfigurations as $objectConfiguration) {
$objectName = $objectConfiguration->getObjectName();
$objects[$objectName] = [
'l' => strtolower($objectName),
's' => $objectConfiguration->getScope(),
'p' => $objectConfiguration->getPackageKey()
];
if ($objectConfiguration->getClassName() !== $objectName) {
$objects[$objectName]['c'] = $objectConfiguration->getClassName();
}
if ($objectConfiguration->getFactoryObjectName() !== '') {
$objects[$objectName]['f'] = [
$objectConfiguration->getFactoryObjectName(),
$objectConfiguration->getFactoryMethodName()
];
$objects[$objectName]['fa'] = [];
$factoryMethodArguments = $objectConfiguration->getArguments();
if (count($factoryMethodArguments) > 0) {
foreach ($factoryMethodArguments as $index => $argument) {
$objects[$objectName]['fa'][$index] = [
't' => $argument->getType(),
'v' => $argument->getValue()
];
}
}
}
}
$this->configurationCache->set('objects', $objects);
return $objects;
} | php | protected function buildObjectsArray()
{
$objects = [];
foreach ($this->objectConfigurations as $objectConfiguration) {
$objectName = $objectConfiguration->getObjectName();
$objects[$objectName] = [
'l' => strtolower($objectName),
's' => $objectConfiguration->getScope(),
'p' => $objectConfiguration->getPackageKey()
];
if ($objectConfiguration->getClassName() !== $objectName) {
$objects[$objectName]['c'] = $objectConfiguration->getClassName();
}
if ($objectConfiguration->getFactoryObjectName() !== '') {
$objects[$objectName]['f'] = [
$objectConfiguration->getFactoryObjectName(),
$objectConfiguration->getFactoryMethodName()
];
$objects[$objectName]['fa'] = [];
$factoryMethodArguments = $objectConfiguration->getArguments();
if (count($factoryMethodArguments) > 0) {
foreach ($factoryMethodArguments as $index => $argument) {
$objects[$objectName]['fa'][$index] = [
't' => $argument->getType(),
'v' => $argument->getValue()
];
}
}
}
}
$this->configurationCache->set('objects', $objects);
return $objects;
} | [
"protected",
"function",
"buildObjectsArray",
"(",
")",
"{",
"$",
"objects",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"objectConfigurations",
"as",
"$",
"objectConfiguration",
")",
"{",
"$",
"objectName",
"=",
"$",
"objectConfiguration",
"->",
... | Builds the objects array which contains information about the registered objects,
their scope, class, built method etc.
@return array | [
"Builds",
"the",
"objects",
"array",
"which",
"contains",
"information",
"about",
"the",
"registered",
"objects",
"their",
"scope",
"class",
"built",
"method",
"etc",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php#L308-L341 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php | CompileTimeObjectManager.get | public function get($objectName)
{
if (isset($this->objects[$objectName]['i'])) {
return $this->objects[$objectName]['i'];
}
if (isset($this->objectConfigurations[$objectName]) && count($this->objectConfigurations[$objectName]->getArguments()) > 0) {
throw new Exception\CannotBuildObjectException('Cannot build object "' . $objectName . '" because constructor injection is not available in the compile time Object Manager. Refactor your code to use setter injection instead. Configuration source: ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . '. Build stack: ' . implode(', ', $this->objectNameBuildStack), 1297090026);
}
if (!isset($this->objects[$objectName])) {
throw new Exception\UnknownObjectException('Cannot build object "' . $objectName . '" because it is unknown to the compile time Object Manager.', 1301477694);
}
if ($this->objects[$objectName]['s'] !== Configuration::SCOPE_SINGLETON) {
throw new Exception\CannotBuildObjectException('Cannot build object "' . $objectName . '" because the get() method in the compile time Object Manager only supports singletons.', 1297090027);
}
$this->objectNameBuildStack[] = $objectName;
$object = parent::get($objectName);
/** @var Configuration $objectConfiguration */
$objectConfiguration = $this->objectConfigurations[$objectName];
/** @var Property $property */
foreach ($objectConfiguration->getProperties() as $propertyName => $property) {
if ($property->getAutowiring() !== Configuration::AUTOWIRING_MODE_ON) {
continue;
}
switch ($property->getType()) {
case Property::PROPERTY_TYPES_STRAIGHTVALUE:
$value = $property->getValue();
break;
case Property::PROPERTY_TYPES_CONFIGURATION:
$propertyValue = $property->getValue();
$value = $this->configurationManager->getConfiguration($propertyValue['type'], $propertyValue['path']);
break;
case Property::PROPERTY_TYPES_OBJECT:
$propertyObjectName = $property->getValue();
if (!is_string($propertyObjectName)) {
throw new Exception\CannotBuildObjectException('The object definition of "' . $objectName . '::' . $propertyName . '" is too complex for the compile time Object Manager. You can only use plain object names, not factories and the like. Check configuration in ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . ' and objects which depend on ' . $objectName . '.', 1297099659);
}
$value = $this->get($propertyObjectName);
break;
default:
throw new Exception\CannotBuildObjectException('Invalid property type.', 1297090029);
}
if (method_exists($object, $setterMethodName = 'inject' . ucfirst($propertyName))) {
$object->$setterMethodName($value);
} elseif (method_exists($object, $setterMethodName = 'set' . ucfirst($propertyName))) {
$object->$setterMethodName($value);
} else {
throw new Exception\UnresolvedDependenciesException('Could not inject configured property "' . $propertyName . '" into "' . $objectName . '" because no injection method exists, but for compile time use this is required. Configuration source: ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . '.', 1297110953);
}
}
$initializationLifecycleMethodName = $this->objectConfigurations[$objectName]->getLifecycleInitializationMethodName();
if (method_exists($object, $initializationLifecycleMethodName)) {
$object->$initializationLifecycleMethodName();
}
$shutdownLifecycleMethodName = $this->objectConfigurations[$objectName]->getLifecycleShutdownMethodName();
if (method_exists($object, $shutdownLifecycleMethodName)) {
$this->shutdownObjects[$object] = $shutdownLifecycleMethodName;
}
array_pop($this->objectNameBuildStack);
return $object;
} | php | public function get($objectName)
{
if (isset($this->objects[$objectName]['i'])) {
return $this->objects[$objectName]['i'];
}
if (isset($this->objectConfigurations[$objectName]) && count($this->objectConfigurations[$objectName]->getArguments()) > 0) {
throw new Exception\CannotBuildObjectException('Cannot build object "' . $objectName . '" because constructor injection is not available in the compile time Object Manager. Refactor your code to use setter injection instead. Configuration source: ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . '. Build stack: ' . implode(', ', $this->objectNameBuildStack), 1297090026);
}
if (!isset($this->objects[$objectName])) {
throw new Exception\UnknownObjectException('Cannot build object "' . $objectName . '" because it is unknown to the compile time Object Manager.', 1301477694);
}
if ($this->objects[$objectName]['s'] !== Configuration::SCOPE_SINGLETON) {
throw new Exception\CannotBuildObjectException('Cannot build object "' . $objectName . '" because the get() method in the compile time Object Manager only supports singletons.', 1297090027);
}
$this->objectNameBuildStack[] = $objectName;
$object = parent::get($objectName);
/** @var Configuration $objectConfiguration */
$objectConfiguration = $this->objectConfigurations[$objectName];
/** @var Property $property */
foreach ($objectConfiguration->getProperties() as $propertyName => $property) {
if ($property->getAutowiring() !== Configuration::AUTOWIRING_MODE_ON) {
continue;
}
switch ($property->getType()) {
case Property::PROPERTY_TYPES_STRAIGHTVALUE:
$value = $property->getValue();
break;
case Property::PROPERTY_TYPES_CONFIGURATION:
$propertyValue = $property->getValue();
$value = $this->configurationManager->getConfiguration($propertyValue['type'], $propertyValue['path']);
break;
case Property::PROPERTY_TYPES_OBJECT:
$propertyObjectName = $property->getValue();
if (!is_string($propertyObjectName)) {
throw new Exception\CannotBuildObjectException('The object definition of "' . $objectName . '::' . $propertyName . '" is too complex for the compile time Object Manager. You can only use plain object names, not factories and the like. Check configuration in ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . ' and objects which depend on ' . $objectName . '.', 1297099659);
}
$value = $this->get($propertyObjectName);
break;
default:
throw new Exception\CannotBuildObjectException('Invalid property type.', 1297090029);
}
if (method_exists($object, $setterMethodName = 'inject' . ucfirst($propertyName))) {
$object->$setterMethodName($value);
} elseif (method_exists($object, $setterMethodName = 'set' . ucfirst($propertyName))) {
$object->$setterMethodName($value);
} else {
throw new Exception\UnresolvedDependenciesException('Could not inject configured property "' . $propertyName . '" into "' . $objectName . '" because no injection method exists, but for compile time use this is required. Configuration source: ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . '.', 1297110953);
}
}
$initializationLifecycleMethodName = $this->objectConfigurations[$objectName]->getLifecycleInitializationMethodName();
if (method_exists($object, $initializationLifecycleMethodName)) {
$object->$initializationLifecycleMethodName();
}
$shutdownLifecycleMethodName = $this->objectConfigurations[$objectName]->getLifecycleShutdownMethodName();
if (method_exists($object, $shutdownLifecycleMethodName)) {
$this->shutdownObjects[$object] = $shutdownLifecycleMethodName;
}
array_pop($this->objectNameBuildStack);
return $object;
} | [
"public",
"function",
"get",
"(",
"$",
"objectName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
"[",
"'i'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"objects",
"[",
"$",
"objectName",
"]",
... | Returns a fresh or existing instance of the object specified by $objectName.
This specialized get() method is able to do setter injection for properties
defined in the object configuration of the specified object.
@param string $objectName The name of the object to return an instance of
@return object The object instance
@throws \Neos\Flow\ObjectManagement\Exception\CannotBuildObjectException
@throws \Neos\Flow\ObjectManagement\Exception\UnresolvedDependenciesException
@throws \Neos\Flow\ObjectManagement\Exception\UnknownObjectException | [
"Returns",
"a",
"fresh",
"or",
"existing",
"instance",
"of",
"the",
"object",
"specified",
"by",
"$objectName",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/CompileTimeObjectManager.php#L365-L432 |
neos/flow-development-collection | Neos.Eel/Resources/Private/PHP/php-peg/Compiler.php | TokenLiteral.match_code | function match_code($value = NULL) {
// We inline single-character matches for speed
if (!$this->contains_expression() && strlen(eval('return ' . $this->value . ';')) == 1) {
return $this->match_fail_conditional('substr($this->string,$this->pos,1) == ' . $this->value,
PHPBuilder::build()
->l(
'$this->pos += 1;',
$this->set_text($this->value)
)
);
}
return parent::match_code($this->value);
} | php | function match_code($value = NULL) {
// We inline single-character matches for speed
if (!$this->contains_expression() && strlen(eval('return ' . $this->value . ';')) == 1) {
return $this->match_fail_conditional('substr($this->string,$this->pos,1) == ' . $this->value,
PHPBuilder::build()
->l(
'$this->pos += 1;',
$this->set_text($this->value)
)
);
}
return parent::match_code($this->value);
} | [
"function",
"match_code",
"(",
"$",
"value",
"=",
"NULL",
")",
"{",
"// We inline single-character matches for speed",
"if",
"(",
"!",
"$",
"this",
"->",
"contains_expression",
"(",
")",
"&&",
"strlen",
"(",
"eval",
"(",
"'return '",
".",
"$",
"this",
"->",
... | The $value default parameter is NOT used, it is just added to conform to interface | [
"The",
"$value",
"default",
"parameter",
"is",
"NOT",
"used",
"it",
"is",
"just",
"added",
"to",
"conform",
"to",
"interface"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Resources/Private/PHP/php-peg/Compiler.php#L288-L300 |
neos/flow-development-collection | Neos.Eel/Classes/FlowQuery/Operations/IsOperation.php | IsOperation.evaluate | public function evaluate(FlowQuery $flowQuery, array $arguments)
{
if (count($arguments) == 0) {
return count($flowQuery->getContext()) > 0;
} else {
$flowQuery->pushOperation('is', []);
$flowQuery->pushOperation('filter', $arguments);
}
} | php | public function evaluate(FlowQuery $flowQuery, array $arguments)
{
if (count($arguments) == 0) {
return count($flowQuery->getContext()) > 0;
} else {
$flowQuery->pushOperation('is', []);
$flowQuery->pushOperation('filter', $arguments);
}
} | [
"public",
"function",
"evaluate",
"(",
"FlowQuery",
"$",
"flowQuery",
",",
"array",
"$",
"arguments",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"arguments",
")",
"==",
"0",
")",
"{",
"return",
"count",
"(",
"$",
"flowQuery",
"->",
"getContext",
"(",
")",... | {@inheritdoc}
@param FlowQuery $flowQuery the FlowQuery object
@param array $arguments the filter arguments
@return void|boolean | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/Operations/IsOperation.php#L45-L53 |
neos/flow-development-collection | Neos.Flow/Classes/I18n/Configuration.php | Configuration.getCurrentLocale | public function getCurrentLocale()
{
if (!$this->currentLocale instanceof Locale
|| $this->currentLocale->getLanguage() === 'mul') {
return $this->defaultLocale;
}
return $this->currentLocale;
} | php | public function getCurrentLocale()
{
if (!$this->currentLocale instanceof Locale
|| $this->currentLocale->getLanguage() === 'mul') {
return $this->defaultLocale;
}
return $this->currentLocale;
} | [
"public",
"function",
"getCurrentLocale",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"currentLocale",
"instanceof",
"Locale",
"||",
"$",
"this",
"->",
"currentLocale",
"->",
"getLanguage",
"(",
")",
"===",
"'mul'",
")",
"{",
"return",
"$",
"this",
... | Returns the current locale. This is the default locale if
no current locale has been set or the set current locale has
a language code of "mul".
@return Locale | [
"Returns",
"the",
"current",
"locale",
".",
"This",
"is",
"the",
"default",
"locale",
"if",
"no",
"current",
"locale",
"has",
"been",
"set",
"or",
"the",
"set",
"current",
"locale",
"has",
"a",
"language",
"code",
"of",
"mul",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Configuration.php#L80-L87 |
neos/flow-development-collection | Neos.Flow/Classes/I18n/Configuration.php | Configuration.setFallbackRule | public function setFallbackRule(array $fallbackRule)
{
if (!array_key_exists('order', $fallbackRule)) {
throw new \InvalidArgumentException('The given fallback rule did not contain an order element.', 1406710671);
}
if (!array_key_exists('strict', $fallbackRule)) {
$fallbackRule['strict'] = false;
}
$this->fallbackRule = $fallbackRule;
} | php | public function setFallbackRule(array $fallbackRule)
{
if (!array_key_exists('order', $fallbackRule)) {
throw new \InvalidArgumentException('The given fallback rule did not contain an order element.', 1406710671);
}
if (!array_key_exists('strict', $fallbackRule)) {
$fallbackRule['strict'] = false;
}
$this->fallbackRule = $fallbackRule;
} | [
"public",
"function",
"setFallbackRule",
"(",
"array",
"$",
"fallbackRule",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'order'",
",",
"$",
"fallbackRule",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The given fallback rule did ... | Allows to set a fallback order for locale resolving. If not set,
the implicit inheritance of locales will be used. That is, if a
locale of en_UK is requested, matches will be searched for in en_UK
and en before trying the default locale configured in Flow.
If this is given an order of [dk, za, fr_CA] a request for en_UK will
be looked up in en_UK, en, dk, za, fr_CA, fr before trying the default
locale.
If strict flag is given in the array, the above example would instead look
in en_UK, dk, za, fr_CA before trying the default locale. In other words,
the implicit fallback is not applied to the locales in the fallback rule.
Here is an example:
array('strict' => false, 'order' => array('dk', 'za'))
@param array $fallbackRule | [
"Allows",
"to",
"set",
"a",
"fallback",
"order",
"for",
"locale",
"resolving",
".",
"If",
"not",
"set",
"the",
"implicit",
"inheritance",
"of",
"locales",
"will",
"be",
"used",
".",
"That",
"is",
"if",
"a",
"locale",
"of",
"en_UK",
"is",
"requested",
"ma... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Configuration.php#L108-L117 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php | PersistenceManager.persistAll | public function persistAll($onlyWhitelistedObjects = false)
{
if ($onlyWhitelistedObjects) {
$unitOfWork = $this->entityManager->getUnitOfWork();
/** @var \Doctrine\ORM\UnitOfWork $unitOfWork */
$unitOfWork->computeChangeSets();
$objectsToBePersisted = $unitOfWork->getScheduledEntityUpdates() + $unitOfWork->getScheduledEntityDeletions() + $unitOfWork->getScheduledEntityInsertions();
foreach ($objectsToBePersisted as $object) {
$this->throwExceptionIfObjectIsNotWhitelisted($object);
}
}
if (!$this->entityManager->isOpen()) {
$this->logger->error('persistAll() skipped flushing data, the Doctrine EntityManager is closed. Check the logs for error message.', LogEnvironment::fromMethodName(__METHOD__));
return;
}
/** @var Connection $connection */
$connection = $this->entityManager->getConnection();
try {
if ($connection->ping() === false) {
$this->logger->info('Reconnecting the Doctrine EntityManager to the persistence backend.', LogEnvironment::fromMethodName(__METHOD__));
$connection->close();
$connection->connect();
}
} catch (ConnectionException $exception) {
$message = $this->throwableStorage->logThrowable($exception);
$this->logger->error($message, LogEnvironment::fromMethodName(__METHOD__));
}
$this->entityManager->flush();
$this->emitAllObjectsPersisted();
} | php | public function persistAll($onlyWhitelistedObjects = false)
{
if ($onlyWhitelistedObjects) {
$unitOfWork = $this->entityManager->getUnitOfWork();
/** @var \Doctrine\ORM\UnitOfWork $unitOfWork */
$unitOfWork->computeChangeSets();
$objectsToBePersisted = $unitOfWork->getScheduledEntityUpdates() + $unitOfWork->getScheduledEntityDeletions() + $unitOfWork->getScheduledEntityInsertions();
foreach ($objectsToBePersisted as $object) {
$this->throwExceptionIfObjectIsNotWhitelisted($object);
}
}
if (!$this->entityManager->isOpen()) {
$this->logger->error('persistAll() skipped flushing data, the Doctrine EntityManager is closed. Check the logs for error message.', LogEnvironment::fromMethodName(__METHOD__));
return;
}
/** @var Connection $connection */
$connection = $this->entityManager->getConnection();
try {
if ($connection->ping() === false) {
$this->logger->info('Reconnecting the Doctrine EntityManager to the persistence backend.', LogEnvironment::fromMethodName(__METHOD__));
$connection->close();
$connection->connect();
}
} catch (ConnectionException $exception) {
$message = $this->throwableStorage->logThrowable($exception);
$this->logger->error($message, LogEnvironment::fromMethodName(__METHOD__));
}
$this->entityManager->flush();
$this->emitAllObjectsPersisted();
} | [
"public",
"function",
"persistAll",
"(",
"$",
"onlyWhitelistedObjects",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"onlyWhitelistedObjects",
")",
"{",
"$",
"unitOfWork",
"=",
"$",
"this",
"->",
"entityManager",
"->",
"getUnitOfWork",
"(",
")",
";",
"/** @var \\Do... | Commits new objects and changes to objects in the current persistence
session into the backend
@param boolean $onlyWhitelistedObjects If true an exception will be thrown if there are scheduled updates/deletes or insertions for objects that are not "whitelisted" (see AbstractPersistenceManager::whitelistObject())
@return void
@api
@throws PersistenceException | [
"Commits",
"new",
"objects",
"and",
"changes",
"to",
"objects",
"in",
"the",
"current",
"persistence",
"session",
"into",
"the",
"backend"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php#L87-L119 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php | PersistenceManager.isNewObject | public function isNewObject($object)
{
return ($this->entityManager->getUnitOfWork()->getEntityState($object, \Doctrine\ORM\UnitOfWork::STATE_NEW) === \Doctrine\ORM\UnitOfWork::STATE_NEW);
} | php | public function isNewObject($object)
{
return ($this->entityManager->getUnitOfWork()->getEntityState($object, \Doctrine\ORM\UnitOfWork::STATE_NEW) === \Doctrine\ORM\UnitOfWork::STATE_NEW);
} | [
"public",
"function",
"isNewObject",
"(",
"$",
"object",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"entityManager",
"->",
"getUnitOfWork",
"(",
")",
"->",
"getEntityState",
"(",
"$",
"object",
",",
"\\",
"Doctrine",
"\\",
"ORM",
"\\",
"UnitOfWork",
"::",... | Checks if the given object has ever been persisted.
@param object $object The object to check
@return boolean true if the object is new, false if the object exists in the repository
@api | [
"Checks",
"if",
"the",
"given",
"object",
"has",
"ever",
"been",
"persisted",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php#L142-L145 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php | PersistenceManager.getIdentifierByObject | public function getIdentifierByObject($object)
{
if (property_exists($object, 'Persistence_Object_Identifier')) {
$identifierCandidate = ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', true);
if ($identifierCandidate !== null) {
return $identifierCandidate;
}
}
if ($this->entityManager->contains($object)) {
try {
return current($this->entityManager->getUnitOfWork()->getEntityIdentifier($object));
} catch (\Doctrine\ORM\ORMException $exception) {
}
}
return null;
} | php | public function getIdentifierByObject($object)
{
if (property_exists($object, 'Persistence_Object_Identifier')) {
$identifierCandidate = ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', true);
if ($identifierCandidate !== null) {
return $identifierCandidate;
}
}
if ($this->entityManager->contains($object)) {
try {
return current($this->entityManager->getUnitOfWork()->getEntityIdentifier($object));
} catch (\Doctrine\ORM\ORMException $exception) {
}
}
return null;
} | [
"public",
"function",
"getIdentifierByObject",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"object",
",",
"'Persistence_Object_Identifier'",
")",
")",
"{",
"$",
"identifierCandidate",
"=",
"ObjectAccess",
"::",
"getProperty",
"(",
"$",
... | Returns the (internal) identifier for the object, if it is known to the
backend. Otherwise NULL is returned.
Note: this returns an identifier even if the object has not been
persisted in case of AOP-managed entities. Use isNewObject() if you need
to distinguish those cases.
@param object $object
@return mixed The identifier for the object if it is known, or NULL
@api
@todo improve try/catch block | [
"Returns",
"the",
"(",
"internal",
")",
"identifier",
"for",
"the",
"object",
"if",
"it",
"is",
"known",
"to",
"the",
"backend",
".",
"Otherwise",
"NULL",
"is",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php#L160-L175 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php | PersistenceManager.getObjectByIdentifier | public function getObjectByIdentifier($identifier, $objectType = null, $useLazyLoading = false)
{
if ($objectType === null) {
throw new \RuntimeException('Using only the identifier is not supported by Doctrine 2. Give classname as well or use repository to query identifier.', 1296646103);
}
if (isset($this->newObjects[$identifier])) {
return $this->newObjects[$identifier];
}
if ($useLazyLoading === true) {
return $this->entityManager->getReference($objectType, $identifier);
} else {
return $this->entityManager->find($objectType, $identifier);
}
} | php | public function getObjectByIdentifier($identifier, $objectType = null, $useLazyLoading = false)
{
if ($objectType === null) {
throw new \RuntimeException('Using only the identifier is not supported by Doctrine 2. Give classname as well or use repository to query identifier.', 1296646103);
}
if (isset($this->newObjects[$identifier])) {
return $this->newObjects[$identifier];
}
if ($useLazyLoading === true) {
return $this->entityManager->getReference($objectType, $identifier);
} else {
return $this->entityManager->find($objectType, $identifier);
}
} | [
"public",
"function",
"getObjectByIdentifier",
"(",
"$",
"identifier",
",",
"$",
"objectType",
"=",
"null",
",",
"$",
"useLazyLoading",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"objectType",
"===",
"null",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
... | Returns the object with the (internal) identifier, if it is known to the
backend. Otherwise NULL is returned.
@param mixed $identifier
@param string $objectType
@param boolean $useLazyLoading Set to true if you want to use lazy loading for this object
@return object The object for the identifier if it is known, or NULL
@throws \RuntimeException
@api | [
"Returns",
"the",
"object",
"with",
"the",
"(",
"internal",
")",
"identifier",
"if",
"it",
"is",
"known",
"to",
"the",
"backend",
".",
"Otherwise",
"NULL",
"is",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php#L188-L201 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php | PersistenceManager.add | public function add($object)
{
if (!$this->isNewObject($object)) {
throw new KnownObjectException('The object of type "' . get_class($object) . '" (identifier: "' . $this->getIdentifierByObject($object) . '") which was passed to EntityManager->add() is not a new object. Check the code which adds this entity to the repository and make sure that only objects are added which were not persisted before. Alternatively use update() for updating existing objects."', 1337934295);
} else {
try {
$this->entityManager->persist($object);
} catch (\Exception $exception) {
throw new PersistenceException('Could not add object of type "' . get_class($object) . '"', 1337934455, $exception);
}
}
} | php | public function add($object)
{
if (!$this->isNewObject($object)) {
throw new KnownObjectException('The object of type "' . get_class($object) . '" (identifier: "' . $this->getIdentifierByObject($object) . '") which was passed to EntityManager->add() is not a new object. Check the code which adds this entity to the repository and make sure that only objects are added which were not persisted before. Alternatively use update() for updating existing objects."', 1337934295);
} else {
try {
$this->entityManager->persist($object);
} catch (\Exception $exception) {
throw new PersistenceException('Could not add object of type "' . get_class($object) . '"', 1337934455, $exception);
}
}
} | [
"public",
"function",
"add",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isNewObject",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"KnownObjectException",
"(",
"'The object of type \"'",
".",
"get_class",
"(",
"$",
"object",
... | Adds an object to the persistence.
@param object $object The object to add
@return void
@throws KnownObjectException if the given $object is not new
@throws PersistenceException if another error occurs
@api | [
"Adds",
"an",
"object",
"to",
"the",
"persistence",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php#L223-L234 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php | PersistenceManager.update | public function update($object)
{
if ($this->isNewObject($object)) {
throw new UnknownObjectException('The object of type "' . get_class($object) . '" (identifier: "' . $this->getIdentifierByObject($object) . '") which was passed to EntityManager->update() is not a previously persisted object. Check the code which updates this entity and make sure that only objects are updated which were persisted before. Alternatively use add() for persisting new objects."', 1313663277);
}
try {
$this->entityManager->persist($object);
} catch (\Exception $exception) {
throw new PersistenceException('Could not merge object of type "' . get_class($object) . '"', 1297778180, $exception);
}
} | php | public function update($object)
{
if ($this->isNewObject($object)) {
throw new UnknownObjectException('The object of type "' . get_class($object) . '" (identifier: "' . $this->getIdentifierByObject($object) . '") which was passed to EntityManager->update() is not a previously persisted object. Check the code which updates this entity and make sure that only objects are updated which were persisted before. Alternatively use add() for persisting new objects."', 1313663277);
}
try {
$this->entityManager->persist($object);
} catch (\Exception $exception) {
throw new PersistenceException('Could not merge object of type "' . get_class($object) . '"', 1297778180, $exception);
}
} | [
"public",
"function",
"update",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNewObject",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"UnknownObjectException",
"(",
"'The object of type \"'",
".",
"get_class",
"(",
"$",
"object",
")... | Update an object in the persistence.
@param object $object The modified object
@return void
@throws UnknownObjectException if the given $object is new
@throws PersistenceException if another error occurs
@api | [
"Update",
"an",
"object",
"in",
"the",
"persistence",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php#L257-L267 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php | PersistenceManager.compile | public function compile()
{
// "driver" is used only for Doctrine, thus we (mis-)use it here
// additionally, when no path is set, skip this step, assuming no DB is needed
if ($this->settings['backendOptions']['driver'] !== null && $this->settings['backendOptions']['path'] !== null) {
$schemaTool = new SchemaTool($this->entityManager);
if ($this->settings['backendOptions']['driver'] === 'pdo_sqlite') {
$schemaTool->createSchema($this->entityManager->getMetadataFactory()->getAllMetadata());
} else {
$schemaTool->updateSchema($this->entityManager->getMetadataFactory()->getAllMetadata());
}
$proxyFactory = $this->entityManager->getProxyFactory();
$proxyFactory->generateProxyClasses($this->entityManager->getMetadataFactory()->getAllMetadata());
$this->logger->info('Doctrine 2 setup finished', LogEnvironment::fromMethodName(__METHOD__));
return true;
} else {
$this->logger->notice('Doctrine 2 setup skipped, driver and path backend options not set!');
return false;
}
} | php | public function compile()
{
// "driver" is used only for Doctrine, thus we (mis-)use it here
// additionally, when no path is set, skip this step, assuming no DB is needed
if ($this->settings['backendOptions']['driver'] !== null && $this->settings['backendOptions']['path'] !== null) {
$schemaTool = new SchemaTool($this->entityManager);
if ($this->settings['backendOptions']['driver'] === 'pdo_sqlite') {
$schemaTool->createSchema($this->entityManager->getMetadataFactory()->getAllMetadata());
} else {
$schemaTool->updateSchema($this->entityManager->getMetadataFactory()->getAllMetadata());
}
$proxyFactory = $this->entityManager->getProxyFactory();
$proxyFactory->generateProxyClasses($this->entityManager->getMetadataFactory()->getAllMetadata());
$this->logger->info('Doctrine 2 setup finished', LogEnvironment::fromMethodName(__METHOD__));
return true;
} else {
$this->logger->notice('Doctrine 2 setup skipped, driver and path backend options not set!');
return false;
}
} | [
"public",
"function",
"compile",
"(",
")",
"{",
"// \"driver\" is used only for Doctrine, thus we (mis-)use it here",
"// additionally, when no path is set, skip this step, assuming no DB is needed",
"if",
"(",
"$",
"this",
"->",
"settings",
"[",
"'backendOptions'",
"]",
"[",
"'d... | Called from functional tests, creates/updates database tables and compiles proxies.
@return boolean | [
"Called",
"from",
"functional",
"tests",
"creates",
"/",
"updates",
"database",
"tables",
"and",
"compiles",
"proxies",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/PersistenceManager.php#L286-L307 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.