repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php
PersistenceManager.initializeObject
public function initializeObject() { if (!$this->backend instanceof Backend\BackendInterface) { throw new MissingBackendException('A persistence backend must be set prior to initializing the persistence manager.', 1215508456); } $this->backend->setPersistenceManager($this); $this->backend->initialize($this->settings['backendOptions']); }
php
public function initializeObject() { if (!$this->backend instanceof Backend\BackendInterface) { throw new MissingBackendException('A persistence backend must be set prior to initializing the persistence manager.', 1215508456); } $this->backend->setPersistenceManager($this); $this->backend->initialize($this->settings['backendOptions']); }
[ "public", "function", "initializeObject", "(", ")", "{", "if", "(", "!", "$", "this", "->", "backend", "instanceof", "Backend", "\\", "BackendInterface", ")", "{", "throw", "new", "MissingBackendException", "(", "'A persistence backend must be set prior to initializing ...
Initializes the persistence manager @return void @throws MissingBackendException
[ "Initializes", "the", "persistence", "manager" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php#L125-L132
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php
PersistenceManager.persistAll
public function persistAll($onlyWhitelistedObjects = false) { if ($onlyWhitelistedObjects) { foreach ($this->changedObjects as $object) { $this->throwExceptionIfObjectIsNotWhitelisted($object); } foreach ($this->removedObjects as $object) { $this->throwExceptionIfObjectIsNotWhitelisted($object); } foreach ($this->addedObjects as $object) { $this->throwExceptionIfObjectIsNotWhitelisted($object); } } // hand in only aggregate roots, leaving handling of subobjects to // the underlying storage layer // reconstituted entities must be fetched from the session and checked // for changes by the underlying backend as well! $this->backend->setAggregateRootObjects($this->addedObjects); $this->backend->setChangedEntities($this->changedObjects); $this->backend->setDeletedEntities($this->removedObjects); $this->backend->commit(); $this->addedObjects = new \SplObjectStorage(); $this->removedObjects = new \SplObjectStorage(); $this->changedObjects = new \SplObjectStorage(); $this->emitAllObjectsPersisted(); $this->hasUnpersistedChanges = false; }
php
public function persistAll($onlyWhitelistedObjects = false) { if ($onlyWhitelistedObjects) { foreach ($this->changedObjects as $object) { $this->throwExceptionIfObjectIsNotWhitelisted($object); } foreach ($this->removedObjects as $object) { $this->throwExceptionIfObjectIsNotWhitelisted($object); } foreach ($this->addedObjects as $object) { $this->throwExceptionIfObjectIsNotWhitelisted($object); } } // hand in only aggregate roots, leaving handling of subobjects to // the underlying storage layer // reconstituted entities must be fetched from the session and checked // for changes by the underlying backend as well! $this->backend->setAggregateRootObjects($this->addedObjects); $this->backend->setChangedEntities($this->changedObjects); $this->backend->setDeletedEntities($this->removedObjects); $this->backend->commit(); $this->addedObjects = new \SplObjectStorage(); $this->removedObjects = new \SplObjectStorage(); $this->changedObjects = new \SplObjectStorage(); $this->emitAllObjectsPersisted(); $this->hasUnpersistedChanges = false; }
[ "public", "function", "persistAll", "(", "$", "onlyWhitelistedObjects", "=", "false", ")", "{", "if", "(", "$", "onlyWhitelistedObjects", ")", "{", "foreach", "(", "$", "this", "->", "changedObjects", "as", "$", "object", ")", "{", "$", "this", "->", "thro...
Commits new objects and changes to objects in the current persistence session into the backend @param boolean $onlyWhitelistedObjects @return void @api
[ "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/Generic/PersistenceManager.php#L166-L195
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php
PersistenceManager.clearState
public function clearState() { parent::clearState(); $this->addedObjects = new \SplObjectStorage(); $this->removedObjects = new \SplObjectStorage(); $this->changedObjects = new \SplObjectStorage(); $this->persistenceSession->destroy(); $this->hasUnpersistedChanges = false; }
php
public function clearState() { parent::clearState(); $this->addedObjects = new \SplObjectStorage(); $this->removedObjects = new \SplObjectStorage(); $this->changedObjects = new \SplObjectStorage(); $this->persistenceSession->destroy(); $this->hasUnpersistedChanges = false; }
[ "public", "function", "clearState", "(", ")", "{", "parent", "::", "clearState", "(", ")", ";", "$", "this", "->", "addedObjects", "=", "new", "\\", "SplObjectStorage", "(", ")", ";", "$", "this", "->", "removedObjects", "=", "new", "\\", "SplObjectStorage...
Clears the in-memory state of the persistence. Managed instances become detached, any fetches will return data directly from the persistence "backend". It will also forget about new objects. @return void
[ "Clears", "the", "in", "-", "memory", "state", "of", "the", "persistence", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php#L206-L214
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php
PersistenceManager.getObjectByIdentifier
public function getObjectByIdentifier($identifier, $objectType = null, $useLazyLoading = false) { if (isset($this->newObjects[$identifier])) { return $this->newObjects[$identifier]; } if ($this->persistenceSession->hasIdentifier($identifier)) { return $this->persistenceSession->getObjectByIdentifier($identifier); } else { $objectData = $this->backend->getObjectDataByIdentifier($identifier, $objectType); if ($objectData !== false) { return $this->dataMapper->mapToObject($objectData); } else { return null; } } }
php
public function getObjectByIdentifier($identifier, $objectType = null, $useLazyLoading = false) { if (isset($this->newObjects[$identifier])) { return $this->newObjects[$identifier]; } if ($this->persistenceSession->hasIdentifier($identifier)) { return $this->persistenceSession->getObjectByIdentifier($identifier); } else { $objectData = $this->backend->getObjectDataByIdentifier($identifier, $objectType); if ($objectData !== false) { return $this->dataMapper->mapToObject($objectData); } else { return null; } } }
[ "public", "function", "getObjectByIdentifier", "(", "$", "identifier", ",", "$", "objectType", "=", "null", ",", "$", "useLazyLoading", "=", "false", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "newObjects", "[", "$", "identifier", "]", ")", ")...
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 This option is ignored in this persistence manager @return object The object for the identifier if it is known, or NULL @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/Generic/PersistenceManager.php#L255-L270
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php
PersistenceManager.add
public function add($object) { $this->hasUnpersistedChanges = true; $this->addedObjects->attach($object); $this->removedObjects->detach($object); }
php
public function add($object) { $this->hasUnpersistedChanges = true; $this->addedObjects->attach($object); $this->removedObjects->detach($object); }
[ "public", "function", "add", "(", "$", "object", ")", "{", "$", "this", "->", "hasUnpersistedChanges", "=", "true", ";", "$", "this", "->", "addedObjects", "->", "attach", "(", "$", "object", ")", ";", "$", "this", "->", "removedObjects", "->", "detach",...
Adds an object to the persistence. @param object $object The object to add @return void @api
[ "Adds", "an", "object", "to", "the", "persistence", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php#L303-L308
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php
PersistenceManager.remove
public function remove($object) { $this->hasUnpersistedChanges = true; if ($this->addedObjects->contains($object)) { $this->addedObjects->detach($object); } else { $this->removedObjects->attach($object); } }
php
public function remove($object) { $this->hasUnpersistedChanges = true; if ($this->addedObjects->contains($object)) { $this->addedObjects->detach($object); } else { $this->removedObjects->attach($object); } }
[ "public", "function", "remove", "(", "$", "object", ")", "{", "$", "this", "->", "hasUnpersistedChanges", "=", "true", ";", "if", "(", "$", "this", "->", "addedObjects", "->", "contains", "(", "$", "object", ")", ")", "{", "$", "this", "->", "addedObje...
Removes an object to the persistence. @param object $object The object to remove @return void @api
[ "Removes", "an", "object", "to", "the", "persistence", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php#L317-L325
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php
PersistenceManager.update
public function update($object) { if ($this->isNewObject($object)) { throw new UnknownObjectException('The object of type "' . get_class($object) . '" given to update must be persisted already, but is new.', 1249479819); } $this->hasUnpersistedChanges = true; $this->changedObjects->attach($object); }
php
public function update($object) { if ($this->isNewObject($object)) { throw new UnknownObjectException('The object of type "' . get_class($object) . '" given to update must be persisted already, but is new.', 1249479819); } $this->hasUnpersistedChanges = true; $this->changedObjects->attach($object); }
[ "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 @api
[ "Update", "an", "object", "in", "the", "persistence", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/PersistenceManager.php#L335-L342
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.set
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null) { if ($this->isFrozen()) { throw new \RuntimeException(sprintf('Cannot add or modify cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192); } if ($lifetime === null) { $lifetime = $this->defaultLifetime; } $setOptions = []; if ($lifetime > 0) { $setOptions['ex'] = $lifetime; } $this->redis->multi(); $result = $this->redis->set($this->buildKey('entry:' . $entryIdentifier), $this->compress($data), $setOptions); if ($result === false) { $this->verifyRedisVersionIsSupported(); } $this->redis->lRem($this->buildKey('entries'), $entryIdentifier, 0); $this->redis->rPush($this->buildKey('entries'), $entryIdentifier); foreach ($tags as $tag) { $this->redis->sAdd($this->buildKey('tag:' . $tag), $entryIdentifier); $this->redis->sAdd($this->buildKey('tags:' . $entryIdentifier), $tag); } $this->redis->exec(); }
php
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null) { if ($this->isFrozen()) { throw new \RuntimeException(sprintf('Cannot add or modify cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192); } if ($lifetime === null) { $lifetime = $this->defaultLifetime; } $setOptions = []; if ($lifetime > 0) { $setOptions['ex'] = $lifetime; } $this->redis->multi(); $result = $this->redis->set($this->buildKey('entry:' . $entryIdentifier), $this->compress($data), $setOptions); if ($result === false) { $this->verifyRedisVersionIsSupported(); } $this->redis->lRem($this->buildKey('entries'), $entryIdentifier, 0); $this->redis->rPush($this->buildKey('entries'), $entryIdentifier); foreach ($tags as $tag) { $this->redis->sAdd($this->buildKey('tag:' . $tag), $entryIdentifier); $this->redis->sAdd($this->buildKey('tags:' . $entryIdentifier), $tag); } $this->redis->exec(); }
[ "public", "function", "set", "(", "string", "$", "entryIdentifier", ",", "string", "$", "data", ",", "array", "$", "tags", "=", "[", "]", ",", "int", "$", "lifetime", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isFrozen", "(", ")", ")", ...
Saves data in the cache. @param string $entryIdentifier An identifier for this specific cache entry @param string $data The data to be stored @param array $tags Tags to associate with this cache entry. If the backend does not support tags, this option can be ignored. @param integer $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime. @throws \RuntimeException @throws CacheException @return void @api
[ "Saves", "data", "in", "the", "cache", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L125-L152
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.get
public function get(string $entryIdentifier) { return $this->uncompress($this->redis->get($this->buildKey('entry:' . $entryIdentifier))); }
php
public function get(string $entryIdentifier) { return $this->uncompress($this->redis->get($this->buildKey('entry:' . $entryIdentifier))); }
[ "public", "function", "get", "(", "string", "$", "entryIdentifier", ")", "{", "return", "$", "this", "->", "uncompress", "(", "$", "this", "->", "redis", "->", "get", "(", "$", "this", "->", "buildKey", "(", "'entry:'", ".", "$", "entryIdentifier", ")", ...
Loads data from the cache. @param string $entryIdentifier An identifier which describes the cache entry to load @return mixed The cache entry's content as a string or false if the cache entry could not be loaded @api
[ "Loads", "data", "from", "the", "cache", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L161-L164
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.has
public function has(string $entryIdentifier): bool { // exists returned true or false in phpredis versions < 4.0.0, now it returns the number of keys $existsResult = $this->redis->exists($this->buildKey('entry:' . $entryIdentifier)); return $existsResult === true || $existsResult > 0; }
php
public function has(string $entryIdentifier): bool { // exists returned true or false in phpredis versions < 4.0.0, now it returns the number of keys $existsResult = $this->redis->exists($this->buildKey('entry:' . $entryIdentifier)); return $existsResult === true || $existsResult > 0; }
[ "public", "function", "has", "(", "string", "$", "entryIdentifier", ")", ":", "bool", "{", "// exists returned true or false in phpredis versions < 4.0.0, now it returns the number of keys", "$", "existsResult", "=", "$", "this", "->", "redis", "->", "exists", "(", "$", ...
Checks if a cache entry with the specified identifier exists. @param string $entryIdentifier An identifier specifying the cache entry @return boolean true if such an entry exists, false if not @api
[ "Checks", "if", "a", "cache", "entry", "with", "the", "specified", "identifier", "exists", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L173-L178
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.remove
public function remove(string $entryIdentifier): bool { if ($this->isFrozen()) { throw new \RuntimeException(sprintf('Cannot remove cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192); } do { $tagsKey = $this->buildKey('tags:' . $entryIdentifier); $this->redis->watch($tagsKey); $tags = $this->redis->sMembers($tagsKey); $this->redis->multi(); $this->redis->del($this->buildKey('entry:' . $entryIdentifier)); foreach ($tags as $tag) { $this->redis->sRem($this->buildKey('tag:' . $tag), $entryIdentifier); } $this->redis->del($this->buildKey('tags:' . $entryIdentifier)); $this->redis->lRem($this->buildKey('entries'), $entryIdentifier, 0); $result = $this->redis->exec(); } while ($result === false); return true; }
php
public function remove(string $entryIdentifier): bool { if ($this->isFrozen()) { throw new \RuntimeException(sprintf('Cannot remove cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192); } do { $tagsKey = $this->buildKey('tags:' . $entryIdentifier); $this->redis->watch($tagsKey); $tags = $this->redis->sMembers($tagsKey); $this->redis->multi(); $this->redis->del($this->buildKey('entry:' . $entryIdentifier)); foreach ($tags as $tag) { $this->redis->sRem($this->buildKey('tag:' . $tag), $entryIdentifier); } $this->redis->del($this->buildKey('tags:' . $entryIdentifier)); $this->redis->lRem($this->buildKey('entries'), $entryIdentifier, 0); $result = $this->redis->exec(); } while ($result === false); return true; }
[ "public", "function", "remove", "(", "string", "$", "entryIdentifier", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "isFrozen", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Cannot remove cache entry because the b...
Removes all cache entries matching the specified identifier. Usually this only affects one entry but if - for what reason ever - old entries for the identifier still exist, they are removed as well. @param string $entryIdentifier Specifies the cache entry to remove @throws \RuntimeException @return boolean true if (at least) an entry could be removed or false if no entry was found @api
[ "Removes", "all", "cache", "entries", "matching", "the", "specified", "identifier", ".", "Usually", "this", "only", "affects", "one", "entry", "but", "if", "-", "for", "what", "reason", "ever", "-", "old", "entries", "for", "the", "identifier", "still", "exi...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L190-L210
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.flush
public function flush() { $script = " local entries = redis.call('LRANGE',KEYS[1],0,-1) for k1,entryIdentifier in ipairs(entries) do redis.call('DEL', ARGV[1]..'entry:'..entryIdentifier) local tags = redis.call('SMEMBERS', ARGV[1]..'tags:'..entryIdentifier) for k2,tagName in ipairs(tags) do redis.call('DEL', ARGV[1]..'tag:'..tagName) end redis.call('DEL', ARGV[1]..'tags:'..entryIdentifier) end redis.call('DEL', KEYS[1]) redis.call('DEL', KEYS[2]) "; $this->redis->eval($script, [$this->buildKey('entries'), $this->buildKey('frozen'), $this->buildKey('')], 2); $this->frozen = null; }
php
public function flush() { $script = " local entries = redis.call('LRANGE',KEYS[1],0,-1) for k1,entryIdentifier in ipairs(entries) do redis.call('DEL', ARGV[1]..'entry:'..entryIdentifier) local tags = redis.call('SMEMBERS', ARGV[1]..'tags:'..entryIdentifier) for k2,tagName in ipairs(tags) do redis.call('DEL', ARGV[1]..'tag:'..tagName) end redis.call('DEL', ARGV[1]..'tags:'..entryIdentifier) end redis.call('DEL', KEYS[1]) redis.call('DEL', KEYS[2]) "; $this->redis->eval($script, [$this->buildKey('entries'), $this->buildKey('frozen'), $this->buildKey('')], 2); $this->frozen = null; }
[ "public", "function", "flush", "(", ")", "{", "$", "script", "=", "\"\n\t\tlocal entries = redis.call('LRANGE',KEYS[1],0,-1)\n\t\tfor k1,entryIdentifier in ipairs(entries) do\n\t\t\tredis.call('DEL', ARGV[1]..'entry:'..entryIdentifier)\n\t\t\tlocal tags = redis.call('SMEMBERS', ARGV[1]..'tags:'..e...
Removes all cache entries of this cache The flush method will use the EVAL command to flush all entries and tags for this cache in an atomic way. @throws \RuntimeException @return void @api
[ "Removes", "all", "cache", "entries", "of", "this", "cache" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L222-L240
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.flushByTag
public function flushByTag(string $tag): int { if ($this->isFrozen()) { throw new \RuntimeException(sprintf('Cannot add or modify cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192); } $script = " local entries = redis.call('SMEMBERS', KEYS[1]) for k1,entryIdentifier in ipairs(entries) do redis.call('DEL', ARGV[1]..'entry:'..entryIdentifier) local tags = redis.call('SMEMBERS', ARGV[1]..'tags:'..entryIdentifier) for k2,tagName in ipairs(tags) do redis.call('SREM', ARGV[1]..'tag:'..tagName, entryIdentifier) end redis.call('DEL', ARGV[1]..'tags:'..entryIdentifier) redis.call('LREM', KEYS[2], 0, entryIdentifier) end return #entries "; $count = $this->redis->eval($script, [$this->buildKey('tag:' . $tag), $this->buildKey('entries'), $this->buildKey('')], 2); return $count; }
php
public function flushByTag(string $tag): int { if ($this->isFrozen()) { throw new \RuntimeException(sprintf('Cannot add or modify cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192); } $script = " local entries = redis.call('SMEMBERS', KEYS[1]) for k1,entryIdentifier in ipairs(entries) do redis.call('DEL', ARGV[1]..'entry:'..entryIdentifier) local tags = redis.call('SMEMBERS', ARGV[1]..'tags:'..entryIdentifier) for k2,tagName in ipairs(tags) do redis.call('SREM', ARGV[1]..'tag:'..tagName, entryIdentifier) end redis.call('DEL', ARGV[1]..'tags:'..entryIdentifier) redis.call('LREM', KEYS[2], 0, entryIdentifier) end return #entries "; $count = $this->redis->eval($script, [$this->buildKey('tag:' . $tag), $this->buildKey('entries'), $this->buildKey('')], 2); return $count; }
[ "public", "function", "flushByTag", "(", "string", "$", "tag", ")", ":", "int", "{", "if", "(", "$", "this", "->", "isFrozen", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Cannot add or modify cache entry because the bac...
Removes all cache entries of this cache which are tagged by the specified tag. @param string $tag The tag the entries must have @throws \RuntimeException @return integer The number of entries which have been affected by this flush @api
[ "Removes", "all", "cache", "entries", "of", "this", "cache", "which", "are", "tagged", "by", "the", "specified", "tag", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L269-L290
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.key
public function key() { $entryIdentifier = $this->redis->lIndex($this->buildKey('entries'), $this->entryCursor); if ($entryIdentifier !== false && !$this->has($entryIdentifier)) { return false; } return $entryIdentifier; }
php
public function key() { $entryIdentifier = $this->redis->lIndex($this->buildKey('entries'), $this->entryCursor); if ($entryIdentifier !== false && !$this->has($entryIdentifier)) { return false; } return $entryIdentifier; }
[ "public", "function", "key", "(", ")", "{", "$", "entryIdentifier", "=", "$", "this", "->", "redis", "->", "lIndex", "(", "$", "this", "->", "buildKey", "(", "'entries'", ")", ",", "$", "this", "->", "entryCursor", ")", ";", "if", "(", "$", "entryIde...
{@inheritdoc}
[ "{" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L324-L331
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.freeze
public function freeze() { if ($this->isFrozen()) { throw new \RuntimeException(sprintf('Cannot add or modify cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192); } do { $entriesKey = $this->buildKey('entries'); $this->redis->watch($entriesKey); $entries = $this->redis->lRange($entriesKey, 0, -1); $this->redis->multi(); foreach ($entries as $entryIdentifier) { $this->redis->persist($this->buildKey('entry:' . $entryIdentifier)); } $this->redis->set($this->buildKey('frozen'), 1); $result = $this->redis->exec(); } while ($result === false); $this->frozen = true; }
php
public function freeze() { if ($this->isFrozen()) { throw new \RuntimeException(sprintf('Cannot add or modify cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192); } do { $entriesKey = $this->buildKey('entries'); $this->redis->watch($entriesKey); $entries = $this->redis->lRange($entriesKey, 0, -1); $this->redis->multi(); foreach ($entries as $entryIdentifier) { $this->redis->persist($this->buildKey('entry:' . $entryIdentifier)); } $this->redis->set($this->buildKey('frozen'), 1); $result = $this->redis->exec(); } while ($result === false); $this->frozen = true; }
[ "public", "function", "freeze", "(", ")", "{", "if", "(", "$", "this", "->", "isFrozen", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Cannot add or modify cache entry because the backend of cache \"%s\" is frozen.'", ",", "$",...
Freezes this cache backend. All data in a frozen backend remains unchanged and methods which try to add or modify data result in an exception thrown. Possible expiry times of individual cache entries are ignored. A frozen backend can only be thawn by calling the flush() method. @throws \RuntimeException @return void
[ "Freezes", "this", "cache", "backend", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L361-L378
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.isFrozen
public function isFrozen(): bool { if (null === $this->frozen) { $this->frozen = $this->redis->exists($this->buildKey('frozen')); } return $this->frozen; }
php
public function isFrozen(): bool { if (null === $this->frozen) { $this->frozen = $this->redis->exists($this->buildKey('frozen')); } return $this->frozen; }
[ "public", "function", "isFrozen", "(", ")", ":", "bool", "{", "if", "(", "null", "===", "$", "this", "->", "frozen", ")", "{", "$", "this", "->", "frozen", "=", "$", "this", "->", "redis", "->", "exists", "(", "$", "this", "->", "buildKey", "(", ...
Tells if this backend is frozen. @return boolean
[ "Tells", "if", "this", "backend", "is", "frozen", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L385-L392
neos/flow-development-collection
Neos.Cache/Classes/Backend/RedisBackend.php
RedisBackend.getStatus
public function getStatus(): Result { $result = new Result(); try { $this->verifyRedisVersionIsSupported(); } catch (CacheException $exception) { $result->addError(new Error($exception->getMessage(), $exception->getCode(), [], 'Redis Version')); return $result; } $serverInfo = (array)$this->redis->info('SERVER'); if (isset($serverInfo['redis_version'])) { $result->addNotice(new Notice((string)$serverInfo['redis_version'], null, [], 'Redis version')); } if (isset($serverInfo['tcp_port'])) { $result->addNotice(new Notice((string)$serverInfo['tcp_port'], null, [], 'TCP Port')); } if (isset($serverInfo['uptime_in_seconds'])) { $result->addNotice(new Notice((string)$serverInfo['uptime_in_seconds'], null, [], 'Uptime (seconds)')); } return $result; }
php
public function getStatus(): Result { $result = new Result(); try { $this->verifyRedisVersionIsSupported(); } catch (CacheException $exception) { $result->addError(new Error($exception->getMessage(), $exception->getCode(), [], 'Redis Version')); return $result; } $serverInfo = (array)$this->redis->info('SERVER'); if (isset($serverInfo['redis_version'])) { $result->addNotice(new Notice((string)$serverInfo['redis_version'], null, [], 'Redis version')); } if (isset($serverInfo['tcp_port'])) { $result->addNotice(new Notice((string)$serverInfo['tcp_port'], null, [], 'TCP Port')); } if (isset($serverInfo['uptime_in_seconds'])) { $result->addNotice(new Notice((string)$serverInfo['uptime_in_seconds'], null, [], 'Uptime (seconds)')); } return $result; }
[ "public", "function", "getStatus", "(", ")", ":", "Result", "{", "$", "result", "=", "new", "Result", "(", ")", ";", "try", "{", "$", "this", "->", "verifyRedisVersionIsSupported", "(", ")", ";", "}", "catch", "(", "CacheException", "$", "exception", ")"...
Validates that the configured redis backend is accessible and returns some details about its configuration if that's the case @return Result @api
[ "Validates", "that", "the", "configured", "redis", "backend", "is", "accessible", "and", "returns", "some", "details", "about", "its", "configuration", "if", "that", "s", "the", "case" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/RedisBackend.php#L548-L568
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateActionController
public function generateActionController($packageKey, $subpackage, $controllerName, $overwrite = false) { list($baseNamespace, $namespaceEntryPath) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey)); $controllerName = ucfirst($controllerName); $controllerClassName = $controllerName . 'Controller'; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Controller/ActionControllerTemplate.php.tmpl'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['packageNamespace'] = trim($baseNamespace, '\\'); $contextVariables['subpackage'] = $subpackage; $contextVariables['isInSubpackage'] = ($subpackage != ''); $contextVariables['controllerClassName'] = $controllerClassName; $contextVariables['controllerName'] = $controllerName; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $subpackagePath = $subpackage != '' ? $subpackage . '/' : ''; $controllerFilename = $controllerClassName . '.php'; $controllerPath = Files::concatenatePaths([$namespaceEntryPath, $subpackagePath, 'Controller']) . '/'; $targetPathAndFilename = $controllerPath . $controllerFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); return $this->generatedFiles; }
php
public function generateActionController($packageKey, $subpackage, $controllerName, $overwrite = false) { list($baseNamespace, $namespaceEntryPath) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey)); $controllerName = ucfirst($controllerName); $controllerClassName = $controllerName . 'Controller'; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Controller/ActionControllerTemplate.php.tmpl'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['packageNamespace'] = trim($baseNamespace, '\\'); $contextVariables['subpackage'] = $subpackage; $contextVariables['isInSubpackage'] = ($subpackage != ''); $contextVariables['controllerClassName'] = $controllerClassName; $contextVariables['controllerName'] = $controllerName; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $subpackagePath = $subpackage != '' ? $subpackage . '/' : ''; $controllerFilename = $controllerClassName . '.php'; $controllerPath = Files::concatenatePaths([$namespaceEntryPath, $subpackagePath, 'Controller']) . '/'; $targetPathAndFilename = $controllerPath . $controllerFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); return $this->generatedFiles; }
[ "public", "function", "generateActionController", "(", "$", "packageKey", ",", "$", "subpackage", ",", "$", "controllerName", ",", "$", "overwrite", "=", "false", ")", "{", "list", "(", "$", "baseNamespace", ",", "$", "namespaceEntryPath", ")", "=", "$", "th...
Generate a controller with the given name for the given package @param string $packageKey The package key of the controller's package @param string $subpackage An optional subpackage name @param string $controllerName The name of the new controller @param boolean $overwrite Overwrite any existing files? @return array An array of generated filenames
[ "Generate", "a", "controller", "with", "the", "given", "name", "for", "the", "given", "package" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L67-L93
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateView
public function generateView($packageKey, $subpackage, $controllerName, $viewName, $templateName, $overwrite = false) { list($baseNamespace) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey)); $viewName = ucfirst($viewName); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/View/' . $templateName . 'Template.html'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['subpackage'] = $subpackage; $contextVariables['isInSubpackage'] = ($subpackage != ''); $contextVariables['controllerName'] = $controllerName; $contextVariables['viewName'] = $viewName; $contextVariables['modelName'] = strtolower($controllerName[0]) . substr($controllerName, 1); $contextVariables['repositoryClassName'] = '\\' . trim($baseNamespace, '\\') . ($subpackage != '' ? '\\' . $subpackage : '') . '\Domain\Repository\\' . $controllerName . 'Repository'; $contextVariables['modelFullClassName'] = '\\' . trim($baseNamespace, '\\') . ($subpackage != '' ? '\\' . $subpackage : '') . '\Domain\Model\\' . $controllerName; $contextVariables['modelClassName'] = ucfirst($contextVariables['modelName']); $modelClassSchema = $this->reflectionService->getClassSchema($contextVariables['modelFullClassName']); if ($modelClassSchema !== null) { $contextVariables['properties'] = $modelClassSchema->getProperties(); if (isset($contextVariables['properties']['Persistence_Object_Identifier'])) { unset($contextVariables['properties']['Persistence_Object_Identifier']); } } if (!isset($contextVariables['properties']) || $contextVariables['properties'] === []) { $contextVariables['properties'] = ['name' => ['type' => 'string']]; } $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $subpackagePath = $subpackage != '' ? $subpackage . '/' : ''; $viewFilename = $viewName . '.html'; $viewPath = 'resource://' . $packageKey . '/Private/Templates/' . $subpackagePath . $controllerName . '/'; $targetPathAndFilename = $viewPath . $viewFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); return $this->generatedFiles; }
php
public function generateView($packageKey, $subpackage, $controllerName, $viewName, $templateName, $overwrite = false) { list($baseNamespace) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey)); $viewName = ucfirst($viewName); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/View/' . $templateName . 'Template.html'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['subpackage'] = $subpackage; $contextVariables['isInSubpackage'] = ($subpackage != ''); $contextVariables['controllerName'] = $controllerName; $contextVariables['viewName'] = $viewName; $contextVariables['modelName'] = strtolower($controllerName[0]) . substr($controllerName, 1); $contextVariables['repositoryClassName'] = '\\' . trim($baseNamespace, '\\') . ($subpackage != '' ? '\\' . $subpackage : '') . '\Domain\Repository\\' . $controllerName . 'Repository'; $contextVariables['modelFullClassName'] = '\\' . trim($baseNamespace, '\\') . ($subpackage != '' ? '\\' . $subpackage : '') . '\Domain\Model\\' . $controllerName; $contextVariables['modelClassName'] = ucfirst($contextVariables['modelName']); $modelClassSchema = $this->reflectionService->getClassSchema($contextVariables['modelFullClassName']); if ($modelClassSchema !== null) { $contextVariables['properties'] = $modelClassSchema->getProperties(); if (isset($contextVariables['properties']['Persistence_Object_Identifier'])) { unset($contextVariables['properties']['Persistence_Object_Identifier']); } } if (!isset($contextVariables['properties']) || $contextVariables['properties'] === []) { $contextVariables['properties'] = ['name' => ['type' => 'string']]; } $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $subpackagePath = $subpackage != '' ? $subpackage . '/' : ''; $viewFilename = $viewName . '.html'; $viewPath = 'resource://' . $packageKey . '/Private/Templates/' . $subpackagePath . $controllerName . '/'; $targetPathAndFilename = $viewPath . $viewFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); return $this->generatedFiles; }
[ "public", "function", "generateView", "(", "$", "packageKey", ",", "$", "subpackage", ",", "$", "controllerName", ",", "$", "viewName", ",", "$", "templateName", ",", "$", "overwrite", "=", "false", ")", "{", "list", "(", "$", "baseNamespace", ")", "=", ...
Generate a view with the given name for the given package and controller @param string $packageKey The package key of the controller's package @param string $subpackage An optional subpackage name @param string $controllerName The name of the new controller @param string $viewName The name of the view @param string $templateName The name of the view @param boolean $overwrite Overwrite any existing files? @return array An array of generated filenames
[ "Generate", "a", "view", "with", "the", "given", "name", "for", "the", "given", "package", "and", "controller" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L180-L220
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateLayout
public function generateLayout($packageKey, $layoutName, $overwrite = false) { $layoutName = ucfirst($layoutName); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/View/' . $layoutName . 'Layout.html'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $layoutFilename = $layoutName . '.html'; $viewPath = 'resource://' . $packageKey . '/Private/Layouts/'; $targetPathAndFilename = $viewPath . $layoutFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); return $this->generatedFiles; }
php
public function generateLayout($packageKey, $layoutName, $overwrite = false) { $layoutName = ucfirst($layoutName); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/View/' . $layoutName . 'Layout.html'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $layoutFilename = $layoutName . '.html'; $viewPath = 'resource://' . $packageKey . '/Private/Layouts/'; $targetPathAndFilename = $viewPath . $layoutFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); return $this->generatedFiles; }
[ "public", "function", "generateLayout", "(", "$", "packageKey", ",", "$", "layoutName", ",", "$", "overwrite", "=", "false", ")", "{", "$", "layoutName", "=", "ucfirst", "(", "$", "layoutName", ")", ";", "$", "templatePathAndFilename", "=", "'resource://Neos.K...
Generate a default layout @param string $packageKey The package key of the controller's package @param string $layoutName The name of the layout @param boolean $overwrite Overwrite any existing files? @return array An array of generated filenames
[ "Generate", "a", "default", "layout" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L230-L248
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateModel
public function generateModel($packageKey, $modelName, array $fieldDefinitions, $overwrite = false) { list($baseNamespace, $namespaceEntryPath) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey)); $modelName = ucfirst($modelName); $namespace = trim($baseNamespace, '\\') . '\\Domain\\Model'; $fieldDefinitions = $this->normalizeFieldDefinitions($fieldDefinitions, $namespace); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Model/EntityTemplate.php.tmpl'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['modelName'] = $modelName; $contextVariables['fieldDefinitions'] = $fieldDefinitions; $contextVariables['namespace'] = $namespace; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $modelFilename = $modelName . '.php'; $modelPath = $namespaceEntryPath . '/Domain/Model/'; $targetPathAndFilename = $modelPath . $modelFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); $this->generateTestsForModel($packageKey, $modelName, $overwrite); return $this->generatedFiles; }
php
public function generateModel($packageKey, $modelName, array $fieldDefinitions, $overwrite = false) { list($baseNamespace, $namespaceEntryPath) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey)); $modelName = ucfirst($modelName); $namespace = trim($baseNamespace, '\\') . '\\Domain\\Model'; $fieldDefinitions = $this->normalizeFieldDefinitions($fieldDefinitions, $namespace); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Model/EntityTemplate.php.tmpl'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['modelName'] = $modelName; $contextVariables['fieldDefinitions'] = $fieldDefinitions; $contextVariables['namespace'] = $namespace; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $modelFilename = $modelName . '.php'; $modelPath = $namespaceEntryPath . '/Domain/Model/'; $targetPathAndFilename = $modelPath . $modelFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); $this->generateTestsForModel($packageKey, $modelName, $overwrite); return $this->generatedFiles; }
[ "public", "function", "generateModel", "(", "$", "packageKey", ",", "$", "modelName", ",", "array", "$", "fieldDefinitions", ",", "$", "overwrite", "=", "false", ")", "{", "list", "(", "$", "baseNamespace", ",", "$", "namespaceEntryPath", ")", "=", "$", "t...
Generate a model for the package with the given model name and fields @param string $packageKey The package key of the controller's package @param string $modelName The name of the new model @param array $fieldDefinitions The field definitions @param boolean $overwrite Overwrite any existing files? @return array An array of generated filenames
[ "Generate", "a", "model", "for", "the", "package", "with", "the", "given", "model", "name", "and", "fields" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L259-L285
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateRepository
public function generateRepository($packageKey, $modelName, $overwrite = false) { list($baseNamespace, $namespaceEntryPath) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey)); $modelName = ucfirst($modelName); $repositoryClassName = $modelName . 'Repository'; $namespace = trim($baseNamespace, '\\') . '\\Domain\\Repository'; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Repository/RepositoryTemplate.php.tmpl'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['modelName'] = $modelName; $contextVariables['repositoryClassName'] = $repositoryClassName; $contextVariables['namespace'] = $namespace; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $repositoryFilename = $repositoryClassName . '.php'; $repositoryPath = Files::concatenatePaths([$namespaceEntryPath, 'Domain/Repository']) . '/'; $targetPathAndFilename = $repositoryPath . $repositoryFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); return $this->generatedFiles; }
php
public function generateRepository($packageKey, $modelName, $overwrite = false) { list($baseNamespace, $namespaceEntryPath) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey)); $modelName = ucfirst($modelName); $repositoryClassName = $modelName . 'Repository'; $namespace = trim($baseNamespace, '\\') . '\\Domain\\Repository'; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Repository/RepositoryTemplate.php.tmpl'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['modelName'] = $modelName; $contextVariables['repositoryClassName'] = $repositoryClassName; $contextVariables['namespace'] = $namespace; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $repositoryFilename = $repositoryClassName . '.php'; $repositoryPath = Files::concatenatePaths([$namespaceEntryPath, 'Domain/Repository']) . '/'; $targetPathAndFilename = $repositoryPath . $repositoryFilename; $this->generateFile($targetPathAndFilename, $fileContent, $overwrite); return $this->generatedFiles; }
[ "public", "function", "generateRepository", "(", "$", "packageKey", ",", "$", "modelName", ",", "$", "overwrite", "=", "false", ")", "{", "list", "(", "$", "baseNamespace", ",", "$", "namespaceEntryPath", ")", "=", "$", "this", "->", "getPrimaryNamespaceAndEnt...
Generate a repository for a model given a model name and package key @param string $packageKey The package key @param string $modelName The name of the model @param boolean $overwrite Overwrite any existing files? @return array An array of generated filenames
[ "Generate", "a", "repository", "for", "a", "model", "given", "a", "model", "name", "and", "package", "key" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L328-L352
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateDocumentation
public function generateDocumentation($packageKey) { $documentationPath = Files::concatenatePaths([$this->packageManager->getPackage($packageKey)->getPackagePath(), 'Documentation']); $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/conf.py'; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $targetPathAndFilename = $documentationPath . '/conf.py'; $this->generateFile($targetPathAndFilename, $fileContent); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/Makefile'; $fileContent = file_get_contents($templatePathAndFilename); $targetPathAndFilename = $documentationPath . '/Makefile'; $this->generateFile($targetPathAndFilename, $fileContent); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/index.rst'; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $targetPathAndFilename = $documentationPath . '/index.rst'; $this->generateFile($targetPathAndFilename, $fileContent); $targetPathAndFilename = $documentationPath . '/_build/.gitignore'; $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10)); $targetPathAndFilename = $documentationPath . '/_static/.gitignore'; $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10)); $targetPathAndFilename = $documentationPath . '/_templates/.gitignore'; $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10)); return $this->generatedFiles; }
php
public function generateDocumentation($packageKey) { $documentationPath = Files::concatenatePaths([$this->packageManager->getPackage($packageKey)->getPackagePath(), 'Documentation']); $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/conf.py'; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $targetPathAndFilename = $documentationPath . '/conf.py'; $this->generateFile($targetPathAndFilename, $fileContent); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/Makefile'; $fileContent = file_get_contents($templatePathAndFilename); $targetPathAndFilename = $documentationPath . '/Makefile'; $this->generateFile($targetPathAndFilename, $fileContent); $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/index.rst'; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $targetPathAndFilename = $documentationPath . '/index.rst'; $this->generateFile($targetPathAndFilename, $fileContent); $targetPathAndFilename = $documentationPath . '/_build/.gitignore'; $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10)); $targetPathAndFilename = $documentationPath . '/_static/.gitignore'; $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10)); $targetPathAndFilename = $documentationPath . '/_templates/.gitignore'; $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10)); return $this->generatedFiles; }
[ "public", "function", "generateDocumentation", "(", "$", "packageKey", ")", "{", "$", "documentationPath", "=", "Files", "::", "concatenatePaths", "(", "[", "$", "this", "->", "packageManager", "->", "getPackage", "(", "$", "packageKey", ")", "->", "getPackagePa...
Generate a documentation skeleton for the package key @param string $packageKey The package key @return array An array of generated filenames
[ "Generate", "a", "documentation", "skeleton", "for", "the", "package", "key" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L360-L389
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateTranslation
public function generateTranslation($packageKey, $sourceLanguageKey, array $targetLanguageKeys = []) { $translationPath = 'resource://' . $packageKey . '/Private/Translations'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['sourceLanguageKey'] = $sourceLanguageKey; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/SourceLanguageTemplate.xlf.tmpl'; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $sourceLanguageFile = Files::concatenatePaths([$translationPath, $sourceLanguageKey, 'Main.xlf']); $this->generateFile($sourceLanguageFile, $fileContent); if ($targetLanguageKeys) { $xliffParser = new XliffParser(); $parsedXliffArray = $xliffParser->getParsedData($sourceLanguageFile); foreach ($targetLanguageKeys as $targetLanguageKey) { $contextVariables['targetLanguageKey'] = $targetLanguageKey; $contextVariables['translationUnits'] = $parsedXliffArray['translationUnits']; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/TargetLanguageTemplate.xlf.tmpl'; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $targetPathAndFilename = Files::concatenatePaths([$translationPath, $targetLanguageKey, 'Main.xlf']); $this->generateFile($targetPathAndFilename, $fileContent); } } return $this->generatedFiles; }
php
public function generateTranslation($packageKey, $sourceLanguageKey, array $targetLanguageKeys = []) { $translationPath = 'resource://' . $packageKey . '/Private/Translations'; $contextVariables = []; $contextVariables['packageKey'] = $packageKey; $contextVariables['sourceLanguageKey'] = $sourceLanguageKey; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/SourceLanguageTemplate.xlf.tmpl'; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $sourceLanguageFile = Files::concatenatePaths([$translationPath, $sourceLanguageKey, 'Main.xlf']); $this->generateFile($sourceLanguageFile, $fileContent); if ($targetLanguageKeys) { $xliffParser = new XliffParser(); $parsedXliffArray = $xliffParser->getParsedData($sourceLanguageFile); foreach ($targetLanguageKeys as $targetLanguageKey) { $contextVariables['targetLanguageKey'] = $targetLanguageKey; $contextVariables['translationUnits'] = $parsedXliffArray['translationUnits']; $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/TargetLanguageTemplate.xlf.tmpl'; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $targetPathAndFilename = Files::concatenatePaths([$translationPath, $targetLanguageKey, 'Main.xlf']); $this->generateFile($targetPathAndFilename, $fileContent); } } return $this->generatedFiles; }
[ "public", "function", "generateTranslation", "(", "$", "packageKey", ",", "$", "sourceLanguageKey", ",", "array", "$", "targetLanguageKeys", "=", "[", "]", ")", "{", "$", "translationPath", "=", "'resource://'", ".", "$", "packageKey", ".", "'/Private/Translations...
Generate translation for the package key @param string $packageKey @param string $sourceLanguageKey @param array $targetLanguageKeys @return array An array of generated filenames
[ "Generate", "translation", "for", "the", "package", "key" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L399-L426
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.normalizeFieldDefinitions
protected function normalizeFieldDefinitions(array $fieldDefinitions, $namespace = '') { foreach ($fieldDefinitions as &$fieldDefinition) { if ($fieldDefinition['type'] == 'bool') { $fieldDefinition['type'] = 'boolean'; } elseif ($fieldDefinition['type'] == 'int') { $fieldDefinition['type'] = 'integer'; } elseif (preg_match('/^[A-Z]/', $fieldDefinition['type'])) { if (class_exists($fieldDefinition['type'])) { $fieldDefinition['type'] = '\\' . $fieldDefinition['type']; } else { $fieldDefinition['type'] = '\\' . $namespace . '\\' . $fieldDefinition['type']; } } } return $fieldDefinitions; }
php
protected function normalizeFieldDefinitions(array $fieldDefinitions, $namespace = '') { foreach ($fieldDefinitions as &$fieldDefinition) { if ($fieldDefinition['type'] == 'bool') { $fieldDefinition['type'] = 'boolean'; } elseif ($fieldDefinition['type'] == 'int') { $fieldDefinition['type'] = 'integer'; } elseif (preg_match('/^[A-Z]/', $fieldDefinition['type'])) { if (class_exists($fieldDefinition['type'])) { $fieldDefinition['type'] = '\\' . $fieldDefinition['type']; } else { $fieldDefinition['type'] = '\\' . $namespace . '\\' . $fieldDefinition['type']; } } } return $fieldDefinitions; }
[ "protected", "function", "normalizeFieldDefinitions", "(", "array", "$", "fieldDefinitions", ",", "$", "namespace", "=", "''", ")", "{", "foreach", "(", "$", "fieldDefinitions", "as", "&", "$", "fieldDefinition", ")", "{", "if", "(", "$", "fieldDefinition", "[...
Normalize types and prefix types with namespaces @param array $fieldDefinitions The field definitions @param string $namespace The namespace @return array The normalized and type converted field definitions
[ "Normalize", "types", "and", "prefix", "types", "with", "namespaces" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L435-L451
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateFile
protected function generateFile($targetPathAndFilename, $fileContent, $force = false) { if (!is_dir(dirname($targetPathAndFilename))) { \Neos\Utility\Files::createDirectoryRecursively(dirname($targetPathAndFilename)); } if (substr($targetPathAndFilename, 0, 11) === 'resource://') { list($packageKey, $resourcePath) = explode('/', substr($targetPathAndFilename, 11), 2); $relativeTargetPathAndFilename = $packageKey . '/Resources/' . $resourcePath; } elseif (strpos($targetPathAndFilename, 'Tests') !== false) { $relativeTargetPathAndFilename = substr($targetPathAndFilename, strrpos(substr($targetPathAndFilename, 0, strpos($targetPathAndFilename, 'Tests/') - 1), '/') + 1); } else { $relativeTargetPathAndFilename = substr($targetPathAndFilename, strrpos(substr($targetPathAndFilename, 0, strpos($targetPathAndFilename, 'Classes/') - 1), '/') + 1); } if (!file_exists($targetPathAndFilename) || $force === true) { file_put_contents($targetPathAndFilename, $fileContent); $this->generatedFiles[] = 'Created .../' . $relativeTargetPathAndFilename; } else { $this->generatedFiles[] = 'Omitted as file already exists .../' . $relativeTargetPathAndFilename; } }
php
protected function generateFile($targetPathAndFilename, $fileContent, $force = false) { if (!is_dir(dirname($targetPathAndFilename))) { \Neos\Utility\Files::createDirectoryRecursively(dirname($targetPathAndFilename)); } if (substr($targetPathAndFilename, 0, 11) === 'resource://') { list($packageKey, $resourcePath) = explode('/', substr($targetPathAndFilename, 11), 2); $relativeTargetPathAndFilename = $packageKey . '/Resources/' . $resourcePath; } elseif (strpos($targetPathAndFilename, 'Tests') !== false) { $relativeTargetPathAndFilename = substr($targetPathAndFilename, strrpos(substr($targetPathAndFilename, 0, strpos($targetPathAndFilename, 'Tests/') - 1), '/') + 1); } else { $relativeTargetPathAndFilename = substr($targetPathAndFilename, strrpos(substr($targetPathAndFilename, 0, strpos($targetPathAndFilename, 'Classes/') - 1), '/') + 1); } if (!file_exists($targetPathAndFilename) || $force === true) { file_put_contents($targetPathAndFilename, $fileContent); $this->generatedFiles[] = 'Created .../' . $relativeTargetPathAndFilename; } else { $this->generatedFiles[] = 'Omitted as file already exists .../' . $relativeTargetPathAndFilename; } }
[ "protected", "function", "generateFile", "(", "$", "targetPathAndFilename", ",", "$", "fileContent", ",", "$", "force", "=", "false", ")", "{", "if", "(", "!", "is_dir", "(", "dirname", "(", "$", "targetPathAndFilename", ")", ")", ")", "{", "\\", "Neos", ...
Generate a file with the given content and add it to the generated files @param string $targetPathAndFilename @param string $fileContent @param boolean $force @return void
[ "Generate", "a", "file", "with", "the", "given", "content", "and", "add", "it", "to", "the", "generated", "files" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L462-L483
neos/flow-development-collection
Neos.Kickstarter/Classes/Service/GeneratorService.php
GeneratorService.renderTemplate
protected function renderTemplate($templatePathAndFilename, array $contextVariables) { $standaloneView = new StandaloneView(); $standaloneView->setTemplatePathAndFilename($templatePathAndFilename); $standaloneView->assignMultiple($contextVariables); return $standaloneView->render(); }
php
protected function renderTemplate($templatePathAndFilename, array $contextVariables) { $standaloneView = new StandaloneView(); $standaloneView->setTemplatePathAndFilename($templatePathAndFilename); $standaloneView->assignMultiple($contextVariables); return $standaloneView->render(); }
[ "protected", "function", "renderTemplate", "(", "$", "templatePathAndFilename", ",", "array", "$", "contextVariables", ")", "{", "$", "standaloneView", "=", "new", "StandaloneView", "(", ")", ";", "$", "standaloneView", "->", "setTemplatePathAndFilename", "(", "$", ...
Render the given template file with the given variables @param string $templatePathAndFilename @param array $contextVariables @return string @throws \Neos\FluidAdaptor\Core\Exception
[ "Render", "the", "given", "template", "file", "with", "the", "given", "variables" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Kickstarter/Classes/Service/GeneratorService.php#L493-L499
neos/flow-development-collection
Neos.Eel/Classes/FlowQuery/OperationResolver.php
OperationResolver.initializeObject
public function initializeObject() { $operationsAndFinalOperationNames = static::buildOperationsAndFinalOperationNames($this->objectManager); $this->operations = $operationsAndFinalOperationNames[0]; $this->finalOperationNames = $operationsAndFinalOperationNames[1]; }
php
public function initializeObject() { $operationsAndFinalOperationNames = static::buildOperationsAndFinalOperationNames($this->objectManager); $this->operations = $operationsAndFinalOperationNames[0]; $this->finalOperationNames = $operationsAndFinalOperationNames[1]; }
[ "public", "function", "initializeObject", "(", ")", "{", "$", "operationsAndFinalOperationNames", "=", "static", "::", "buildOperationsAndFinalOperationNames", "(", "$", "this", "->", "objectManager", ")", ";", "$", "this", "->", "operations", "=", "$", "operationsA...
Initializer, building up $this->operations and $this->finalOperationNames
[ "Initializer", "building", "up", "$this", "-", ">", "operations", "and", "$this", "-", ">", "finalOperationNames" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/OperationResolver.php#L56-L61
neos/flow-development-collection
Neos.Eel/Classes/FlowQuery/OperationResolver.php
OperationResolver.resolveOperation
public function resolveOperation($operationName, $context) { if (!isset($this->operations[$operationName])) { throw new FlowQueryException('Operation "' . $operationName . '" not found.', 1332491837); } foreach ($this->operations[$operationName] as $operationClassName) { /** @var OperationInterface $operation */ $operation = $this->objectManager->get($operationClassName); if ($operation->canEvaluate($context)) { return $operation; } } throw new FlowQueryException('No operation which satisfies the runtime constraints found for "' . $operationName . '".', 1332491864); }
php
public function resolveOperation($operationName, $context) { if (!isset($this->operations[$operationName])) { throw new FlowQueryException('Operation "' . $operationName . '" not found.', 1332491837); } foreach ($this->operations[$operationName] as $operationClassName) { /** @var OperationInterface $operation */ $operation = $this->objectManager->get($operationClassName); if ($operation->canEvaluate($context)) { return $operation; } } throw new FlowQueryException('No operation which satisfies the runtime constraints found for "' . $operationName . '".', 1332491864); }
[ "public", "function", "resolveOperation", "(", "$", "operationName", ",", "$", "context", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "operations", "[", "$", "operationName", "]", ")", ")", "{", "throw", "new", "FlowQueryException", "(", "...
Resolve an operation, taking runtime constraints into account. @param string $operationName @param array|mixed $context @throws FlowQueryException @return OperationInterface the resolved operation
[ "Resolve", "an", "operation", "taking", "runtime", "constraints", "into", "account", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/OperationResolver.php#L120-L134
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Aspect/LazyLoadingObjectAspect.php
LazyLoadingObjectAspect.initialize
public function initialize(JoinPointInterface $joinPoint) { $proxy = $joinPoint->getProxy(); if (property_exists($proxy, 'Flow_Persistence_LazyLoadingObject_thawProperties') && $proxy->Flow_Persistence_LazyLoadingObject_thawProperties instanceof \Closure) { $proxy->Flow_Persistence_LazyLoadingObject_thawProperties->__invoke($proxy); unset($proxy->Flow_Persistence_LazyLoadingObject_thawProperties); } }
php
public function initialize(JoinPointInterface $joinPoint) { $proxy = $joinPoint->getProxy(); if (property_exists($proxy, 'Flow_Persistence_LazyLoadingObject_thawProperties') && $proxy->Flow_Persistence_LazyLoadingObject_thawProperties instanceof \Closure) { $proxy->Flow_Persistence_LazyLoadingObject_thawProperties->__invoke($proxy); unset($proxy->Flow_Persistence_LazyLoadingObject_thawProperties); } }
[ "public", "function", "initialize", "(", "JoinPointInterface", "$", "joinPoint", ")", "{", "$", "proxy", "=", "$", "joinPoint", "->", "getProxy", "(", ")", ";", "if", "(", "property_exists", "(", "$", "proxy", ",", "'Flow_Persistence_LazyLoadingObject_thawProperti...
Before advice, making sure we initialize before use. This expects $proxy->Flow_Persistence_LazyLoadingObject_thawProperties to be a Closure that populates the object. That variable is unset after initializing the object! @param JoinPointInterface $joinPoint The current join point @return void @Flow\Before("Neos\Flow\Persistence\Generic\Aspect\LazyLoadingObjectAspect->needsLazyLoadingObjectAspect && !method(.*->__construct())")
[ "Before", "advice", "making", "sure", "we", "initialize", "before", "use", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Aspect/LazyLoadingObjectAspect.php#L50-L57
neos/flow-development-collection
Neos.Flow/Classes/Security/Authorization/Privilege/Method/MethodTargetExpressionParser.php
MethodTargetExpressionParser.parseDesignatorPointcut
protected function parseDesignatorPointcut(string $operator, string $pointcutExpression, PointcutFilterComposite $pointcutFilterComposite, array &$trace = []): void { throw new InvalidPointcutExpressionException('The given method privilege target matcher contained an expression for a named pointcut. This not supported! Given expression: "' . $pointcutExpression . '".', 1222014591); }
php
protected function parseDesignatorPointcut(string $operator, string $pointcutExpression, PointcutFilterComposite $pointcutFilterComposite, array &$trace = []): void { throw new InvalidPointcutExpressionException('The given method privilege target matcher contained an expression for a named pointcut. This not supported! Given expression: "' . $pointcutExpression . '".', 1222014591); }
[ "protected", "function", "parseDesignatorPointcut", "(", "string", "$", "operator", ",", "string", "$", "pointcutExpression", ",", "PointcutFilterComposite", "$", "pointcutFilterComposite", ",", "array", "&", "$", "trace", "=", "[", "]", ")", ":", "void", "{", "...
Throws an exception, as recursive privilege targets are not allowed. @param string $operator The operator @param string $pointcutExpression The pointcut expression (value of the designator) @param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the pointcut filter) will be added to this composite object. @param array &$trace @return void @throws InvalidPointcutExpressionException
[ "Throws", "an", "exception", "as", "recursive", "privilege", "targets", "are", "not", "allowed", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Authorization/Privilege/Method/MethodTargetExpressionParser.php#L37-L40
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.injectSettings
public function injectSettings(array $settings) { if (isset($settings['security']['cryptography']['RSAWalletServicePHP']['openSSLConfiguration']) && is_array($settings['security']['cryptography']['RSAWalletServicePHP']['openSSLConfiguration'])) { $this->openSSLConfiguration = $settings['security']['cryptography']['RSAWalletServicePHP']['openSSLConfiguration']; } if (isset($settings['security']['cryptography']['RSAWalletServicePHP']['keystorePath'])) { $this->keystorePathAndFilename = $settings['security']['cryptography']['RSAWalletServicePHP']['keystorePath']; } else { throw new MissingConfigurationException('The configuration setting Neos.Flow.security.cryptography.RSAWalletServicePHP.keystorePath is missing. Please specify it in your Settings.yaml file. Beware: This file must not be accessible by the public!', 1305711354); } if (isset($settings['security']['cryptography']['RSAWalletServicePHP']['paddingAlgorithm']) && is_int($settings['security']['cryptography']['RSAWalletServicePHP']['paddingAlgorithm'])) { $this->paddingAlgorithm = $settings['security']['cryptography']['RSAWalletServicePHP']['paddingAlgorithm']; } else { throw new SecurityException('The padding algorithm given in security.cryptography.RSAWalletServicePHP.paddingAlgorithm is not available.', 1556785429); } }
php
public function injectSettings(array $settings) { if (isset($settings['security']['cryptography']['RSAWalletServicePHP']['openSSLConfiguration']) && is_array($settings['security']['cryptography']['RSAWalletServicePHP']['openSSLConfiguration'])) { $this->openSSLConfiguration = $settings['security']['cryptography']['RSAWalletServicePHP']['openSSLConfiguration']; } if (isset($settings['security']['cryptography']['RSAWalletServicePHP']['keystorePath'])) { $this->keystorePathAndFilename = $settings['security']['cryptography']['RSAWalletServicePHP']['keystorePath']; } else { throw new MissingConfigurationException('The configuration setting Neos.Flow.security.cryptography.RSAWalletServicePHP.keystorePath is missing. Please specify it in your Settings.yaml file. Beware: This file must not be accessible by the public!', 1305711354); } if (isset($settings['security']['cryptography']['RSAWalletServicePHP']['paddingAlgorithm']) && is_int($settings['security']['cryptography']['RSAWalletServicePHP']['paddingAlgorithm'])) { $this->paddingAlgorithm = $settings['security']['cryptography']['RSAWalletServicePHP']['paddingAlgorithm']; } else { throw new SecurityException('The padding algorithm given in security.cryptography.RSAWalletServicePHP.paddingAlgorithm is not available.', 1556785429); } }
[ "public", "function", "injectSettings", "(", "array", "$", "settings", ")", "{", "if", "(", "isset", "(", "$", "settings", "[", "'security'", "]", "[", "'cryptography'", "]", "[", "'RSAWalletServicePHP'", "]", "[", "'openSSLConfiguration'", "]", ")", "&&", "...
Injects the OpenSSL configuration to be used @param array $settings @return void @throws MissingConfigurationException @throws SecurityException
[ "Injects", "the", "OpenSSL", "configuration", "to", "be", "used" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L63-L81
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.initializeObject
public function initializeObject() { if (file_exists($this->keystorePathAndFilename)) { $this->keys = unserialize(file_get_contents($this->keystorePathAndFilename)); } $this->saveKeysOnShutdown = false; }
php
public function initializeObject() { if (file_exists($this->keystorePathAndFilename)) { $this->keys = unserialize(file_get_contents($this->keystorePathAndFilename)); } $this->saveKeysOnShutdown = false; }
[ "public", "function", "initializeObject", "(", ")", "{", "if", "(", "file_exists", "(", "$", "this", "->", "keystorePathAndFilename", ")", ")", "{", "$", "this", "->", "keys", "=", "unserialize", "(", "file_get_contents", "(", "$", "this", "->", "keystorePat...
Initializes the rsa wallet service by fetching the keys from the keystore file @return void
[ "Initializes", "the", "rsa", "wallet", "service", "by", "fetching", "the", "keys", "from", "the", "keystore", "file" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L88-L94
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.generateNewKeypair
public function generateNewKeypair($usedForPasswords = false) { $keyResource = openssl_pkey_new($this->openSSLConfiguration); if ($keyResource === false) { throw new SecurityException('OpenSSL private key generation failed.', 1254838154); } $modulus = $this->getModulus($keyResource); $privateKeyString = $this->getPrivateKeyString($keyResource); $publicKeyString = $this->getPublicKeyString($keyResource); $privateKey = new OpenSslRsaKey($modulus, $privateKeyString); $publicKey = new OpenSslRsaKey($modulus, $publicKeyString); return $this->storeKeyPair($publicKey, $privateKey, $usedForPasswords); }
php
public function generateNewKeypair($usedForPasswords = false) { $keyResource = openssl_pkey_new($this->openSSLConfiguration); if ($keyResource === false) { throw new SecurityException('OpenSSL private key generation failed.', 1254838154); } $modulus = $this->getModulus($keyResource); $privateKeyString = $this->getPrivateKeyString($keyResource); $publicKeyString = $this->getPublicKeyString($keyResource); $privateKey = new OpenSslRsaKey($modulus, $privateKeyString); $publicKey = new OpenSslRsaKey($modulus, $publicKeyString); return $this->storeKeyPair($publicKey, $privateKey, $usedForPasswords); }
[ "public", "function", "generateNewKeypair", "(", "$", "usedForPasswords", "=", "false", ")", "{", "$", "keyResource", "=", "openssl_pkey_new", "(", "$", "this", "->", "openSSLConfiguration", ")", ";", "if", "(", "$", "keyResource", "===", "false", ")", "{", ...
Generates a new keypair and returns a fingerprint to refer to it @param boolean $usedForPasswords true if this keypair should be used to encrypt passwords (then decryption won't be allowed!). @return string The RSA public key fingerprint for reference @throws SecurityException
[ "Generates", "a", "new", "keypair", "and", "returns", "a", "fingerprint", "to", "refer", "to", "it" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L103-L119
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.registerKeyPairFromPrivateKeyString
public function registerKeyPairFromPrivateKeyString($privateKeyString, $usedForPasswords = false) { $keyResource = openssl_pkey_get_private($privateKeyString); $modulus = $this->getModulus($keyResource); $publicKeyString = $this->getPublicKeyString($keyResource); $privateKey = new OpenSslRsaKey($modulus, $privateKeyString); $publicKey = new OpenSslRsaKey($modulus, $publicKeyString); return $this->storeKeyPair($publicKey, $privateKey, $usedForPasswords); }
php
public function registerKeyPairFromPrivateKeyString($privateKeyString, $usedForPasswords = false) { $keyResource = openssl_pkey_get_private($privateKeyString); $modulus = $this->getModulus($keyResource); $publicKeyString = $this->getPublicKeyString($keyResource); $privateKey = new OpenSslRsaKey($modulus, $privateKeyString); $publicKey = new OpenSslRsaKey($modulus, $publicKeyString); return $this->storeKeyPair($publicKey, $privateKey, $usedForPasswords); }
[ "public", "function", "registerKeyPairFromPrivateKeyString", "(", "$", "privateKeyString", ",", "$", "usedForPasswords", "=", "false", ")", "{", "$", "keyResource", "=", "openssl_pkey_get_private", "(", "$", "privateKeyString", ")", ";", "$", "modulus", "=", "$", ...
Adds the specified keypair to the local store and returns a fingerprint to refer to it. @param string $privateKeyString The private key in its string representation @param boolean $usedForPasswords true if this keypair should be used to encrypt passwords (then decryption won't be allowed!). @return string The RSA public key fingerprint for reference
[ "Adds", "the", "specified", "keypair", "to", "the", "local", "store", "and", "returns", "a", "fingerprint", "to", "refer", "to", "it", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L128-L139
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.registerPublicKeyFromString
public function registerPublicKeyFromString($publicKeyString) { $keyResource = openssl_pkey_get_public($publicKeyString); $modulus = $this->getModulus($keyResource); $publicKey = new OpenSslRsaKey($modulus, $publicKeyString); return $this->storeKeyPair($publicKey, null, false); }
php
public function registerPublicKeyFromString($publicKeyString) { $keyResource = openssl_pkey_get_public($publicKeyString); $modulus = $this->getModulus($keyResource); $publicKey = new OpenSslRsaKey($modulus, $publicKeyString); return $this->storeKeyPair($publicKey, null, false); }
[ "public", "function", "registerPublicKeyFromString", "(", "$", "publicKeyString", ")", "{", "$", "keyResource", "=", "openssl_pkey_get_public", "(", "$", "publicKeyString", ")", ";", "$", "modulus", "=", "$", "this", "->", "getModulus", "(", "$", "keyResource", ...
Adds the specified public key to the wallet and returns a fingerprint to refer to it. This is helpful if you have not private key and want to use this key only to verify incoming data. @param string $publicKeyString The public key in its string representation @return string The RSA public key fingerprint for reference
[ "Adds", "the", "specified", "public", "key", "to", "the", "wallet", "and", "returns", "a", "fingerprint", "to", "refer", "to", "it", ".", "This", "is", "helpful", "if", "you", "have", "not", "private", "key", "and", "want", "to", "use", "this", "key", ...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L149-L157
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.getPublicKey
public function getPublicKey($fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1231438860); } return $this->keys[$fingerprint]['publicKey']; }
php
public function getPublicKey($fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1231438860); } return $this->keys[$fingerprint]['publicKey']; }
[ "public", "function", "getPublicKey", "(", "$", "fingerprint", ")", "{", "if", "(", "$", "fingerprint", "===", "null", "||", "!", "isset", "(", "$", "this", "->", "keys", "[", "$", "fingerprint", "]", ")", ")", "{", "throw", "new", "InvalidKeyPairIdExcep...
Returns the public key for the given fingerprint @param string $fingerprint The fingerprint of the stored key @return OpenSslRsaKey The public key @throws InvalidKeyPairIdException If the given fingerprint identifies no valid key pair
[ "Returns", "the", "public", "key", "for", "the", "given", "fingerprint" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L166-L173
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.encryptWithPublicKey
public function encryptWithPublicKey($plaintext, $fingerprint) { $cipher = ''; if (openssl_public_encrypt($plaintext, $cipher, $this->getPublicKey($fingerprint)->getKeyString(), $this->paddingAlgorithm) === false) { $openSslErrors = []; while (($errorMessage = openssl_error_string()) !== false) { $openSslErrors[] = $errorMessage; } throw new SecurityException(sprintf('Encryption failed, OpenSSL error: %s', implode(chr(10), $openSslErrors)), 1556609369); } return $cipher; }
php
public function encryptWithPublicKey($plaintext, $fingerprint) { $cipher = ''; if (openssl_public_encrypt($plaintext, $cipher, $this->getPublicKey($fingerprint)->getKeyString(), $this->paddingAlgorithm) === false) { $openSslErrors = []; while (($errorMessage = openssl_error_string()) !== false) { $openSslErrors[] = $errorMessage; } throw new SecurityException(sprintf('Encryption failed, OpenSSL error: %s', implode(chr(10), $openSslErrors)), 1556609369); } return $cipher; }
[ "public", "function", "encryptWithPublicKey", "(", "$", "plaintext", ",", "$", "fingerprint", ")", "{", "$", "cipher", "=", "''", ";", "if", "(", "openssl_public_encrypt", "(", "$", "plaintext", ",", "$", "cipher", ",", "$", "this", "->", "getPublicKey", "...
Encrypts the given plaintext with the public key identified by the given fingerprint @param string $plaintext The plaintext to encrypt @param string $fingerprint The fingerprint to identify to correct public key @return string The ciphertext @throws SecurityException If encryption failed for some other reason
[ "Encrypts", "the", "given", "plaintext", "with", "the", "public", "key", "identified", "by", "the", "given", "fingerprint" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L183-L195
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.decrypt
public function decrypt($cipher, $fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1231438861); } $keyPair = $this->keys[$fingerprint]; if ($keyPair['usedForPasswords']) { throw new DecryptionNotAllowedException('You are not allowed to decrypt passwords!', 1233655350); } return $this->decryptWithPrivateKey($cipher, $keyPair['privateKey']); }
php
public function decrypt($cipher, $fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1231438861); } $keyPair = $this->keys[$fingerprint]; if ($keyPair['usedForPasswords']) { throw new DecryptionNotAllowedException('You are not allowed to decrypt passwords!', 1233655350); } return $this->decryptWithPrivateKey($cipher, $keyPair['privateKey']); }
[ "public", "function", "decrypt", "(", "$", "cipher", ",", "$", "fingerprint", ")", "{", "if", "(", "$", "fingerprint", "===", "null", "||", "!", "isset", "(", "$", "this", "->", "keys", "[", "$", "fingerprint", "]", ")", ")", "{", "throw", "new", "...
Decrypts the given cipher with the private key identified by the given fingerprint Note: You should never decrypt a password with this function. Use checkRSAEncryptedPassword() to check passwords! @param string $cipher cipher text to decrypt @param string $fingerprint The fingerprint to identify the private key (RSA public key fingerprint) @return string The decrypted text @throws InvalidKeyPairIdException If the given fingerprint identifies no valid keypair @throws DecryptionNotAllowedException If the given fingerprint identifies a keypair for encrypted passwords @throws SecurityException If decryption failed for some other reason
[ "Decrypts", "the", "given", "cipher", "with", "the", "private", "key", "identified", "by", "the", "given", "fingerprint", "Note", ":", "You", "should", "never", "decrypt", "a", "password", "with", "this", "function", ".", "Use", "checkRSAEncryptedPassword", "()"...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L209-L222
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.sign
public function sign($plaintext, $fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1299095799); } $signature = ''; openssl_sign($plaintext, $signature, $this->keys[$fingerprint]['privateKey']->getKeyString()); return $signature; }
php
public function sign($plaintext, $fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1299095799); } $signature = ''; openssl_sign($plaintext, $signature, $this->keys[$fingerprint]['privateKey']->getKeyString()); return $signature; }
[ "public", "function", "sign", "(", "$", "plaintext", ",", "$", "fingerprint", ")", "{", "if", "(", "$", "fingerprint", "===", "null", "||", "!", "isset", "(", "$", "this", "->", "keys", "[", "$", "fingerprint", "]", ")", ")", "{", "throw", "new", "...
Signs the given plaintext with the private key identified by the given fingerprint @param string $plaintext The plaintext to sign @param string $fingerprint The fingerprint to identify the private key (RSA public key fingerprint) @return string The signature of the given plaintext @throws InvalidKeyPairIdException If the given fingerprint identifies no valid keypair
[ "Signs", "the", "given", "plaintext", "with", "the", "private", "key", "identified", "by", "the", "given", "fingerprint" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L232-L242
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.verifySignature
public function verifySignature($plaintext, $signature, $fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1304959763); } $verifyResult = openssl_verify($plaintext, $signature, $this->getPublicKey($fingerprint)->getKeyString()); return $verifyResult === 1; }
php
public function verifySignature($plaintext, $signature, $fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1304959763); } $verifyResult = openssl_verify($plaintext, $signature, $this->getPublicKey($fingerprint)->getKeyString()); return $verifyResult === 1; }
[ "public", "function", "verifySignature", "(", "$", "plaintext", ",", "$", "signature", ",", "$", "fingerprint", ")", "{", "if", "(", "$", "fingerprint", "===", "null", "||", "!", "isset", "(", "$", "this", "->", "keys", "[", "$", "fingerprint", "]", ")...
Checks whether the given signature is valid for the given plaintext with the public key identified by the given fingerprint @param string $plaintext The plaintext to sign @param string $signature The signature that should be verified @param string $fingerprint The fingerprint to identify the public key (RSA public key fingerprint) @return boolean true if the signature is correct for the given plaintext and public key @throws InvalidKeyPairIdException
[ "Checks", "whether", "the", "given", "signature", "is", "valid", "for", "the", "given", "plaintext", "with", "the", "public", "key", "identified", "by", "the", "given", "fingerprint" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L254-L263
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.checkRSAEncryptedPassword
public function checkRSAEncryptedPassword($encryptedPassword, $passwordHash, $salt, $fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1233655216); } $decryptedPassword = $this->decryptWithPrivateKey($encryptedPassword, $this->keys[$fingerprint]['privateKey']); return ($passwordHash === md5(md5($decryptedPassword) . $salt)); }
php
public function checkRSAEncryptedPassword($encryptedPassword, $passwordHash, $salt, $fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1233655216); } $decryptedPassword = $this->decryptWithPrivateKey($encryptedPassword, $this->keys[$fingerprint]['privateKey']); return ($passwordHash === md5(md5($decryptedPassword) . $salt)); }
[ "public", "function", "checkRSAEncryptedPassword", "(", "$", "encryptedPassword", ",", "$", "passwordHash", ",", "$", "salt", ",", "$", "fingerprint", ")", "{", "if", "(", "$", "fingerprint", "===", "null", "||", "!", "isset", "(", "$", "this", "->", "keys...
Checks if the given encrypted password is correct by comparing it's md5 hash. The salt is appended to the decrypted password string before hashing. @param string $encryptedPassword The received, RSA encrypted password to check @param string $passwordHash The md5 hashed password string (md5(md5(password) . salt)) @param string $salt The salt used in the md5 password hash @param string $fingerprint The fingerprint to identify the private key (RSA public key fingerprint) @return boolean true if the password is correct @throws InvalidKeyPairIdException If the given fingerprint identifies no valid keypair
[ "Checks", "if", "the", "given", "encrypted", "password", "is", "correct", "by", "comparing", "it", "s", "md5", "hash", ".", "The", "salt", "is", "appended", "to", "the", "decrypted", "password", "string", "before", "hashing", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L276-L285
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.destroyKeypair
public function destroyKeypair($fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1231438863); } unset($this->keys[$fingerprint]); $this->saveKeysOnShutdown = true; }
php
public function destroyKeypair($fingerprint) { if ($fingerprint === null || !isset($this->keys[$fingerprint])) { throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1231438863); } unset($this->keys[$fingerprint]); $this->saveKeysOnShutdown = true; }
[ "public", "function", "destroyKeypair", "(", "$", "fingerprint", ")", "{", "if", "(", "$", "fingerprint", "===", "null", "||", "!", "isset", "(", "$", "this", "->", "keys", "[", "$", "fingerprint", "]", ")", ")", "{", "throw", "new", "InvalidKeyPairIdExc...
Destroys the keypair identified by the given fingerprint @param string $fingerprint The fingerprint @return void @throws InvalidKeyPairIdException If the given fingerprint identifies no valid key pair
[ "Destroys", "the", "keypair", "identified", "by", "the", "given", "fingerprint" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L294-L302
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.decryptWithPrivateKey
private function decryptWithPrivateKey($cipher, OpenSslRsaKey $privateKey) { $decrypted = ''; $key = openssl_pkey_get_private($privateKey->getKeyString()); if (openssl_private_decrypt($cipher, $decrypted, $key, $this->paddingAlgorithm) === false) { // Fallback for data that was encrypted with old default OPENSSL_PKCS1_PADDING if ($this->paddingAlgorithm !== OPENSSL_PKCS1_PADDING) { if (openssl_private_decrypt($cipher, $decrypted, $key, OPENSSL_PKCS1_PADDING) !== false) { return $decrypted; } } $openSslErrors = []; while (($errorMessage = openssl_error_string()) !== false) { $openSslErrors[] = $errorMessage; } throw new SecurityException(sprintf('Decryption failed, OpenSSL error: %s', implode(chr(10), $openSslErrors)), 1556609762); } return $decrypted; }
php
private function decryptWithPrivateKey($cipher, OpenSslRsaKey $privateKey) { $decrypted = ''; $key = openssl_pkey_get_private($privateKey->getKeyString()); if (openssl_private_decrypt($cipher, $decrypted, $key, $this->paddingAlgorithm) === false) { // Fallback for data that was encrypted with old default OPENSSL_PKCS1_PADDING if ($this->paddingAlgorithm !== OPENSSL_PKCS1_PADDING) { if (openssl_private_decrypt($cipher, $decrypted, $key, OPENSSL_PKCS1_PADDING) !== false) { return $decrypted; } } $openSslErrors = []; while (($errorMessage = openssl_error_string()) !== false) { $openSslErrors[] = $errorMessage; } throw new SecurityException(sprintf('Decryption failed, OpenSSL error: %s', implode(chr(10), $openSslErrors)), 1556609762); } return $decrypted; }
[ "private", "function", "decryptWithPrivateKey", "(", "$", "cipher", ",", "OpenSslRsaKey", "$", "privateKey", ")", "{", "$", "decrypted", "=", "''", ";", "$", "key", "=", "openssl_pkey_get_private", "(", "$", "privateKey", "->", "getKeyString", "(", ")", ")", ...
Decrypts the given ciphertext with the given private key @param string $cipher The ciphertext to decrypt @param OpenSslRsaKey $privateKey The private key @return string The decrypted plaintext @throws SecurityException
[ "Decrypts", "the", "given", "ciphertext", "with", "the", "given", "private", "key" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L349-L368
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.storeKeyPair
private function storeKeyPair($publicKey, $privateKey, $usedForPasswords) { $publicKeyFingerprint = $this->getFingerprintByPublicKey($publicKey->getKeyString()); $keyPair = []; $keyPair['publicKey'] = $publicKey; $keyPair['privateKey'] = $privateKey; $keyPair['usedForPasswords'] = $usedForPasswords; $this->keys[$publicKeyFingerprint] = $keyPair; $this->saveKeysOnShutdown = true; return $publicKeyFingerprint; }
php
private function storeKeyPair($publicKey, $privateKey, $usedForPasswords) { $publicKeyFingerprint = $this->getFingerprintByPublicKey($publicKey->getKeyString()); $keyPair = []; $keyPair['publicKey'] = $publicKey; $keyPair['privateKey'] = $privateKey; $keyPair['usedForPasswords'] = $usedForPasswords; $this->keys[$publicKeyFingerprint] = $keyPair; $this->saveKeysOnShutdown = true; return $publicKeyFingerprint; }
[ "private", "function", "storeKeyPair", "(", "$", "publicKey", ",", "$", "privateKey", ",", "$", "usedForPasswords", ")", "{", "$", "publicKeyFingerprint", "=", "$", "this", "->", "getFingerprintByPublicKey", "(", "$", "publicKey", "->", "getKeyString", "(", ")",...
Stores the given keypair and returns its fingerprint. The SSH fingerprint of the RSA public key will be used as an identifier for consistent key access. @param OpenSslRsaKey $publicKey The public key @param OpenSslRsaKey $privateKey The private key @param boolean $usedForPasswords true if this keypair should be used to encrypt passwords (then decryption won't be allowed!). @return string The fingerprint which is used as an identifier for storing the key pair
[ "Stores", "the", "given", "keypair", "and", "returns", "its", "fingerprint", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L381-L394
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.shutdownObject
public function shutdownObject() { if ($this->saveKeysOnShutdown === false) { return; } $temporaryKeystorePathAndFilename = $this->keystorePathAndFilename . Utility\Algorithms::generateRandomString(13) . '.temp'; $result = file_put_contents($temporaryKeystorePathAndFilename, serialize($this->keys)); if ($result === false) { throw new SecurityException('The temporary keystore file "' . $temporaryKeystorePathAndFilename . '" could not be written.', 1305812921); } $i = 0; while (($result = rename($temporaryKeystorePathAndFilename, $this->keystorePathAndFilename)) === false && $i < 5) { $i++; } if ($result === false) { throw new SecurityException('The keystore file "' . $this->keystorePathAndFilename . '" could not be written.', 1305812938); } }
php
public function shutdownObject() { if ($this->saveKeysOnShutdown === false) { return; } $temporaryKeystorePathAndFilename = $this->keystorePathAndFilename . Utility\Algorithms::generateRandomString(13) . '.temp'; $result = file_put_contents($temporaryKeystorePathAndFilename, serialize($this->keys)); if ($result === false) { throw new SecurityException('The temporary keystore file "' . $temporaryKeystorePathAndFilename . '" could not be written.', 1305812921); } $i = 0; while (($result = rename($temporaryKeystorePathAndFilename, $this->keystorePathAndFilename)) === false && $i < 5) { $i++; } if ($result === false) { throw new SecurityException('The keystore file "' . $this->keystorePathAndFilename . '" could not be written.', 1305812938); } }
[ "public", "function", "shutdownObject", "(", ")", "{", "if", "(", "$", "this", "->", "saveKeysOnShutdown", "===", "false", ")", "{", "return", ";", "}", "$", "temporaryKeystorePathAndFilename", "=", "$", "this", "->", "keystorePathAndFilename", ".", "Utility", ...
Stores the keys array in the keystore file @return void @throws SecurityException
[ "Stores", "the", "keys", "array", "in", "the", "keystore", "file" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L402-L421
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.getFingerprintByPublicKey
public function getFingerprintByPublicKey($publicKeyString) { $keyResource = openssl_pkey_get_public($publicKeyString); $keyDetails = openssl_pkey_get_details($keyResource); $modulus = $this->sshConvertMpint($keyDetails['rsa']['n']); $publicExponent = $this->sshConvertMpint($keyDetails['rsa']['e']); $rsaPublicKey = pack('Na*Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($publicExponent), $publicExponent, strlen($modulus), $modulus); return md5($rsaPublicKey); }
php
public function getFingerprintByPublicKey($publicKeyString) { $keyResource = openssl_pkey_get_public($publicKeyString); $keyDetails = openssl_pkey_get_details($keyResource); $modulus = $this->sshConvertMpint($keyDetails['rsa']['n']); $publicExponent = $this->sshConvertMpint($keyDetails['rsa']['e']); $rsaPublicKey = pack('Na*Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($publicExponent), $publicExponent, strlen($modulus), $modulus); return md5($rsaPublicKey); }
[ "public", "function", "getFingerprintByPublicKey", "(", "$", "publicKeyString", ")", "{", "$", "keyResource", "=", "openssl_pkey_get_public", "(", "$", "publicKeyString", ")", ";", "$", "keyDetails", "=", "openssl_pkey_get_details", "(", "$", "keyResource", ")", ";"...
Generate an OpenSSH fingerprint for a RSA public key See <http://tools.ietf.org/html/rfc4253#page-15> for reference of OpenSSH "ssh-rsa" key format. The fingerprint is obtained by applying an MD5 hash on the raw public key bytes. If you have a PEM encoded private key, you can generate the same fingerprint using this: ssh-keygen -yf my-key.pem > my-key.pub ssh-keygen -lf my-key.pub @param string $publicKeyString RSA public key, PKCS1 encoded @return string The public key fingerprint
[ "Generate", "an", "OpenSSH", "fingerprint", "for", "a", "RSA", "public", "key" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L439-L449
neos/flow-development-collection
Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php
RsaWalletServicePhp.sshConvertMpint
private function sshConvertMpint($bytes) { if (empty($bytes)) { $bytes = chr(0); } if (ord($bytes[0]) & 0x80) { $bytes = chr(0) . $bytes; } return $bytes; }
php
private function sshConvertMpint($bytes) { if (empty($bytes)) { $bytes = chr(0); } if (ord($bytes[0]) & 0x80) { $bytes = chr(0) . $bytes; } return $bytes; }
[ "private", "function", "sshConvertMpint", "(", "$", "bytes", ")", "{", "if", "(", "empty", "(", "$", "bytes", ")", ")", "{", "$", "bytes", "=", "chr", "(", "0", ")", ";", "}", "if", "(", "ord", "(", "$", "bytes", "[", "0", "]", ")", "&", "0x8...
Convert a binary representation of a multiple precision integer to mpint format defined for SSH RSA key exchange (used in "ssh-rsa" format). See <http://tools.ietf.org/html/rfc4251#page-8> for mpint encoding @param string $bytes Binary representation of integer @return string The mpint encoded integer
[ "Convert", "a", "binary", "representation", "of", "a", "multiple", "precision", "integer", "to", "mpint", "format", "defined", "for", "SSH", "RSA", "key", "exchange", "(", "used", "in", "ssh", "-", "rsa", "format", ")", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Cryptography/RsaWalletServicePhp.php#L460-L470
neos/flow-development-collection
Neos.Flow/Classes/Security/Authorization/RequestFilter.php
RequestFilter.filterRequest
public function filterRequest(RequestInterface $request) { if ($this->pattern->matchRequest($request)) { $this->securityInterceptor->invoke(); return true; } return false; }
php
public function filterRequest(RequestInterface $request) { if ($this->pattern->matchRequest($request)) { $this->securityInterceptor->invoke(); return true; } return false; }
[ "public", "function", "filterRequest", "(", "RequestInterface", "$", "request", ")", "{", "if", "(", "$", "this", "->", "pattern", "->", "matchRequest", "(", "$", "request", ")", ")", "{", "$", "this", "->", "securityInterceptor", "->", "invoke", "(", ")",...
Tries to match the given request against this filter and calls the set security interceptor on success. @param RequestInterface $request The request to be matched @return boolean Returns true if the filter matched, false otherwise
[ "Tries", "to", "match", "the", "given", "request", "against", "this", "filter", "and", "calls", "the", "set", "security", "interceptor", "on", "success", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Authorization/RequestFilter.php#L72-L79
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.initializeArguments
public function initializeArguments() { $this->registerTagAttribute('enctype', 'string', 'MIME type with which the form is submitted'); $this->registerTagAttribute('method', 'string', 'Transfer type (GET or POST or dialog)'); $this->registerTagAttribute('name', 'string', 'Name of form'); $this->registerTagAttribute('onreset', 'string', 'JavaScript: On reset of the form'); $this->registerTagAttribute('onsubmit', 'string', 'JavaScript: On submit of the form'); $this->registerArgument('action', 'string', 'Target action', false, null); $this->registerArgument('arguments', 'array', 'Arguments', false, []); $this->registerArgument('controller', 'string', 'Target controller. If NULL current controllerName is used', false, null); $this->registerArgument('package', 'string', 'Target package. if NULL current package is used', false, null); $this->registerArgument('subpackage', 'string', 'Target subpackage. if NULL current subpackage is used', false, null); $this->registerArgument('object', 'mixed', 'object to use for the form. Use in conjunction with the "property" attribute on the sub tags', false, null); $this->registerArgument('section', 'string', 'The anchor to be added to the URI', false, ''); $this->registerArgument('format', 'string', 'The requested format, e.g. ".html"', false, ''); $this->registerArgument('additionalParams', 'array', 'additional query parameters that won\'t be prefixed like $arguments (overrule $arguments)', false, []); $this->registerArgument('absolute', 'boolean', 'If set, an absolute action URI is rendered (only active if $actionUri is not set)', false, false); $this->registerArgument('addQueryString', 'boolean', 'If set, the current query parameters will be kept in the URI', false, false); $this->registerArgument('argumentsToBeExcludedFromQueryString', 'array', 'arguments to be removed from the URI. Only active if $addQueryString = true', false, []); $this->registerArgument('fieldNamePrefix', 'string', 'Prefix that will be added to all field names within this form', false, null); $this->registerArgument('actionUri', 'string', 'can be used to overwrite the "action" attribute of the form tag', false, null); $this->registerArgument('objectName', 'string', 'name of the object that is bound to this form. If this argument is not specified, the name attribute of this form is used to determine the FormObjectName', false, null); $this->registerArgument('useParentRequest', 'boolean', 'If set, the parent Request will be used instead ob the current one', false, false); $this->registerUniversalTagAttributes(); }
php
public function initializeArguments() { $this->registerTagAttribute('enctype', 'string', 'MIME type with which the form is submitted'); $this->registerTagAttribute('method', 'string', 'Transfer type (GET or POST or dialog)'); $this->registerTagAttribute('name', 'string', 'Name of form'); $this->registerTagAttribute('onreset', 'string', 'JavaScript: On reset of the form'); $this->registerTagAttribute('onsubmit', 'string', 'JavaScript: On submit of the form'); $this->registerArgument('action', 'string', 'Target action', false, null); $this->registerArgument('arguments', 'array', 'Arguments', false, []); $this->registerArgument('controller', 'string', 'Target controller. If NULL current controllerName is used', false, null); $this->registerArgument('package', 'string', 'Target package. if NULL current package is used', false, null); $this->registerArgument('subpackage', 'string', 'Target subpackage. if NULL current subpackage is used', false, null); $this->registerArgument('object', 'mixed', 'object to use for the form. Use in conjunction with the "property" attribute on the sub tags', false, null); $this->registerArgument('section', 'string', 'The anchor to be added to the URI', false, ''); $this->registerArgument('format', 'string', 'The requested format, e.g. ".html"', false, ''); $this->registerArgument('additionalParams', 'array', 'additional query parameters that won\'t be prefixed like $arguments (overrule $arguments)', false, []); $this->registerArgument('absolute', 'boolean', 'If set, an absolute action URI is rendered (only active if $actionUri is not set)', false, false); $this->registerArgument('addQueryString', 'boolean', 'If set, the current query parameters will be kept in the URI', false, false); $this->registerArgument('argumentsToBeExcludedFromQueryString', 'array', 'arguments to be removed from the URI. Only active if $addQueryString = true', false, []); $this->registerArgument('fieldNamePrefix', 'string', 'Prefix that will be added to all field names within this form', false, null); $this->registerArgument('actionUri', 'string', 'can be used to overwrite the "action" attribute of the form tag', false, null); $this->registerArgument('objectName', 'string', 'name of the object that is bound to this form. If this argument is not specified, the name attribute of this form is used to determine the FormObjectName', false, null); $this->registerArgument('useParentRequest', 'boolean', 'If set, the parent Request will be used instead ob the current one', false, false); $this->registerUniversalTagAttributes(); }
[ "public", "function", "initializeArguments", "(", ")", "{", "$", "this", "->", "registerTagAttribute", "(", "'enctype'", ",", "'string'", ",", "'MIME type with which the form is submitted'", ")", ";", "$", "this", "->", "registerTagAttribute", "(", "'method'", ",", ...
Initialize arguments. @return void
[ "Initialize", "arguments", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L103-L128
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.render
public function render() { $this->formActionUri = null; if ($this->arguments['action'] === null && $this->arguments['actionUri'] === null) { throw new ViewHelper\Exception('FormViewHelper requires "actionUri" or "action" argument to be specified', 1355243748); } $this->tag->addAttribute('action', $this->getFormActionUri()); if (strtolower($this->arguments['method']) === 'get') { $this->tag->addAttribute('method', 'get'); } elseif (strtolower($this->arguments['method']) === 'dialog') { $this->tag->addAttribute('method', 'dialog'); } else { $this->tag->addAttribute('method', 'post'); } $this->addFormObjectNameToViewHelperVariableContainer(); $this->addFormObjectToViewHelperVariableContainer(); $this->addFieldNamePrefixToViewHelperVariableContainer(); $this->addFormFieldNamesToViewHelperVariableContainer(); $this->addEmptyHiddenFieldNamesToViewHelperVariableContainer(); $this->viewHelperVariableContainer->addOrUpdate(FormViewHelper::class, 'required-enctype', ''); $formContent = $this->renderChildren(); $requiredEnctype = $this->viewHelperVariableContainer->get(FormViewHelper::class, 'required-enctype'); if ($requiredEnctype !== '' && $requiredEnctype !== strtolower($this->arguments['enctype'])) { throw new WrongEnctypeException('The form you are trying to render requires an enctype of "' . $requiredEnctype . '". Please specify the correct enctype when using file uploads.', 1522706399); } // wrap hidden field in div container in order to create XHTML valid output $content = chr(10) . '<div style="display: none">'; if (strtolower($this->arguments['method']) === 'get') { $content .= $this->renderHiddenActionUriQueryParameters(); } $content .= $this->renderHiddenIdentityField($this->arguments['object'], $this->getFormObjectName()); $content .= $this->renderAdditionalIdentityFields(); $content .= $this->renderHiddenReferrerFields(); $content .= $this->renderEmptyHiddenFields(); // Render the trusted list of all properties after everything else has been rendered $content .= $this->renderTrustedPropertiesField(); $content .= $this->renderCsrfTokenField(); $content .= '</div>' . chr(10); $content .= $formContent; $this->tag->setContent($content); $this->removeFieldNamePrefixFromViewHelperVariableContainer(); $this->removeFormObjectFromViewHelperVariableContainer(); $this->removeFormObjectNameFromViewHelperVariableContainer(); $this->removeFormFieldNamesFromViewHelperVariableContainer(); $this->removeEmptyHiddenFieldNamesFromViewHelperVariableContainer(); return $this->tag->render(); }
php
public function render() { $this->formActionUri = null; if ($this->arguments['action'] === null && $this->arguments['actionUri'] === null) { throw new ViewHelper\Exception('FormViewHelper requires "actionUri" or "action" argument to be specified', 1355243748); } $this->tag->addAttribute('action', $this->getFormActionUri()); if (strtolower($this->arguments['method']) === 'get') { $this->tag->addAttribute('method', 'get'); } elseif (strtolower($this->arguments['method']) === 'dialog') { $this->tag->addAttribute('method', 'dialog'); } else { $this->tag->addAttribute('method', 'post'); } $this->addFormObjectNameToViewHelperVariableContainer(); $this->addFormObjectToViewHelperVariableContainer(); $this->addFieldNamePrefixToViewHelperVariableContainer(); $this->addFormFieldNamesToViewHelperVariableContainer(); $this->addEmptyHiddenFieldNamesToViewHelperVariableContainer(); $this->viewHelperVariableContainer->addOrUpdate(FormViewHelper::class, 'required-enctype', ''); $formContent = $this->renderChildren(); $requiredEnctype = $this->viewHelperVariableContainer->get(FormViewHelper::class, 'required-enctype'); if ($requiredEnctype !== '' && $requiredEnctype !== strtolower($this->arguments['enctype'])) { throw new WrongEnctypeException('The form you are trying to render requires an enctype of "' . $requiredEnctype . '". Please specify the correct enctype when using file uploads.', 1522706399); } // wrap hidden field in div container in order to create XHTML valid output $content = chr(10) . '<div style="display: none">'; if (strtolower($this->arguments['method']) === 'get') { $content .= $this->renderHiddenActionUriQueryParameters(); } $content .= $this->renderHiddenIdentityField($this->arguments['object'], $this->getFormObjectName()); $content .= $this->renderAdditionalIdentityFields(); $content .= $this->renderHiddenReferrerFields(); $content .= $this->renderEmptyHiddenFields(); // Render the trusted list of all properties after everything else has been rendered $content .= $this->renderTrustedPropertiesField(); $content .= $this->renderCsrfTokenField(); $content .= '</div>' . chr(10); $content .= $formContent; $this->tag->setContent($content); $this->removeFieldNamePrefixFromViewHelperVariableContainer(); $this->removeFormObjectFromViewHelperVariableContainer(); $this->removeFormObjectNameFromViewHelperVariableContainer(); $this->removeFormFieldNamesFromViewHelperVariableContainer(); $this->removeEmptyHiddenFieldNamesFromViewHelperVariableContainer(); return $this->tag->render(); }
[ "public", "function", "render", "(", ")", "{", "$", "this", "->", "formActionUri", "=", "null", ";", "if", "(", "$", "this", "->", "arguments", "[", "'action'", "]", "===", "null", "&&", "$", "this", "->", "arguments", "[", "'actionUri'", "]", "===", ...
Render the form. @return string rendered form @api @throws ViewHelper\Exception
[ "Render", "the", "form", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L137-L191
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.getFormActionUri
protected function getFormActionUri() { if ($this->formActionUri !== null) { return $this->formActionUri; } if ($this->hasArgument('actionUri')) { $this->formActionUri = $this->arguments['actionUri']; } else { $uriBuilder = $this->controllerContext->getUriBuilder(); if ($this->arguments['useParentRequest'] === true) { $request = $this->controllerContext->getRequest(); if ($request->isMainRequest()) { throw new ViewHelper\Exception('You can\'t use the parent Request, you are already in the MainRequest.', 1361354942); } $uriBuilder = clone $uriBuilder; $uriBuilder->setRequest($request->getParentRequest()); } $uriBuilder ->reset() ->setSection($this->arguments['section']) ->setCreateAbsoluteUri($this->arguments['absolute']) ->setAddQueryString($this->arguments['addQueryString']) ->setFormat($this->arguments['format']); if (is_array($this->arguments['additionalParams'])) { $uriBuilder->setArguments($this->arguments['additionalParams']); } if (is_array($this->arguments['argumentsToBeExcludedFromQueryString'])) { $uriBuilder->setArgumentsToBeExcludedFromQueryString($this->arguments['argumentsToBeExcludedFromQueryString']); } try { $this->formActionUri = $uriBuilder ->uriFor($this->arguments['action'], $this->arguments['arguments'], $this->arguments['controller'], $this->arguments['package'], $this->arguments['subpackage']); } catch (\Exception $exception) { throw new ViewHelper\Exception($exception->getMessage(), $exception->getCode(), $exception); } } return $this->formActionUri; }
php
protected function getFormActionUri() { if ($this->formActionUri !== null) { return $this->formActionUri; } if ($this->hasArgument('actionUri')) { $this->formActionUri = $this->arguments['actionUri']; } else { $uriBuilder = $this->controllerContext->getUriBuilder(); if ($this->arguments['useParentRequest'] === true) { $request = $this->controllerContext->getRequest(); if ($request->isMainRequest()) { throw new ViewHelper\Exception('You can\'t use the parent Request, you are already in the MainRequest.', 1361354942); } $uriBuilder = clone $uriBuilder; $uriBuilder->setRequest($request->getParentRequest()); } $uriBuilder ->reset() ->setSection($this->arguments['section']) ->setCreateAbsoluteUri($this->arguments['absolute']) ->setAddQueryString($this->arguments['addQueryString']) ->setFormat($this->arguments['format']); if (is_array($this->arguments['additionalParams'])) { $uriBuilder->setArguments($this->arguments['additionalParams']); } if (is_array($this->arguments['argumentsToBeExcludedFromQueryString'])) { $uriBuilder->setArgumentsToBeExcludedFromQueryString($this->arguments['argumentsToBeExcludedFromQueryString']); } try { $this->formActionUri = $uriBuilder ->uriFor($this->arguments['action'], $this->arguments['arguments'], $this->arguments['controller'], $this->arguments['package'], $this->arguments['subpackage']); } catch (\Exception $exception) { throw new ViewHelper\Exception($exception->getMessage(), $exception->getCode(), $exception); } } return $this->formActionUri; }
[ "protected", "function", "getFormActionUri", "(", ")", "{", "if", "(", "$", "this", "->", "formActionUri", "!==", "null", ")", "{", "return", "$", "this", "->", "formActionUri", ";", "}", "if", "(", "$", "this", "->", "hasArgument", "(", "'actionUri'", "...
Returns the action URI of the form tag. If the argument "actionUri" is specified, this will be returned Otherwise this creates the action URI using the UriBuilder @return string @throws ViewHelper\Exception if the action URI could not be created
[ "Returns", "the", "action", "URI", "of", "the", "form", "tag", ".", "If", "the", "argument", "actionUri", "is", "specified", "this", "will", "be", "returned", "Otherwise", "this", "creates", "the", "action", "URI", "using", "the", "UriBuilder" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L201-L238
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.renderHiddenActionUriQueryParameters
protected function renderHiddenActionUriQueryParameters() { $result = ''; $actionUri = $this->getFormActionUri(); $query = parse_url($actionUri, PHP_URL_QUERY); if (is_string($query)) { $queryParts = explode('&', $query); foreach ($queryParts as $queryPart) { if (strpos($queryPart, '=') !== false) { list($parameterName, $parameterValue) = explode('=', $queryPart, 2); $result .= chr(10) . '<input type="hidden" name="' . htmlspecialchars(urldecode($parameterName)) . '" value="' . htmlspecialchars(urldecode($parameterValue)) . '" />'; } } } return $result; }
php
protected function renderHiddenActionUriQueryParameters() { $result = ''; $actionUri = $this->getFormActionUri(); $query = parse_url($actionUri, PHP_URL_QUERY); if (is_string($query)) { $queryParts = explode('&', $query); foreach ($queryParts as $queryPart) { if (strpos($queryPart, '=') !== false) { list($parameterName, $parameterValue) = explode('=', $queryPart, 2); $result .= chr(10) . '<input type="hidden" name="' . htmlspecialchars(urldecode($parameterName)) . '" value="' . htmlspecialchars(urldecode($parameterValue)) . '" />'; } } } return $result; }
[ "protected", "function", "renderHiddenActionUriQueryParameters", "(", ")", "{", "$", "result", "=", "''", ";", "$", "actionUri", "=", "$", "this", "->", "getFormActionUri", "(", ")", ";", "$", "query", "=", "parse_url", "(", "$", "actionUri", ",", "PHP_URL_Q...
Render hidden form fields for query parameters from action URI. This is only needed if the form method is GET. @return string Hidden fields for query parameters from action URI
[ "Render", "hidden", "form", "fields", "for", "query", "parameters", "from", "action", "URI", ".", "This", "is", "only", "needed", "if", "the", "form", "method", "is", "GET", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L246-L262
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.renderAdditionalIdentityFields
protected function renderAdditionalIdentityFields() { if ($this->viewHelperVariableContainer->exists(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'additionalIdentityProperties')) { $additionalIdentityProperties = $this->viewHelperVariableContainer->get(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'additionalIdentityProperties'); $output = ''; foreach ($additionalIdentityProperties as $identity) { $output .= chr(10) . $identity; } return $output; } return ''; }
php
protected function renderAdditionalIdentityFields() { if ($this->viewHelperVariableContainer->exists(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'additionalIdentityProperties')) { $additionalIdentityProperties = $this->viewHelperVariableContainer->get(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'additionalIdentityProperties'); $output = ''; foreach ($additionalIdentityProperties as $identity) { $output .= chr(10) . $identity; } return $output; } return ''; }
[ "protected", "function", "renderAdditionalIdentityFields", "(", ")", "{", "if", "(", "$", "this", "->", "viewHelperVariableContainer", "->", "exists", "(", "\\", "Neos", "\\", "FluidAdaptor", "\\", "ViewHelpers", "\\", "FormViewHelper", "::", "class", ",", "'addit...
Render additional identity fields which were registered by form elements. This happens if a form field is defined like property="bla.blubb" - then we might need an identity property for the sub-object "bla". @return string HTML-string for the additional identity properties
[ "Render", "additional", "identity", "fields", "which", "were", "registered", "by", "form", "elements", ".", "This", "happens", "if", "a", "form", "field", "is", "defined", "like", "property", "=", "bla", ".", "blubb", "-", "then", "we", "might", "need", "a...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L270-L281
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.addFormObjectNameToViewHelperVariableContainer
protected function addFormObjectNameToViewHelperVariableContainer() { $formObjectName = $this->getFormObjectName(); if ($formObjectName !== null) { $this->viewHelperVariableContainer->add(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formObjectName', $formObjectName); } }
php
protected function addFormObjectNameToViewHelperVariableContainer() { $formObjectName = $this->getFormObjectName(); if ($formObjectName !== null) { $this->viewHelperVariableContainer->add(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formObjectName', $formObjectName); } }
[ "protected", "function", "addFormObjectNameToViewHelperVariableContainer", "(", ")", "{", "$", "formObjectName", "=", "$", "this", "->", "getFormObjectName", "(", ")", ";", "if", "(", "$", "formObjectName", "!==", "null", ")", "{", "$", "this", "->", "viewHelper...
Adds the form object name to the ViewHelperVariableContainer if "objectName" argument or "name" attribute is specified. @return void
[ "Adds", "the", "form", "object", "name", "to", "the", "ViewHelperVariableContainer", "if", "objectName", "argument", "or", "name", "attribute", "is", "specified", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L338-L344
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.removeFormObjectNameFromViewHelperVariableContainer
protected function removeFormObjectNameFromViewHelperVariableContainer() { $formObjectName = $this->getFormObjectName(); if ($formObjectName !== null) { $this->viewHelperVariableContainer->remove(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formObjectName'); } }
php
protected function removeFormObjectNameFromViewHelperVariableContainer() { $formObjectName = $this->getFormObjectName(); if ($formObjectName !== null) { $this->viewHelperVariableContainer->remove(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formObjectName'); } }
[ "protected", "function", "removeFormObjectNameFromViewHelperVariableContainer", "(", ")", "{", "$", "formObjectName", "=", "$", "this", "->", "getFormObjectName", "(", ")", ";", "if", "(", "$", "formObjectName", "!==", "null", ")", "{", "$", "this", "->", "viewH...
Removes the form object name from the ViewHelperVariableContainer. @return void
[ "Removes", "the", "form", "object", "name", "from", "the", "ViewHelperVariableContainer", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L351-L357
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.getFormObjectName
protected function getFormObjectName() { $formObjectName = null; if ($this->hasArgument('objectName')) { $formObjectName = $this->arguments['objectName']; } elseif ($this->hasArgument('name')) { $formObjectName = $this->arguments['name']; } return $formObjectName; }
php
protected function getFormObjectName() { $formObjectName = null; if ($this->hasArgument('objectName')) { $formObjectName = $this->arguments['objectName']; } elseif ($this->hasArgument('name')) { $formObjectName = $this->arguments['name']; } return $formObjectName; }
[ "protected", "function", "getFormObjectName", "(", ")", "{", "$", "formObjectName", "=", "null", ";", "if", "(", "$", "this", "->", "hasArgument", "(", "'objectName'", ")", ")", "{", "$", "formObjectName", "=", "$", "this", "->", "arguments", "[", "'object...
Returns the name of the object that is bound to this form. If the "objectName" argument has been specified, this is returned. Otherwise the name attribute of this form. If neither objectName nor name arguments have been set, NULL is returned. @return string specified Form name or NULL if neither $objectName nor $name arguments have been specified
[ "Returns", "the", "name", "of", "the", "object", "that", "is", "bound", "to", "this", "form", ".", "If", "the", "objectName", "argument", "has", "been", "specified", "this", "is", "returned", ".", "Otherwise", "the", "name", "attribute", "of", "this", "for...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L366-L375
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.addFormObjectToViewHelperVariableContainer
protected function addFormObjectToViewHelperVariableContainer() { if ($this->hasArgument('object')) { $this->viewHelperVariableContainer->add(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formObject', $this->arguments['object']); $this->viewHelperVariableContainer->add(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'additionalIdentityProperties', []); } }
php
protected function addFormObjectToViewHelperVariableContainer() { if ($this->hasArgument('object')) { $this->viewHelperVariableContainer->add(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formObject', $this->arguments['object']); $this->viewHelperVariableContainer->add(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'additionalIdentityProperties', []); } }
[ "protected", "function", "addFormObjectToViewHelperVariableContainer", "(", ")", "{", "if", "(", "$", "this", "->", "hasArgument", "(", "'object'", ")", ")", "{", "$", "this", "->", "viewHelperVariableContainer", "->", "add", "(", "\\", "Neos", "\\", "FluidAdapt...
Adds the object that is bound to this form to the ViewHelperVariableContainer if the formObject attribute is specified. @return void
[ "Adds", "the", "object", "that", "is", "bound", "to", "this", "form", "to", "the", "ViewHelperVariableContainer", "if", "the", "formObject", "attribute", "is", "specified", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L382-L388
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.removeFormObjectFromViewHelperVariableContainer
protected function removeFormObjectFromViewHelperVariableContainer() { if ($this->hasArgument('object')) { $this->viewHelperVariableContainer->remove(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formObject'); $this->viewHelperVariableContainer->remove(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'additionalIdentityProperties'); } }
php
protected function removeFormObjectFromViewHelperVariableContainer() { if ($this->hasArgument('object')) { $this->viewHelperVariableContainer->remove(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formObject'); $this->viewHelperVariableContainer->remove(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'additionalIdentityProperties'); } }
[ "protected", "function", "removeFormObjectFromViewHelperVariableContainer", "(", ")", "{", "if", "(", "$", "this", "->", "hasArgument", "(", "'object'", ")", ")", "{", "$", "this", "->", "viewHelperVariableContainer", "->", "remove", "(", "\\", "Neos", "\\", "Fl...
Removes the form object from the ViewHelperVariableContainer. @return void
[ "Removes", "the", "form", "object", "from", "the", "ViewHelperVariableContainer", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L395-L401
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.addFieldNamePrefixToViewHelperVariableContainer
protected function addFieldNamePrefixToViewHelperVariableContainer() { $fieldNamePrefix = $this->getFieldNamePrefix(); $this->viewHelperVariableContainer->add(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'fieldNamePrefix', $fieldNamePrefix); }
php
protected function addFieldNamePrefixToViewHelperVariableContainer() { $fieldNamePrefix = $this->getFieldNamePrefix(); $this->viewHelperVariableContainer->add(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'fieldNamePrefix', $fieldNamePrefix); }
[ "protected", "function", "addFieldNamePrefixToViewHelperVariableContainer", "(", ")", "{", "$", "fieldNamePrefix", "=", "$", "this", "->", "getFieldNamePrefix", "(", ")", ";", "$", "this", "->", "viewHelperVariableContainer", "->", "add", "(", "\\", "Neos", "\\", ...
Adds the field name prefix to the ViewHelperVariableContainer @return void
[ "Adds", "the", "field", "name", "prefix", "to", "the", "ViewHelperVariableContainer" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L408-L412
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.getDefaultFieldNamePrefix
protected function getDefaultFieldNamePrefix() { $request = $this->controllerContext->getRequest(); if (!$request->isMainRequest()) { if ($this->arguments['useParentRequest'] === true) { return $request->getParentRequest()->getArgumentNamespace(); } else { return $request->getArgumentNamespace(); } } return ''; }
php
protected function getDefaultFieldNamePrefix() { $request = $this->controllerContext->getRequest(); if (!$request->isMainRequest()) { if ($this->arguments['useParentRequest'] === true) { return $request->getParentRequest()->getArgumentNamespace(); } else { return $request->getArgumentNamespace(); } } return ''; }
[ "protected", "function", "getDefaultFieldNamePrefix", "(", ")", "{", "$", "request", "=", "$", "this", "->", "controllerContext", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "request", "->", "isMainRequest", "(", ")", ")", "{", "if", "(", "$"...
Retrieves the default field name prefix for this form @return string default field name prefix
[ "Retrieves", "the", "default", "field", "name", "prefix", "for", "this", "form" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L433-L444
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.renderEmptyHiddenFields
protected function renderEmptyHiddenFields() { $result = ''; if ($this->viewHelperVariableContainer->exists(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames')) { $emptyHiddenFieldNames = $this->viewHelperVariableContainer->get(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames'); foreach ($emptyHiddenFieldNames as $hiddenFieldName => $disabled) { $disabledAttribute = $disabled !== false ? ' disabled="' . htmlspecialchars($disabled) . '"' : ''; $result .= '<input type="hidden" name="' . htmlspecialchars($hiddenFieldName) . '" value=""' . $disabledAttribute . ' />' . chr(10); } } return $result; }
php
protected function renderEmptyHiddenFields() { $result = ''; if ($this->viewHelperVariableContainer->exists(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames')) { $emptyHiddenFieldNames = $this->viewHelperVariableContainer->get(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames'); foreach ($emptyHiddenFieldNames as $hiddenFieldName => $disabled) { $disabledAttribute = $disabled !== false ? ' disabled="' . htmlspecialchars($disabled) . '"' : ''; $result .= '<input type="hidden" name="' . htmlspecialchars($hiddenFieldName) . '" value=""' . $disabledAttribute . ' />' . chr(10); } } return $result; }
[ "protected", "function", "renderEmptyHiddenFields", "(", ")", "{", "$", "result", "=", "''", ";", "if", "(", "$", "this", "->", "viewHelperVariableContainer", "->", "exists", "(", "\\", "Neos", "\\", "FluidAdaptor", "\\", "ViewHelpers", "\\", "FormViewHelper", ...
Renders all empty hidden fields that have been added to ViewHelperVariableContainer @see \Neos\FluidAdaptor\ViewHelpers\Form\AbstractFormFieldViewHelper::renderHiddenFieldForEmptyValue() @return string
[ "Renders", "all", "empty", "hidden", "fields", "that", "have", "been", "added", "to", "ViewHelperVariableContainer", "@see", "\\", "Neos", "\\", "FluidAdaptor", "\\", "ViewHelpers", "\\", "Form", "\\", "AbstractFormFieldViewHelper", "::", "renderHiddenFieldForEmptyValue...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L504-L515
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.renderTrustedPropertiesField
protected function renderTrustedPropertiesField() { $formFieldNames = $this->viewHelperVariableContainer->get(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formFieldNames'); $requestHash = $this->mvcPropertyMappingConfigurationService->generateTrustedPropertiesToken($formFieldNames, $this->getFieldNamePrefix()); return '<input type="hidden" name="' . $this->prefixFieldName('__trustedProperties') . '" value="' . htmlspecialchars($requestHash) . '" />' . chr(10); }
php
protected function renderTrustedPropertiesField() { $formFieldNames = $this->viewHelperVariableContainer->get(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formFieldNames'); $requestHash = $this->mvcPropertyMappingConfigurationService->generateTrustedPropertiesToken($formFieldNames, $this->getFieldNamePrefix()); return '<input type="hidden" name="' . $this->prefixFieldName('__trustedProperties') . '" value="' . htmlspecialchars($requestHash) . '" />' . chr(10); }
[ "protected", "function", "renderTrustedPropertiesField", "(", ")", "{", "$", "formFieldNames", "=", "$", "this", "->", "viewHelperVariableContainer", "->", "get", "(", "\\", "Neos", "\\", "FluidAdaptor", "\\", "ViewHelpers", "\\", "FormViewHelper", "::", "class", ...
Render the request hash field @return string the hmac field
[ "Render", "the", "request", "hash", "field" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L522-L527
neos/flow-development-collection
Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php
FormViewHelper.renderCsrfTokenField
protected function renderCsrfTokenField() { if (strtolower($this->arguments['method']) === 'get') { return ''; } if (!$this->securityContext->isInitialized() || !$this->authenticationManager->isAuthenticated()) { return ''; } $csrfToken = $this->securityContext->getCsrfProtectionToken(); return '<input type="hidden" name="__csrfToken" value="' . htmlspecialchars($csrfToken) . '" />' . chr(10); }
php
protected function renderCsrfTokenField() { if (strtolower($this->arguments['method']) === 'get') { return ''; } if (!$this->securityContext->isInitialized() || !$this->authenticationManager->isAuthenticated()) { return ''; } $csrfToken = $this->securityContext->getCsrfProtectionToken(); return '<input type="hidden" name="__csrfToken" value="' . htmlspecialchars($csrfToken) . '" />' . chr(10); }
[ "protected", "function", "renderCsrfTokenField", "(", ")", "{", "if", "(", "strtolower", "(", "$", "this", "->", "arguments", "[", "'method'", "]", ")", "===", "'get'", ")", "{", "return", "''", ";", "}", "if", "(", "!", "$", "this", "->", "securityCon...
Render the a hidden field with a CSRF token @return string the CSRF token field
[ "Render", "the", "a", "hidden", "field", "with", "a", "CSRF", "token" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/ViewHelpers/FormViewHelper.php#L534-L544
neos/flow-development-collection
Neos.Flow/Classes/Security/Authentication/Token/UsernamePasswordHttpBasic.php
UsernamePasswordHttpBasic.updateCredentials
public function updateCredentials(ActionRequest $actionRequest) { $this->credentials = ['username' => null, 'password' => null]; $this->authenticationStatus = self::NO_CREDENTIALS_GIVEN; $authorizationHeader = $actionRequest->getHttpRequest()->getHeaders()->get('Authorization'); if (strpos($authorizationHeader, 'Basic ') !== 0) { return; } $credentials = base64_decode(substr($authorizationHeader, 6)); list($username, $password) = explode(':', $credentials, 2); $this->credentials['username'] = $username; $this->credentials['password'] = $password; $this->authenticationStatus = self::AUTHENTICATION_NEEDED; }
php
public function updateCredentials(ActionRequest $actionRequest) { $this->credentials = ['username' => null, 'password' => null]; $this->authenticationStatus = self::NO_CREDENTIALS_GIVEN; $authorizationHeader = $actionRequest->getHttpRequest()->getHeaders()->get('Authorization'); if (strpos($authorizationHeader, 'Basic ') !== 0) { return; } $credentials = base64_decode(substr($authorizationHeader, 6)); list($username, $password) = explode(':', $credentials, 2); $this->credentials['username'] = $username; $this->credentials['password'] = $password; $this->authenticationStatus = self::AUTHENTICATION_NEEDED; }
[ "public", "function", "updateCredentials", "(", "ActionRequest", "$", "actionRequest", ")", "{", "$", "this", "->", "credentials", "=", "[", "'username'", "=>", "null", ",", "'password'", "=>", "null", "]", ";", "$", "this", "->", "authenticationStatus", "=", ...
Updates the username and password credentials from the HTTP authorization header. Sets the authentication status to AUTHENTICATION_NEEDED, if the header has been sent, to NO_CREDENTIALS_GIVEN if no authorization header was there. @param ActionRequest $actionRequest The current action request instance @return void
[ "Updates", "the", "username", "and", "password", "credentials", "from", "the", "HTTP", "authorization", "header", ".", "Sets", "the", "authentication", "status", "to", "AUTHENTICATION_NEEDED", "if", "the", "header", "has", "been", "sent", "to", "NO_CREDENTIALS_GIVEN...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Authentication/Token/UsernamePasswordHttpBasic.php#L29-L44
neos/flow-development-collection
Neos.Cache/Classes/CacheFactory.php
CacheFactory.create
public function create(string $cacheIdentifier, string $cacheObjectName, string $backendObjectName, array $backendOptions = []): FrontendInterface { $backend = $this->instantiateBackend($backendObjectName, $backendOptions, $this->environmentConfiguration); $cache = $this->instantiateCache($cacheIdentifier, $cacheObjectName, $backend); $backend->setCache($cache); return $cache; }
php
public function create(string $cacheIdentifier, string $cacheObjectName, string $backendObjectName, array $backendOptions = []): FrontendInterface { $backend = $this->instantiateBackend($backendObjectName, $backendOptions, $this->environmentConfiguration); $cache = $this->instantiateCache($cacheIdentifier, $cacheObjectName, $backend); $backend->setCache($cache); return $cache; }
[ "public", "function", "create", "(", "string", "$", "cacheIdentifier", ",", "string", "$", "cacheObjectName", ",", "string", "$", "backendObjectName", ",", "array", "$", "backendOptions", "=", "[", "]", ")", ":", "FrontendInterface", "{", "$", "backend", "=", ...
Factory method which creates the specified cache along with the specified kind of backend. After creating the cache, it will be registered at the cache manager. @param string $cacheIdentifier The name / identifier of the cache to create @param string $cacheObjectName Object name of the cache frontend @param string $backendObjectName Object name of the cache backend @param array $backendOptions (optional) Array of backend options @return FrontendInterface The created cache frontend @throws InvalidBackendException @throws InvalidCacheException @api
[ "Factory", "method", "which", "creates", "the", "specified", "cache", "along", "with", "the", "specified", "kind", "of", "backend", ".", "After", "creating", "the", "cache", "it", "will", "be", "registered", "at", "the", "cache", "manager", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/CacheFactory.php#L58-L65
neos/flow-development-collection
Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php
GenericObjectValidator.isValid
protected function isValid($object) { if (!is_object($object)) { $this->addError('Object expected, %1$s given.', 1241099149, [gettype($object)]); return; } elseif ($this->isValidatedAlready($object) === true) { return; } foreach ($this->propertyValidators as $propertyName => $validators) { $propertyValue = $this->getPropertyValue($object, $propertyName); $result = $this->checkProperty($propertyValue, $validators); if ($result !== null) { $this->result->forProperty($propertyName)->merge($result); } } }
php
protected function isValid($object) { if (!is_object($object)) { $this->addError('Object expected, %1$s given.', 1241099149, [gettype($object)]); return; } elseif ($this->isValidatedAlready($object) === true) { return; } foreach ($this->propertyValidators as $propertyName => $validators) { $propertyValue = $this->getPropertyValue($object, $propertyName); $result = $this->checkProperty($propertyValue, $validators); if ($result !== null) { $this->result->forProperty($propertyName)->merge($result); } } }
[ "protected", "function", "isValid", "(", "$", "object", ")", "{", "if", "(", "!", "is_object", "(", "$", "object", ")", ")", "{", "$", "this", "->", "addError", "(", "'Object expected, %1$s given.'", ",", "1241099149", ",", "[", "gettype", "(", "$", "obj...
Checks if the given value is valid according to the property validators. @param mixed $object The value that should be validated @return void @api
[ "Checks", "if", "the", "given", "value", "is", "valid", "according", "to", "the", "property", "validators", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php#L53-L68
neos/flow-development-collection
Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php
GenericObjectValidator.getPropertyValue
protected function getPropertyValue($object, $propertyName) { if ($object instanceof \Doctrine\ORM\Proxy\Proxy) { $object->__load(); } return ObjectAccess::getProperty($object, $propertyName, !ObjectAccess::isPropertyGettable($object, $propertyName)); }
php
protected function getPropertyValue($object, $propertyName) { if ($object instanceof \Doctrine\ORM\Proxy\Proxy) { $object->__load(); } return ObjectAccess::getProperty($object, $propertyName, !ObjectAccess::isPropertyGettable($object, $propertyName)); }
[ "protected", "function", "getPropertyValue", "(", "$", "object", ",", "$", "propertyName", ")", "{", "if", "(", "$", "object", "instanceof", "\\", "Doctrine", "\\", "ORM", "\\", "Proxy", "\\", "Proxy", ")", "{", "$", "object", "->", "__load", "(", ")", ...
Load the property value to be used for validation. In case the object is a doctrine proxy, we need to load the real instance first. @param object $object @param string $propertyName @return mixed
[ "Load", "the", "property", "value", "to", "be", "used", "for", "validation", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php#L97-L104
neos/flow-development-collection
Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php
GenericObjectValidator.checkProperty
protected function checkProperty($value, $validators) { $result = null; foreach ($validators as $validator) { if ($validator instanceof ObjectValidatorInterface) { $validator->setValidatedInstancesContainer($this->validatedInstancesContainer); } $currentResult = $validator->validate($value); if ($currentResult->hasMessages()) { if ($result === null) { $result = $currentResult; } else { $result->merge($currentResult); } } } return $result; }
php
protected function checkProperty($value, $validators) { $result = null; foreach ($validators as $validator) { if ($validator instanceof ObjectValidatorInterface) { $validator->setValidatedInstancesContainer($this->validatedInstancesContainer); } $currentResult = $validator->validate($value); if ($currentResult->hasMessages()) { if ($result === null) { $result = $currentResult; } else { $result->merge($currentResult); } } } return $result; }
[ "protected", "function", "checkProperty", "(", "$", "value", ",", "$", "validators", ")", "{", "$", "result", "=", "null", ";", "foreach", "(", "$", "validators", "as", "$", "validator", ")", "{", "if", "(", "$", "validator", "instanceof", "ObjectValidator...
Checks if the specified property of the given object is valid, and adds found errors to the $messages object. @param mixed $value The value to be validated @param array $validators The validators to be called on the value @return NULL|ErrorResult
[ "Checks", "if", "the", "specified", "property", "of", "the", "given", "object", "is", "valid", "and", "adds", "found", "errors", "to", "the", "$messages", "object", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php#L114-L131
neos/flow-development-collection
Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php
GenericObjectValidator.addPropertyValidator
public function addPropertyValidator($propertyName, ValidatorInterface $validator) { if (!isset($this->propertyValidators[$propertyName])) { $this->propertyValidators[$propertyName] = new \SplObjectStorage(); } $this->propertyValidators[$propertyName]->attach($validator); }
php
public function addPropertyValidator($propertyName, ValidatorInterface $validator) { if (!isset($this->propertyValidators[$propertyName])) { $this->propertyValidators[$propertyName] = new \SplObjectStorage(); } $this->propertyValidators[$propertyName]->attach($validator); }
[ "public", "function", "addPropertyValidator", "(", "$", "propertyName", ",", "ValidatorInterface", "$", "validator", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "propertyValidators", "[", "$", "propertyName", "]", ")", ")", "{", "$", "this", ...
Adds the given validator for validation of the specified property. @param string $propertyName Name of the property to validate @param ValidatorInterface $validator The property validator @return void @api
[ "Adds", "the", "given", "validator", "for", "validation", "of", "the", "specified", "property", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php#L141-L147
neos/flow-development-collection
Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php
GenericObjectValidator.getPropertyValidators
public function getPropertyValidators($propertyName = null) { if ($propertyName !== null) { return $this->propertyValidators[$propertyName] ?? []; } return $this->propertyValidators; }
php
public function getPropertyValidators($propertyName = null) { if ($propertyName !== null) { return $this->propertyValidators[$propertyName] ?? []; } return $this->propertyValidators; }
[ "public", "function", "getPropertyValidators", "(", "$", "propertyName", "=", "null", ")", "{", "if", "(", "$", "propertyName", "!==", "null", ")", "{", "return", "$", "this", "->", "propertyValidators", "[", "$", "propertyName", "]", "??", "[", "]", ";", ...
Returns all property validators - or only validators of the specified property @param string $propertyName Name of the property to return validators for @return array An array of validators
[ "Returns", "all", "property", "validators", "-", "or", "only", "validators", "of", "the", "specified", "property" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Validation/Validator/GenericObjectValidator.php#L155-L161
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.registerReconstitutedEntity
public function registerReconstitutedEntity($entity, array $entityData) { $this->reconstitutedEntities->attach($entity); $this->reconstitutedEntitiesData[$entityData['identifier']] = $entityData; }
php
public function registerReconstitutedEntity($entity, array $entityData) { $this->reconstitutedEntities->attach($entity); $this->reconstitutedEntitiesData[$entityData['identifier']] = $entityData; }
[ "public", "function", "registerReconstitutedEntity", "(", "$", "entity", ",", "array", "$", "entityData", ")", "{", "$", "this", "->", "reconstitutedEntities", "->", "attach", "(", "$", "entity", ")", ";", "$", "this", "->", "reconstitutedEntitiesData", "[", "...
Registers data for a reconstituted object. $entityData format is described in "Documentation/PersistenceFramework object data format.txt" @param object $entity @param array $entityData @return void
[ "Registers", "data", "for", "a", "reconstituted", "object", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L86-L90
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.replaceReconstitutedEntity
public function replaceReconstitutedEntity($oldEntity, $newEntity) { $this->reconstitutedEntities->detach($oldEntity); $this->reconstitutedEntities->attach($newEntity); }
php
public function replaceReconstitutedEntity($oldEntity, $newEntity) { $this->reconstitutedEntities->detach($oldEntity); $this->reconstitutedEntities->attach($newEntity); }
[ "public", "function", "replaceReconstitutedEntity", "(", "$", "oldEntity", ",", "$", "newEntity", ")", "{", "$", "this", "->", "reconstitutedEntities", "->", "detach", "(", "$", "oldEntity", ")", ";", "$", "this", "->", "reconstitutedEntities", "->", "attach", ...
Replace a reconstituted object, leaves the clean data unchanged. @param object $oldEntity @param object $newEntity @return void
[ "Replace", "a", "reconstituted", "object", "leaves", "the", "clean", "data", "unchanged", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L99-L103
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.unregisterReconstitutedEntity
public function unregisterReconstitutedEntity($entity) { if ($this->reconstitutedEntities->contains($entity)) { $this->reconstitutedEntities->detach($entity); unset($this->reconstitutedEntitiesData[$this->getIdentifierByObject($entity)]); } }
php
public function unregisterReconstitutedEntity($entity) { if ($this->reconstitutedEntities->contains($entity)) { $this->reconstitutedEntities->detach($entity); unset($this->reconstitutedEntitiesData[$this->getIdentifierByObject($entity)]); } }
[ "public", "function", "unregisterReconstitutedEntity", "(", "$", "entity", ")", "{", "if", "(", "$", "this", "->", "reconstitutedEntities", "->", "contains", "(", "$", "entity", ")", ")", "{", "$", "this", "->", "reconstitutedEntities", "->", "detach", "(", ...
Unregisters data for a reconstituted object @param object $entity @return void
[ "Unregisters", "data", "for", "a", "reconstituted", "object" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L111-L117
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.isDirty
public function isDirty($object, $propertyName) { if ($this->isReconstitutedEntity($object) === false) { return true; } if (property_exists($object, 'Flow_Persistence_LazyLoadingObject_thawProperties')) { return false; } $currentValue = ObjectAccess::getProperty($object, $propertyName, true); $cleanData =& $this->reconstitutedEntitiesData[$this->getIdentifierByObject($object)]['properties'][$propertyName]; if (($currentValue instanceof LazySplObjectStorage && !$currentValue->isInitialized()) || ($currentValue === null && $cleanData['value'] === null)) { return false; } if ($cleanData['multivalue']) { return $this->isMultiValuedPropertyDirty($cleanData, $currentValue); } else { return $this->isSingleValuedPropertyDirty($cleanData['type'], $cleanData['value'], $currentValue); } }
php
public function isDirty($object, $propertyName) { if ($this->isReconstitutedEntity($object) === false) { return true; } if (property_exists($object, 'Flow_Persistence_LazyLoadingObject_thawProperties')) { return false; } $currentValue = ObjectAccess::getProperty($object, $propertyName, true); $cleanData =& $this->reconstitutedEntitiesData[$this->getIdentifierByObject($object)]['properties'][$propertyName]; if (($currentValue instanceof LazySplObjectStorage && !$currentValue->isInitialized()) || ($currentValue === null && $cleanData['value'] === null)) { return false; } if ($cleanData['multivalue']) { return $this->isMultiValuedPropertyDirty($cleanData, $currentValue); } else { return $this->isSingleValuedPropertyDirty($cleanData['type'], $cleanData['value'], $currentValue); } }
[ "public", "function", "isDirty", "(", "$", "object", ",", "$", "propertyName", ")", "{", "if", "(", "$", "this", "->", "isReconstitutedEntity", "(", "$", "object", ")", "===", "false", ")", "{", "return", "true", ";", "}", "if", "(", "property_exists", ...
Checks whether the given property was changed in the object since it was reconstituted. Returns true for unknown objects in all cases! @param object $object @param string $propertyName @return boolean @api
[ "Checks", "whether", "the", "given", "property", "was", "changed", "in", "the", "object", "since", "it", "was", "reconstituted", ".", "Returns", "true", "for", "unknown", "objects", "in", "all", "cases!" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L149-L172
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.isMultiValuedPropertyDirty
protected function isMultiValuedPropertyDirty(array $cleanData, $currentValue) { if (count($cleanData['value']) > 0 && count($cleanData['value']) === count($currentValue)) { if ($currentValue instanceof \SplObjectStorage) { $cleanIdentifiers = []; foreach ($cleanData['value'] as &$cleanObjectData) { $cleanIdentifiers[] = $cleanObjectData['value']['identifier']; } sort($cleanIdentifiers); $currentIdentifiers = []; foreach ($currentValue as $currentObject) { $currentIdentifier = $this->getIdentifierByObject($currentObject); if ($currentIdentifier !== null) { $currentIdentifiers[] = $currentIdentifier; } } sort($currentIdentifiers); if ($cleanIdentifiers !== $currentIdentifiers) { return true; } } else { foreach ($cleanData['value'] as &$cleanObjectData) { if (!isset($currentValue[$cleanObjectData['index']])) { return true; } if (($cleanObjectData['type'] === 'array' && $this->isMultiValuedPropertyDirty($cleanObjectData, $currentValue[$cleanObjectData['index']]) === true) || ($cleanObjectData['type'] !== 'array' && $this->isSingleValuedPropertyDirty($cleanObjectData['type'], $cleanObjectData['value'], $currentValue[$cleanObjectData['index']]) === true)) { return true; } } } } elseif (count($cleanData['value']) > 0 || count($currentValue) > 0) { return true; } return false; }
php
protected function isMultiValuedPropertyDirty(array $cleanData, $currentValue) { if (count($cleanData['value']) > 0 && count($cleanData['value']) === count($currentValue)) { if ($currentValue instanceof \SplObjectStorage) { $cleanIdentifiers = []; foreach ($cleanData['value'] as &$cleanObjectData) { $cleanIdentifiers[] = $cleanObjectData['value']['identifier']; } sort($cleanIdentifiers); $currentIdentifiers = []; foreach ($currentValue as $currentObject) { $currentIdentifier = $this->getIdentifierByObject($currentObject); if ($currentIdentifier !== null) { $currentIdentifiers[] = $currentIdentifier; } } sort($currentIdentifiers); if ($cleanIdentifiers !== $currentIdentifiers) { return true; } } else { foreach ($cleanData['value'] as &$cleanObjectData) { if (!isset($currentValue[$cleanObjectData['index']])) { return true; } if (($cleanObjectData['type'] === 'array' && $this->isMultiValuedPropertyDirty($cleanObjectData, $currentValue[$cleanObjectData['index']]) === true) || ($cleanObjectData['type'] !== 'array' && $this->isSingleValuedPropertyDirty($cleanObjectData['type'], $cleanObjectData['value'], $currentValue[$cleanObjectData['index']]) === true)) { return true; } } } } elseif (count($cleanData['value']) > 0 || count($currentValue) > 0) { return true; } return false; }
[ "protected", "function", "isMultiValuedPropertyDirty", "(", "array", "$", "cleanData", ",", "$", "currentValue", ")", "{", "if", "(", "count", "(", "$", "cleanData", "[", "'value'", "]", ")", ">", "0", "&&", "count", "(", "$", "cleanData", "[", "'value'", ...
Checks the $currentValue against the $cleanData. @param array $cleanData @param \Traversable $currentValue @return boolean
[ "Checks", "the", "$currentValue", "against", "the", "$cleanData", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L181-L216
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.isSingleValuedPropertyDirty
protected function isSingleValuedPropertyDirty($type, $previousValue, $currentValue) { switch ($type) { case 'integer': if ($currentValue === (int) $previousValue) { return false; } break; case 'float': if ($currentValue === (float) $previousValue) { return false; } break; case 'boolean': if ($currentValue === (boolean) $previousValue) { return false; } break; case 'string': if ($currentValue === (string) $previousValue) { return false; } break; case 'DateTime': if ($currentValue instanceof \DateTimeInterface && $currentValue->getTimestamp() === (int) $previousValue) { return false; } break; default: if (is_object($currentValue) && $this->getIdentifierByObject($currentValue) === $previousValue['identifier']) { return false; } break; } return true; }
php
protected function isSingleValuedPropertyDirty($type, $previousValue, $currentValue) { switch ($type) { case 'integer': if ($currentValue === (int) $previousValue) { return false; } break; case 'float': if ($currentValue === (float) $previousValue) { return false; } break; case 'boolean': if ($currentValue === (boolean) $previousValue) { return false; } break; case 'string': if ($currentValue === (string) $previousValue) { return false; } break; case 'DateTime': if ($currentValue instanceof \DateTimeInterface && $currentValue->getTimestamp() === (int) $previousValue) { return false; } break; default: if (is_object($currentValue) && $this->getIdentifierByObject($currentValue) === $previousValue['identifier']) { return false; } break; } return true; }
[ "protected", "function", "isSingleValuedPropertyDirty", "(", "$", "type", ",", "$", "previousValue", ",", "$", "currentValue", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "'integer'", ":", "if", "(", "$", "currentValue", "===", "(", "int", ")",...
Checks the $previousValue against the $currentValue. @param string $type @param mixed $previousValue @param mixed &$currentValue @return boolean
[ "Checks", "the", "$previousValue", "against", "the", "$currentValue", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L226-L261
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.getCleanStateOfProperty
public function getCleanStateOfProperty($object, $propertyName) { if ($this->isReconstitutedEntity($object) === false) { return null; } $identifier = $this->getIdentifierByObject($object); if (!isset($this->reconstitutedEntitiesData[$identifier]['properties'][$propertyName])) { return null; } return $this->reconstitutedEntitiesData[$identifier]['properties'][$propertyName]; }
php
public function getCleanStateOfProperty($object, $propertyName) { if ($this->isReconstitutedEntity($object) === false) { return null; } $identifier = $this->getIdentifierByObject($object); if (!isset($this->reconstitutedEntitiesData[$identifier]['properties'][$propertyName])) { return null; } return $this->reconstitutedEntitiesData[$identifier]['properties'][$propertyName]; }
[ "public", "function", "getCleanStateOfProperty", "(", "$", "object", ",", "$", "propertyName", ")", "{", "if", "(", "$", "this", "->", "isReconstitutedEntity", "(", "$", "object", ")", "===", "false", ")", "{", "return", "null", ";", "}", "$", "identifier"...
Returns the previous (last persisted) state of the property. If nothing is found, NULL is returned. @param object $object @param string $propertyName @return mixed
[ "Returns", "the", "previous", "(", "last", "persisted", ")", "state", "of", "the", "property", ".", "If", "nothing", "is", "found", "NULL", "is", "returned", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L271-L281
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.getIdentifierByObject
public function getIdentifierByObject($object) { if ($this->hasObject($object)) { return $this->objectMap[$object]; } $idPropertyNames = $this->reflectionService->getPropertyNamesByTag(get_class($object), 'id'); if (count($idPropertyNames) === 1) { $idPropertyName = $idPropertyNames[0]; return ObjectAccess::getProperty($object, $idPropertyName, true); } elseif (property_exists($object, 'Persistence_Object_Identifier')) { return ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', true); } return null; }
php
public function getIdentifierByObject($object) { if ($this->hasObject($object)) { return $this->objectMap[$object]; } $idPropertyNames = $this->reflectionService->getPropertyNamesByTag(get_class($object), 'id'); if (count($idPropertyNames) === 1) { $idPropertyName = $idPropertyNames[0]; return ObjectAccess::getProperty($object, $idPropertyName, true); } elseif (property_exists($object, 'Persistence_Object_Identifier')) { return ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', true); } return null; }
[ "public", "function", "getIdentifierByObject", "(", "$", "object", ")", "{", "if", "(", "$", "this", "->", "hasObject", "(", "$", "object", ")", ")", "{", "return", "$", "this", "->", "objectMap", "[", "$", "object", "]", ";", "}", "$", "idPropertyName...
Returns the identifier for the given object either from the session, if the object was registered, or from the object itself using a special uuid property or the internal properties set by AOP. Note: this returns an UUID 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 string @api
[ "Returns", "the", "identifier", "for", "the", "given", "object", "either", "from", "the", "session", "if", "the", "object", "was", "registered", "or", "from", "the", "object", "itself", "using", "a", "special", "uuid", "property", "or", "the", "internal", "p...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L332-L347
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.registerObject
public function registerObject($object, $identifier) { $this->objectMap[$object] = $identifier; $this->identifierMap[$identifier] = $object; }
php
public function registerObject($object, $identifier) { $this->objectMap[$object] = $identifier; $this->identifierMap[$identifier] = $object; }
[ "public", "function", "registerObject", "(", "$", "object", ",", "$", "identifier", ")", "{", "$", "this", "->", "objectMap", "[", "$", "object", "]", "=", "$", "identifier", ";", "$", "this", "->", "identifierMap", "[", "$", "identifier", "]", "=", "$...
Register an identifier for an object @param object $object @param string $identifier @api
[ "Register", "an", "identifier", "for", "an", "object" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L356-L360
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.unregisterObject
public function unregisterObject($object) { unset($this->identifierMap[$this->objectMap[$object]]); $this->objectMap->detach($object); }
php
public function unregisterObject($object) { unset($this->identifierMap[$this->objectMap[$object]]); $this->objectMap->detach($object); }
[ "public", "function", "unregisterObject", "(", "$", "object", ")", "{", "unset", "(", "$", "this", "->", "identifierMap", "[", "$", "this", "->", "objectMap", "[", "$", "object", "]", "]", ")", ";", "$", "this", "->", "objectMap", "->", "detach", "(", ...
Unregister an object @param string $object @return void
[ "Unregister", "an", "object" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L368-L372
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Session.php
Session.destroy
public function destroy() { $this->identifierMap = []; $this->objectMap = new \SplObjectStorage(); $this->reconstitutedEntities = new \SplObjectStorage(); $this->reconstitutedEntitiesData = []; }
php
public function destroy() { $this->identifierMap = []; $this->objectMap = new \SplObjectStorage(); $this->reconstitutedEntities = new \SplObjectStorage(); $this->reconstitutedEntitiesData = []; }
[ "public", "function", "destroy", "(", ")", "{", "$", "this", "->", "identifierMap", "=", "[", "]", ";", "$", "this", "->", "objectMap", "=", "new", "\\", "SplObjectStorage", "(", ")", ";", "$", "this", "->", "reconstitutedEntities", "=", "new", "\\", "...
Destroy the state of the persistence session and reset all internal data. @return void
[ "Destroy", "the", "state", "of", "the", "persistence", "session", "and", "reset", "all", "internal", "data", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Session.php#L380-L386
neos/flow-development-collection
Neos.Flow/Classes/Property/TypeConverter/PersistentObjectSerializer.php
PersistentObjectSerializer.convertFrom
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) { $identifier = $this->persistenceManager->getIdentifierByObject($source); return $identifier; }
php
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) { $identifier = $this->persistenceManager->getIdentifierByObject($source); return $identifier; }
[ "public", "function", "convertFrom", "(", "$", "source", ",", "$", "targetType", ",", "array", "$", "convertedChildProperties", "=", "[", "]", ",", "PropertyMappingConfigurationInterface", "$", "configuration", "=", "null", ")", "{", "$", "identifier", "=", "$",...
Convert an entity or valueobject to a string representation (by using the identifier) @param object $source @param string $targetType @param array $convertedChildProperties @param PropertyMappingConfigurationInterface $configuration @return object the target type
[ "Convert", "an", "entity", "or", "valueobject", "to", "a", "string", "representation", "(", "by", "using", "the", "identifier", ")" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Property/TypeConverter/PersistentObjectSerializer.php#L59-L63
neos/flow-development-collection
Neos.Flow/Classes/Cli/Request.php
Request.getCommand
public function getCommand(): Command { if ($this->command === null) { $this->command = new Command($this->controllerObjectName, $this->controllerCommandName); } return $this->command; }
php
public function getCommand(): Command { if ($this->command === null) { $this->command = new Command($this->controllerObjectName, $this->controllerCommandName); } return $this->command; }
[ "public", "function", "getCommand", "(", ")", ":", "Command", "{", "if", "(", "$", "this", "->", "command", "===", "null", ")", "{", "$", "this", "->", "command", "=", "new", "Command", "(", "$", "this", "->", "controllerObjectName", ",", "$", "this", ...
Returns the command object for this request @return Command
[ "Returns", "the", "command", "object", "for", "this", "request" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/Request.php#L161-L167
neos/flow-development-collection
Neos.Flow/Classes/Cli/Request.php
Request.setArgument
public function setArgument(string $argumentName, $value) { if ($argumentName === '') { throw new InvalidArgumentNameException('Invalid argument name.', 1300893885); } $this->arguments[$argumentName] = $value; }
php
public function setArgument(string $argumentName, $value) { if ($argumentName === '') { throw new InvalidArgumentNameException('Invalid argument name.', 1300893885); } $this->arguments[$argumentName] = $value; }
[ "public", "function", "setArgument", "(", "string", "$", "argumentName", ",", "$", "value", ")", "{", "if", "(", "$", "argumentName", "===", "''", ")", "{", "throw", "new", "InvalidArgumentNameException", "(", "'Invalid argument name.'", ",", "1300893885", ")", ...
Sets the value of the specified argument @param string $argumentName Name of the argument to set @param mixed $value The new value @return void @throws InvalidArgumentNameException
[ "Sets", "the", "value", "of", "the", "specified", "argument" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/Request.php#L177-L183
neos/flow-development-collection
Neos.Flow/Classes/Cli/Request.php
Request.getArgument
public function getArgument(string $argumentName) { if (!isset($this->arguments[$argumentName])) { throw new NoSuchArgumentException('An argument "' . $argumentName . '" does not exist for this request.', 1300893886); } return $this->arguments[$argumentName]; }
php
public function getArgument(string $argumentName) { if (!isset($this->arguments[$argumentName])) { throw new NoSuchArgumentException('An argument "' . $argumentName . '" does not exist for this request.', 1300893886); } return $this->arguments[$argumentName]; }
[ "public", "function", "getArgument", "(", "string", "$", "argumentName", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "arguments", "[", "$", "argumentName", "]", ")", ")", "{", "throw", "new", "NoSuchArgumentException", "(", "'An argument \"'",...
Returns the value of the specified argument @param string $argumentName Name of the argument @return mixed Value of the argument @throws NoSuchArgumentException if such an argument does not exist
[ "Returns", "the", "value", "of", "the", "specified", "argument" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/Request.php#L203-L209
neos/flow-development-collection
Neos.Flow/Classes/I18n/Cldr/CldrRepository.php
CldrRepository.getModel
public function getModel($filename) { $filename = Files::concatenatePaths([$this->cldrBasePath, $filename . '.xml']); if (isset($this->models[$filename])) { return $this->models[$filename]; } if (!is_file($filename)) { return false; } return $this->models[$filename] = new CldrModel([$filename]); }
php
public function getModel($filename) { $filename = Files::concatenatePaths([$this->cldrBasePath, $filename . '.xml']); if (isset($this->models[$filename])) { return $this->models[$filename]; } if (!is_file($filename)) { return false; } return $this->models[$filename] = new CldrModel([$filename]); }
[ "public", "function", "getModel", "(", "$", "filename", ")", "{", "$", "filename", "=", "Files", "::", "concatenatePaths", "(", "[", "$", "this", "->", "cldrBasePath", ",", "$", "filename", ".", "'.xml'", "]", ")", ";", "if", "(", "isset", "(", "$", ...
Returns an instance of CldrModel which represents CLDR file found under specified path. Will return existing instance if a model for given $filename was already requested before. Returns false when $filename doesn't point to existing file. @param string $filename Relative (from CLDR root) path to existing CLDR file @return CldrModel|boolean A CldrModel instance or false on failure
[ "Returns", "an", "instance", "of", "CldrModel", "which", "represents", "CLDR", "file", "found", "under", "specified", "path", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Cldr/CldrRepository.php#L78-L91
neos/flow-development-collection
Neos.Flow/Classes/I18n/Cldr/CldrRepository.php
CldrRepository.getModelForLocale
public function getModelForLocale(I18n\Locale $locale, $directoryPath = 'main') { $directoryPath = Files::concatenatePaths([$this->cldrBasePath, $directoryPath]); if (isset($this->models[$directoryPath][(string)$locale])) { return $this->models[$directoryPath][(string)$locale]; } if (!is_dir($directoryPath)) { return null; } $filesInHierarchy = $this->findLocaleChain($locale, $directoryPath); return $this->models[$directoryPath][(string)$locale] = new CldrModel($filesInHierarchy); }
php
public function getModelForLocale(I18n\Locale $locale, $directoryPath = 'main') { $directoryPath = Files::concatenatePaths([$this->cldrBasePath, $directoryPath]); if (isset($this->models[$directoryPath][(string)$locale])) { return $this->models[$directoryPath][(string)$locale]; } if (!is_dir($directoryPath)) { return null; } $filesInHierarchy = $this->findLocaleChain($locale, $directoryPath); return $this->models[$directoryPath][(string)$locale] = new CldrModel($filesInHierarchy); }
[ "public", "function", "getModelForLocale", "(", "I18n", "\\", "Locale", "$", "locale", ",", "$", "directoryPath", "=", "'main'", ")", "{", "$", "directoryPath", "=", "Files", "::", "concatenatePaths", "(", "[", "$", "this", "->", "cldrBasePath", ",", "$", ...
Returns an instance of CldrModel which represents group of CLDR files which are related in hierarchy. This method finds a group of CLDR files within $directoryPath dir, for particular Locale. Returned model represents whole locale-chain. For example, for locale en_GB, returned model could represent 'en_GB', 'en', and 'root' CLDR files. Returns false when $directoryPath doesn't point to existing directory. @param I18n\Locale $locale A locale @param string $directoryPath Relative path to existing CLDR directory which contains one file per locale (see 'main' directory in CLDR for example) @return CldrModel A CldrModel instance or NULL on failure
[ "Returns", "an", "instance", "of", "CldrModel", "which", "represents", "group", "of", "CLDR", "files", "which", "are", "related", "in", "hierarchy", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Cldr/CldrRepository.php#L109-L124
neos/flow-development-collection
Neos.Flow/Classes/I18n/Cldr/CldrRepository.php
CldrRepository.findLocaleChain
protected function findLocaleChain(I18n\Locale $locale, $directoryPath) { $filesInHierarchy = [Files::concatenatePaths([$directoryPath, (string)$locale . '.xml'])]; $localeIdentifier = (string)$locale; while ($localeIdentifier = substr($localeIdentifier, 0, (int)strrpos($localeIdentifier, '_'))) { $possibleFilename = Files::concatenatePaths([$directoryPath, $localeIdentifier . '.xml']); if (file_exists($possibleFilename)) { array_unshift($filesInHierarchy, $possibleFilename); } } array_unshift($filesInHierarchy, Files::concatenatePaths([$directoryPath, 'root.xml'])); return $filesInHierarchy; }
php
protected function findLocaleChain(I18n\Locale $locale, $directoryPath) { $filesInHierarchy = [Files::concatenatePaths([$directoryPath, (string)$locale . '.xml'])]; $localeIdentifier = (string)$locale; while ($localeIdentifier = substr($localeIdentifier, 0, (int)strrpos($localeIdentifier, '_'))) { $possibleFilename = Files::concatenatePaths([$directoryPath, $localeIdentifier . '.xml']); if (file_exists($possibleFilename)) { array_unshift($filesInHierarchy, $possibleFilename); } } array_unshift($filesInHierarchy, Files::concatenatePaths([$directoryPath, 'root.xml'])); return $filesInHierarchy; }
[ "protected", "function", "findLocaleChain", "(", "I18n", "\\", "Locale", "$", "locale", ",", "$", "directoryPath", ")", "{", "$", "filesInHierarchy", "=", "[", "Files", "::", "concatenatePaths", "(", "[", "$", "directoryPath", ",", "(", "string", ")", "$", ...
Returns absolute paths to CLDR files connected in hierarchy For given locale, many CLDR files have to be merged in order to get full set of CLDR data. For example, for 'en_GB' locale, files 'root', 'en', and 'en_GB' should be merged. @param I18n\Locale $locale A locale @param string $directoryPath Relative path to existing CLDR directory which contains one file per locale (see 'main' directory in CLDR for example) @return array<string> Absolute paths to CLDR files in hierarchy
[ "Returns", "absolute", "paths", "to", "CLDR", "files", "connected", "in", "hierarchy" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Cldr/CldrRepository.php#L137-L151
neos/flow-development-collection
Neos.Utility.Schema/Classes/SchemaGenerator.php
SchemaGenerator.generate
public function generate($value): array { $schema = []; switch (gettype($value)) { case 'NULL': $schema['type'] = 'null'; break; case 'boolean': $schema['type'] = 'boolean'; break; case 'integer': $schema['type'] = 'integer'; break; case 'double': $schema['type'] = 'number'; break; case 'string': $schema = $this->generateStringSchema($value); break; case 'array': $isDictionary = array_keys($value) !== range(0, count($value) - 1); if ($isDictionary) { $schema = $this->generateDictionarySchema($value); } else { $schema = $this->generateArraySchema($value); } break; } return $schema; }
php
public function generate($value): array { $schema = []; switch (gettype($value)) { case 'NULL': $schema['type'] = 'null'; break; case 'boolean': $schema['type'] = 'boolean'; break; case 'integer': $schema['type'] = 'integer'; break; case 'double': $schema['type'] = 'number'; break; case 'string': $schema = $this->generateStringSchema($value); break; case 'array': $isDictionary = array_keys($value) !== range(0, count($value) - 1); if ($isDictionary) { $schema = $this->generateDictionarySchema($value); } else { $schema = $this->generateArraySchema($value); } break; } return $schema; }
[ "public", "function", "generate", "(", "$", "value", ")", ":", "array", "{", "$", "schema", "=", "[", "]", ";", "switch", "(", "gettype", "(", "$", "value", ")", ")", "{", "case", "'NULL'", ":", "$", "schema", "[", "'type'", "]", "=", "'null'", "...
Generate a schema for the given value @param mixed $value value to create a schema for @return array schema as array structure
[ "Generate", "a", "schema", "for", "the", "given", "value" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Schema/Classes/SchemaGenerator.php#L31-L60
neos/flow-development-collection
Neos.Utility.Schema/Classes/SchemaGenerator.php
SchemaGenerator.generateDictionarySchema
protected function generateDictionarySchema(array $dictionaryValue): array { $schema = ['type' => 'dictionary', 'properties' => []]; ksort($dictionaryValue); foreach ($dictionaryValue as $name => $subvalue) { $schema['properties'][$name] = $this->generate($subvalue); } return $schema; }
php
protected function generateDictionarySchema(array $dictionaryValue): array { $schema = ['type' => 'dictionary', 'properties' => []]; ksort($dictionaryValue); foreach ($dictionaryValue as $name => $subvalue) { $schema['properties'][$name] = $this->generate($subvalue); } return $schema; }
[ "protected", "function", "generateDictionarySchema", "(", "array", "$", "dictionaryValue", ")", ":", "array", "{", "$", "schema", "=", "[", "'type'", "=>", "'dictionary'", ",", "'properties'", "=>", "[", "]", "]", ";", "ksort", "(", "$", "dictionaryValue", "...
Create a schema for a dictionary @param array $dictionaryValue @return array
[ "Create", "a", "schema", "for", "a", "dictionary" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Schema/Classes/SchemaGenerator.php#L68-L76
neos/flow-development-collection
Neos.Utility.Schema/Classes/SchemaGenerator.php
SchemaGenerator.generateArraySchema
protected function generateArraySchema(array $arrayValue): array { $schema = ['type' => 'array']; $subSchemas = []; foreach ($arrayValue as $subValue) { $subSchemas[] = $this->generate($subValue); } $schema['items'] = $this->filterDuplicatesFromArray($subSchemas); return $schema; }
php
protected function generateArraySchema(array $arrayValue): array { $schema = ['type' => 'array']; $subSchemas = []; foreach ($arrayValue as $subValue) { $subSchemas[] = $this->generate($subValue); } $schema['items'] = $this->filterDuplicatesFromArray($subSchemas); return $schema; }
[ "protected", "function", "generateArraySchema", "(", "array", "$", "arrayValue", ")", ":", "array", "{", "$", "schema", "=", "[", "'type'", "=>", "'array'", "]", ";", "$", "subSchemas", "=", "[", "]", ";", "foreach", "(", "$", "arrayValue", "as", "$", ...
Create a schema for an array structure @param array $arrayValue @return array schema
[ "Create", "a", "schema", "for", "an", "array", "structure" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Schema/Classes/SchemaGenerator.php#L84-L93
neos/flow-development-collection
Neos.Utility.Schema/Classes/SchemaGenerator.php
SchemaGenerator.generateStringSchema
protected function generateStringSchema(string $stringValue): array { $schema = ['type' => 'string']; $schemaValidator = new SchemaValidator(); $detectedFormat = null; $detectableFormats = ['uri','email','ip-address','class-name','interface-name']; foreach ($detectableFormats as $testFormat) { $testSchema = ['type' => 'string', 'format' => $testFormat]; $result = $schemaValidator->validate($stringValue, $testSchema); if ($result->hasErrors() === false) { $detectedFormat = $testFormat; } } if ($detectedFormat !== null) { $schema['format'] = $detectedFormat; } return $schema; }
php
protected function generateStringSchema(string $stringValue): array { $schema = ['type' => 'string']; $schemaValidator = new SchemaValidator(); $detectedFormat = null; $detectableFormats = ['uri','email','ip-address','class-name','interface-name']; foreach ($detectableFormats as $testFormat) { $testSchema = ['type' => 'string', 'format' => $testFormat]; $result = $schemaValidator->validate($stringValue, $testSchema); if ($result->hasErrors() === false) { $detectedFormat = $testFormat; } } if ($detectedFormat !== null) { $schema['format'] = $detectedFormat; } return $schema; }
[ "protected", "function", "generateStringSchema", "(", "string", "$", "stringValue", ")", ":", "array", "{", "$", "schema", "=", "[", "'type'", "=>", "'string'", "]", ";", "$", "schemaValidator", "=", "new", "SchemaValidator", "(", ")", ";", "$", "detectedFor...
Create a schema for a given string @param string $stringValue @return array
[ "Create", "a", "schema", "for", "a", "given", "string" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Schema/Classes/SchemaGenerator.php#L101-L119
neos/flow-development-collection
Neos.Utility.Schema/Classes/SchemaGenerator.php
SchemaGenerator.filterDuplicatesFromArray
protected function filterDuplicatesFromArray(array $values) { $uniqueItems = []; foreach ($values as $value) { $uniqueItems[md5(serialize($value))] = $value; } $result = array_values($uniqueItems); if (count($result) === 1) { return $result[0]; } return $result; }
php
protected function filterDuplicatesFromArray(array $values) { $uniqueItems = []; foreach ($values as $value) { $uniqueItems[md5(serialize($value))] = $value; } $result = array_values($uniqueItems); if (count($result) === 1) { return $result[0]; } return $result; }
[ "protected", "function", "filterDuplicatesFromArray", "(", "array", "$", "values", ")", "{", "$", "uniqueItems", "=", "[", "]", ";", "foreach", "(", "$", "values", "as", "$", "value", ")", "{", "$", "uniqueItems", "[", "md5", "(", "serialize", "(", "$", ...
Compact an array of items to avoid adding the same value more than once. If the result contains only one item, that item is returned directly. @param array $values array of values @return mixed
[ "Compact", "an", "array", "of", "items", "to", "avoid", "adding", "the", "same", "value", "more", "than", "once", ".", "If", "the", "result", "contains", "only", "one", "item", "that", "item", "is", "returned", "directly", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.Schema/Classes/SchemaGenerator.php#L128-L139
neos/flow-development-collection
Neos.Flow/Classes/Aop/Pointcut/PointcutSettingFilter.php
PointcutSettingFilter.injectConfigurationManager
public function injectConfigurationManager(ConfigurationManager $configurationManager): void { $this->configurationManager = $configurationManager; $this->parseConfigurationOptionPath($this->settingComparisonExpression); }
php
public function injectConfigurationManager(ConfigurationManager $configurationManager): void { $this->configurationManager = $configurationManager; $this->parseConfigurationOptionPath($this->settingComparisonExpression); }
[ "public", "function", "injectConfigurationManager", "(", "ConfigurationManager", "$", "configurationManager", ")", ":", "void", "{", "$", "this", "->", "configurationManager", "=", "$", "configurationManager", ";", "$", "this", "->", "parseConfigurationOptionPath", "(",...
Injects the configuration manager @param ConfigurationManager $configurationManager @return void
[ "Injects", "the", "configuration", "manager" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutSettingFilter.php#L75-L79
neos/flow-development-collection
Neos.Flow/Classes/Aop/Pointcut/PointcutSettingFilter.php
PointcutSettingFilter.matches
public function matches($className, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier): bool { if ($this->cachedResult === null) { $this->cachedResult = (is_bool($this->actualSettingValue)) ? $this->actualSettingValue : ($this->condition === $this->actualSettingValue); } return $this->cachedResult; }
php
public function matches($className, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier): bool { if ($this->cachedResult === null) { $this->cachedResult = (is_bool($this->actualSettingValue)) ? $this->actualSettingValue : ($this->condition === $this->actualSettingValue); } return $this->cachedResult; }
[ "public", "function", "matches", "(", "$", "className", ",", "$", "methodName", ",", "$", "methodDeclaringClassName", ",", "$", "pointcutQueryIdentifier", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "cachedResult", "===", "null", ")", "{", "$", "t...
Checks if the specified configuration option is set to true or false, or if it matches the specified condition @param string $className Name of the class to check against @param string $methodName Name of the method - not used here @param string $methodDeclaringClassName Name of the class the method was originally declared in - not used here @param mixed $pointcutQueryIdentifier Some identifier for this query - must at least differ from a previous identifier. Used for circular reference detection. @return boolean true if the class matches, otherwise false
[ "Checks", "if", "the", "specified", "configuration", "option", "is", "set", "to", "true", "or", "false", "or", "if", "it", "matches", "the", "specified", "condition" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutSettingFilter.php#L91-L97
neos/flow-development-collection
Neos.Flow/Classes/Aop/Pointcut/PointcutSettingFilter.php
PointcutSettingFilter.parseConfigurationOptionPath
protected function parseConfigurationOptionPath(string $settingComparisonExpression): void { $settingComparisonExpression = preg_split(self::PATTERN_SPLITBYEQUALSIGN, $settingComparisonExpression); if (isset($settingComparisonExpression[1])) { $matches = []; preg_match(self::PATTERN_MATCHVALUEINQUOTES, $settingComparisonExpression[1], $matches); if (isset($matches['SingleQuotedString']) && $matches['SingleQuotedString'] !== '') { $this->condition = $matches['SingleQuotedString']; } elseif (isset($matches['DoubleQuotedString']) && $matches['DoubleQuotedString'] !== '') { $this->condition = $matches['DoubleQuotedString']; } else { throw new InvalidPointcutExpressionException('The given condition has a syntax error (Make sure to set quotes correctly). Got: "' . $settingComparisonExpression[1] . '"', 1230047529); } } $configurationKeys = explode('.', $settingComparisonExpression[0]); if (count($configurationKeys) > 0) { $settingPackageKey = array_shift($configurationKeys); $settingValue = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $settingPackageKey); foreach ($configurationKeys as $currentKey) { if (!isset($settingValue[$currentKey])) { throw new InvalidPointcutExpressionException('The given configuration path in the pointcut designator "setting" did not exist. Got: "' . $settingComparisonExpression[0] . '"', 1230035614); } $settingValue = $settingValue[$currentKey]; } $this->actualSettingValue = $settingValue; } }
php
protected function parseConfigurationOptionPath(string $settingComparisonExpression): void { $settingComparisonExpression = preg_split(self::PATTERN_SPLITBYEQUALSIGN, $settingComparisonExpression); if (isset($settingComparisonExpression[1])) { $matches = []; preg_match(self::PATTERN_MATCHVALUEINQUOTES, $settingComparisonExpression[1], $matches); if (isset($matches['SingleQuotedString']) && $matches['SingleQuotedString'] !== '') { $this->condition = $matches['SingleQuotedString']; } elseif (isset($matches['DoubleQuotedString']) && $matches['DoubleQuotedString'] !== '') { $this->condition = $matches['DoubleQuotedString']; } else { throw new InvalidPointcutExpressionException('The given condition has a syntax error (Make sure to set quotes correctly). Got: "' . $settingComparisonExpression[1] . '"', 1230047529); } } $configurationKeys = explode('.', $settingComparisonExpression[0]); if (count($configurationKeys) > 0) { $settingPackageKey = array_shift($configurationKeys); $settingValue = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $settingPackageKey); foreach ($configurationKeys as $currentKey) { if (!isset($settingValue[$currentKey])) { throw new InvalidPointcutExpressionException('The given configuration path in the pointcut designator "setting" did not exist. Got: "' . $settingComparisonExpression[0] . '"', 1230035614); } $settingValue = $settingValue[$currentKey]; } $this->actualSettingValue = $settingValue; } }
[ "protected", "function", "parseConfigurationOptionPath", "(", "string", "$", "settingComparisonExpression", ")", ":", "void", "{", "$", "settingComparisonExpression", "=", "preg_split", "(", "self", "::", "PATTERN_SPLITBYEQUALSIGN", ",", "$", "settingComparisonExpression", ...
Parses the given configuration path expression and sets $this->actualSettingValue and $this->condition accordingly @param string $settingComparisonExpression The configuration expression (path + optional condition) @return void @throws InvalidPointcutExpressionException
[ "Parses", "the", "given", "configuration", "path", "expression", "and", "sets", "$this", "-", ">", "actualSettingValue", "and", "$this", "-", ">", "condition", "accordingly" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Pointcut/PointcutSettingFilter.php#L127-L155
neos/flow-development-collection
Neos.Cache/Classes/Backend/AbstractBackend.php
AbstractBackend.setCache
public function setCache(FrontendInterface $cache) { $this->cache = $cache; $this->cacheIdentifier = $this->cache->getIdentifier(); }
php
public function setCache(FrontendInterface $cache) { $this->cache = $cache; $this->cacheIdentifier = $this->cache->getIdentifier(); }
[ "public", "function", "setCache", "(", "FrontendInterface", "$", "cache", ")", "{", "$", "this", "->", "cache", "=", "$", "cache", ";", "$", "this", "->", "cacheIdentifier", "=", "$", "this", "->", "cache", "->", "getIdentifier", "(", ")", ";", "}" ]
Sets a reference to the cache frontend which uses this backend @param FrontendInterface $cache The frontend for this backend @return void @api
[ "Sets", "a", "reference", "to", "the", "cache", "frontend", "which", "uses", "this", "backend" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/AbstractBackend.php#L108-L112
neos/flow-development-collection
Neos.Cache/Classes/Backend/AbstractBackend.php
AbstractBackend.calculateExpiryTime
protected function calculateExpiryTime(int $lifetime = null): \DateTime { if ($lifetime === self::UNLIMITED_LIFETIME || ($lifetime === null && $this->defaultLifetime === self::UNLIMITED_LIFETIME)) { return new \DateTime(self::DATETIME_EXPIRYTIME_UNLIMITED, new \DateTimeZone('UTC')); } if ($lifetime === null) { $lifetime = $this->defaultLifetime; } return new \DateTime('now +' . $lifetime . ' seconds', new \DateTimeZone('UTC')); }
php
protected function calculateExpiryTime(int $lifetime = null): \DateTime { if ($lifetime === self::UNLIMITED_LIFETIME || ($lifetime === null && $this->defaultLifetime === self::UNLIMITED_LIFETIME)) { return new \DateTime(self::DATETIME_EXPIRYTIME_UNLIMITED, new \DateTimeZone('UTC')); } if ($lifetime === null) { $lifetime = $this->defaultLifetime; } return new \DateTime('now +' . $lifetime . ' seconds', new \DateTimeZone('UTC')); }
[ "protected", "function", "calculateExpiryTime", "(", "int", "$", "lifetime", "=", "null", ")", ":", "\\", "DateTime", "{", "if", "(", "$", "lifetime", "===", "self", "::", "UNLIMITED_LIFETIME", "||", "(", "$", "lifetime", "===", "null", "&&", "$", "this", ...
Calculates the expiry time by the given lifetime. If no lifetime is specified, the default lifetime is used. @param integer $lifetime The lifetime in seconds @return \DateTime The expiry time
[ "Calculates", "the", "expiry", "time", "by", "the", "given", "lifetime", ".", "If", "no", "lifetime", "is", "specified", "the", "default", "lifetime", "is", "used", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/AbstractBackend.php#L158-L168
neos/flow-development-collection
Neos.Flow/Classes/Cli/CommandArgumentDefinition.php
CommandArgumentDefinition.getDashedName
public function getDashedName(): string { $dashedName = ucfirst($this->name); $dashedName = preg_replace('/([A-Z][a-z0-9]+)/', '$1-', $dashedName); return '--' . strtolower(substr($dashedName, 0, -1)); }
php
public function getDashedName(): string { $dashedName = ucfirst($this->name); $dashedName = preg_replace('/([A-Z][a-z0-9]+)/', '$1-', $dashedName); return '--' . strtolower(substr($dashedName, 0, -1)); }
[ "public", "function", "getDashedName", "(", ")", ":", "string", "{", "$", "dashedName", "=", "ucfirst", "(", "$", "this", "->", "name", ")", ";", "$", "dashedName", "=", "preg_replace", "(", "'/([A-Z][a-z0-9]+)/'", ",", "'$1-'", ",", "$", "dashedName", ")"...
Returns the lowercased name with dashes as word separator @return string
[ "Returns", "the", "lowercased", "name", "with", "dashes", "as", "word", "separator" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/CommandArgumentDefinition.php#L62-L67