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
doctrine/cache
lib/Doctrine/Common/Cache/ChainCache.php
ChainCache.doGetStats
protected function doGetStats() { // We return all the stats from all adapters $stats = []; foreach ($this->cacheProviders as $cacheProvider) { $stats[] = $cacheProvider->doGetStats(); } return $stats; }
php
protected function doGetStats() { // We return all the stats from all adapters $stats = []; foreach ($this->cacheProviders as $cacheProvider) { $stats[] = $cacheProvider->doGetStats(); } return $stats; }
[ "protected", "function", "doGetStats", "(", ")", "{", "// We return all the stats from all adapters", "$", "stats", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "cacheProviders", "as", "$", "cacheProvider", ")", "{", "$", "stats", "[", "]", "=", "$...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ChainCache.php#L176-L186
doctrine/cache
lib/Doctrine/Common/Cache/PhpFileCache.php
PhpFileCache.doFetch
protected function doFetch($id) { $value = $this->includeFileForId($id); if ($value === null) { return false; } if ($value['lifetime'] !== 0 && $value['lifetime'] < time()) { return false; } return $value['data']; }
php
protected function doFetch($id) { $value = $this->includeFileForId($id); if ($value === null) { return false; } if ($value['lifetime'] !== 0 && $value['lifetime'] < time()) { return false; } return $value['data']; }
[ "protected", "function", "doFetch", "(", "$", "id", ")", "{", "$", "value", "=", "$", "this", "->", "includeFileForId", "(", "$", "id", ")", ";", "if", "(", "$", "value", "===", "null", ")", "{", "return", "false", ";", "}", "if", "(", "$", "valu...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/PhpFileCache.php#L42-L55
doctrine/cache
lib/Doctrine/Common/Cache/PhpFileCache.php
PhpFileCache.doContains
protected function doContains($id) { $value = $this->includeFileForId($id); if ($value === null) { return false; } return $value['lifetime'] === 0 || $value['lifetime'] > time(); }
php
protected function doContains($id) { $value = $this->includeFileForId($id); if ($value === null) { return false; } return $value['lifetime'] === 0 || $value['lifetime'] > time(); }
[ "protected", "function", "doContains", "(", "$", "id", ")", "{", "$", "value", "=", "$", "this", "->", "includeFileForId", "(", "$", "id", ")", ";", "if", "(", "$", "value", "===", "null", ")", "{", "return", "false", ";", "}", "return", "$", "valu...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/PhpFileCache.php#L60-L69
doctrine/cache
lib/Doctrine/Common/Cache/PhpFileCache.php
PhpFileCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { if ($lifeTime > 0) { $lifeTime = time() + $lifeTime; } $filename = $this->getFilename($id); $value = [ 'lifetime' => $lifeTime, 'data' => $data, ]; if (is_object($data)...
php
protected function doSave($id, $data, $lifeTime = 0) { if ($lifeTime > 0) { $lifeTime = time() + $lifeTime; } $filename = $this->getFilename($id); $value = [ 'lifetime' => $lifeTime, 'data' => $data, ]; if (is_object($data)...
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "if", "(", "$", "lifeTime", ">", "0", ")", "{", "$", "lifeTime", "=", "time", "(", ")", "+", "$", "lifeTime", ";", "}", "$", "filenam...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/PhpFileCache.php#L74-L96
doctrine/cache
lib/Doctrine/Common/Cache/ArrayCache.php
ArrayCache.doFetch
protected function doFetch($id) { if (! $this->doContains($id)) { $this->missesCount += 1; return false; } $this->hitsCount += 1; return $this->data[$id][0]; }
php
protected function doFetch($id) { if (! $this->doContains($id)) { $this->missesCount += 1; return false; } $this->hitsCount += 1; return $this->data[$id][0]; }
[ "protected", "function", "doFetch", "(", "$", "id", ")", "{", "if", "(", "!", "$", "this", "->", "doContains", "(", "$", "id", ")", ")", "{", "$", "this", "->", "missesCount", "+=", "1", ";", "return", "false", ";", "}", "$", "this", "->", "hitsC...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ArrayCache.php#L37-L48
doctrine/cache
lib/Doctrine/Common/Cache/ArrayCache.php
ArrayCache.doContains
protected function doContains($id) { if (! isset($this->data[$id])) { return false; } $expiration = $this->data[$id][1]; if ($expiration && $expiration < time()) { $this->doDelete($id); return false; } return true; }
php
protected function doContains($id) { if (! isset($this->data[$id])) { return false; } $expiration = $this->data[$id][1]; if ($expiration && $expiration < time()) { $this->doDelete($id); return false; } return true; }
[ "protected", "function", "doContains", "(", "$", "id", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "data", "[", "$", "id", "]", ")", ")", "{", "return", "false", ";", "}", "$", "expiration", "=", "$", "this", "->", "data", "[", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ArrayCache.php#L53-L68
doctrine/cache
lib/Doctrine/Common/Cache/ArrayCache.php
ArrayCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { $this->data[$id] = [$data, $lifeTime ? time() + $lifeTime : false]; return true; }
php
protected function doSave($id, $data, $lifeTime = 0) { $this->data[$id] = [$data, $lifeTime ? time() + $lifeTime : false]; return true; }
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "$", "this", "->", "data", "[", "$", "id", "]", "=", "[", "$", "data", ",", "$", "lifeTime", "?", "time", "(", ")", "+", "$", "life...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ArrayCache.php#L73-L78
doctrine/cache
lib/Doctrine/Common/Cache/ArrayCache.php
ArrayCache.doGetStats
protected function doGetStats() { return [ Cache::STATS_HITS => $this->hitsCount, Cache::STATS_MISSES => $this->missesCount, Cache::STATS_UPTIME => $this->upTime, Cache::STATS_MEMORY_USAGE => null, Cache::STATS_M...
php
protected function doGetStats() { return [ Cache::STATS_HITS => $this->hitsCount, Cache::STATS_MISSES => $this->missesCount, Cache::STATS_UPTIME => $this->upTime, Cache::STATS_MEMORY_USAGE => null, Cache::STATS_M...
[ "protected", "function", "doGetStats", "(", ")", "{", "return", "[", "Cache", "::", "STATS_HITS", "=>", "$", "this", "->", "hitsCount", ",", "Cache", "::", "STATS_MISSES", "=>", "$", "this", "->", "missesCount", ",", "Cache", "::", "STATS_UPTIME", "=>", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ArrayCache.php#L103-L112
doctrine/cache
lib/Doctrine/Common/Cache/MemcachedCache.php
MemcachedCache.doSaveMultiple
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { if ($lifetime > 30 * 24 * 3600) { $lifetime = time() + $lifetime; } return $this->memcached->setMulti($keysAndValues, $lifetime); }
php
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { if ($lifetime > 30 * 24 * 3600) { $lifetime = time() + $lifetime; } return $this->memcached->setMulti($keysAndValues, $lifetime); }
[ "protected", "function", "doSaveMultiple", "(", "array", "$", "keysAndValues", ",", "$", "lifetime", "=", "0", ")", "{", "if", "(", "$", "lifetime", ">", "30", "*", "24", "*", "3600", ")", "{", "$", "lifetime", "=", "time", "(", ")", "+", "$", "lif...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/MemcachedCache.php#L57-L64
doctrine/cache
lib/Doctrine/Common/Cache/MemcachedCache.php
MemcachedCache.doContains
protected function doContains($id) { $this->memcached->get($id); return $this->memcached->getResultCode() === Memcached::RES_SUCCESS; }
php
protected function doContains($id) { $this->memcached->get($id); return $this->memcached->getResultCode() === Memcached::RES_SUCCESS; }
[ "protected", "function", "doContains", "(", "$", "id", ")", "{", "$", "this", "->", "memcached", "->", "get", "(", "$", "id", ")", ";", "return", "$", "this", "->", "memcached", "->", "getResultCode", "(", ")", "===", "Memcached", "::", "RES_SUCCESS", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/MemcachedCache.php#L69-L74
doctrine/cache
lib/Doctrine/Common/Cache/MemcachedCache.php
MemcachedCache.doDelete
protected function doDelete($id) { return $this->memcached->delete($id) || $this->memcached->getResultCode() === Memcached::RES_NOTFOUND; }
php
protected function doDelete($id) { return $this->memcached->delete($id) || $this->memcached->getResultCode() === Memcached::RES_NOTFOUND; }
[ "protected", "function", "doDelete", "(", "$", "id", ")", "{", "return", "$", "this", "->", "memcached", "->", "delete", "(", "$", "id", ")", "||", "$", "this", "->", "memcached", "->", "getResultCode", "(", ")", "===", "Memcached", "::", "RES_NOTFOUND",...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/MemcachedCache.php#L100-L104
doctrine/cache
lib/Doctrine/Common/Cache/MemcachedCache.php
MemcachedCache.doGetStats
protected function doGetStats() { $stats = $this->memcached->getStats(); $servers = $this->memcached->getServerList(); $key = $servers[0]['host'] . ':' . $servers[0]['port']; $stats = $stats[$key]; return [ Cache::STATS_HITS => $stats['get_hits'], ...
php
protected function doGetStats() { $stats = $this->memcached->getStats(); $servers = $this->memcached->getServerList(); $key = $servers[0]['host'] . ':' . $servers[0]['port']; $stats = $stats[$key]; return [ Cache::STATS_HITS => $stats['get_hits'], ...
[ "protected", "function", "doGetStats", "(", ")", "{", "$", "stats", "=", "$", "this", "->", "memcached", "->", "getStats", "(", ")", ";", "$", "servers", "=", "$", "this", "->", "memcached", "->", "getServerList", "(", ")", ";", "$", "key", "=", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/MemcachedCache.php#L117-L131
doctrine/cache
lib/Doctrine/Common/Cache/RedisCache.php
RedisCache.doFetchMultiple
protected function doFetchMultiple(array $keys) { $fetchedItems = array_combine($keys, $this->redis->mget($keys)); // Redis mget returns false for keys that do not exist. So we need to filter those out unless it's the real data. $foundItems = []; foreach ($fetchedItems as $key => $...
php
protected function doFetchMultiple(array $keys) { $fetchedItems = array_combine($keys, $this->redis->mget($keys)); // Redis mget returns false for keys that do not exist. So we need to filter those out unless it's the real data. $foundItems = []; foreach ($fetchedItems as $key => $...
[ "protected", "function", "doFetchMultiple", "(", "array", "$", "keys", ")", "{", "$", "fetchedItems", "=", "array_combine", "(", "$", "keys", ",", "$", "this", "->", "redis", "->", "mget", "(", "$", "keys", ")", ")", ";", "// Redis mget returns false for key...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RedisCache.php#L53-L69
doctrine/cache
lib/Doctrine/Common/Cache/RedisCache.php
RedisCache.doSaveMultiple
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { if ($lifetime) { $success = true; // Keys have lifetime, use SETEX for each of them foreach ($keysAndValues as $key => $value) { if ($this->redis->setex($key, $lifetime, $value)) { ...
php
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { if ($lifetime) { $success = true; // Keys have lifetime, use SETEX for each of them foreach ($keysAndValues as $key => $value) { if ($this->redis->setex($key, $lifetime, $value)) { ...
[ "protected", "function", "doSaveMultiple", "(", "array", "$", "keysAndValues", ",", "$", "lifetime", "=", "0", ")", "{", "if", "(", "$", "lifetime", ")", "{", "$", "success", "=", "true", ";", "// Keys have lifetime, use SETEX for each of them", "foreach", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RedisCache.php#L74-L93
doctrine/cache
lib/Doctrine/Common/Cache/RedisCache.php
RedisCache.doContains
protected function doContains($id) { $exists = $this->redis->exists($id); if (is_bool($exists)) { return $exists; } return $exists > 0; }
php
protected function doContains($id) { $exists = $this->redis->exists($id); if (is_bool($exists)) { return $exists; } return $exists > 0; }
[ "protected", "function", "doContains", "(", "$", "id", ")", "{", "$", "exists", "=", "$", "this", "->", "redis", "->", "exists", "(", "$", "id", ")", ";", "if", "(", "is_bool", "(", "$", "exists", ")", ")", "{", "return", "$", "exists", ";", "}",...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RedisCache.php#L98-L107
doctrine/cache
lib/Doctrine/Common/Cache/RedisCache.php
RedisCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { if ($lifeTime > 0) { return $this->redis->setex($id, $lifeTime, $data); } return $this->redis->set($id, $data); }
php
protected function doSave($id, $data, $lifeTime = 0) { if ($lifeTime > 0) { return $this->redis->setex($id, $lifeTime, $data); } return $this->redis->set($id, $data); }
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "if", "(", "$", "lifeTime", ">", "0", ")", "{", "return", "$", "this", "->", "redis", "->", "setex", "(", "$", "id", ",", "$", "lifeT...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RedisCache.php#L112-L119
doctrine/cache
lib/Doctrine/Common/Cache/RedisCache.php
RedisCache.doGetStats
protected function doGetStats() { $info = $this->redis->info(); return [ Cache::STATS_HITS => $info['keyspace_hits'], Cache::STATS_MISSES => $info['keyspace_misses'], Cache::STATS_UPTIME => $info['uptime_in_seconds'], Cache::STATS_MEMORY_USAGE ...
php
protected function doGetStats() { $info = $this->redis->info(); return [ Cache::STATS_HITS => $info['keyspace_hits'], Cache::STATS_MISSES => $info['keyspace_misses'], Cache::STATS_UPTIME => $info['uptime_in_seconds'], Cache::STATS_MEMORY_USAGE ...
[ "protected", "function", "doGetStats", "(", ")", "{", "$", "info", "=", "$", "this", "->", "redis", "->", "info", "(", ")", ";", "return", "[", "Cache", "::", "STATS_HITS", "=>", "$", "info", "[", "'keyspace_hits'", "]", ",", "Cache", "::", "STATS_MISS...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RedisCache.php#L148-L159
doctrine/cache
lib/Doctrine/Common/Cache/SQLite3Cache.php
SQLite3Cache.doFetch
protected function doFetch($id) { $item = $this->findById($id); if (! $item) { return false; } return unserialize($item[self::DATA_FIELD]); }
php
protected function doFetch($id) { $item = $this->findById($id); if (! $item) { return false; } return unserialize($item[self::DATA_FIELD]); }
[ "protected", "function", "doFetch", "(", "$", "id", ")", "{", "$", "item", "=", "$", "this", "->", "findById", "(", "$", "id", ")", ";", "if", "(", "!", "$", "item", ")", "{", "return", "false", ";", "}", "return", "unserialize", "(", "$", "item"...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/SQLite3Cache.php#L74-L83
doctrine/cache
lib/Doctrine/Common/Cache/SQLite3Cache.php
SQLite3Cache.doSave
protected function doSave($id, $data, $lifeTime = 0) { $statement = $this->sqlite->prepare(sprintf( 'INSERT OR REPLACE INTO %s (%s) VALUES (:id, :data, :expire)', $this->table, implode(',', $this->getFields()) )); $statement->bindValue(':id', $id); ...
php
protected function doSave($id, $data, $lifeTime = 0) { $statement = $this->sqlite->prepare(sprintf( 'INSERT OR REPLACE INTO %s (%s) VALUES (:id, :data, :expire)', $this->table, implode(',', $this->getFields()) )); $statement->bindValue(':id', $id); ...
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "$", "statement", "=", "$", "this", "->", "sqlite", "->", "prepare", "(", "sprintf", "(", "'INSERT OR REPLACE INTO %s (%s) VALUES (:id, :data, :expir...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/SQLite3Cache.php#L96-L109
doctrine/cache
lib/Doctrine/Common/Cache/SQLite3Cache.php
SQLite3Cache.doDelete
protected function doDelete($id) { [$idField] = $this->getFields(); $statement = $this->sqlite->prepare(sprintf( 'DELETE FROM %s WHERE %s = :id', $this->table, $idField )); $statement->bindValue(':id', $id); return $statement->execute() ...
php
protected function doDelete($id) { [$idField] = $this->getFields(); $statement = $this->sqlite->prepare(sprintf( 'DELETE FROM %s WHERE %s = :id', $this->table, $idField )); $statement->bindValue(':id', $id); return $statement->execute() ...
[ "protected", "function", "doDelete", "(", "$", "id", ")", "{", "[", "$", "idField", "]", "=", "$", "this", "->", "getFields", "(", ")", ";", "$", "statement", "=", "$", "this", "->", "sqlite", "->", "prepare", "(", "sprintf", "(", "'DELETE FROM %s WHER...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/SQLite3Cache.php#L114-L127
doctrine/cache
lib/Doctrine/Common/Cache/SQLite3Cache.php
SQLite3Cache.findById
private function findById($id, bool $includeData = true) : ?array { [$idField] = $fields = $this->getFields(); if (! $includeData) { $key = array_search(static::DATA_FIELD, $fields); unset($fields[$key]); } $statement = $this->sqlite->prepare(sprintf( ...
php
private function findById($id, bool $includeData = true) : ?array { [$idField] = $fields = $this->getFields(); if (! $includeData) { $key = array_search(static::DATA_FIELD, $fields); unset($fields[$key]); } $statement = $this->sqlite->prepare(sprintf( ...
[ "private", "function", "findById", "(", "$", "id", ",", "bool", "$", "includeData", "=", "true", ")", ":", "?", "array", "{", "[", "$", "idField", "]", "=", "$", "fields", "=", "$", "this", "->", "getFields", "(", ")", ";", "if", "(", "!", "$", ...
Find a single row by ID. @param mixed $id @return array|null
[ "Find", "a", "single", "row", "by", "ID", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/SQLite3Cache.php#L152-L183
doctrine/cache
lib/Doctrine/Common/Cache/SQLite3Cache.php
SQLite3Cache.isExpired
private function isExpired(array $item) : bool { return isset($item[static::EXPIRATION_FIELD]) && $item[self::EXPIRATION_FIELD] !== null && $item[self::EXPIRATION_FIELD] < time(); }
php
private function isExpired(array $item) : bool { return isset($item[static::EXPIRATION_FIELD]) && $item[self::EXPIRATION_FIELD] !== null && $item[self::EXPIRATION_FIELD] < time(); }
[ "private", "function", "isExpired", "(", "array", "$", "item", ")", ":", "bool", "{", "return", "isset", "(", "$", "item", "[", "static", "::", "EXPIRATION_FIELD", "]", ")", "&&", "$", "item", "[", "self", "::", "EXPIRATION_FIELD", "]", "!==", "null", ...
Check if the item is expired. @param array $item
[ "Check", "if", "the", "item", "is", "expired", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/SQLite3Cache.php#L200-L205
doctrine/cache
lib/Doctrine/Common/Cache/CouchbaseCache.php
CouchbaseCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { if ($lifeTime > 30 * 24 * 3600) { $lifeTime = time() + $lifeTime; } return $this->couchbase->set($id, $data, (int) $lifeTime); }
php
protected function doSave($id, $data, $lifeTime = 0) { if ($lifeTime > 30 * 24 * 3600) { $lifeTime = time() + $lifeTime; } return $this->couchbase->set($id, $data, (int) $lifeTime); }
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "if", "(", "$", "lifeTime", ">", "30", "*", "24", "*", "3600", ")", "{", "$", "lifeTime", "=", "time", "(", ")", "+", "$", "lifeTime"...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CouchbaseCache.php#L61-L68
doctrine/cache
lib/Doctrine/Common/Cache/CouchbaseCache.php
CouchbaseCache.doGetStats
protected function doGetStats() { $stats = $this->couchbase->getStats(); $servers = $this->couchbase->getServers(); $server = explode(':', $servers[0]); $key = $server[0] . ':11210'; $stats = $stats[$key]; return [ Cache::STATS_HITS => $stats['...
php
protected function doGetStats() { $stats = $this->couchbase->getStats(); $servers = $this->couchbase->getServers(); $server = explode(':', $servers[0]); $key = $server[0] . ':11210'; $stats = $stats[$key]; return [ Cache::STATS_HITS => $stats['...
[ "protected", "function", "doGetStats", "(", ")", "{", "$", "stats", "=", "$", "this", "->", "couchbase", "->", "getStats", "(", ")", ";", "$", "servers", "=", "$", "this", "->", "couchbase", "->", "getServers", "(", ")", ";", "$", "server", "=", "exp...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CouchbaseCache.php#L89-L104
doctrine/cache
lib/Doctrine/Common/Cache/MongoDBCache.php
MongoDBCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { return $this->provider->doSave($id, $data, $lifeTime); }
php
protected function doSave($id, $data, $lifeTime = 0) { return $this->provider->doSave($id, $data, $lifeTime); }
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "return", "$", "this", "->", "provider", "->", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/MongoDBCache.php#L84-L87
doctrine/cache
lib/Doctrine/Common/Cache/RiakCache.php
RiakCache.doFetch
protected function doFetch($id) { try { $response = $this->bucket->get($id); // No objects found if (! $response->hasObject()) { return false; } // Check for attempted siblings $object = $response->hasSiblings() ...
php
protected function doFetch($id) { try { $response = $this->bucket->get($id); // No objects found if (! $response->hasObject()) { return false; } // Check for attempted siblings $object = $response->hasSiblings() ...
[ "protected", "function", "doFetch", "(", "$", "id", ")", "{", "try", "{", "$", "response", "=", "$", "this", "->", "bucket", "->", "get", "(", "$", "id", ")", ";", "// No objects found", "if", "(", "!", "$", "response", "->", "hasObject", "(", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RiakCache.php#L39-L71
doctrine/cache
lib/Doctrine/Common/Cache/RiakCache.php
RiakCache.doContains
protected function doContains($id) { try { // We only need the HEAD, not the entire object $input = new Input\GetInput(); $input->setReturnHead(true); $response = $this->bucket->get($id, $input); // No objects found if (! $response->...
php
protected function doContains($id) { try { // We only need the HEAD, not the entire object $input = new Input\GetInput(); $input->setReturnHead(true); $response = $this->bucket->get($id, $input); // No objects found if (! $response->...
[ "protected", "function", "doContains", "(", "$", "id", ")", "{", "try", "{", "// We only need the HEAD, not the entire object", "$", "input", "=", "new", "Input", "\\", "GetInput", "(", ")", ";", "$", "input", "->", "setReturnHead", "(", "true", ")", ";", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RiakCache.php#L76-L106
doctrine/cache
lib/Doctrine/Common/Cache/RiakCache.php
RiakCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { try { $object = new RiakObject($id); $object->setContent(serialize($data)); if ($lifeTime > 0) { $object->addMetadata(self::EXPIRES_HEADER, (string) (time() + $lifeTime)); } ...
php
protected function doSave($id, $data, $lifeTime = 0) { try { $object = new RiakObject($id); $object->setContent(serialize($data)); if ($lifeTime > 0) { $object->addMetadata(self::EXPIRES_HEADER, (string) (time() + $lifeTime)); } ...
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "try", "{", "$", "object", "=", "new", "RiakObject", "(", "$", "id", ")", ";", "$", "object", "->", "setContent", "(", "serialize", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RiakCache.php#L111-L130
doctrine/cache
lib/Doctrine/Common/Cache/RiakCache.php
RiakCache.doDelete
protected function doDelete($id) { try { $this->bucket->delete($id); return true; } catch (Exception\BadArgumentsException $e) { // Key did not exist on cluster already } catch (Exception\RiakException $e) { // Covers: // - Riak\Ex...
php
protected function doDelete($id) { try { $this->bucket->delete($id); return true; } catch (Exception\BadArgumentsException $e) { // Key did not exist on cluster already } catch (Exception\RiakException $e) { // Covers: // - Riak\Ex...
[ "protected", "function", "doDelete", "(", "$", "id", ")", "{", "try", "{", "$", "this", "->", "bucket", "->", "delete", "(", "$", "id", ")", ";", "return", "true", ";", "}", "catch", "(", "Exception", "\\", "BadArgumentsException", "$", "e", ")", "{"...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RiakCache.php#L135-L151
doctrine/cache
lib/Doctrine/Common/Cache/RiakCache.php
RiakCache.isExpired
private function isExpired(RiakObject $object) : bool { $metadataMap = $object->getMetadataMap(); return isset($metadataMap[self::EXPIRES_HEADER]) && $metadataMap[self::EXPIRES_HEADER] < time(); }
php
private function isExpired(RiakObject $object) : bool { $metadataMap = $object->getMetadataMap(); return isset($metadataMap[self::EXPIRES_HEADER]) && $metadataMap[self::EXPIRES_HEADER] < time(); }
[ "private", "function", "isExpired", "(", "RiakObject", "$", "object", ")", ":", "bool", "{", "$", "metadataMap", "=", "$", "object", "->", "getMetadataMap", "(", ")", ";", "return", "isset", "(", "$", "metadataMap", "[", "self", "::", "EXPIRES_HEADER", "]"...
Check if a given RiakObject has expired.
[ "Check", "if", "a", "given", "RiakObject", "has", "expired", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RiakCache.php#L185-L191
doctrine/cache
lib/Doctrine/Common/Cache/RiakCache.php
RiakCache.resolveConflict
protected function resolveConflict($id, $vClock, array $objectList) { // Our approach here is last-write wins $winner = $objectList[count($objectList) - 1]; $putInput = new Input\PutInput(); $putInput->setVClock($vClock); $mergedObject = new RiakObject($id); $merged...
php
protected function resolveConflict($id, $vClock, array $objectList) { // Our approach here is last-write wins $winner = $objectList[count($objectList) - 1]; $putInput = new Input\PutInput(); $putInput->setVClock($vClock); $mergedObject = new RiakObject($id); $merged...
[ "protected", "function", "resolveConflict", "(", "$", "id", ",", "$", "vClock", ",", "array", "$", "objectList", ")", "{", "// Our approach here is last-write wins", "$", "winner", "=", "$", "objectList", "[", "count", "(", "$", "objectList", ")", "-", "1", ...
On-read conflict resolution. Applied approach here is last write wins. Specific needs may override this method to apply alternate conflict resolutions. {@internal Riak does not attempt to resolve a write conflict, and store it as sibling of conflicted one. By following this approach, it is up to the next read to resol...
[ "On", "-", "read", "conflict", "resolution", ".", "Applied", "approach", "here", "is", "last", "write", "wins", ".", "Specific", "needs", "may", "override", "this", "method", "to", "apply", "alternate", "conflict", "resolutions", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/RiakCache.php#L213-L227
doctrine/cache
lib/Doctrine/Common/Cache/LegacyMongoDBCache.php
LegacyMongoDBCache.doFetch
protected function doFetch($id) { $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::DATA_FIELD, MongoDBCache::EXPIRATION_FIELD]); if ($document === null) { return false; } if ($this->isExpired($document)) { $this->createExpirationIndex();...
php
protected function doFetch($id) { $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::DATA_FIELD, MongoDBCache::EXPIRATION_FIELD]); if ($document === null) { return false; } if ($this->isExpired($document)) { $this->createExpirationIndex();...
[ "protected", "function", "doFetch", "(", "$", "id", ")", "{", "$", "document", "=", "$", "this", "->", "collection", "->", "findOne", "(", "[", "'_id'", "=>", "$", "id", "]", ",", "[", "MongoDBCache", "::", "DATA_FIELD", ",", "MongoDBCache", "::", "EXP...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/LegacyMongoDBCache.php#L47-L63
doctrine/cache
lib/Doctrine/Common/Cache/LegacyMongoDBCache.php
LegacyMongoDBCache.doContains
protected function doContains($id) { $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::EXPIRATION_FIELD]); if ($document === null) { return false; } if ($this->isExpired($document)) { $this->createExpirationIndex(); $this->doD...
php
protected function doContains($id) { $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::EXPIRATION_FIELD]); if ($document === null) { return false; } if ($this->isExpired($document)) { $this->createExpirationIndex(); $this->doD...
[ "protected", "function", "doContains", "(", "$", "id", ")", "{", "$", "document", "=", "$", "this", "->", "collection", "->", "findOne", "(", "[", "'_id'", "=>", "$", "id", "]", ",", "[", "MongoDBCache", "::", "EXPIRATION_FIELD", "]", ")", ";", "if", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/LegacyMongoDBCache.php#L68-L84
doctrine/cache
lib/Doctrine/Common/Cache/LegacyMongoDBCache.php
LegacyMongoDBCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { try { $result = $this->collection->update( ['_id' => $id], [ '$set' => [ MongoDBCache::EXPIRATION_FIELD => ($lifeTime > 0 ? new MongoDate(time() + $lifeTime) : null)...
php
protected function doSave($id, $data, $lifeTime = 0) { try { $result = $this->collection->update( ['_id' => $id], [ '$set' => [ MongoDBCache::EXPIRATION_FIELD => ($lifeTime > 0 ? new MongoDate(time() + $lifeTime) : null)...
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "try", "{", "$", "result", "=", "$", "this", "->", "collection", "->", "update", "(", "[", "'_id'", "=>", "$", "id", "]", ",", "[", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/LegacyMongoDBCache.php#L89-L107
doctrine/cache
lib/Doctrine/Common/Cache/LegacyMongoDBCache.php
LegacyMongoDBCache.doGetStats
protected function doGetStats() { $serverStatus = $this->collection->db->command([ 'serverStatus' => 1, 'locks' => 0, 'metrics' => 0, 'recordStats' => 0, 'repl' => 0, ]); $collStats = $this->collection->db->command(['collStats' => ...
php
protected function doGetStats() { $serverStatus = $this->collection->db->command([ 'serverStatus' => 1, 'locks' => 0, 'metrics' => 0, 'recordStats' => 0, 'repl' => 0, ]); $collStats = $this->collection->db->command(['collStats' => ...
[ "protected", "function", "doGetStats", "(", ")", "{", "$", "serverStatus", "=", "$", "this", "->", "collection", "->", "db", "->", "command", "(", "[", "'serverStatus'", "=>", "1", ",", "'locks'", "=>", "0", ",", "'metrics'", "=>", "0", ",", "'recordStat...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/LegacyMongoDBCache.php#L133-L152
doctrine/cache
lib/Doctrine/Common/Cache/LegacyMongoDBCache.php
LegacyMongoDBCache.isExpired
private function isExpired(array $document) : bool { return isset($document[MongoDBCache::EXPIRATION_FIELD]) && $document[MongoDBCache::EXPIRATION_FIELD] instanceof MongoDate && $document[MongoDBCache::EXPIRATION_FIELD]->sec < time(); }
php
private function isExpired(array $document) : bool { return isset($document[MongoDBCache::EXPIRATION_FIELD]) && $document[MongoDBCache::EXPIRATION_FIELD] instanceof MongoDate && $document[MongoDBCache::EXPIRATION_FIELD]->sec < time(); }
[ "private", "function", "isExpired", "(", "array", "$", "document", ")", ":", "bool", "{", "return", "isset", "(", "$", "document", "[", "MongoDBCache", "::", "EXPIRATION_FIELD", "]", ")", "&&", "$", "document", "[", "MongoDBCache", "::", "EXPIRATION_FIELD", ...
Check if the document is expired. @param array $document
[ "Check", "if", "the", "document", "is", "expired", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/LegacyMongoDBCache.php#L159-L164
doctrine/cache
lib/Doctrine/Common/Cache/WinCacheCache.php
WinCacheCache.doSaveMultiple
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { $result = wincache_ucache_set($keysAndValues, null, $lifetime); return empty($result); }
php
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { $result = wincache_ucache_set($keysAndValues, null, $lifetime); return empty($result); }
[ "protected", "function", "doSaveMultiple", "(", "array", "$", "keysAndValues", ",", "$", "lifetime", "=", "0", ")", "{", "$", "result", "=", "wincache_ucache_set", "(", "$", "keysAndValues", ",", "null", ",", "$", "lifetime", ")", ";", "return", "empty", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/WinCacheCache.php#L73-L78
doctrine/cache
lib/Doctrine/Common/Cache/WinCacheCache.php
WinCacheCache.doDeleteMultiple
protected function doDeleteMultiple(array $keys) { $result = wincache_ucache_delete($keys); return is_array($result) && count($result) !== count($keys); }
php
protected function doDeleteMultiple(array $keys) { $result = wincache_ucache_delete($keys); return is_array($result) && count($result) !== count($keys); }
[ "protected", "function", "doDeleteMultiple", "(", "array", "$", "keys", ")", "{", "$", "result", "=", "wincache_ucache_delete", "(", "$", "keys", ")", ";", "return", "is_array", "(", "$", "result", ")", "&&", "count", "(", "$", "result", ")", "!==", "cou...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/WinCacheCache.php#L83-L88
doctrine/cache
lib/Doctrine/Common/Cache/WinCacheCache.php
WinCacheCache.doGetStats
protected function doGetStats() { $info = wincache_ucache_info(); $meminfo = wincache_ucache_meminfo(); return [ Cache::STATS_HITS => $info['total_hit_count'], Cache::STATS_MISSES => $info['total_miss_count'], Cache::STATS_UPTIME ...
php
protected function doGetStats() { $info = wincache_ucache_info(); $meminfo = wincache_ucache_meminfo(); return [ Cache::STATS_HITS => $info['total_hit_count'], Cache::STATS_MISSES => $info['total_miss_count'], Cache::STATS_UPTIME ...
[ "protected", "function", "doGetStats", "(", ")", "{", "$", "info", "=", "wincache_ucache_info", "(", ")", ";", "$", "meminfo", "=", "wincache_ucache_meminfo", "(", ")", ";", "return", "[", "Cache", "::", "STATS_HITS", "=>", "$", "info", "[", "'total_hit_coun...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/WinCacheCache.php#L93-L105
doctrine/cache
lib/Doctrine/Common/Cache/FileCache.php
FileCache.getFilename
protected function getFilename($id) { $hash = hash('sha256', $id); // This ensures that the filename is unique and that there are no invalid chars in it. if ($id === '' || ((strlen($id) * 2 + $this->extensionStringLength) > 255) || ($this->isRunningOnWindows && ($thi...
php
protected function getFilename($id) { $hash = hash('sha256', $id); // This ensures that the filename is unique and that there are no invalid chars in it. if ($id === '' || ((strlen($id) * 2 + $this->extensionStringLength) > 255) || ($this->isRunningOnWindows && ($thi...
[ "protected", "function", "getFilename", "(", "$", "id", ")", "{", "$", "hash", "=", "hash", "(", "'sha256'", ",", "$", "id", ")", ";", "// This ensures that the filename is unique and that there are no invalid chars in it.", "if", "(", "$", "id", "===", "''", "||"...
@param string $id @return string
[ "@param", "string", "$id" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/FileCache.php#L131-L156
doctrine/cache
lib/Doctrine/Common/Cache/FileCache.php
FileCache.doDelete
protected function doDelete($id) { $filename = $this->getFilename($id); return @unlink($filename) || ! file_exists($filename); }
php
protected function doDelete($id) { $filename = $this->getFilename($id); return @unlink($filename) || ! file_exists($filename); }
[ "protected", "function", "doDelete", "(", "$", "id", ")", "{", "$", "filename", "=", "$", "this", "->", "getFilename", "(", "$", "id", ")", ";", "return", "@", "unlink", "(", "$", "filename", ")", "||", "!", "file_exists", "(", "$", "filename", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/FileCache.php#L161-L166
doctrine/cache
lib/Doctrine/Common/Cache/FileCache.php
FileCache.doGetStats
protected function doGetStats() { $usage = 0; foreach ($this->getIterator() as $name => $file) { if ($file->isDir() || ! $this->isFilenameEndingWithExtension($name)) { continue; } $usage += $file->getSize(); } $free = disk_free_sp...
php
protected function doGetStats() { $usage = 0; foreach ($this->getIterator() as $name => $file) { if ($file->isDir() || ! $this->isFilenameEndingWithExtension($name)) { continue; } $usage += $file->getSize(); } $free = disk_free_sp...
[ "protected", "function", "doGetStats", "(", ")", "{", "$", "usage", "=", "0", ";", "foreach", "(", "$", "this", "->", "getIterator", "(", ")", "as", "$", "name", "=>", "$", "file", ")", "{", "if", "(", "$", "file", "->", "isDir", "(", ")", "||", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/FileCache.php#L192-L212
doctrine/cache
lib/Doctrine/Common/Cache/FileCache.php
FileCache.createPathIfNeeded
private function createPathIfNeeded(string $path) : bool { if (! is_dir($path)) { if (@mkdir($path, 0777 & (~$this->umask), true) === false && ! is_dir($path)) { return false; } } return true; }
php
private function createPathIfNeeded(string $path) : bool { if (! is_dir($path)) { if (@mkdir($path, 0777 & (~$this->umask), true) === false && ! is_dir($path)) { return false; } } return true; }
[ "private", "function", "createPathIfNeeded", "(", "string", "$", "path", ")", ":", "bool", "{", "if", "(", "!", "is_dir", "(", "$", "path", ")", ")", "{", "if", "(", "@", "mkdir", "(", "$", "path", ",", "0777", "&", "(", "~", "$", "this", "->", ...
Create path if needed. @return bool TRUE on success or if path already exists, FALSE if path cannot be created.
[ "Create", "path", "if", "needed", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/FileCache.php#L219-L228
doctrine/cache
lib/Doctrine/Common/Cache/FileCache.php
FileCache.writeFile
protected function writeFile(string $filename, string $content) : bool { $filepath = pathinfo($filename, PATHINFO_DIRNAME); if (! $this->createPathIfNeeded($filepath)) { return false; } if (! is_writable($filepath)) { return false; } $tmpFil...
php
protected function writeFile(string $filename, string $content) : bool { $filepath = pathinfo($filename, PATHINFO_DIRNAME); if (! $this->createPathIfNeeded($filepath)) { return false; } if (! is_writable($filepath)) { return false; } $tmpFil...
[ "protected", "function", "writeFile", "(", "string", "$", "filename", ",", "string", "$", "content", ")", ":", "bool", "{", "$", "filepath", "=", "pathinfo", "(", "$", "filename", ",", "PATHINFO_DIRNAME", ")", ";", "if", "(", "!", "$", "this", "->", "c...
Writes a string content to file in an atomic way. @param string $filename Path to the file where to write the data. @param string $content The content to write @return bool TRUE on success, FALSE if path cannot be created, if path is not writable or an any other error.
[ "Writes", "a", "string", "content", "to", "file", "in", "an", "atomic", "way", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/FileCache.php#L238-L263
doctrine/cache
lib/Doctrine/Common/Cache/FilesystemCache.php
FilesystemCache.doFetch
protected function doFetch($id) { $data = ''; $lifetime = -1; $filename = $this->getFilename($id); if (! is_file($filename)) { return false; } $resource = fopen($filename, 'r'); $line = fgets($resource); if ($line !== false) { ...
php
protected function doFetch($id) { $data = ''; $lifetime = -1; $filename = $this->getFilename($id); if (! is_file($filename)) { return false; } $resource = fopen($filename, 'r'); $line = fgets($resource); if ($line !== false) { ...
[ "protected", "function", "doFetch", "(", "$", "id", ")", "{", "$", "data", "=", "''", ";", "$", "lifetime", "=", "-", "1", ";", "$", "filename", "=", "$", "this", "->", "getFilename", "(", "$", "id", ")", ";", "if", "(", "!", "is_file", "(", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/FilesystemCache.php#L32-L62
doctrine/cache
lib/Doctrine/Common/Cache/FilesystemCache.php
FilesystemCache.doContains
protected function doContains($id) { $lifetime = -1; $filename = $this->getFilename($id); if (! is_file($filename)) { return false; } $resource = fopen($filename, 'r'); $line = fgets($resource); if ($line !== false) { $lifetime =...
php
protected function doContains($id) { $lifetime = -1; $filename = $this->getFilename($id); if (! is_file($filename)) { return false; } $resource = fopen($filename, 'r'); $line = fgets($resource); if ($line !== false) { $lifetime =...
[ "protected", "function", "doContains", "(", "$", "id", ")", "{", "$", "lifetime", "=", "-", "1", ";", "$", "filename", "=", "$", "this", "->", "getFilename", "(", "$", "id", ")", ";", "if", "(", "!", "is_file", "(", "$", "filename", ")", ")", "{"...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/FilesystemCache.php#L67-L86
doctrine/cache
lib/Doctrine/Common/Cache/FilesystemCache.php
FilesystemCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { if ($lifeTime > 0) { $lifeTime = time() + $lifeTime; } $data = serialize($data); $filename = $this->getFilename($id); return $this->writeFile($filename, $lifeTime . PHP_EOL . $data); }
php
protected function doSave($id, $data, $lifeTime = 0) { if ($lifeTime > 0) { $lifeTime = time() + $lifeTime; } $data = serialize($data); $filename = $this->getFilename($id); return $this->writeFile($filename, $lifeTime . PHP_EOL . $data); }
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "if", "(", "$", "lifeTime", ">", "0", ")", "{", "$", "lifeTime", "=", "time", "(", ")", "+", "$", "lifeTime", ";", "}", "$", "data", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/FilesystemCache.php#L91-L101
doctrine/cache
lib/Doctrine/Common/Cache/ExtMongoDBCache.php
ExtMongoDBCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { try { $this->collection->updateOne( ['_id' => $id], [ '$set' => [ MongoDBCache::EXPIRATION_FIELD => ($lifeTime > 0 ? new UTCDateTime((time() + $lifeTime) * 1000): nu...
php
protected function doSave($id, $data, $lifeTime = 0) { try { $this->collection->updateOne( ['_id' => $id], [ '$set' => [ MongoDBCache::EXPIRATION_FIELD => ($lifeTime > 0 ? new UTCDateTime((time() + $lifeTime) * 1000): nu...
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "try", "{", "$", "this", "->", "collection", "->", "updateOne", "(", "[", "'_id'", "=>", "$", "id", "]", ",", "[", "'$set'", "=>", "[",...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ExtMongoDBCache.php#L96-L114
doctrine/cache
lib/Doctrine/Common/Cache/ExtMongoDBCache.php
ExtMongoDBCache.doDelete
protected function doDelete($id) { try { $this->collection->deleteOne(['_id' => $id]); } catch (Exception $e) { return false; } return true; }
php
protected function doDelete($id) { try { $this->collection->deleteOne(['_id' => $id]); } catch (Exception $e) { return false; } return true; }
[ "protected", "function", "doDelete", "(", "$", "id", ")", "{", "try", "{", "$", "this", "->", "collection", "->", "deleteOne", "(", "[", "'_id'", "=>", "$", "id", "]", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "return", "false",...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ExtMongoDBCache.php#L119-L128
doctrine/cache
lib/Doctrine/Common/Cache/ExtMongoDBCache.php
ExtMongoDBCache.doGetStats
protected function doGetStats() { $uptime = null; $memoryUsage = null; try { $serverStatus = $this->database->command([ 'serverStatus' => 1, 'locks' => 0, 'metrics' => 0, 'recordStats' => 0, 're...
php
protected function doGetStats() { $uptime = null; $memoryUsage = null; try { $serverStatus = $this->database->command([ 'serverStatus' => 1, 'locks' => 0, 'metrics' => 0, 'recordStats' => 0, 're...
[ "protected", "function", "doGetStats", "(", ")", "{", "$", "uptime", "=", "null", ";", "$", "memoryUsage", "=", "null", ";", "try", "{", "$", "serverStatus", "=", "$", "this", "->", "database", "->", "command", "(", "[", "'serverStatus'", "=>", "1", ",...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ExtMongoDBCache.php#L148-L178
doctrine/cache
lib/Doctrine/Common/Cache/ExtMongoDBCache.php
ExtMongoDBCache.isExpired
private function isExpired(BSONDocument $document) : bool { return isset($document[MongoDBCache::EXPIRATION_FIELD]) && $document[MongoDBCache::EXPIRATION_FIELD] instanceof UTCDateTime && $document[MongoDBCache::EXPIRATION_FIELD]->toDateTime() < new DateTime(); }
php
private function isExpired(BSONDocument $document) : bool { return isset($document[MongoDBCache::EXPIRATION_FIELD]) && $document[MongoDBCache::EXPIRATION_FIELD] instanceof UTCDateTime && $document[MongoDBCache::EXPIRATION_FIELD]->toDateTime() < new DateTime(); }
[ "private", "function", "isExpired", "(", "BSONDocument", "$", "document", ")", ":", "bool", "{", "return", "isset", "(", "$", "document", "[", "MongoDBCache", "::", "EXPIRATION_FIELD", "]", ")", "&&", "$", "document", "[", "MongoDBCache", "::", "EXPIRATION_FIE...
Check if the document is expired.
[ "Check", "if", "the", "document", "is", "expired", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ExtMongoDBCache.php#L183-L188
doctrine/cache
lib/Doctrine/Common/Cache/MemcacheCache.php
MemcacheCache.doContains
protected function doContains($id) { $flags = null; $this->memcache->get($id, $flags); //if memcache has changed the value of "flags", it means the value exists return $flags !== null; }
php
protected function doContains($id) { $flags = null; $this->memcache->get($id, $flags); //if memcache has changed the value of "flags", it means the value exists return $flags !== null; }
[ "protected", "function", "doContains", "(", "$", "id", ")", "{", "$", "flags", "=", "null", ";", "$", "this", "->", "memcache", "->", "get", "(", "$", "id", ",", "$", "flags", ")", ";", "//if memcache has changed the value of \"flags\", it means the value exists...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/MemcacheCache.php#L51-L58
doctrine/cache
lib/Doctrine/Common/Cache/MemcacheCache.php
MemcacheCache.doGetStats
protected function doGetStats() { $stats = $this->memcache->getStats(); return [ Cache::STATS_HITS => $stats['get_hits'], Cache::STATS_MISSES => $stats['get_misses'], Cache::STATS_UPTIME => $stats['uptime'], Cache::STATS_MEMORY_USAGE => $stats['...
php
protected function doGetStats() { $stats = $this->memcache->getStats(); return [ Cache::STATS_HITS => $stats['get_hits'], Cache::STATS_MISSES => $stats['get_misses'], Cache::STATS_UPTIME => $stats['uptime'], Cache::STATS_MEMORY_USAGE => $stats['...
[ "protected", "function", "doGetStats", "(", ")", "{", "$", "stats", "=", "$", "this", "->", "memcache", "->", "getStats", "(", ")", ";", "return", "[", "Cache", "::", "STATS_HITS", "=>", "$", "stats", "[", "'get_hits'", "]", ",", "Cache", "::", "STATS_...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/MemcacheCache.php#L92-L103
doctrine/cache
lib/Doctrine/Common/Cache/PredisCache.php
PredisCache.doFetchMultiple
protected function doFetchMultiple(array $keys) { $fetchedItems = call_user_func_array([$this->client, 'mget'], $keys); return array_map('unserialize', array_filter(array_combine($keys, $fetchedItems))); }
php
protected function doFetchMultiple(array $keys) { $fetchedItems = call_user_func_array([$this->client, 'mget'], $keys); return array_map('unserialize', array_filter(array_combine($keys, $fetchedItems))); }
[ "protected", "function", "doFetchMultiple", "(", "array", "$", "keys", ")", "{", "$", "fetchedItems", "=", "call_user_func_array", "(", "[", "$", "this", "->", "client", ",", "'mget'", "]", ",", "$", "keys", ")", ";", "return", "array_map", "(", "'unserial...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/PredisCache.php#L42-L47
doctrine/cache
lib/Doctrine/Common/Cache/PredisCache.php
PredisCache.doSaveMultiple
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { if ($lifetime) { $success = true; // Keys have lifetime, use SETEX for each of them foreach ($keysAndValues as $key => $value) { $response = (string) $this->client->setex($key, $life...
php
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { if ($lifetime) { $success = true; // Keys have lifetime, use SETEX for each of them foreach ($keysAndValues as $key => $value) { $response = (string) $this->client->setex($key, $life...
[ "protected", "function", "doSaveMultiple", "(", "array", "$", "keysAndValues", ",", "$", "lifetime", "=", "0", ")", "{", "if", "(", "$", "lifetime", ")", "{", "$", "success", "=", "true", ";", "// Keys have lifetime, use SETEX for each of them", "foreach", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/PredisCache.php#L52-L77
doctrine/cache
lib/Doctrine/Common/Cache/PredisCache.php
PredisCache.doSave
protected function doSave($id, $data, $lifeTime = 0) { $data = serialize($data); if ($lifeTime > 0) { $response = $this->client->setex($id, $lifeTime, $data); } else { $response = $this->client->set($id, $data); } return $response === true || $respons...
php
protected function doSave($id, $data, $lifeTime = 0) { $data = serialize($data); if ($lifeTime > 0) { $response = $this->client->setex($id, $lifeTime, $data); } else { $response = $this->client->set($id, $data); } return $response === true || $respons...
[ "protected", "function", "doSave", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "$", "data", "=", "serialize", "(", "$", "data", ")", ";", "if", "(", "$", "lifeTime", ">", "0", ")", "{", "$", "response", "=", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/PredisCache.php#L90-L100
doctrine/cache
lib/Doctrine/Common/Cache/ApcuCache.php
ApcuCache.doDeleteMultiple
protected function doDeleteMultiple(array $keys) { $result = apcu_delete($keys); return $result !== false && count($result) !== count($keys); }
php
protected function doDeleteMultiple(array $keys) { $result = apcu_delete($keys); return $result !== false && count($result) !== count($keys); }
[ "protected", "function", "doDeleteMultiple", "(", "array", "$", "keys", ")", "{", "$", "result", "=", "apcu_delete", "(", "$", "keys", ")", ";", "return", "$", "result", "!==", "false", "&&", "count", "(", "$", "result", ")", "!==", "count", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ApcuCache.php#L57-L62
doctrine/cache
lib/Doctrine/Common/Cache/ApcuCache.php
ApcuCache.doSaveMultiple
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { $result = apcu_store($keysAndValues, null, $lifetime); return empty($result); }
php
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { $result = apcu_store($keysAndValues, null, $lifetime); return empty($result); }
[ "protected", "function", "doSaveMultiple", "(", "array", "$", "keysAndValues", ",", "$", "lifetime", "=", "0", ")", "{", "$", "result", "=", "apcu_store", "(", "$", "keysAndValues", ",", "null", ",", "$", "lifetime", ")", ";", "return", "empty", "(", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ApcuCache.php#L83-L88
doctrine/cache
lib/Doctrine/Common/Cache/ApcuCache.php
ApcuCache.doGetStats
protected function doGetStats() { $info = apcu_cache_info(true); $sma = apcu_sma_info(); return [ Cache::STATS_HITS => $info['num_hits'], Cache::STATS_MISSES => $info['num_misses'], Cache::STATS_UPTIME => $info['start_time...
php
protected function doGetStats() { $info = apcu_cache_info(true); $sma = apcu_sma_info(); return [ Cache::STATS_HITS => $info['num_hits'], Cache::STATS_MISSES => $info['num_misses'], Cache::STATS_UPTIME => $info['start_time...
[ "protected", "function", "doGetStats", "(", ")", "{", "$", "info", "=", "apcu_cache_info", "(", "true", ")", ";", "$", "sma", "=", "apcu_sma_info", "(", ")", ";", "return", "[", "Cache", "::", "STATS_HITS", "=>", "$", "info", "[", "'num_hits'", "]", ",...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ApcuCache.php#L93-L105
doctrine/cache
lib/Doctrine/Common/Cache/CacheProvider.php
CacheProvider.fetchMultiple
public function fetchMultiple(array $keys) { if (empty($keys)) { return []; } // note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys $namespacedKeys = array_combine($keys, array_map([$this, 'getNamespacedId'], $keys)); ...
php
public function fetchMultiple(array $keys) { if (empty($keys)) { return []; } // note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys $namespacedKeys = array_combine($keys, array_map([$this, 'getNamespacedId'], $keys)); ...
[ "public", "function", "fetchMultiple", "(", "array", "$", "keys", ")", "{", "if", "(", "empty", "(", "$", "keys", ")", ")", "{", "return", "[", "]", ";", "}", "// note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CacheProvider.php#L65-L87
doctrine/cache
lib/Doctrine/Common/Cache/CacheProvider.php
CacheProvider.saveMultiple
public function saveMultiple(array $keysAndValues, $lifetime = 0) { $namespacedKeysAndValues = []; foreach ($keysAndValues as $key => $value) { $namespacedKeysAndValues[$this->getNamespacedId($key)] = $value; } return $this->doSaveMultiple($namespacedKeysAndValues, $life...
php
public function saveMultiple(array $keysAndValues, $lifetime = 0) { $namespacedKeysAndValues = []; foreach ($keysAndValues as $key => $value) { $namespacedKeysAndValues[$this->getNamespacedId($key)] = $value; } return $this->doSaveMultiple($namespacedKeysAndValues, $life...
[ "public", "function", "saveMultiple", "(", "array", "$", "keysAndValues", ",", "$", "lifetime", "=", "0", ")", "{", "$", "namespacedKeysAndValues", "=", "[", "]", ";", "foreach", "(", "$", "keysAndValues", "as", "$", "key", "=>", "$", "value", ")", "{", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CacheProvider.php#L92-L100
doctrine/cache
lib/Doctrine/Common/Cache/CacheProvider.php
CacheProvider.save
public function save($id, $data, $lifeTime = 0) { return $this->doSave($this->getNamespacedId($id), $data, $lifeTime); }
php
public function save($id, $data, $lifeTime = 0) { return $this->doSave($this->getNamespacedId($id), $data, $lifeTime); }
[ "public", "function", "save", "(", "$", "id", ",", "$", "data", ",", "$", "lifeTime", "=", "0", ")", "{", "return", "$", "this", "->", "doSave", "(", "$", "this", "->", "getNamespacedId", "(", "$", "id", ")", ",", "$", "data", ",", "$", "lifeTime...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CacheProvider.php#L113-L116
doctrine/cache
lib/Doctrine/Common/Cache/CacheProvider.php
CacheProvider.deleteAll
public function deleteAll() { $namespaceCacheKey = $this->getNamespaceCacheKey(); $namespaceVersion = $this->getNamespaceVersion() + 1; if ($this->doSave($namespaceCacheKey, $namespaceVersion)) { $this->namespaceVersion = $namespaceVersion; return true; } ...
php
public function deleteAll() { $namespaceCacheKey = $this->getNamespaceCacheKey(); $namespaceVersion = $this->getNamespaceVersion() + 1; if ($this->doSave($namespaceCacheKey, $namespaceVersion)) { $this->namespaceVersion = $namespaceVersion; return true; } ...
[ "public", "function", "deleteAll", "(", ")", "{", "$", "namespaceCacheKey", "=", "$", "this", "->", "getNamespaceCacheKey", "(", ")", ";", "$", "namespaceVersion", "=", "$", "this", "->", "getNamespaceVersion", "(", ")", "+", "1", ";", "if", "(", "$", "t...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CacheProvider.php#L153-L165
doctrine/cache
lib/Doctrine/Common/Cache/CacheProvider.php
CacheProvider.getNamespacedId
private function getNamespacedId(string $id) : string { $namespaceVersion = $this->getNamespaceVersion(); return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion); }
php
private function getNamespacedId(string $id) : string { $namespaceVersion = $this->getNamespaceVersion(); return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion); }
[ "private", "function", "getNamespacedId", "(", "string", "$", "id", ")", ":", "string", "{", "$", "namespaceVersion", "=", "$", "this", "->", "getNamespaceVersion", "(", ")", ";", "return", "sprintf", "(", "'%s[%s][%s]'", ",", "$", "this", "->", "namespace",...
Prefixes the passed id with the configured namespace value. @param string $id The id to namespace. @return string The namespaced id.
[ "Prefixes", "the", "passed", "id", "with", "the", "configured", "namespace", "value", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CacheProvider.php#L174-L179
doctrine/cache
lib/Doctrine/Common/Cache/CacheProvider.php
CacheProvider.getNamespaceVersion
private function getNamespaceVersion() : int { if ($this->namespaceVersion !== null) { return $this->namespaceVersion; } $namespaceCacheKey = $this->getNamespaceCacheKey(); $this->namespaceVersion = (int) $this->doFetch($namespaceCacheKey) ?: 1; return $thi...
php
private function getNamespaceVersion() : int { if ($this->namespaceVersion !== null) { return $this->namespaceVersion; } $namespaceCacheKey = $this->getNamespaceCacheKey(); $this->namespaceVersion = (int) $this->doFetch($namespaceCacheKey) ?: 1; return $thi...
[ "private", "function", "getNamespaceVersion", "(", ")", ":", "int", "{", "if", "(", "$", "this", "->", "namespaceVersion", "!==", "null", ")", "{", "return", "$", "this", "->", "namespaceVersion", ";", "}", "$", "namespaceCacheKey", "=", "$", "this", "->",...
Returns the namespace version.
[ "Returns", "the", "namespace", "version", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CacheProvider.php#L192-L202
doctrine/cache
lib/Doctrine/Common/Cache/CacheProvider.php
CacheProvider.doFetchMultiple
protected function doFetchMultiple(array $keys) { $returnValues = []; foreach ($keys as $key) { $item = $this->doFetch($key); if ($item === false && ! $this->doContains($key)) { continue; } $returnValues[$key] = $item; } ...
php
protected function doFetchMultiple(array $keys) { $returnValues = []; foreach ($keys as $key) { $item = $this->doFetch($key); if ($item === false && ! $this->doContains($key)) { continue; } $returnValues[$key] = $item; } ...
[ "protected", "function", "doFetchMultiple", "(", "array", "$", "keys", ")", "{", "$", "returnValues", "=", "[", "]", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "$", "item", "=", "$", "this", "->", "doFetch", "(", "$", "key", ")",...
Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it. @param array $keys Array of keys to retrieve from cache @return array Array of values retrieved for the given keys.
[ "Default", "implementation", "of", "doFetchMultiple", ".", "Each", "driver", "that", "supports", "multi", "-", "get", "should", "owerwrite", "it", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CacheProvider.php#L211-L225
doctrine/cache
lib/Doctrine/Common/Cache/CacheProvider.php
CacheProvider.doSaveMultiple
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { $success = true; foreach ($keysAndValues as $key => $value) { if ($this->doSave($key, $value, $lifetime)) { continue; } $success = false; } return $success;...
php
protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { $success = true; foreach ($keysAndValues as $key => $value) { if ($this->doSave($key, $value, $lifetime)) { continue; } $success = false; } return $success;...
[ "protected", "function", "doSaveMultiple", "(", "array", "$", "keysAndValues", ",", "$", "lifetime", "=", "0", ")", "{", "$", "success", "=", "true", ";", "foreach", "(", "$", "keysAndValues", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", ...
Default implementation of doSaveMultiple. Each driver that supports multi-put should override it. @param array $keysAndValues Array of keys and values to save in cache @param int $lifetime The lifetime. If != 0, sets a specific lifetime for these cache entries (0 => infinite lifeTime). @return bool TRUE if the...
[ "Default", "implementation", "of", "doSaveMultiple", ".", "Each", "driver", "that", "supports", "multi", "-", "put", "should", "override", "it", "." ]
train
https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CacheProvider.php#L254-L267
overblog/GraphQLBundle
src/DependencyInjection/OverblogGraphQLExtension.php
OverblogGraphQLExtension.buildExceptionMap
private function buildExceptionMap(array $exceptionConfig) { $exceptionMap = []; $errorsMapping = [ 'errors' => UserError::class, 'warnings' => UserWarning::class, ]; foreach ($exceptionConfig as $type => $exceptionList) { foreach ($exceptionList ...
php
private function buildExceptionMap(array $exceptionConfig) { $exceptionMap = []; $errorsMapping = [ 'errors' => UserError::class, 'warnings' => UserWarning::class, ]; foreach ($exceptionConfig as $type => $exceptionList) { foreach ($exceptionList ...
[ "private", "function", "buildExceptionMap", "(", "array", "$", "exceptionConfig", ")", "{", "$", "exceptionMap", "=", "[", "]", ";", "$", "errorsMapping", "=", "[", "'errors'", "=>", "UserError", "::", "class", ",", "'warnings'", "=>", "UserWarning", "::", "...
Returns a list of custom exceptions mapped to error/warning classes. @param array $exceptionConfig @return array Custom exception map, [exception => UserError/UserWarning]
[ "Returns", "a", "list", "of", "custom", "exceptions", "mapped", "to", "error", "/", "warning", "classes", "." ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/DependencyInjection/OverblogGraphQLExtension.php#L265-L280
overblog/GraphQLBundle
src/Generator/TypeGenerator.php
TypeGenerator.generateComplexity
protected function generateComplexity(array $value): string { $resolveComplexity = parent::generateComplexity($value); $resolveComplexity = \ltrim($this->prefixCodeWithSpaces($resolveComplexity)); if ('null' === $resolveComplexity) { return $resolveComplexity; } ...
php
protected function generateComplexity(array $value): string { $resolveComplexity = parent::generateComplexity($value); $resolveComplexity = \ltrim($this->prefixCodeWithSpaces($resolveComplexity)); if ('null' === $resolveComplexity) { return $resolveComplexity; } ...
[ "protected", "function", "generateComplexity", "(", "array", "$", "value", ")", ":", "string", "{", "$", "resolveComplexity", "=", "parent", "::", "generateComplexity", "(", "$", "value", ")", ";", "$", "resolveComplexity", "=", "\\", "ltrim", "(", "$", "thi...
@param array $value @return string
[ "@param", "array", "$value" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Generator/TypeGenerator.php#L152-L174
overblog/GraphQLBundle
lib/generator/src/Generator/AbstractClassGenerator.php
AbstractClassGenerator.setNumSpaces
public function setNumSpaces(int $numSpaces): self { $this->spaces = \str_repeat(' ', $numSpaces); $this->numSpaces = $numSpaces; return $this; }
php
public function setNumSpaces(int $numSpaces): self { $this->spaces = \str_repeat(' ', $numSpaces); $this->numSpaces = $numSpaces; return $this; }
[ "public", "function", "setNumSpaces", "(", "int", "$", "numSpaces", ")", ":", "self", "{", "$", "this", "->", "spaces", "=", "\\", "str_repeat", "(", "' '", ",", "$", "numSpaces", ")", ";", "$", "this", "->", "numSpaces", "=", "$", "numSpaces", ";", ...
Sets the number of spaces the exported class should have. @param integer $numSpaces @return self
[ "Sets", "the", "number", "of", "spaces", "the", "exported", "class", "should", "have", "." ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/lib/generator/src/Generator/AbstractClassGenerator.php#L137-L143
overblog/GraphQLBundle
src/Request/Executor.php
Executor.addSchema
public function addSchema(string $name, Schema $schema): self { $this->schemas[$name] = $schema; return $this; }
php
public function addSchema(string $name, Schema $schema): self { $this->schemas[$name] = $schema; return $this; }
[ "public", "function", "addSchema", "(", "string", "$", "name", ",", "Schema", "$", "schema", ")", ":", "self", "{", "$", "this", "->", "schemas", "[", "$", "name", "]", "=", "$", "schema", ";", "return", "$", "this", ";", "}" ]
@param string $name @param Schema $schema @return self
[ "@param", "string", "$name", "@param", "Schema", "$schema" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Request/Executor.php#L75-L80
overblog/GraphQLBundle
src/Request/Executor.php
Executor.getSchema
public function getSchema(?string $name = null): Schema { if (empty($this->schemas)) { throw new \RuntimeException('At least one schema should be declare.'); } if (null === $name) { $schema = \array_values($this->schemas)[0]; } else { if (!isset($...
php
public function getSchema(?string $name = null): Schema { if (empty($this->schemas)) { throw new \RuntimeException('At least one schema should be declare.'); } if (null === $name) { $schema = \array_values($this->schemas)[0]; } else { if (!isset($...
[ "public", "function", "getSchema", "(", "?", "string", "$", "name", "=", "null", ")", ":", "Schema", "{", "if", "(", "empty", "(", "$", "this", "->", "schemas", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'At least one schema should be d...
@param string|null $name @return Schema
[ "@param", "string|null", "$name" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Request/Executor.php#L87-L103
overblog/GraphQLBundle
src/Request/Executor.php
Executor.execute
public function execute(?string $schemaName = null, array $request, $rootValue = null): ExecutionResult { $executorArgumentsEvent = $this->preExecute( $this->getSchema($schemaName), $request[ParserInterface::PARAM_QUERY] ?? null, new \ArrayObject(), $rootValue...
php
public function execute(?string $schemaName = null, array $request, $rootValue = null): ExecutionResult { $executorArgumentsEvent = $this->preExecute( $this->getSchema($schemaName), $request[ParserInterface::PARAM_QUERY] ?? null, new \ArrayObject(), $rootValue...
[ "public", "function", "execute", "(", "?", "string", "$", "schemaName", "=", "null", ",", "array", "$", "request", ",", "$", "rootValue", "=", "null", ")", ":", "ExecutionResult", "{", "$", "executorArgumentsEvent", "=", "$", "this", "->", "preExecute", "(...
@param string|null $schemaName @param array $request @param array|\ArrayObject|object|null $rootValue @return ExecutionResult
[ "@param", "string|null", "$schemaName", "@param", "array", "$request", "@param", "array|", "\\", "ArrayObject|object|null", "$rootValue" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Request/Executor.php#L136-L161
overblog/GraphQLBundle
src/Request/Executor.php
Executor.postExecute
private function postExecute($result): ExecutionResult { if ($result instanceof Promise) { $result = $this->promiseAdapter->wait($result); } $this->checkExecutionResult($result); return $this->dispatcher->dispatch(Events::POST_EXECUTOR, new ExecutorResultEvent($result))...
php
private function postExecute($result): ExecutionResult { if ($result instanceof Promise) { $result = $this->promiseAdapter->wait($result); } $this->checkExecutionResult($result); return $this->dispatcher->dispatch(Events::POST_EXECUTOR, new ExecutorResultEvent($result))...
[ "private", "function", "postExecute", "(", "$", "result", ")", ":", "ExecutionResult", "{", "if", "(", "$", "result", "instanceof", "Promise", ")", "{", "$", "result", "=", "$", "this", "->", "promiseAdapter", "->", "wait", "(", "$", "result", ")", ";", ...
@param ExecutionResult|Promise $result @return ExecutionResult
[ "@param", "ExecutionResult|Promise", "$result" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Request/Executor.php#L191-L200
overblog/GraphQLBundle
src/Request/Parser.php
Parser.parse
public function parse(Request $request): array { // Extracts the GraphQL request parameters $parsedBody = $this->getParsedBody($request); $data = $this->getParams($request, $parsedBody); return $data; }
php
public function parse(Request $request): array { // Extracts the GraphQL request parameters $parsedBody = $this->getParsedBody($request); $data = $this->getParams($request, $parsedBody); return $data; }
[ "public", "function", "parse", "(", "Request", "$", "request", ")", ":", "array", "{", "// Extracts the GraphQL request parameters", "$", "parsedBody", "=", "$", "this", "->", "getParsedBody", "(", "$", "request", ")", ";", "$", "data", "=", "$", "this", "->...
@param Request $request @return array
[ "@param", "Request", "$request" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Request/Parser.php#L19-L26
overblog/GraphQLBundle
src/Request/Parser.php
Parser.getParsedBody
private function getParsedBody(Request $request): array { $body = $request->getContent(); $contentType = \explode(';', (string) $request->headers->get('content-type'), 2)[0]; switch ($contentType) { // Plain string case static::CONTENT_TYPE_GRAPHQL: $...
php
private function getParsedBody(Request $request): array { $body = $request->getContent(); $contentType = \explode(';', (string) $request->headers->get('content-type'), 2)[0]; switch ($contentType) { // Plain string case static::CONTENT_TYPE_GRAPHQL: $...
[ "private", "function", "getParsedBody", "(", "Request", "$", "request", ")", ":", "array", "{", "$", "body", "=", "$", "request", "->", "getContent", "(", ")", ";", "$", "contentType", "=", "\\", "explode", "(", "';'", ",", "(", "string", ")", "$", "...
Gets the body from the request based on Content-Type header. @param Request $request @return array
[ "Gets", "the", "body", "from", "the", "request", "based", "on", "Content", "-", "Type", "header", "." ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Request/Parser.php#L35-L74
overblog/GraphQLBundle
src/Request/Parser.php
Parser.getParams
private function getParams(Request $request, array $data = []): array { // Add default request parameters $data = \array_filter($data) + [ static::PARAM_QUERY => null, static::PARAM_VARIABLES => null, static::PARAM_OPERATION_NAME => null, ]...
php
private function getParams(Request $request, array $data = []): array { // Add default request parameters $data = \array_filter($data) + [ static::PARAM_QUERY => null, static::PARAM_VARIABLES => null, static::PARAM_OPERATION_NAME => null, ]...
[ "private", "function", "getParams", "(", "Request", "$", "request", ",", "array", "$", "data", "=", "[", "]", ")", ":", "array", "{", "// Add default request parameters", "$", "data", "=", "\\", "array_filter", "(", "$", "data", ")", "+", "[", "static", ...
Gets the GraphQL parameters from the request. @param Request $request @param array $data @return array
[ "Gets", "the", "GraphQL", "parameters", "from", "the", "request", "." ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Request/Parser.php#L84-L121
overblog/GraphQLBundle
src/Error/ErrorHandler.php
ErrorHandler.treatExceptions
private function treatExceptions(array $errors, bool $throwRawException): array { $treatedExceptions = [ 'errors' => [], 'extensions' => [ 'warnings' => [], ], ]; /** @var GraphQLError $error */ foreach ($this->flattenErrors($error...
php
private function treatExceptions(array $errors, bool $throwRawException): array { $treatedExceptions = [ 'errors' => [], 'extensions' => [ 'warnings' => [], ], ]; /** @var GraphQLError $error */ foreach ($this->flattenErrors($error...
[ "private", "function", "treatExceptions", "(", "array", "$", "errors", ",", "bool", "$", "throwRawException", ")", ":", "array", "{", "$", "treatedExceptions", "=", "[", "'errors'", "=>", "[", "]", ",", "'extensions'", "=>", "[", "'warnings'", "=>", "[", "...
@param GraphQLError[] $errors @param bool $throwRawException @return array @throws \Error|\Exception
[ "@param", "GraphQLError", "[]", "$errors", "@param", "bool", "$throwRawException" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Error/ErrorHandler.php#L82-L132
overblog/GraphQLBundle
src/Error/ErrorHandler.php
ErrorHandler.flattenErrors
private function flattenErrors(array $errors): array { $flattenErrors = []; foreach ($errors as $error) { $rawException = $error->getPrevious(); // multiple errors if ($rawException instanceof UserErrors) { $rawExceptions = $rawException; ...
php
private function flattenErrors(array $errors): array { $flattenErrors = []; foreach ($errors as $error) { $rawException = $error->getPrevious(); // multiple errors if ($rawException instanceof UserErrors) { $rawExceptions = $rawException; ...
[ "private", "function", "flattenErrors", "(", "array", "$", "errors", ")", ":", "array", "{", "$", "flattenErrors", "=", "[", "]", ";", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "rawException", "=", "$", "error", "->", "getPrevio...
@param GraphQLError[] $errors @return GraphQLError[]
[ "@param", "GraphQLError", "[]", "$errors" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Error/ErrorHandler.php#L139-L157
overblog/GraphQLBundle
src/Error/ErrorHandler.php
ErrorHandler.convertException
private function convertException($rawException = null) { if (null === $rawException || $rawException instanceof ClientAware) { return $rawException; } $errorClass = $this->findErrorClass($rawException); if (null !== $errorClass) { return new $errorClass($raw...
php
private function convertException($rawException = null) { if (null === $rawException || $rawException instanceof ClientAware) { return $rawException; } $errorClass = $this->findErrorClass($rawException); if (null !== $errorClass) { return new $errorClass($raw...
[ "private", "function", "convertException", "(", "$", "rawException", "=", "null", ")", "{", "if", "(", "null", "===", "$", "rawException", "||", "$", "rawException", "instanceof", "ClientAware", ")", "{", "return", "$", "rawException", ";", "}", "$", "errorC...
Tries to convert a raw exception into a user warning or error that is displayed to the user. @param \Exception|\Error $rawException @return \Exception|\Error
[ "Tries", "to", "convert", "a", "raw", "exception", "into", "a", "user", "warning", "or", "error", "that", "is", "displayed", "to", "the", "user", "." ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Error/ErrorHandler.php#L167-L179
overblog/GraphQLBundle
src/Error/ErrorHandler.php
ErrorHandler.findErrorClass
private function findErrorClass($rawException) { $rawExceptionClass = \get_class($rawException); if (isset($this->exceptionMap[$rawExceptionClass])) { return $this->exceptionMap[$rawExceptionClass]; } if ($this->mapExceptionsToParent) { return $this->findErro...
php
private function findErrorClass($rawException) { $rawExceptionClass = \get_class($rawException); if (isset($this->exceptionMap[$rawExceptionClass])) { return $this->exceptionMap[$rawExceptionClass]; } if ($this->mapExceptionsToParent) { return $this->findErro...
[ "private", "function", "findErrorClass", "(", "$", "rawException", ")", "{", "$", "rawExceptionClass", "=", "\\", "get_class", "(", "$", "rawException", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "exceptionMap", "[", "$", "rawExceptionClass", "]",...
@param \Exception|\Error $rawException @return string|null
[ "@param", "\\", "Exception|", "\\", "Error", "$rawException" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Error/ErrorHandler.php#L186-L198
overblog/GraphQLBundle
src/Error/ErrorHandler.php
ErrorHandler.findErrorClassUsingParentException
private function findErrorClassUsingParentException($rawException) { foreach ($this->exceptionMap as $rawExceptionClass => $errorClass) { if ($rawException instanceof $rawExceptionClass) { return $errorClass; } } return null; }
php
private function findErrorClassUsingParentException($rawException) { foreach ($this->exceptionMap as $rawExceptionClass => $errorClass) { if ($rawException instanceof $rawExceptionClass) { return $errorClass; } } return null; }
[ "private", "function", "findErrorClassUsingParentException", "(", "$", "rawException", ")", "{", "foreach", "(", "$", "this", "->", "exceptionMap", "as", "$", "rawExceptionClass", "=>", "$", "errorClass", ")", "{", "if", "(", "$", "rawException", "instanceof", "...
@param \Exception|\Error $rawException @return string|null
[ "@param", "\\", "Exception|", "\\", "Error", "$rawException" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Error/ErrorHandler.php#L205-L214
overblog/GraphQLBundle
src/Relay/Mutation/MutationFieldDefinition.php
MutationFieldDefinition.ensureValidMutateAndGetPayloadConfiguration
private function ensureValidMutateAndGetPayloadConfiguration($mutateAndGetPayload): void { if (\is_string($mutateAndGetPayload) && 0 === \strpos($mutateAndGetPayload, '@=')) { return; } if (null === $mutateAndGetPayload) { throw new InvalidArgumentException(\sprintf(...
php
private function ensureValidMutateAndGetPayloadConfiguration($mutateAndGetPayload): void { if (\is_string($mutateAndGetPayload) && 0 === \strpos($mutateAndGetPayload, '@=')) { return; } if (null === $mutateAndGetPayload) { throw new InvalidArgumentException(\sprintf(...
[ "private", "function", "ensureValidMutateAndGetPayloadConfiguration", "(", "$", "mutateAndGetPayload", ")", ":", "void", "{", "if", "(", "\\", "is_string", "(", "$", "mutateAndGetPayload", ")", "&&", "0", "===", "\\", "strpos", "(", "$", "mutateAndGetPayload", ","...
@param mixed $mutateAndGetPayload @throws InvalidArgumentException
[ "@param", "mixed", "$mutateAndGetPayload" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Mutation/MutationFieldDefinition.php#L44-L61
overblog/GraphQLBundle
src/Executor/Executor.php
Executor.execute
public function execute(Schema $schema, string $requestString, array $rootValue = null, $contextValue = null, $variableValues = null, $operationName = null) { $args = \func_get_args(); \array_unshift($args, $this->promiseAdapter); return \call_user_func_array([GraphQL::class, 'promiseToExec...
php
public function execute(Schema $schema, string $requestString, array $rootValue = null, $contextValue = null, $variableValues = null, $operationName = null) { $args = \func_get_args(); \array_unshift($args, $this->promiseAdapter); return \call_user_func_array([GraphQL::class, 'promiseToExec...
[ "public", "function", "execute", "(", "Schema", "$", "schema", ",", "string", "$", "requestString", ",", "array", "$", "rootValue", "=", "null", ",", "$", "contextValue", "=", "null", ",", "$", "variableValues", "=", "null", ",", "$", "operationName", "=",...
{@inheritdoc}
[ "{" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Executor/Executor.php#L19-L25
overblog/GraphQLBundle
src/Config/Parser/GraphQLParser.php
GraphQLParser.parse
public static function parse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): array { $container->addResource(new FileResource($file->getRealPath())); $content = \trim(\file_get_contents($file->getPathname())); $typesConfig = []; // allow empty files if...
php
public static function parse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): array { $container->addResource(new FileResource($file->getRealPath())); $content = \trim(\file_get_contents($file->getPathname())); $typesConfig = []; // allow empty files if...
[ "public", "static", "function", "parse", "(", "\\", "SplFileInfo", "$", "file", ",", "ContainerBuilder", "$", "container", ",", "array", "$", "configs", "=", "[", "]", ")", ":", "array", "{", "$", "container", "->", "addResource", "(", "new", "FileResource...
{@inheritdoc}
[ "{" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/GraphQLParser.php#L28-L51
overblog/GraphQLBundle
src/Config/Processor/BuilderProcessor.php
BuilderProcessor.process
public static function process(array $configs): array { $addedTypes = []; // map: "type name" => "provided by" for better DX, while debugging accidental type overrides in builders $reservedTypesMap = \array_combine( \array_keys($configs), \array_fill(0, \count($config...
php
public static function process(array $configs): array { $addedTypes = []; // map: "type name" => "provided by" for better DX, while debugging accidental type overrides in builders $reservedTypesMap = \array_combine( \array_keys($configs), \array_fill(0, \count($config...
[ "public", "static", "function", "process", "(", "array", "$", "configs", ")", ":", "array", "{", "$", "addedTypes", "=", "[", "]", ";", "// map: \"type name\" => \"provided by\" for better DX, while debugging accidental type overrides in builders", "$", "reservedTypesMap", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Processor/BuilderProcessor.php#L53-L91
overblog/GraphQLBundle
src/Config/Processor/BuilderProcessor.php
BuilderProcessor.getFieldBuilderMapping
private static function getFieldBuilderMapping(string $builderName, string $builderType, array $builderConfig, array &$reservedTypesMap) { $builder = self::getBuilder($builderName, $builderType); $mapping = $builder->toMappingDefinition($builderConfig); $fieldMappingKey = null; if ...
php
private static function getFieldBuilderMapping(string $builderName, string $builderType, array $builderConfig, array &$reservedTypesMap) { $builder = self::getBuilder($builderName, $builderType); $mapping = $builder->toMappingDefinition($builderConfig); $fieldMappingKey = null; if ...
[ "private", "static", "function", "getFieldBuilderMapping", "(", "string", "$", "builderName", ",", "string", "$", "builderType", ",", "array", "$", "builderConfig", ",", "array", "&", "$", "reservedTypesMap", ")", "{", "$", "builder", "=", "self", "::", "getBu...
@param string $builderName @param string $builderType @param array $builderConfig @param array $reservedTypesMap @return array @throws InvalidConfigurationException
[ "@param", "string", "$builderName", "@param", "string", "$builderType", "@param", "array", "$builderConfig", "@param", "array", "$reservedTypesMap" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Processor/BuilderProcessor.php#L207-L245
overblog/GraphQLBundle
src/Config/Processor/BuilderProcessor.php
BuilderProcessor.getBuilder
private static function getBuilder($name, $type) { static $builders = []; if (isset($builders[$type][$name])) { return $builders[$type][$name]; } $builderClassMap = self::$builderClassMap[$type]; if (isset($builderClassMap[$name])) { return $builders...
php
private static function getBuilder($name, $type) { static $builders = []; if (isset($builders[$type][$name])) { return $builders[$type][$name]; } $builderClassMap = self::$builderClassMap[$type]; if (isset($builderClassMap[$name])) { return $builders...
[ "private", "static", "function", "getBuilder", "(", "$", "name", ",", "$", "type", ")", "{", "static", "$", "builders", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "builders", "[", "$", "type", "]", "[", "$", "name", "]", ")", ")", "{", "...
@param string $name @param string $type @return MappingInterface @throws InvalidConfigurationException if builder class not define
[ "@param", "string", "$name", "@param", "string", "$type" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Processor/BuilderProcessor.php#L255-L279
overblog/GraphQLBundle
src/Definition/Type/ExtensibleSchema.php
ExtensibleSchema.setExtensions
public function setExtensions(array $extensions) { $this->extensions = []; foreach ($extensions as $extension) { $this->addExtension($extension); } return $this; }
php
public function setExtensions(array $extensions) { $this->extensions = []; foreach ($extensions as $extension) { $this->addExtension($extension); } return $this; }
[ "public", "function", "setExtensions", "(", "array", "$", "extensions", ")", "{", "$", "this", "->", "extensions", "=", "[", "]", ";", "foreach", "(", "$", "extensions", "as", "$", "extension", ")", "{", "$", "this", "->", "addExtension", "(", "$", "ex...
@param SchemaExtensionInterface[] $extensions @return $this
[ "@param", "SchemaExtensionInterface", "[]", "$extensions" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Definition/Type/ExtensibleSchema.php#L30-L38
overblog/GraphQLBundle
src/Definition/ConfigProcessor/PublicFieldsFilterConfigProcessor.php
PublicFieldsFilterConfigProcessor.process
public function process(LazyConfig $lazyConfig): LazyConfig { $lazyConfig->addPostLoader(function ($config) { if (isset($config['fields']) && \is_callable($config['fields'])) { $config['fields'] = function () use ($config) { $fields = $config['fields'](); ...
php
public function process(LazyConfig $lazyConfig): LazyConfig { $lazyConfig->addPostLoader(function ($config) { if (isset($config['fields']) && \is_callable($config['fields'])) { $config['fields'] = function () use ($config) { $fields = $config['fields'](); ...
[ "public", "function", "process", "(", "LazyConfig", "$", "lazyConfig", ")", ":", "LazyConfig", "{", "$", "lazyConfig", "->", "addPostLoader", "(", "function", "(", "$", "config", ")", "{", "if", "(", "isset", "(", "$", "config", "[", "'fields'", "]", ")"...
{@inheritdoc}
[ "{" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Definition/ConfigProcessor/PublicFieldsFilterConfigProcessor.php#L31-L46
overblog/GraphQLBundle
src/Definition/ConfigProcessor/AclConfigProcessor.php
AclConfigProcessor.findFieldResolver
private static function findFieldResolver(array $field, ResolveInfo $info, callable $defaultResolver): callable { if (isset($field['resolve'])) { $resolver = $field['resolve']; } elseif (isset($info->parentType->config['resolveField'])) { $resolver = $info->parentType->config...
php
private static function findFieldResolver(array $field, ResolveInfo $info, callable $defaultResolver): callable { if (isset($field['resolve'])) { $resolver = $field['resolve']; } elseif (isset($info->parentType->config['resolveField'])) { $resolver = $info->parentType->config...
[ "private", "static", "function", "findFieldResolver", "(", "array", "$", "field", ",", "ResolveInfo", "$", "info", ",", "callable", "$", "defaultResolver", ")", ":", "callable", "{", "if", "(", "isset", "(", "$", "field", "[", "'resolve'", "]", ")", ")", ...
@param array $field @param ResolveInfo $info @param callable $defaultResolver @return callable
[ "@param", "array", "$field", "@param", "ResolveInfo", "$info", "@param", "callable", "$defaultResolver" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Definition/ConfigProcessor/AclConfigProcessor.php#L73-L84
overblog/GraphQLBundle
src/DependencyInjection/Compiler/TaggedServiceMappingPass.php
TaggedServiceMappingPass.resolveAttributes
private static function resolveAttributes(array $attributes, string $id, bool $withMethod): array { $default = ['id' => $id, 'aliases' => []]; if ($withMethod) { $default['method'] = '__invoke'; } $attributes = \array_replace($default, $attributes); return $attri...
php
private static function resolveAttributes(array $attributes, string $id, bool $withMethod): array { $default = ['id' => $id, 'aliases' => []]; if ($withMethod) { $default['method'] = '__invoke'; } $attributes = \array_replace($default, $attributes); return $attri...
[ "private", "static", "function", "resolveAttributes", "(", "array", "$", "attributes", ",", "string", "$", "id", ",", "bool", "$", "withMethod", ")", ":", "array", "{", "$", "default", "=", "[", "'id'", "=>", "$", "id", ",", "'aliases'", "=>", "[", "]"...
@param array $attributes @param string $id @param bool $withMethod @return array
[ "@param", "array", "$attributes", "@param", "string", "$id", "@param", "bool", "$withMethod" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/DependencyInjection/Compiler/TaggedServiceMappingPass.php#L83-L92
overblog/GraphQLBundle
src/Definition/Builder/SchemaBuilder.php
SchemaBuilder.create
public function create(string $name, ?string $queryAlias, ?string $mutationAlias = null, ?string $subscriptionAlias = null, array $types = []): ExtensibleSchema { $this->typeResolver->setCurrentSchemaName($name); $query = $this->typeResolver->resolve($queryAlias); $mutation = $this->typeRes...
php
public function create(string $name, ?string $queryAlias, ?string $mutationAlias = null, ?string $subscriptionAlias = null, array $types = []): ExtensibleSchema { $this->typeResolver->setCurrentSchemaName($name); $query = $this->typeResolver->resolve($queryAlias); $mutation = $this->typeRes...
[ "public", "function", "create", "(", "string", "$", "name", ",", "?", "string", "$", "queryAlias", ",", "?", "string", "$", "mutationAlias", "=", "null", ",", "?", "string", "$", "subscriptionAlias", "=", "null", ",", "array", "$", "types", "=", "[", "...
@param string $name @param string|null $queryAlias @param string|null $mutationAlias @param string|null $subscriptionAlias @param string[] $types @return ExtensibleSchema
[ "@param", "string", "$name", "@param", "string|null", "$queryAlias", "@param", "string|null", "$mutationAlias", "@param", "string|null", "$subscriptionAlias", "@param", "string", "[]", "$types" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Definition/Builder/SchemaBuilder.php#L35-L51
overblog/GraphQLBundle
src/Definition/GlobalVariables.php
GlobalVariables.get
public function get(string $name) { if (!isset($this->services[$name])) { throw new \LogicException(\sprintf('Global variable %s could not be located. You should define it.', \json_encode($name))); } return $this->services[$name]; }
php
public function get(string $name) { if (!isset($this->services[$name])) { throw new \LogicException(\sprintf('Global variable %s could not be located. You should define it.', \json_encode($name))); } return $this->services[$name]; }
[ "public", "function", "get", "(", "string", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "services", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "\\", "sprintf", "(", "'Global variable...
@param string $name @return mixed
[ "@param", "string", "$name" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Definition/GlobalVariables.php#L22-L29
overblog/GraphQLBundle
src/Resolver/AbstractProxyResolver.php
AbstractProxyResolver.resolve
public function resolve($input) { if (!\is_array($input)) { $input = [$input]; } if (!isset($input[0]) || !isset($input[1])) { $optionResolver = new OptionsResolver(); $optionResolver->setDefaults([null, []]); $input = $optionResolver->resolve...
php
public function resolve($input) { if (!\is_array($input)) { $input = [$input]; } if (!isset($input[0]) || !isset($input[1])) { $optionResolver = new OptionsResolver(); $optionResolver->setDefaults([null, []]); $input = $optionResolver->resolve...
[ "public", "function", "resolve", "(", "$", "input", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "input", ")", ")", "{", "$", "input", "=", "[", "$", "input", "]", ";", "}", "if", "(", "!", "isset", "(", "$", "input", "[", "0", "]", ...
@param $input @return mixed
[ "@param", "$input" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/AbstractProxyResolver.php#L16-L41
overblog/GraphQLBundle
src/DependencyInjection/Compiler/AliasedPass.php
AliasedPass.process
public function process(ContainerBuilder $container): void { $definitions = $this->filterDefinitions($container->getDefinitions()); foreach ($definitions as $definition) { $this->addDefinitionTagsFromAliases($definition); } }
php
public function process(ContainerBuilder $container): void { $definitions = $this->filterDefinitions($container->getDefinitions()); foreach ($definitions as $definition) { $this->addDefinitionTagsFromAliases($definition); } }
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", ":", "void", "{", "$", "definitions", "=", "$", "this", "->", "filterDefinitions", "(", "$", "container", "->", "getDefinitions", "(", ")", ")", ";", "foreach", "(", "$", "def...
{@inheritdoc}
[ "{" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/DependencyInjection/Compiler/AliasedPass.php#L26-L32
overblog/GraphQLBundle
src/DependencyInjection/Compiler/AliasedPass.php
AliasedPass.filterDefinitions
private function filterDefinitions(array $definitions): array { return \array_filter($definitions, function (Definition $definition) { foreach (self::SERVICE_SUBCLASS_TAG_MAPPING as $tagName) { if ($definition->hasTag($tagName)) { return \is_subclass_of($defin...
php
private function filterDefinitions(array $definitions): array { return \array_filter($definitions, function (Definition $definition) { foreach (self::SERVICE_SUBCLASS_TAG_MAPPING as $tagName) { if ($definition->hasTag($tagName)) { return \is_subclass_of($defin...
[ "private", "function", "filterDefinitions", "(", "array", "$", "definitions", ")", ":", "array", "{", "return", "\\", "array_filter", "(", "$", "definitions", ",", "function", "(", "Definition", "$", "definition", ")", "{", "foreach", "(", "self", "::", "SER...
@param Definition[] $definitions @return Definition[]
[ "@param", "Definition", "[]", "$definitions" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/DependencyInjection/Compiler/AliasedPass.php#L39-L50
overblog/GraphQLBundle
src/Config/ObjectTypeDefinition.php
ObjectTypeDefinition.treatFieldsDefaultAccess
private function treatFieldsDefaultAccess(ArrayNodeDefinition $node): void { $node->validate() ->ifTrue(function ($v) { return \array_key_exists('fieldsDefaultAccess', $v) && null !== $v['fieldsDefaultAccess']; }) ->then(function ($v) { for...
php
private function treatFieldsDefaultAccess(ArrayNodeDefinition $node): void { $node->validate() ->ifTrue(function ($v) { return \array_key_exists('fieldsDefaultAccess', $v) && null !== $v['fieldsDefaultAccess']; }) ->then(function ($v) { for...
[ "private", "function", "treatFieldsDefaultAccess", "(", "ArrayNodeDefinition", "$", "node", ")", ":", "void", "{", "$", "node", "->", "validate", "(", ")", "->", "ifTrue", "(", "function", "(", "$", "v", ")", "{", "return", "\\", "array_key_exists", "(", "...
set empty fields.access with fieldsDefaultAccess values if is set? @param ArrayNodeDefinition $node
[ "set", "empty", "fields", ".", "access", "with", "fieldsDefaultAccess", "values", "if", "is", "set?" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/ObjectTypeDefinition.php#L45-L63
overblog/GraphQLBundle
src/Resolver/ResolverMaps.php
ResolverMaps.resolve
public function resolve(string $typeName, string $fieldName) { foreach ($this->resolverMaps as $resolverMap) { if ($resolverMap->isResolvable($typeName, $fieldName)) { return $resolverMap->resolve($typeName, $fieldName); } } throw new UnresolvableExcep...
php
public function resolve(string $typeName, string $fieldName) { foreach ($this->resolverMaps as $resolverMap) { if ($resolverMap->isResolvable($typeName, $fieldName)) { return $resolverMap->resolve($typeName, $fieldName); } } throw new UnresolvableExcep...
[ "public", "function", "resolve", "(", "string", "$", "typeName", ",", "string", "$", "fieldName", ")", "{", "foreach", "(", "$", "this", "->", "resolverMaps", "as", "$", "resolverMap", ")", "{", "if", "(", "$", "resolverMap", "->", "isResolvable", "(", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/ResolverMaps.php#L21-L29
overblog/GraphQLBundle
src/Resolver/ResolverMaps.php
ResolverMaps.isResolvable
public function isResolvable(string $typeName, string $fieldName): bool { foreach ($this->resolverMaps as $resolverMap) { if ($resolverMap->isResolvable($typeName, $fieldName)) { return true; } } return false; }
php
public function isResolvable(string $typeName, string $fieldName): bool { foreach ($this->resolverMaps as $resolverMap) { if ($resolverMap->isResolvable($typeName, $fieldName)) { return true; } } return false; }
[ "public", "function", "isResolvable", "(", "string", "$", "typeName", ",", "string", "$", "fieldName", ")", ":", "bool", "{", "foreach", "(", "$", "this", "->", "resolverMaps", "as", "$", "resolverMap", ")", "{", "if", "(", "$", "resolverMap", "->", "isR...
{@inheritdoc}
[ "{" ]
train
https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/ResolverMaps.php#L34-L43