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
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php
vfsStreamAbstractContent.chmod
public function chmod(int $permissions): vfsStreamContent { $this->permissions = $permissions; $this->lastAttributeModified = time(); clearstatcache(); return $this; }
php
public function chmod(int $permissions): vfsStreamContent { $this->permissions = $permissions; $this->lastAttributeModified = time(); clearstatcache(); return $this; }
[ "public", "function", "chmod", "(", "int", "$", "permissions", ")", ":", "vfsStreamContent", "{", "$", "this", "->", "permissions", "=", "$", "permissions", ";", "$", "this", "->", "lastAttributeModified", "=", "time", "(", ")", ";", "clearstatcache", "(", ...
change file mode to given permissions @param int $permissions @return vfsStreamContent
[ "change", "file", "mode", "to", "given", "permissions" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php#L244-L250
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php
vfsStreamAbstractContent.isReadable
public function isReadable(int $user, int $group): bool { if ($this->user === $user) { $check = 0400; } elseif ($this->group === $group) { $check = 0040; } else { $check = 0004; } return (bool) ($this->permissions & $check); }
php
public function isReadable(int $user, int $group): bool { if ($this->user === $user) { $check = 0400; } elseif ($this->group === $group) { $check = 0040; } else { $check = 0004; } return (bool) ($this->permissions & $check); }
[ "public", "function", "isReadable", "(", "int", "$", "user", ",", "int", "$", "group", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "user", "===", "$", "user", ")", "{", "$", "check", "=", "0400", ";", "}", "elseif", "(", "$", "this", "...
checks whether content is readable @param int $user id of user to check for @param int $group id of group to check for @return bool
[ "checks", "whether", "content", "is", "readable" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php#L269-L280
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php
vfsStreamAbstractContent.isWritable
public function isWritable(int $user, int $group): bool { if ($this->user === $user) { $check = 0200; } elseif ($this->group === $group) { $check = 0020; } else { $check = 0002; } return (bool) ($this->permissions & $check); }
php
public function isWritable(int $user, int $group): bool { if ($this->user === $user) { $check = 0200; } elseif ($this->group === $group) { $check = 0020; } else { $check = 0002; } return (bool) ($this->permissions & $check); }
[ "public", "function", "isWritable", "(", "int", "$", "user", ",", "int", "$", "group", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "user", "===", "$", "user", ")", "{", "$", "check", "=", "0200", ";", "}", "elseif", "(", "$", "this", "...
checks whether content is writable @param int $user id of user to check for @param int $group id of group to check for @return bool
[ "checks", "whether", "content", "is", "writable" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php#L289-L300
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php
vfsStreamAbstractContent.isExecutable
public function isExecutable(int $user, int $group): bool { if ($this->user === $user) { $check = 0100; } elseif ($this->group === $group) { $check = 0010; } else { $check = 0001; } return (bool) ($this->permissions & $check); }
php
public function isExecutable(int $user, int $group): bool { if ($this->user === $user) { $check = 0100; } elseif ($this->group === $group) { $check = 0010; } else { $check = 0001; } return (bool) ($this->permissions & $check); }
[ "public", "function", "isExecutable", "(", "int", "$", "user", ",", "int", "$", "group", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "user", "===", "$", "user", ")", "{", "$", "check", "=", "0100", ";", "}", "elseif", "(", "$", "this", ...
checks whether content is executable @param int $user id of user to check for @param int $group id of group to check for @return bool
[ "checks", "whether", "content", "is", "executable" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php#L309-L320
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php
vfsStreamAbstractContent.chown
public function chown(int $user): vfsStreamContent { $this->user = $user; $this->lastAttributeModified = time(); return $this; }
php
public function chown(int $user): vfsStreamContent { $this->user = $user; $this->lastAttributeModified = time(); return $this; }
[ "public", "function", "chown", "(", "int", "$", "user", ")", ":", "vfsStreamContent", "{", "$", "this", "->", "user", "=", "$", "user", ";", "$", "this", "->", "lastAttributeModified", "=", "time", "(", ")", ";", "return", "$", "this", ";", "}" ]
change owner of file to given user @param int $user @return vfsStreamContent
[ "change", "owner", "of", "file", "to", "given", "user" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php#L328-L333
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php
vfsStreamAbstractContent.chgrp
public function chgrp(int $group): vfsStreamContent { $this->group = $group; $this->lastAttributeModified = time(); return $this; }
php
public function chgrp(int $group): vfsStreamContent { $this->group = $group; $this->lastAttributeModified = time(); return $this; }
[ "public", "function", "chgrp", "(", "int", "$", "group", ")", ":", "vfsStreamContent", "{", "$", "this", "->", "group", "=", "$", "group", ";", "$", "this", "->", "lastAttributeModified", "=", "time", "(", ")", ";", "return", "$", "this", ";", "}" ]
change owner group of file to given group @param int $group @return vfsStreamContent
[ "change", "owner", "group", "of", "file", "to", "given", "group" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php#L362-L367
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php
vfsStreamAbstractContent.path
public function path(): string { if (null === $this->parentPath) { return $this->name; } return $this->parentPath . '/' . $this->name; }
php
public function path(): string { if (null === $this->parentPath) { return $this->name; } return $this->parentPath . '/' . $this->name; }
[ "public", "function", "path", "(", ")", ":", "string", "{", "if", "(", "null", "===", "$", "this", "->", "parentPath", ")", "{", "return", "$", "this", "->", "name", ";", "}", "return", "$", "this", "->", "parentPath", ".", "'/'", ".", "$", "this",...
returns path to this content @return string @since 1.2.0
[ "returns", "path", "to", "this", "content" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php#L419-L426
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamDirectory.php
vfsStreamDirectory.sizeSummarized
public function sizeSummarized(): int { $size = 0; foreach ($this->children as $child) { if ($child instanceof self) { $size += $child->sizeSummarized(); } else { $size += $child->size(); } } return $size; }
php
public function sizeSummarized(): int { $size = 0; foreach ($this->children as $child) { if ($child instanceof self) { $size += $child->sizeSummarized(); } else { $size += $child->size(); } } return $size; }
[ "public", "function", "sizeSummarized", "(", ")", ":", "int", "{", "$", "size", "=", "0", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "child", ")", "{", "if", "(", "$", "child", "instanceof", "self", ")", "{", "$", "size", "+=", ...
returns summarized size of directory and its children @return int
[ "returns", "summarized", "size", "of", "directory", "and", "its", "children" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamDirectory.php#L68-L80
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamDirectory.php
vfsStreamDirectory.setParentPath
public function setParentPath(string $parentPath) { parent::setParentPath($parentPath); foreach ($this->children as $child) { $child->setParentPath($this->path()); } }
php
public function setParentPath(string $parentPath) { parent::setParentPath($parentPath); foreach ($this->children as $child) { $child->setParentPath($this->path()); } }
[ "public", "function", "setParentPath", "(", "string", "$", "parentPath", ")", "{", "parent", "::", "setParentPath", "(", "$", "parentPath", ")", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "child", ")", "{", "$", "child", "->", "setPar...
sets parent path @param string $parentPath @internal only to be set by parent @since 1.2.0
[ "sets", "parent", "path" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamDirectory.php#L89-L95
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamDirectory.php
vfsStreamDirectory.addChild
public function addChild(vfsStreamContent $child) { $child->setParentPath($this->path()); $this->children[$child->getName()] = $child; $this->updateModifications(); }
php
public function addChild(vfsStreamContent $child) { $child->setParentPath($this->path()); $this->children[$child->getName()] = $child; $this->updateModifications(); }
[ "public", "function", "addChild", "(", "vfsStreamContent", "$", "child", ")", "{", "$", "child", "->", "setParentPath", "(", "$", "this", "->", "path", "(", ")", ")", ";", "$", "this", "->", "children", "[", "$", "child", "->", "getName", "(", ")", "...
adds child to the directory @param vfsStreamContent $child
[ "adds", "child", "to", "the", "directory" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamDirectory.php#L102-L107
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamDirectory.php
vfsStreamDirectory.removeChild
public function removeChild(string $name): bool { foreach ($this->children as $key => $child) { if ($child->appliesTo($name)) { $child->removeParentPath(); unset($this->children[$key]); $this->updateModifications(); return true; ...
php
public function removeChild(string $name): bool { foreach ($this->children as $key => $child) { if ($child->appliesTo($name)) { $child->removeParentPath(); unset($this->children[$key]); $this->updateModifications(); return true; ...
[ "public", "function", "removeChild", "(", "string", "$", "name", ")", ":", "bool", "{", "foreach", "(", "$", "this", "->", "children", "as", "$", "key", "=>", "$", "child", ")", "{", "if", "(", "$", "child", "->", "appliesTo", "(", "$", "name", ")"...
removes child from the directory @param string $name @return bool
[ "removes", "child", "from", "the", "directory" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamDirectory.php#L115-L127
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamDirectory.php
vfsStreamDirectory.getChild
public function getChild(string $name): ?vfsStreamContent { $childName = $this->getRealChildName($name); foreach ($this->children as $child) { if ($child->getName() === $childName) { return $child; } if (!$child instanceof vfsStreamContainer) { ...
php
public function getChild(string $name): ?vfsStreamContent { $childName = $this->getRealChildName($name); foreach ($this->children as $child) { if ($child->getName() === $childName) { return $child; } if (!$child instanceof vfsStreamContainer) { ...
[ "public", "function", "getChild", "(", "string", "$", "name", ")", ":", "?", "vfsStreamContent", "{", "$", "childName", "=", "$", "this", "->", "getRealChildName", "(", "$", "name", ")", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "c...
returns the child with the given name @param string $name @return vfsStreamContent|null
[ "returns", "the", "child", "with", "the", "given", "name" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamDirectory.php#L156-L174
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamDirectory.php
vfsStreamDirectory.getRealChildName
protected function getRealChildName(string $name): string { if ($this->appliesTo($name) === true) { return self::getChildName($name, $this->name); } return $name; }
php
protected function getRealChildName(string $name): string { if ($this->appliesTo($name) === true) { return self::getChildName($name, $this->name); } return $name; }
[ "protected", "function", "getRealChildName", "(", "string", "$", "name", ")", ":", "string", "{", "if", "(", "$", "this", "->", "appliesTo", "(", "$", "name", ")", "===", "true", ")", "{", "return", "self", "::", "getChildName", "(", "$", "name", ",", ...
helper method to detect the real child name @param string $name @return string
[ "helper", "method", "to", "detect", "the", "real", "child", "name" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamDirectory.php#L182-L189
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamDirectory.php
vfsStreamDirectory.getChildName
protected static function getChildName(string $name, string $ownName): string { if ($name === $ownName) { return $name; } return substr($name, strlen($ownName) + 1); }
php
protected static function getChildName(string $name, string $ownName): string { if ($name === $ownName) { return $name; } return substr($name, strlen($ownName) + 1); }
[ "protected", "static", "function", "getChildName", "(", "string", "$", "name", ",", "string", "$", "ownName", ")", ":", "string", "{", "if", "(", "$", "name", "===", "$", "ownName", ")", "{", "return", "$", "name", ";", "}", "return", "substr", "(", ...
helper method to calculate the child name @param string $name @param string $ownName @return string
[ "helper", "method", "to", "calculate", "the", "child", "name" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamDirectory.php#L198-L205
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamContainerIterator.php
vfsStreamContainerIterator.key
public function key() { $child = current($this->children); if (false === $child) { return null; } return $child->getName(); }
php
public function key() { $child = current($this->children); if (false === $child) { return null; } return $child->getName(); }
[ "public", "function", "key", "(", ")", "{", "$", "child", "=", "current", "(", "$", "this", "->", "children", ")", ";", "if", "(", "false", "===", "$", "child", ")", "{", "return", "null", ";", "}", "return", "$", "child", "->", "getName", "(", "...
returns the name of the current child @return string|null
[ "returns", "the", "name", "of", "the", "current", "child" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamContainerIterator.php#L67-L75
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php
StringBasedFileContent.doRead
protected function doRead(int $offset, int $count): string { /** @var string|false $data */ $data = substr($this->content, $offset, $count); return (false === $data) ? '' : $data; }
php
protected function doRead(int $offset, int $count): string { /** @var string|false $data */ $data = substr($this->content, $offset, $count); return (false === $data) ? '' : $data; }
[ "protected", "function", "doRead", "(", "int", "$", "offset", ",", "int", "$", "count", ")", ":", "string", "{", "/** @var string|false $data */", "$", "data", "=", "substr", "(", "$", "this", "->", "content", ",", "$", "offset", ",", "$", "count", ")", ...
actual reading of length starting at given offset @param int $offset @param int $count @return string
[ "actual", "reading", "of", "length", "starting", "at", "given", "offset" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php#L63-L68
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php
StringBasedFileContent.doWrite
protected function doWrite(string $data, int $offset, int $length) { $this->content = substr($this->content, 0, $offset) . $data . substr($this->content, $offset + $length); }
php
protected function doWrite(string $data, int $offset, int $length) { $this->content = substr($this->content, 0, $offset) . $data . substr($this->content, $offset + $length); }
[ "protected", "function", "doWrite", "(", "string", "$", "data", ",", "int", "$", "offset", ",", "int", "$", "length", ")", "{", "$", "this", "->", "content", "=", "substr", "(", "$", "this", "->", "content", ",", "0", ",", "$", "offset", ")", ".", ...
actual writing of data with specified length at given offset @param string $data @param int $offset @param int $length
[ "actual", "writing", "of", "data", "with", "specified", "length", "at", "given", "offset" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php#L77-L82
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php
StringBasedFileContent.truncate
public function truncate(int $size): bool { if ($size > $this->size()) { // Pad with null-chars if we're "truncating up" $this->content .= str_repeat("\0", $size - $this->size()); } else { $this->content = substr($this->content, 0, $size); } retur...
php
public function truncate(int $size): bool { if ($size > $this->size()) { // Pad with null-chars if we're "truncating up" $this->content .= str_repeat("\0", $size - $this->size()); } else { $this->content = substr($this->content, 0, $size); } retur...
[ "public", "function", "truncate", "(", "int", "$", "size", ")", ":", "bool", "{", "if", "(", "$", "size", ">", "$", "this", "->", "size", "(", ")", ")", "{", "// Pad with null-chars if we're \"truncating up\"", "$", "this", "->", "content", ".=", "str_repe...
Truncates a file to a given length @param int $size length to truncate file to @return bool
[ "Truncates", "a", "file", "to", "a", "given", "length" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php#L90-L100
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.withContent
public function withContent($content): vfsStreamFile { if (is_string($content)) { $this->content = new StringBasedFileContent($content); } elseif ($content instanceof FileContent) { $this->content = $content; } else { throw new \InvalidArgumentException('G...
php
public function withContent($content): vfsStreamFile { if (is_string($content)) { $this->content = new StringBasedFileContent($content); } elseif ($content instanceof FileContent) { $this->content = $content; } else { throw new \InvalidArgumentException('G...
[ "public", "function", "withContent", "(", "$", "content", ")", ":", "vfsStreamFile", "{", "if", "(", "is_string", "(", "$", "content", ")", ")", "{", "$", "this", "->", "content", "=", "new", "StringBasedFileContent", "(", "$", "content", ")", ";", "}", ...
sets the contents of the file Setting content with this method does not change the time when the file was last modified. @param string|FileContent $content @return vfsStreamFile @throws \InvalidArgumentException
[ "sets", "the", "contents", "of", "the", "file" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L97-L108
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.openWithTruncate
public function openWithTruncate() { $this->open(); $this->content->truncate(0); $time = time(); $this->lastAccessed = $time; $this->lastModified = $time; }
php
public function openWithTruncate() { $this->open(); $this->content->truncate(0); $time = time(); $this->lastAccessed = $time; $this->lastModified = $time; }
[ "public", "function", "openWithTruncate", "(", ")", "{", "$", "this", "->", "open", "(", ")", ";", "$", "this", "->", "content", "->", "truncate", "(", "0", ")", ";", "$", "time", "=", "time", "(", ")", ";", "$", "this", "->", "lastAccessed", "=", ...
open file and truncate content @since 0.9
[ "open", "file", "and", "truncate", "content" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L150-L157
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.read
public function read(int $count): string { $this->lastAccessed = time(); return $this->content->read($count); }
php
public function read(int $count): string { $this->lastAccessed = time(); return $this->content->read($count); }
[ "public", "function", "read", "(", "int", "$", "count", ")", ":", "string", "{", "$", "this", "->", "lastAccessed", "=", "time", "(", ")", ";", "return", "$", "this", "->", "content", "->", "read", "(", "$", "count", ")", ";", "}" ]
reads the given amount of bytes from content Using this method changes the time when the file was last accessed. @param int $count @return string
[ "reads", "the", "given", "amount", "of", "bytes", "from", "content" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L167-L171
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.write
public function write(string $data): int { $this->lastModified = time(); return $this->content->write($data); }
php
public function write(string $data): int { $this->lastModified = time(); return $this->content->write($data); }
[ "public", "function", "write", "(", "string", "$", "data", ")", ":", "int", "{", "$", "this", "->", "lastModified", "=", "time", "(", ")", ";", "return", "$", "this", "->", "content", "->", "write", "(", "$", "data", ")", ";", "}" ]
writes an amount of data Using this method changes the time when the file was last modified. @param string $data @return int amount of written bytes
[ "writes", "an", "amount", "of", "data" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L195-L199
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.truncate
public function truncate(int $size): bool { $this->content->truncate($size); $this->lastModified = time(); return true; }
php
public function truncate(int $size): bool { $this->content->truncate($size); $this->lastModified = time(); return true; }
[ "public", "function", "truncate", "(", "int", "$", "size", ")", ":", "bool", "{", "$", "this", "->", "content", "->", "truncate", "(", "$", "size", ")", ";", "$", "this", "->", "lastModified", "=", "time", "(", ")", ";", "return", "true", ";", "}" ...
Truncates a file to a given length @param int $size length to truncate file to @return bool @since 1.1.0
[ "Truncates", "a", "file", "to", "a", "given", "length" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L208-L213
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.lock
public function lock($resource, int $operation): bool { if ((LOCK_NB & $operation) == LOCK_NB) { $operation = $operation - LOCK_NB; } // call to lock file on the same file handler firstly releases the lock $this->unlock($resource); if (LOCK_EX === $operation) { ...
php
public function lock($resource, int $operation): bool { if ((LOCK_NB & $operation) == LOCK_NB) { $operation = $operation - LOCK_NB; } // call to lock file on the same file handler firstly releases the lock $this->unlock($resource); if (LOCK_EX === $operation) { ...
[ "public", "function", "lock", "(", "$", "resource", ",", "int", "$", "operation", ")", ":", "bool", "{", "if", "(", "(", "LOCK_NB", "&", "$", "operation", ")", "==", "LOCK_NB", ")", "{", "$", "operation", "=", "$", "operation", "-", "LOCK_NB", ";", ...
locks file for @param resource|vfsStreamWrapper $resource @param int $operation @return bool @since 0.10.0 @see https://github.com/mikey179/vfsStream/issues/6 @see https://github.com/mikey179/vfsStream/issues/40
[ "locks", "file", "for" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L269-L293
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.unlock
public function unlock($resource) { if ($this->hasExclusiveLock($resource)) { $this->exclusiveLock = null; } if ($this->hasSharedLock($resource)) { unset($this->sharedLock[$this->getResourceId($resource)]); } }
php
public function unlock($resource) { if ($this->hasExclusiveLock($resource)) { $this->exclusiveLock = null; } if ($this->hasSharedLock($resource)) { unset($this->sharedLock[$this->getResourceId($resource)]); } }
[ "public", "function", "unlock", "(", "$", "resource", ")", "{", "if", "(", "$", "this", "->", "hasExclusiveLock", "(", "$", "resource", ")", ")", "{", "$", "this", "->", "exclusiveLock", "=", "null", ";", "}", "if", "(", "$", "this", "->", "hasShared...
Removes lock from file acquired by given resource @param resource|vfsStreamWrapper $resource @see https://github.com/mikey179/vfsStream/issues/40
[ "Removes", "lock", "from", "file", "acquired", "by", "given", "resource" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L301-L308
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.isLocked
public function isLocked($resource = null): bool { return $this->hasSharedLock($resource) || $this->hasExclusiveLock($resource); }
php
public function isLocked($resource = null): bool { return $this->hasSharedLock($resource) || $this->hasExclusiveLock($resource); }
[ "public", "function", "isLocked", "(", "$", "resource", "=", "null", ")", ":", "bool", "{", "return", "$", "this", "->", "hasSharedLock", "(", "$", "resource", ")", "||", "$", "this", "->", "hasExclusiveLock", "(", "$", "resource", ")", ";", "}" ]
checks whether file is locked @param resource|vfsStreamWrapper $resource @return bool @since 0.10.0 @see https://github.com/mikey179/vfsStream/issues/6 @see https://github.com/mikey179/vfsStream/issues/40
[ "checks", "whether", "file", "is", "locked" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L339-L342
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.hasSharedLock
public function hasSharedLock($resource = null): bool { if (null !== $resource) { return isset($this->sharedLock[$this->getResourceId($resource)]); } return !empty($this->sharedLock); }
php
public function hasSharedLock($resource = null): bool { if (null !== $resource) { return isset($this->sharedLock[$this->getResourceId($resource)]); } return !empty($this->sharedLock); }
[ "public", "function", "hasSharedLock", "(", "$", "resource", "=", "null", ")", ":", "bool", "{", "if", "(", "null", "!==", "$", "resource", ")", "{", "return", "isset", "(", "$", "this", "->", "sharedLock", "[", "$", "this", "->", "getResourceId", "(",...
checks whether file is locked in shared mode @param resource|vfsStreamWrapper $resource @return bool @since 0.10.0 @see https://github.com/mikey179/vfsStream/issues/6 @see https://github.com/mikey179/vfsStream/issues/40
[ "checks", "whether", "file", "is", "locked", "in", "shared", "mode" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L353-L360
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.getResourceId
public function getResourceId($resource): string { if (is_resource($resource)) { $data = stream_get_meta_data($resource); $resource = $data['wrapper_data']; } return spl_object_hash($resource); }
php
public function getResourceId($resource): string { if (is_resource($resource)) { $data = stream_get_meta_data($resource); $resource = $data['wrapper_data']; } return spl_object_hash($resource); }
[ "public", "function", "getResourceId", "(", "$", "resource", ")", ":", "string", "{", "if", "(", "is_resource", "(", "$", "resource", ")", ")", "{", "$", "data", "=", "stream_get_meta_data", "(", "$", "resource", ")", ";", "$", "resource", "=", "$", "d...
Returns unique resource id @param resource|vfsStreamWrapper $resource @return string @see https://github.com/mikey179/vfsStream/issues/40
[ "Returns", "unique", "resource", "id" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L369-L377
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamFile.php
vfsStreamFile.hasExclusiveLock
public function hasExclusiveLock($resource = null): bool { if (null !== $resource) { return $this->exclusiveLock === $this->getResourceId($resource); } return null !== $this->exclusiveLock; }
php
public function hasExclusiveLock($resource = null): bool { if (null !== $resource) { return $this->exclusiveLock === $this->getResourceId($resource); } return null !== $this->exclusiveLock; }
[ "public", "function", "hasExclusiveLock", "(", "$", "resource", "=", "null", ")", ":", "bool", "{", "if", "(", "null", "!==", "$", "resource", ")", "{", "return", "$", "this", "->", "exclusiveLock", "===", "$", "this", "->", "getResourceId", "(", "$", ...
checks whether file is locked in exclusive mode @param resource|vfsStreamWrapper $resource @return bool @since 0.10.0 @see https://github.com/mikey179/vfsStream/issues/6 @see https://github.com/mikey179/vfsStream/issues/40
[ "checks", "whether", "file", "is", "locked", "in", "exclusive", "mode" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamFile.php#L388-L395
bovigo/vfsStream
src/main/php/org/bovigo/vfs/Quota.php
Quota.spaceLeft
public function spaceLeft(int $usedSpace): int { if (self::UNLIMITED === $this->amount) { return $usedSpace; } if ($usedSpace >= $this->amount) { return 0; } $spaceLeft = $this->amount - $usedSpace; if (0 >= $spaceLeft) { return 0...
php
public function spaceLeft(int $usedSpace): int { if (self::UNLIMITED === $this->amount) { return $usedSpace; } if ($usedSpace >= $this->amount) { return 0; } $spaceLeft = $this->amount - $usedSpace; if (0 >= $spaceLeft) { return 0...
[ "public", "function", "spaceLeft", "(", "int", "$", "usedSpace", ")", ":", "int", "{", "if", "(", "self", "::", "UNLIMITED", "===", "$", "this", "->", "amount", ")", "{", "return", "$", "usedSpace", ";", "}", "if", "(", "$", "usedSpace", ">=", "$", ...
checks if given used space exceeda quota limit @param int $usedSpace @return int
[ "checks", "if", "given", "used", "space", "exceeda", "quota", "limit" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/Quota.php#L70-L86
bovigo/vfsStream
src/main/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitor.php
vfsStreamStructureVisitor.visitBlockDevice
public function visitBlockDevice(vfsStreamBlock $block): vfsStreamVisitor { $this->current['[' . $block->getName() . ']'] = $block->getContent(); return $this; }
php
public function visitBlockDevice(vfsStreamBlock $block): vfsStreamVisitor { $this->current['[' . $block->getName() . ']'] = $block->getContent(); return $this; }
[ "public", "function", "visitBlockDevice", "(", "vfsStreamBlock", "$", "block", ")", ":", "vfsStreamVisitor", "{", "$", "this", "->", "current", "[", "'['", ".", "$", "block", "->", "getName", "(", ")", ".", "']'", "]", "=", "$", "block", "->", "getConten...
visit a block device and process it @param vfsStreamBlock $block @return vfsStreamStructureVisitor
[ "visit", "a", "block", "device", "and", "process", "it" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitor.php#L65-L69
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/LargeFileContent.php
LargeFileContent.doRead
protected function doRead(int $offset, int $count): string { if (($offset + $count) > $this->size) { $count = $this->size - $offset; } $result = ''; for ($i = 0; $i < $count; $i++) { $result .= $this->content[$i + $offset] ?? ' '; } return $r...
php
protected function doRead(int $offset, int $count): string { if (($offset + $count) > $this->size) { $count = $this->size - $offset; } $result = ''; for ($i = 0; $i < $count; $i++) { $result .= $this->content[$i + $offset] ?? ' '; } return $r...
[ "protected", "function", "doRead", "(", "int", "$", "offset", ",", "int", "$", "count", ")", ":", "string", "{", "if", "(", "(", "$", "offset", "+", "$", "count", ")", ">", "$", "this", "->", "size", ")", "{", "$", "count", "=", "$", "this", "-...
actual reading of given byte count starting at given offset @param int $offset @param int $count @return string
[ "actual", "reading", "of", "given", "byte", "count", "starting", "at", "given", "offset" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/LargeFileContent.php#L111-L123
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/LargeFileContent.php
LargeFileContent.doWrite
protected function doWrite(string $data, int $offset, int $length) { for ($i = 0; $i < $length; $i++) { $this->content[$i + $offset] = $data{$i}; } if ($offset >= $this->size) { $this->size += $length; } elseif (($offset + $length) > $this->size) { ...
php
protected function doWrite(string $data, int $offset, int $length) { for ($i = 0; $i < $length; $i++) { $this->content[$i + $offset] = $data{$i}; } if ($offset >= $this->size) { $this->size += $length; } elseif (($offset + $length) > $this->size) { ...
[ "protected", "function", "doWrite", "(", "string", "$", "data", ",", "int", "$", "offset", ",", "int", "$", "length", ")", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "length", ";", "$", "i", "++", ")", "{", "$", "this", "->...
actual writing of data with specified length at given offset @param string $data @param int $offset @param int $length
[ "actual", "writing", "of", "data", "with", "specified", "length", "at", "given", "offset" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/LargeFileContent.php#L132-L143
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/LargeFileContent.php
LargeFileContent.truncate
public function truncate(int $size): bool { $this->size = $size; foreach (array_filter(array_keys($this->content), function($pos) use ($size) { return $pos >= $size; } ...
php
public function truncate(int $size): bool { $this->size = $size; foreach (array_filter(array_keys($this->content), function($pos) use ($size) { return $pos >= $size; } ...
[ "public", "function", "truncate", "(", "int", "$", "size", ")", ":", "bool", "{", "$", "this", "->", "size", "=", "$", "size", ";", "foreach", "(", "array_filter", "(", "array_keys", "(", "$", "this", "->", "content", ")", ",", "function", "(", "$", ...
Truncates a file to a given length @param int $size length to truncate file to @return bool
[ "Truncates", "a", "file", "to", "a", "given", "length" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/LargeFileContent.php#L151-L164
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.url
public static function url(string $path): string { return self::SCHEME . '://' . join( '/', array_map( 'rawurlencode', // ensure singe path parts are correctly urlencoded explode( '/', ...
php
public static function url(string $path): string { return self::SCHEME . '://' . join( '/', array_map( 'rawurlencode', // ensure singe path parts are correctly urlencoded explode( '/', ...
[ "public", "static", "function", "url", "(", "string", "$", "path", ")", ":", "string", "{", "return", "self", "::", "SCHEME", ".", "'://'", ".", "join", "(", "'/'", ",", "array_map", "(", "'rawurlencode'", ",", "// ensure singe path parts are correctly urlencode...
prepends the scheme to the given URL @param string $path path to translate to vfsStream url @return string
[ "prepends", "the", "scheme", "to", "the", "given", "URL" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L69-L81
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.path
public static function path(string $url): string { // remove line feeds and trailing whitespaces and path separators $path = trim($url, " \t\r\n\0\x0B/\\"); $path = substr($path, strlen(self::SCHEME . '://')); $path = str_replace('\\', '/', $path); // replace double slashes w...
php
public static function path(string $url): string { // remove line feeds and trailing whitespaces and path separators $path = trim($url, " \t\r\n\0\x0B/\\"); $path = substr($path, strlen(self::SCHEME . '://')); $path = str_replace('\\', '/', $path); // replace double slashes w...
[ "public", "static", "function", "path", "(", "string", "$", "url", ")", ":", "string", "{", "// remove line feeds and trailing whitespaces and path separators", "$", "path", "=", "trim", "(", "$", "url", ",", "\" \\t\\r\\n\\0\\x0B/\\\\\"", ")", ";", "$", "path", "...
restores the path from the url @param string $url vfsStream url to translate into path @return string
[ "restores", "the", "path", "from", "the", "url" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L89-L98
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.umask
public static function umask(int $umask = null): int { $oldUmask = self::$umask; if (null !== $umask) { self::$umask = $umask; } return $oldUmask; }
php
public static function umask(int $umask = null): int { $oldUmask = self::$umask; if (null !== $umask) { self::$umask = $umask; } return $oldUmask; }
[ "public", "static", "function", "umask", "(", "int", "$", "umask", "=", "null", ")", ":", "int", "{", "$", "oldUmask", "=", "self", "::", "$", "umask", ";", "if", "(", "null", "!==", "$", "umask", ")", "{", "self", "::", "$", "umask", "=", "$", ...
sets new umask setting and returns previous umask setting If no value is given only the current umask setting is returned. @param int|null $umask new umask setting @return int @since 0.8.0
[ "sets", "new", "umask", "setting", "and", "returns", "previous", "umask", "setting" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L109-L117
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.setup
public static function setup(string $rootDirName = 'root', int $permissions = null, array $structure = []): vfsStreamDirectory { vfsStreamWrapper::register(); return self::create($structure, vfsStreamWrapper::setRoot(self::newDirectory($rootDirName, $permissions))); }
php
public static function setup(string $rootDirName = 'root', int $permissions = null, array $structure = []): vfsStreamDirectory { vfsStreamWrapper::register(); return self::create($structure, vfsStreamWrapper::setRoot(self::newDirectory($rootDirName, $permissions))); }
[ "public", "static", "function", "setup", "(", "string", "$", "rootDirName", "=", "'root'", ",", "int", "$", "permissions", "=", "null", ",", "array", "$", "structure", "=", "[", "]", ")", ":", "vfsStreamDirectory", "{", "vfsStreamWrapper", "::", "register", ...
helper method for setting up vfsStream in unit tests Instead of vfsStreamWrapper::register(); vfsStreamWrapper::setRoot(vfsStream::newDirectory('root')); you can simply do vfsStream::setup() which yields the same result. Additionally, the method returns the freshly created root directory which you can use to make furt...
[ "helper", "method", "for", "setting", "up", "vfsStream", "in", "unit", "tests" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L165-L169
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.create
public static function create(array $structure, vfsStreamDirectory $baseDir = null): vfsStreamDirectory { if (null === $baseDir) { $baseDir = vfsStreamWrapper::getRoot(); } if (null === $baseDir) { throw new \InvalidArgumentException('No baseDir given and no root dir...
php
public static function create(array $structure, vfsStreamDirectory $baseDir = null): vfsStreamDirectory { if (null === $baseDir) { $baseDir = vfsStreamWrapper::getRoot(); } if (null === $baseDir) { throw new \InvalidArgumentException('No baseDir given and no root dir...
[ "public", "static", "function", "create", "(", "array", "$", "structure", ",", "vfsStreamDirectory", "$", "baseDir", "=", "null", ")", ":", "vfsStreamDirectory", "{", "if", "(", "null", "===", "$", "baseDir", ")", "{", "$", "baseDir", "=", "vfsStreamWrapper"...
creates vfsStream directory structure from an array and adds it to given base dir Assumed $structure contains an array like this: <code> array('Core' = array('AbstractFactory' => array('test.php' => 'some text content', 'other.php' => 'Some more text content', 'Invalid.csv' => 'Something else', ), 'AnEmptyFolder'...
[ "creates", "vfsStream", "directory", "structure", "from", "an", "array", "and", "adds", "it", "to", "given", "base", "dir" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L212-L223
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.addStructure
protected static function addStructure(array $structure, vfsStreamDirectory $baseDir): vfsStreamDirectory { foreach ($structure as $name => $data) { $name = (string) $name; if (is_array($data) === true) { self::addStructure($data, self::newDirectory($name)->at($baseDi...
php
protected static function addStructure(array $structure, vfsStreamDirectory $baseDir): vfsStreamDirectory { foreach ($structure as $name => $data) { $name = (string) $name; if (is_array($data) === true) { self::addStructure($data, self::newDirectory($name)->at($baseDi...
[ "protected", "static", "function", "addStructure", "(", "array", "$", "structure", ",", "vfsStreamDirectory", "$", "baseDir", ")", ":", "vfsStreamDirectory", "{", "foreach", "(", "$", "structure", "as", "$", "name", "=>", "$", "data", ")", "{", "$", "name", ...
helper method to create subdirectories recursively @param array $structure subdirectory structure to add @param vfsStreamDirectory $baseDir directory to add the structure to @return vfsStreamDirectory
[ "helper", "method", "to", "create", "subdirectories", "recursively" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L232-L254
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.copyFromFileSystem
public static function copyFromFileSystem(string $path, vfsStreamDirectory $baseDir = null, int $maxFileSize = 1048576): vfsStreamDirectory { if (null === $baseDir) { /** @var vfsStreamDirectory|null $baseDir **/ $baseDir = vfsStreamWrapper::getRoot(); } if (null ===...
php
public static function copyFromFileSystem(string $path, vfsStreamDirectory $baseDir = null, int $maxFileSize = 1048576): vfsStreamDirectory { if (null === $baseDir) { /** @var vfsStreamDirectory|null $baseDir **/ $baseDir = vfsStreamWrapper::getRoot(); } if (null ===...
[ "public", "static", "function", "copyFromFileSystem", "(", "string", "$", "path", ",", "vfsStreamDirectory", "$", "baseDir", "=", "null", ",", "int", "$", "maxFileSize", "=", "1048576", ")", ":", "vfsStreamDirectory", "{", "if", "(", "null", "===", "$", "bas...
copies the file system structure from given path into the base dir If no baseDir is given it will try to add the structure to the existing root directory without replacing existing childs except those with equal names. File permissions are copied as well. Please note that file contents will only be copied if their fil...
[ "copies", "the", "file", "system", "structure", "from", "given", "path", "into", "the", "base", "dir" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L276-L329
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.newFile
public static function newFile(string $name, int $permissions = null): vfsStreamFile { return new vfsStreamFile($name, $permissions); }
php
public static function newFile(string $name, int $permissions = null): vfsStreamFile { return new vfsStreamFile($name, $permissions); }
[ "public", "static", "function", "newFile", "(", "string", "$", "name", ",", "int", "$", "permissions", "=", "null", ")", ":", "vfsStreamFile", "{", "return", "new", "vfsStreamFile", "(", "$", "name", ",", "$", "permissions", ")", ";", "}" ]
returns a new file with given name @param string $name name of file to create @param int|null $permissions permissions of file to create @return vfsStreamFile
[ "returns", "a", "new", "file", "with", "given", "name" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L338-L341
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.newDirectory
public static function newDirectory(string $name, int $permissions = null): vfsStreamDirectory { if ('/' === $name{0}) { $name = substr($name, 1); } $firstSlash = strpos($name, '/'); if (false === $firstSlash) { return new vfsStreamDirectory($name, $permissio...
php
public static function newDirectory(string $name, int $permissions = null): vfsStreamDirectory { if ('/' === $name{0}) { $name = substr($name, 1); } $firstSlash = strpos($name, '/'); if (false === $firstSlash) { return new vfsStreamDirectory($name, $permissio...
[ "public", "static", "function", "newDirectory", "(", "string", "$", "name", ",", "int", "$", "permissions", "=", "null", ")", ":", "vfsStreamDirectory", "{", "if", "(", "'/'", "===", "$", "name", "{", "0", "}", ")", "{", "$", "name", "=", "substr", "...
returns a new directory with given name If the name contains slashes, a new directory structure will be created. The returned directory will always be the parent directory of this directory structure. @param string $name name of directory to create @param int|null $permissions permissions of director...
[ "returns", "a", "new", "directory", "with", "given", "name" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L354-L373
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.newBlock
public static function newBlock(string $name, int $permissions = null): vfsStreamBlock { return new vfsStreamBlock($name, $permissions); }
php
public static function newBlock(string $name, int $permissions = null): vfsStreamBlock { return new vfsStreamBlock($name, $permissions); }
[ "public", "static", "function", "newBlock", "(", "string", "$", "name", ",", "int", "$", "permissions", "=", "null", ")", ":", "vfsStreamBlock", "{", "return", "new", "vfsStreamBlock", "(", "$", "name", ",", "$", "permissions", ")", ";", "}" ]
returns a new block with the given name @param string $name name of the block device @param int|null $permissions permissions of block to create @return vfsStreamBlock
[ "returns", "a", "new", "block", "with", "the", "given", "name" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L382-L385
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStream.php
vfsStream.inspect
public static function inspect(vfsStreamVisitor $visitor, vfsStreamContent $content = null): vfsStreamVisitor { if (null !== $content) { return $visitor->visit($content); } $root = vfsStreamWrapper::getRoot(); if (null === $root) { throw new \InvalidArgumentE...
php
public static function inspect(vfsStreamVisitor $visitor, vfsStreamContent $content = null): vfsStreamVisitor { if (null !== $content) { return $visitor->visit($content); } $root = vfsStreamWrapper::getRoot(); if (null === $root) { throw new \InvalidArgumentE...
[ "public", "static", "function", "inspect", "(", "vfsStreamVisitor", "$", "visitor", ",", "vfsStreamContent", "$", "content", "=", "null", ")", ":", "vfsStreamVisitor", "{", "if", "(", "null", "!==", "$", "content", ")", "{", "return", "$", "visitor", "->", ...
use visitor to inspect a content structure If the given content is null it will fall back to use the current root directory of the stream wrapper. Returns given visitor for method chaining comfort. @param vfsStreamVisitor $visitor the visitor who inspects @param vfsStreamContent|null $content directory ...
[ "use", "visitor", "to", "inspect", "a", "content", "structure" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStream.php#L426-L438
bovigo/vfsStream
src/main/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.php
vfsStreamPrintVisitor.visitBlockDevice
public function visitBlockDevice(vfsStreamBlock $block): vfsStreamVisitor { $name = '[' . $block->getName() . ']'; $this->printContent($name); return $this; }
php
public function visitBlockDevice(vfsStreamBlock $block): vfsStreamVisitor { $name = '[' . $block->getName() . ']'; $this->printContent($name); return $this; }
[ "public", "function", "visitBlockDevice", "(", "vfsStreamBlock", "$", "block", ")", ":", "vfsStreamVisitor", "{", "$", "name", "=", "'['", ".", "$", "block", "->", "getName", "(", ")", ".", "']'", ";", "$", "this", "->", "printContent", "(", "$", "name",...
visit a block device and process it @param vfsStreamBlock $block @return vfsStreamPrintVisitor
[ "visit", "a", "block", "device", "and", "process", "it" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.php#L73-L78
bovigo/vfsStream
src/main/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.php
vfsStreamPrintVisitor.printContent
protected function printContent(string $name) { fwrite($this->out, str_repeat(' ', $this->depth) . '- ' . $name . "\n"); }
php
protected function printContent(string $name) { fwrite($this->out, str_repeat(' ', $this->depth) . '- ' . $name . "\n"); }
[ "protected", "function", "printContent", "(", "string", "$", "name", ")", "{", "fwrite", "(", "$", "this", "->", "out", ",", "str_repeat", "(", "' '", ",", "$", "this", "->", "depth", ")", ".", "'- '", ".", "$", "name", ".", "\"\\n\"", ")", ";", "...
helper method to print the content @param string $name
[ "helper", "method", "to", "print", "the", "content" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.php#L103-L106
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.unregister
public static function unregister() { if (!self::$registered) { if (in_array(vfsStream::SCHEME, stream_get_wrappers())) { throw new vfsStreamException('The URL wrapper for the protocol ' . vfsStream::SCHEME . ' was not registered with this version of vfsStream.'); } ...
php
public static function unregister() { if (!self::$registered) { if (in_array(vfsStream::SCHEME, stream_get_wrappers())) { throw new vfsStreamException('The URL wrapper for the protocol ' . vfsStream::SCHEME . ' was not registered with this version of vfsStream.'); } ...
[ "public", "static", "function", "unregister", "(", ")", "{", "if", "(", "!", "self", "::", "$", "registered", ")", "{", "if", "(", "in_array", "(", "vfsStream", "::", "SCHEME", ",", "stream_get_wrappers", "(", ")", ")", ")", "{", "throw", "new", "vfsSt...
Unregisters a previously registered URL wrapper for the vfs scheme. If this stream wrapper wasn't registered, the method returns silently. If unregistering fails, or if the URL wrapper for vfs:// was not registered with this class, a vfsStreamException will be thrown. @throws vfsStreamException @since 1.6.0
[ "Unregisters", "a", "previously", "registered", "URL", "wrapper", "for", "the", "vfs", "scheme", "." ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L130-L144
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.setRoot
public static function setRoot(vfsStreamDirectory $root): vfsStreamDirectory { self::$root = $root; clearstatcache(); return self::$root; }
php
public static function setRoot(vfsStreamDirectory $root): vfsStreamDirectory { self::$root = $root; clearstatcache(); return self::$root; }
[ "public", "static", "function", "setRoot", "(", "vfsStreamDirectory", "$", "root", ")", ":", "vfsStreamDirectory", "{", "self", "::", "$", "root", "=", "$", "root", ";", "clearstatcache", "(", ")", ";", "return", "self", "::", "$", "root", ";", "}" ]
sets the root content @param vfsStreamDirectory $root @return vfsStreamDirectory
[ "sets", "the", "root", "content" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L152-L157
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.getContent
protected function getContent(string $path): ?vfsStreamContent { if (null === self::$root) { return null; } if (self::$root->getName() === $path) { return self::$root; } if ($this->isInRoot($path) && self::$root->hasChild($path) === true) { ...
php
protected function getContent(string $path): ?vfsStreamContent { if (null === self::$root) { return null; } if (self::$root->getName() === $path) { return self::$root; } if ($this->isInRoot($path) && self::$root->hasChild($path) === true) { ...
[ "protected", "function", "getContent", "(", "string", "$", "path", ")", ":", "?", "vfsStreamContent", "{", "if", "(", "null", "===", "self", "::", "$", "root", ")", "{", "return", "null", ";", "}", "if", "(", "self", "::", "$", "root", "->", "getName...
returns content for given path @param string $path @return vfsStreamContent|null
[ "returns", "content", "for", "given", "path" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L186-L201
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.isInRoot
private function isInRoot(string $path): bool { return substr($path, 0, strlen(self::$root->getName())) === self::$root->getName(); }
php
private function isInRoot(string $path): bool { return substr($path, 0, strlen(self::$root->getName())) === self::$root->getName(); }
[ "private", "function", "isInRoot", "(", "string", "$", "path", ")", ":", "bool", "{", "return", "substr", "(", "$", "path", ",", "0", ",", "strlen", "(", "self", "::", "$", "root", "->", "getName", "(", ")", ")", ")", "===", "self", "::", "$", "r...
helper method to detect whether given path is in root path @param string $path @return bool
[ "helper", "method", "to", "detect", "whether", "given", "path", "is", "in", "root", "path" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L209-L212
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.getContentOfType
protected function getContentOfType(string $path, int $type): ?vfsStreamContent { $content = $this->getContent($path); if (null !== $content && $content->getType() === $type) { return $content; } return null; }
php
protected function getContentOfType(string $path, int $type): ?vfsStreamContent { $content = $this->getContent($path); if (null !== $content && $content->getType() === $type) { return $content; } return null; }
[ "protected", "function", "getContentOfType", "(", "string", "$", "path", ",", "int", "$", "type", ")", ":", "?", "vfsStreamContent", "{", "$", "content", "=", "$", "this", "->", "getContent", "(", "$", "path", ")", ";", "if", "(", "null", "!==", "$", ...
returns content for given path but only when it is of given type @param string $path @param int $type @return vfsStreamContent|null
[ "returns", "content", "for", "given", "path", "but", "only", "when", "it", "is", "of", "given", "type" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L221-L229
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.stream_open
public function stream_open(string $path, string $mode, int $options, string $opened_path = null): bool { $extended = ((strstr($mode, '+') !== false) ? (true) : (false)); $mode = str_replace(['t', 'b', '+'], '', $mode); if (in_array($mode, ['r', 'w', 'a', 'x', 'c']) === false) { ...
php
public function stream_open(string $path, string $mode, int $options, string $opened_path = null): bool { $extended = ((strstr($mode, '+') !== false) ? (true) : (false)); $mode = str_replace(['t', 'b', '+'], '', $mode); if (in_array($mode, ['r', 'w', 'a', 'x', 'c']) === false) { ...
[ "public", "function", "stream_open", "(", "string", "$", "path", ",", "string", "$", "mode", ",", "int", "$", "options", ",", "string", "$", "opened_path", "=", "null", ")", ":", "bool", "{", "$", "extended", "=", "(", "(", "strstr", "(", "$", "mode"...
open the stream @param string $path the path to open @param string $mode mode for opening @param int $options options for opening @param string|null $opened_path full path that was actually opened @return bool
[ "open", "the", "stream" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L281-L340
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.createFile
private function createFile(string $path, string $mode = null, int $options = null) { $names = $this->splitPath($path); if (empty($names['dirname']) === true) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('File ' . $names['basename'] . ...
php
private function createFile(string $path, string $mode = null, int $options = null) { $names = $this->splitPath($path); if (empty($names['dirname']) === true) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('File ' . $names['basename'] . ...
[ "private", "function", "createFile", "(", "string", "$", "path", ",", "string", "$", "mode", "=", "null", ",", "int", "$", "options", "=", "null", ")", "{", "$", "names", "=", "$", "this", "->", "splitPath", "(", "$", "path", ")", ";", "if", "(", ...
creates a file at given path @param string $path the path to open @param string|null $mode mode for opening @param int|null $options options for opening @return vfsStreamFile|false
[ "creates", "a", "file", "at", "given", "path" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L350-L397
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.calculateMode
protected function calculateMode(string $mode, bool $extended): int { if (true === $extended) { return self::ALL; } if (self::READ === $mode) { return self::READONLY; } return self::WRITEONLY; }
php
protected function calculateMode(string $mode, bool $extended): int { if (true === $extended) { return self::ALL; } if (self::READ === $mode) { return self::READONLY; } return self::WRITEONLY; }
[ "protected", "function", "calculateMode", "(", "string", "$", "mode", ",", "bool", "$", "extended", ")", ":", "int", "{", "if", "(", "true", "===", "$", "extended", ")", "{", "return", "self", "::", "ALL", ";", "}", "if", "(", "self", "::", "READ", ...
calculates the file mode @param string $mode opening mode: r, w, a or x @param bool $extended true if + was set with opening mode @return int
[ "calculates", "the", "file", "mode" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L406-L417
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.stream_write
public function stream_write(string $data): int { if (self::READONLY === $this->mode) { return 0; } if ($this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return 0; } if (self::$quota->isLimited()) { ...
php
public function stream_write(string $data): int { if (self::READONLY === $this->mode) { return 0; } if ($this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return 0; } if (self::$quota->isLimited()) { ...
[ "public", "function", "stream_write", "(", "string", "$", "data", ")", ":", "int", "{", "if", "(", "self", "::", "READONLY", "===", "$", "this", "->", "mode", ")", "{", "return", "0", ";", "}", "if", "(", "$", "this", "->", "content", "->", "isWrit...
writes data into the stream @param string $data @return int amount of bytes written
[ "writes", "data", "into", "the", "stream" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L454-L469
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.stream_truncate
public function stream_truncate(int $size): bool { if (self::READONLY === $this->mode) { return false; } if ($this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return false; } if ($this->content->getTyp...
php
public function stream_truncate(int $size): bool { if (self::READONLY === $this->mode) { return false; } if ($this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return false; } if ($this->content->getTyp...
[ "public", "function", "stream_truncate", "(", "int", "$", "size", ")", ":", "bool", "{", "if", "(", "self", "::", "READONLY", "===", "$", "this", "->", "mode", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "content", "->", "i...
truncates a file to a given length @param int $size length to truncate file to @return bool @since 1.1.0
[ "truncates", "a", "file", "to", "a", "given", "length" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L478-L504
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.stream_metadata
public function stream_metadata(string $path, int $option, $var): bool { $path = $this->resolvePath(vfsStream::path($path)); /** @var vfsStreamAbstractContent|null $content */ $content = $this->getContent($path); switch ($option) { case STREAM_META_TOUCH: ...
php
public function stream_metadata(string $path, int $option, $var): bool { $path = $this->resolvePath(vfsStream::path($path)); /** @var vfsStreamAbstractContent|null $content */ $content = $this->getContent($path); switch ($option) { case STREAM_META_TOUCH: ...
[ "public", "function", "stream_metadata", "(", "string", "$", "path", ",", "int", "$", "option", ",", "$", "var", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "resolvePath", "(", "vfsStream", "::", "path", "(", "$", "path", ")", ")", ...
sets metadata like owner, user or permissions @param string $path @param int $option @param mixed $var @return bool @since 1.1.0
[ "sets", "metadata", "like", "owner", "user", "or", "permissions" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L515-L578
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.doPermChange
private function doPermChange(string $path, vfsStreamAbstractContent $content, callable $change): bool { if (!$content->isOwnedByUser(vfsStream::getCurrentUser())) { return false; } if (self::$root->getName() !== $path) { $names = $this->splitPath($path); ...
php
private function doPermChange(string $path, vfsStreamAbstractContent $content, callable $change): bool { if (!$content->isOwnedByUser(vfsStream::getCurrentUser())) { return false; } if (self::$root->getName() !== $path) { $names = $this->splitPath($path); ...
[ "private", "function", "doPermChange", "(", "string", "$", "path", ",", "vfsStreamAbstractContent", "$", "content", ",", "callable", "$", "change", ")", ":", "bool", "{", "if", "(", "!", "$", "content", "->", "isOwnedByUser", "(", "vfsStream", "::", "getCurr...
executes given permission change when necessary rights allow such a change @param string $path @param vfsStreamAbstractContent $content @param callable $change @return bool
[ "executes", "given", "permission", "change", "when", "necessary", "rights", "allow", "such", "a", "change" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L588-L604
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.stream_seek
public function stream_seek(int $offset, int $whence): bool { return $this->content->seek($offset, $whence); }
php
public function stream_seek(int $offset, int $whence): bool { return $this->content->seek($offset, $whence); }
[ "public", "function", "stream_seek", "(", "int", "$", "offset", ",", "int", "$", "whence", ")", ":", "bool", "{", "return", "$", "this", "->", "content", "->", "seek", "(", "$", "offset", ",", "$", "whence", ")", ";", "}" ]
seeks to the given offset @param int $offset @param int $whence @return bool
[ "seeks", "to", "the", "given", "offset" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L633-L636
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.stream_stat
public function stream_stat(): array { $fileStat = [ 'dev' => 0, 'ino' => 0, 'mode' => $this->content->getType() | $this->content->getPermissions(), 'nlink' => 0, 'uid' => $this->content->getUser(), 'gid' => $this->...
php
public function stream_stat(): array { $fileStat = [ 'dev' => 0, 'ino' => 0, 'mode' => $this->content->getType() | $this->content->getPermissions(), 'nlink' => 0, 'uid' => $this->content->getUser(), 'gid' => $this->...
[ "public", "function", "stream_stat", "(", ")", ":", "array", "{", "$", "fileStat", "=", "[", "'dev'", "=>", "0", ",", "'ino'", "=>", "0", ",", "'mode'", "=>", "$", "this", "->", "content", "->", "getType", "(", ")", "|", "$", "this", "->", "content...
returns status of stream @return array
[ "returns", "status", "of", "stream" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L653-L671
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.stream_lock
public function stream_lock(int $operation): bool { if ((LOCK_NB & $operation) == LOCK_NB) { $operation = $operation - LOCK_NB; } return $this->content->lock($this, $operation); }
php
public function stream_lock(int $operation): bool { if ((LOCK_NB & $operation) == LOCK_NB) { $operation = $operation - LOCK_NB; } return $this->content->lock($this, $operation); }
[ "public", "function", "stream_lock", "(", "int", "$", "operation", ")", ":", "bool", "{", "if", "(", "(", "LOCK_NB", "&", "$", "operation", ")", "==", "LOCK_NB", ")", "{", "$", "operation", "=", "$", "operation", "-", "LOCK_NB", ";", "}", "return", "...
set lock status for stream @param int $operation @return bool @since 0.10.0 @see https://github.com/mikey179/vfsStream/issues/6 @see https://github.com/mikey179/vfsStream/issues/31 @see https://github.com/mikey179/vfsStream/issues/40
[ "set", "lock", "status", "for", "stream" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L699-L706
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.stream_set_option
public function stream_set_option(int $option, $arg1, $arg2) { switch ($option) { case STREAM_OPTION_BLOCKING: // break omitted case STREAM_OPTION_READ_TIMEOUT: // break omitted case STREAM_OPTION_WRITE_BUFFER: // break om...
php
public function stream_set_option(int $option, $arg1, $arg2) { switch ($option) { case STREAM_OPTION_BLOCKING: // break omitted case STREAM_OPTION_READ_TIMEOUT: // break omitted case STREAM_OPTION_WRITE_BUFFER: // break om...
[ "public", "function", "stream_set_option", "(", "int", "$", "option", ",", "$", "arg1", ",", "$", "arg2", ")", "{", "switch", "(", "$", "option", ")", "{", "case", "STREAM_OPTION_BLOCKING", ":", "// break omitted", "case", "STREAM_OPTION_READ_TIMEOUT", ":", "/...
sets options on the stream @param int $option key of option to set @param int $arg1 @param int $arg2 @return bool @since 0.10.0 @see https://github.com/mikey179/vfsStream/issues/15 @see http://www.php.net/manual/streamwrapper.stream-set-option.php
[ "sets", "options", "on", "the", "stream" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L719-L736
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.unlink
public function unlink(string $path): bool { $realPath = $this->resolvePath(vfsStream::path($path)); $content = $this->getContent($realPath); if (null === $content) { trigger_error('unlink(' . $path . '): No such file or directory', E_USER_WARNING); return false; ...
php
public function unlink(string $path): bool { $realPath = $this->resolvePath(vfsStream::path($path)); $content = $this->getContent($realPath); if (null === $content) { trigger_error('unlink(' . $path . '): No such file or directory', E_USER_WARNING); return false; ...
[ "public", "function", "unlink", "(", "string", "$", "path", ")", ":", "bool", "{", "$", "realPath", "=", "$", "this", "->", "resolvePath", "(", "vfsStream", "::", "path", "(", "$", "path", ")", ")", ";", "$", "content", "=", "$", "this", "->", "get...
remove the data under the given path @param string $path @return bool
[ "remove", "the", "data", "under", "the", "given", "path" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L744-L759
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.doUnlink
protected function doUnlink(string $path): bool { if (self::$root->getName() === $path) { // delete root? very brave. :) self::$root = null; clearstatcache(); return true; } $names = $this->splitPath($path); /** @var vfsStreamDirector...
php
protected function doUnlink(string $path): bool { if (self::$root->getName() === $path) { // delete root? very brave. :) self::$root = null; clearstatcache(); return true; } $names = $this->splitPath($path); /** @var vfsStreamDirector...
[ "protected", "function", "doUnlink", "(", "string", "$", "path", ")", ":", "bool", "{", "if", "(", "self", "::", "$", "root", "->", "getName", "(", ")", "===", "$", "path", ")", "{", "// delete root? very brave. :)", "self", "::", "$", "root", "=", "nu...
removes a path @param string $path @return bool
[ "removes", "a", "path" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L767-L786
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.rename
public function rename(string $path_from, string $path_to): bool { $srcRealPath = $this->resolvePath(vfsStream::path($path_from)); $dstRealPath = $this->resolvePath(vfsStream::path($path_to)); $srcContent = $this->getContent($srcRealPath); if (null === $srcContent) { tri...
php
public function rename(string $path_from, string $path_to): bool { $srcRealPath = $this->resolvePath(vfsStream::path($path_from)); $dstRealPath = $this->resolvePath(vfsStream::path($path_to)); $srcContent = $this->getContent($srcRealPath); if (null === $srcContent) { tri...
[ "public", "function", "rename", "(", "string", "$", "path_from", ",", "string", "$", "path_to", ")", ":", "bool", "{", "$", "srcRealPath", "=", "$", "this", "->", "resolvePath", "(", "vfsStream", "::", "path", "(", "$", "path_from", ")", ")", ";", "$",...
rename from one path to another @param string $path_from @param string $path_to @return bool @author Benoit Aubuchon
[ "rename", "from", "one", "path", "to", "another" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L796-L834
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.mkdir
public function mkdir(string $path, int $mode, int $options): bool { $umask = vfsStream::umask(); if (0 < $umask) { $permissions = $mode & ~$umask; } else { $permissions = $mode; } $path = $this->resolvePath(vfsStream::path($path)); if (null !...
php
public function mkdir(string $path, int $mode, int $options): bool { $umask = vfsStream::umask(); if (0 < $umask) { $permissions = $mode & ~$umask; } else { $permissions = $mode; } $path = $this->resolvePath(vfsStream::path($path)); if (null !...
[ "public", "function", "mkdir", "(", "string", "$", "path", ",", "int", "$", "mode", ",", "int", "$", "options", ")", ":", "bool", "{", "$", "umask", "=", "vfsStream", "::", "umask", "(", ")", ";", "if", "(", "0", "<", "$", "umask", ")", "{", "$...
creates a new directory @param string $path @param int $mode @param int $options @return bool
[ "creates", "a", "new", "directory" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L844-L892
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.rmdir
public function rmdir(string $path, int $options): bool { $path = $this->resolvePath(vfsStream::path($path)); /** @var vfsStreamDirectory|null $child */ $child = $this->getContentOfType($path, vfsStreamContent::TYPE_DIR); if (null === $child) { return false; } ...
php
public function rmdir(string $path, int $options): bool { $path = $this->resolvePath(vfsStream::path($path)); /** @var vfsStreamDirectory|null $child */ $child = $this->getContentOfType($path, vfsStreamContent::TYPE_DIR); if (null === $child) { return false; } ...
[ "public", "function", "rmdir", "(", "string", "$", "path", ",", "int", "$", "options", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "resolvePath", "(", "vfsStream", "::", "path", "(", "$", "path", ")", ")", ";", "/** @var vfsStreamDirect...
removes a directory @param string $path @param int $options @return bool @todo consider $options with STREAM_MKDIR_RECURSIVE
[ "removes", "a", "directory" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L902-L934
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.dir_opendir
public function dir_opendir(string $path, int $options): bool { $path = $this->resolvePath(vfsStream::path($path)); $this->dir = null; /** @var vfsStreamDirectory|null $dir */ $dir = $this->getContentOfType($path, vfsStreamContent::TYPE_DIR); if (null === $dir) { ...
php
public function dir_opendir(string $path, int $options): bool { $path = $this->resolvePath(vfsStream::path($path)); $this->dir = null; /** @var vfsStreamDirectory|null $dir */ $dir = $this->getContentOfType($path, vfsStreamContent::TYPE_DIR); if (null === $dir) { ...
[ "public", "function", "dir_opendir", "(", "string", "$", "path", ",", "int", "$", "options", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "resolvePath", "(", "vfsStream", "::", "path", "(", "$", "path", ")", ")", ";", "$", "this", "-...
opens a directory @param string $path @param int $options @return bool
[ "opens", "a", "directory" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L943-L961
bovigo/vfsStream
src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
vfsStreamWrapper.dir_readdir
public function dir_readdir() { $dir = $this->dirIterator->current(); if (null === $dir) { return false; } $this->dirIterator->next(); return $dir->getName(); }
php
public function dir_readdir() { $dir = $this->dirIterator->current(); if (null === $dir) { return false; } $this->dirIterator->next(); return $dir->getName(); }
[ "public", "function", "dir_readdir", "(", ")", "{", "$", "dir", "=", "$", "this", "->", "dirIterator", "->", "current", "(", ")", ";", "if", "(", "null", "===", "$", "dir", ")", "{", "return", "false", ";", "}", "$", "this", "->", "dirIterator", "-...
reads directory contents @return string|bool
[ "reads", "directory", "contents" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php#L968-L977
bovigo/vfsStream
examples/FilemodeExample.php
FilemodeExample.setDirectory
public function setDirectory($directory) { $this->directory = $directory . DIRECTORY_SEPARATOR . $this->id; if (file_exists($this->directory) === false) { mkdir($this->directory, $this->fileMode, true); } }
php
public function setDirectory($directory) { $this->directory = $directory . DIRECTORY_SEPARATOR . $this->id; if (file_exists($this->directory) === false) { mkdir($this->directory, $this->fileMode, true); } }
[ "public", "function", "setDirectory", "(", "$", "directory", ")", "{", "$", "this", "->", "directory", "=", "$", "directory", ".", "DIRECTORY_SEPARATOR", ".", "$", "this", "->", "id", ";", "if", "(", "file_exists", "(", "$", "this", "->", "directory", ")...
sets the directory @param string $directory
[ "sets", "the", "directory" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/examples/FilemodeExample.php#L52-L58
bovigo/vfsStream
src/main/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitor.php
vfsStreamAbstractVisitor.visit
public function visit(vfsStreamContent $content): vfsStreamVisitor { if ($content instanceof vfsStreamBlock) { $this->visitBlockDevice($content); } elseif ($content instanceof vfsStreamFile) { $this->visitFile($content); } elseif ($content instanceof vfsStreamDirector...
php
public function visit(vfsStreamContent $content): vfsStreamVisitor { if ($content instanceof vfsStreamBlock) { $this->visitBlockDevice($content); } elseif ($content instanceof vfsStreamFile) { $this->visitFile($content); } elseif ($content instanceof vfsStreamDirector...
[ "public", "function", "visit", "(", "vfsStreamContent", "$", "content", ")", ":", "vfsStreamVisitor", "{", "if", "(", "$", "content", "instanceof", "vfsStreamBlock", ")", "{", "$", "this", "->", "visitBlockDevice", "(", "$", "content", ")", ";", "}", "elseif...
visit a content and process it @param vfsStreamContent $content @return vfsStreamVisitor @throws \InvalidArgumentException
[ "visit", "a", "content", "and", "process", "it" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitor.php#L32-L47
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/SeekableFileContent.php
SeekableFileContent.read
public function read(int $count): string { $data = $this->doRead($this->offset, $count); $this->offset += $count; return $data; }
php
public function read(int $count): string { $data = $this->doRead($this->offset, $count); $this->offset += $count; return $data; }
[ "public", "function", "read", "(", "int", "$", "count", ")", ":", "string", "{", "$", "data", "=", "$", "this", "->", "doRead", "(", "$", "this", "->", "offset", ",", "$", "count", ")", ";", "$", "this", "->", "offset", "+=", "$", "count", ";", ...
reads the given amount of bytes from content @param int $count @return string
[ "reads", "the", "given", "amount", "of", "bytes", "from", "content" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/SeekableFileContent.php#L32-L37
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/SeekableFileContent.php
SeekableFileContent.seek
public function seek(int $offset, int $whence): bool { $newOffset = $this->offset; switch ($whence) { case SEEK_CUR: $newOffset += $offset; break; case SEEK_END: $newOffset = $this->size() + $offset; break; ...
php
public function seek(int $offset, int $whence): bool { $newOffset = $this->offset; switch ($whence) { case SEEK_CUR: $newOffset += $offset; break; case SEEK_END: $newOffset = $this->size() + $offset; break; ...
[ "public", "function", "seek", "(", "int", "$", "offset", ",", "int", "$", "whence", ")", ":", "bool", "{", "$", "newOffset", "=", "$", "this", "->", "offset", ";", "switch", "(", "$", "whence", ")", "{", "case", "SEEK_CUR", ":", "$", "newOffset", "...
seeks to the given offset @param int $offset @param int $whence @return bool
[ "seeks", "to", "the", "given", "offset" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/SeekableFileContent.php#L55-L81
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/SeekableFileContent.php
SeekableFileContent.write
public function write(string $data): int { $dataLength = strlen($data); $this->doWrite($data, $this->offset, $dataLength); $this->offset += $dataLength; return $dataLength; }
php
public function write(string $data): int { $dataLength = strlen($data); $this->doWrite($data, $this->offset, $dataLength); $this->offset += $dataLength; return $dataLength; }
[ "public", "function", "write", "(", "string", "$", "data", ")", ":", "int", "{", "$", "dataLength", "=", "strlen", "(", "$", "data", ")", ";", "$", "this", "->", "doWrite", "(", "$", "data", ",", "$", "this", "->", "offset", ",", "$", "dataLength",...
writes an amount of data @param string $data @return int amount of written bytes
[ "writes", "an", "amount", "of", "data" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/SeekableFileContent.php#L99-L105
bovigo/vfsStream
src/main/php/org/bovigo/vfs/content/SeekableFileContent.php
SeekableFileContent.readUntilEnd
public function readUntilEnd(): string { /** @var string|false $data */ $data = substr($this->content(), $this->offset); return (false === $data) ? '' : $data; }
php
public function readUntilEnd(): string { /** @var string|false $data */ $data = substr($this->content(), $this->offset); return (false === $data) ? '' : $data; }
[ "public", "function", "readUntilEnd", "(", ")", ":", "string", "{", "/** @var string|false $data */", "$", "data", "=", "substr", "(", "$", "this", "->", "content", "(", ")", ",", "$", "this", "->", "offset", ")", ";", "return", "(", "false", "===", "$",...
for backwards compatibility with vfsStreamFile::readUntilEnd() @return string @internal
[ "for", "backwards", "compatibility", "with", "vfsStreamFile", "::", "readUntilEnd", "()" ]
train
https://github.com/bovigo/vfsStream/blob/b46b9dfee1ce1e7c26a4389f07182373ec489c4c/src/main/php/org/bovigo/vfs/content/SeekableFileContent.php#L133-L138
FriendsOfSymfony/FOSRestBundle
Version/ChainVersionResolver.php
ChainVersionResolver.resolve
public function resolve(Request $request) { foreach ($this->resolvers as $resolver) { $version = $resolver->resolve($request); if (false !== $version) { return $version; } } return false; }
php
public function resolve(Request $request) { foreach ($this->resolvers as $resolver) { $version = $resolver->resolve($request); if (false !== $version) { return $version; } } return false; }
[ "public", "function", "resolve", "(", "Request", "$", "request", ")", "{", "foreach", "(", "$", "this", "->", "resolvers", "as", "$", "resolver", ")", "{", "$", "version", "=", "$", "resolver", "->", "resolve", "(", "$", "request", ")", ";", "if", "(...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Version/ChainVersionResolver.php#L39-L49
FriendsOfSymfony/FOSRestBundle
Exception/InvalidParameterException.php
InvalidParameterException.withViolationsAndMessage
public static function withViolationsAndMessage(ParamInterface $parameter, ConstraintViolationListInterface $violations, $message) { $exception = new self($message); $exception->parameter = $parameter; $exception->violations = $violations; return $exception; }
php
public static function withViolationsAndMessage(ParamInterface $parameter, ConstraintViolationListInterface $violations, $message) { $exception = new self($message); $exception->parameter = $parameter; $exception->violations = $violations; return $exception; }
[ "public", "static", "function", "withViolationsAndMessage", "(", "ParamInterface", "$", "parameter", ",", "ConstraintViolationListInterface", "$", "violations", ",", "$", "message", ")", "{", "$", "exception", "=", "new", "self", "(", "$", "message", ")", ";", "...
Do not use this method. It will be removed in 2.0. @param ParamInterface $parameter @param ConstraintViolationListInterface $violations @param string $message @return self @internal
[ "Do", "not", "use", "this", "method", ".", "It", "will", "be", "removed", "in", "2", ".", "0", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Exception/InvalidParameterException.php#L66-L73
FriendsOfSymfony/FOSRestBundle
Controller/ControllerTrait.php
ControllerTrait.view
protected function view($data = null, $statusCode = null, array $headers = []) { return View::create($data, $statusCode, $headers); }
php
protected function view($data = null, $statusCode = null, array $headers = []) { return View::create($data, $statusCode, $headers); }
[ "protected", "function", "view", "(", "$", "data", "=", "null", ",", "$", "statusCode", "=", "null", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "View", "::", "create", "(", "$", "data", ",", "$", "statusCode", ",", "$", "heade...
Creates a view. Convenience method to allow for a fluent interface. @param mixed $data @param int $statusCode @param array $headers @return View
[ "Creates", "a", "view", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/ControllerTrait.php#L66-L69
FriendsOfSymfony/FOSRestBundle
Controller/ControllerTrait.php
ControllerTrait.redirectView
protected function redirectView($url, $statusCode = Response::HTTP_FOUND, array $headers = []) { return View::createRedirect($url, $statusCode, $headers); }
php
protected function redirectView($url, $statusCode = Response::HTTP_FOUND, array $headers = []) { return View::createRedirect($url, $statusCode, $headers); }
[ "protected", "function", "redirectView", "(", "$", "url", ",", "$", "statusCode", "=", "Response", "::", "HTTP_FOUND", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "View", "::", "createRedirect", "(", "$", "url", ",", "$", "statusCode...
Creates a Redirect view. Convenience method to allow for a fluent interface. @param string $url @param int $statusCode @param array $headers @return View
[ "Creates", "a", "Redirect", "view", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/ControllerTrait.php#L82-L85
FriendsOfSymfony/FOSRestBundle
Controller/ControllerTrait.php
ControllerTrait.routeRedirectView
protected function routeRedirectView($route, array $parameters = [], $statusCode = Response::HTTP_CREATED, array $headers = []) { return View::createRouteRedirect($route, $parameters, $statusCode, $headers); }
php
protected function routeRedirectView($route, array $parameters = [], $statusCode = Response::HTTP_CREATED, array $headers = []) { return View::createRouteRedirect($route, $parameters, $statusCode, $headers); }
[ "protected", "function", "routeRedirectView", "(", "$", "route", ",", "array", "$", "parameters", "=", "[", "]", ",", "$", "statusCode", "=", "Response", "::", "HTTP_CREATED", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "View", "::",...
Creates a Route Redirect View. Convenience method to allow for a fluent interface. @param string $route @param mixed $parameters @param int $statusCode @param array $headers @return View
[ "Creates", "a", "Route", "Redirect", "View", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/ControllerTrait.php#L99-L102
FriendsOfSymfony/FOSRestBundle
Form/Transformer/EntityToIdObjectTransformer.php
EntityToIdObjectTransformer.transform
public function transform($object) { if (null === $object) { return ''; } return current(array_values($this->om->getClassMetadata($this->entityName)->getIdentifierValues($object))); }
php
public function transform($object) { if (null === $object) { return ''; } return current(array_values($this->om->getClassMetadata($this->entityName)->getIdentifierValues($object))); }
[ "public", "function", "transform", "(", "$", "object", ")", "{", "if", "(", "null", "===", "$", "object", ")", "{", "return", "''", ";", "}", "return", "current", "(", "array_values", "(", "$", "this", "->", "om", "->", "getClassMetadata", "(", "$", ...
Do nothing. @param object|null $object @return string
[ "Do", "nothing", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Form/Transformer/EntityToIdObjectTransformer.php#L52-L59
FriendsOfSymfony/FOSRestBundle
Form/Transformer/EntityToIdObjectTransformer.php
EntityToIdObjectTransformer.reverseTransform
public function reverseTransform($idObject) { if (!is_array($idObject)) { return; } $identifier = current(array_values($this->om->getClassMetadata($this->entityName)->getIdentifier())); $id = $idObject[$identifier]; $object = $this->om ->getRepositor...
php
public function reverseTransform($idObject) { if (!is_array($idObject)) { return; } $identifier = current(array_values($this->om->getClassMetadata($this->entityName)->getIdentifier())); $id = $idObject[$identifier]; $object = $this->om ->getRepositor...
[ "public", "function", "reverseTransform", "(", "$", "idObject", ")", "{", "if", "(", "!", "is_array", "(", "$", "idObject", ")", ")", "{", "return", ";", "}", "$", "identifier", "=", "current", "(", "array_values", "(", "$", "this", "->", "om", "->", ...
Transforms an array including an identifier to an object. @param array $idObject @throws TransformationFailedException if object is not found @return object|null
[ "Transforms", "an", "array", "including", "an", "identifier", "to", "an", "object", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Form/Transformer/EntityToIdObjectTransformer.php#L70-L91
FriendsOfSymfony/FOSRestBundle
Request/ParamFetcher.php
ParamFetcher.get
public function get($name, $strict = null) { $params = $this->getParams(); if (!array_key_exists($name, $params)) { throw new \InvalidArgumentException(sprintf("No @ParamInterface configuration for parameter '%s'.", $name)); } /** @var ParamInterface $param */ $...
php
public function get($name, $strict = null) { $params = $this->getParams(); if (!array_key_exists($name, $params)) { throw new \InvalidArgumentException(sprintf("No @ParamInterface configuration for parameter '%s'.", $name)); } /** @var ParamInterface $param */ $...
[ "public", "function", "get", "(", "$", "name", ",", "$", "strict", "=", "null", ")", "{", "$", "params", "=", "$", "this", "->", "getParams", "(", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "name", ",", "$", "params", ")", ")", "{", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/ParamFetcher.php#L97-L114
FriendsOfSymfony/FOSRestBundle
Request/ParamFetcher.php
ParamFetcher.cleanParamWithRequirements
protected function cleanParamWithRequirements(ParamInterface $param, $paramValue, $strict, $default) { $this->checkNotIncompatibleParams($param); if (null !== $default && $default === $paramValue) { return $paramValue; } if (null === $this->validator) { throw...
php
protected function cleanParamWithRequirements(ParamInterface $param, $paramValue, $strict, $default) { $this->checkNotIncompatibleParams($param); if (null !== $default && $default === $paramValue) { return $paramValue; } if (null === $this->validator) { throw...
[ "protected", "function", "cleanParamWithRequirements", "(", "ParamInterface", "$", "param", ",", "$", "paramValue", ",", "$", "strict", ",", "$", "default", ")", "{", "$", "this", "->", "checkNotIncompatibleParams", "(", "$", "param", ")", ";", "if", "(", "n...
@param ParamInterface $param @param mixed $paramValue @param bool $strict @param mixed $default @throws BadRequestHttpException @throws \RuntimeException @return mixed @internal
[ "@param", "ParamInterface", "$param", "@param", "mixed", "$paramValue", "@param", "bool", "$strict", "@param", "mixed", "$default" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/ParamFetcher.php#L129-L173
FriendsOfSymfony/FOSRestBundle
Request/ParamFetcher.php
ParamFetcher.all
public function all($strict = null) { $configuredParams = $this->getParams(); $params = []; foreach ($configuredParams as $name => $param) { $params[$name] = $this->get($name, $strict); } return $params; }
php
public function all($strict = null) { $configuredParams = $this->getParams(); $params = []; foreach ($configuredParams as $name => $param) { $params[$name] = $this->get($name, $strict); } return $params; }
[ "public", "function", "all", "(", "$", "strict", "=", "null", ")", "{", "$", "configuredParams", "=", "$", "this", "->", "getParams", "(", ")", ";", "$", "params", "=", "[", "]", ";", "foreach", "(", "$", "configuredParams", "as", "$", "name", "=>", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/ParamFetcher.php#L178-L188
FriendsOfSymfony/FOSRestBundle
Request/ParamFetcher.php
ParamFetcher.checkNotIncompatibleParams
protected function checkNotIncompatibleParams(ParamInterface $param) { if (null === $param->getValue($this->getRequest(), null)) { return; } $params = $this->getParams(); foreach ($param->getIncompatibilities() as $incompatibleParamName) { if (!array_key_exis...
php
protected function checkNotIncompatibleParams(ParamInterface $param) { if (null === $param->getValue($this->getRequest(), null)) { return; } $params = $this->getParams(); foreach ($param->getIncompatibilities() as $incompatibleParamName) { if (!array_key_exis...
[ "protected", "function", "checkNotIncompatibleParams", "(", "ParamInterface", "$", "param", ")", "{", "if", "(", "null", "===", "$", "param", "->", "getValue", "(", "$", "this", "->", "getRequest", "(", ")", ",", "null", ")", ")", "{", "return", ";", "}"...
Check if current param is not in conflict with other parameters according to the "incompatibles" field. @param ParamInterface $param the configuration for the param fetcher @throws InvalidArgumentException @throws BadRequestHttpException @internal
[ "Check", "if", "current", "param", "is", "not", "in", "conflict", "with", "other", "parameters", "according", "to", "the", "incompatibles", "field", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/ParamFetcher.php#L201-L224
FriendsOfSymfony/FOSRestBundle
FOSRestBundle.php
FOSRestBundle.build
public function build(ContainerBuilder $container) { $container->addCompilerPass(new SerializerConfigurationPass()); $container->addCompilerPass(new ConfigurationCheckPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -10); $container->addCompilerPass(new FormatListenerRulesPass()); $cont...
php
public function build(ContainerBuilder $container) { $container->addCompilerPass(new SerializerConfigurationPass()); $container->addCompilerPass(new ConfigurationCheckPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -10); $container->addCompilerPass(new FormatListenerRulesPass()); $cont...
[ "public", "function", "build", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "container", "->", "addCompilerPass", "(", "new", "SerializerConfigurationPass", "(", ")", ")", ";", "$", "container", "->", "addCompilerPass", "(", "new", "ConfigurationCheck...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/FOSRestBundle.php#L36-L45
FriendsOfSymfony/FOSRestBundle
Serializer/Normalizer/AbstractExceptionNormalizer.php
AbstractExceptionNormalizer.getExceptionMessage
protected function getExceptionMessage(\Exception $exception, $statusCode = null) { $showMessage = $this->messagesMap->resolveException($exception); if ($showMessage || $this->debug) { return $exception->getMessage(); } return array_key_exists($statusCode, Response::$st...
php
protected function getExceptionMessage(\Exception $exception, $statusCode = null) { $showMessage = $this->messagesMap->resolveException($exception); if ($showMessage || $this->debug) { return $exception->getMessage(); } return array_key_exists($statusCode, Response::$st...
[ "protected", "function", "getExceptionMessage", "(", "\\", "Exception", "$", "exception", ",", "$", "statusCode", "=", "null", ")", "{", "$", "showMessage", "=", "$", "this", "->", "messagesMap", "->", "resolveException", "(", "$", "exception", ")", ";", "if...
Extracts the exception message. @param \Exception $exception @param int|null $statusCode @return string
[ "Extracts", "the", "exception", "message", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/Normalizer/AbstractExceptionNormalizer.php#L52-L61
FriendsOfSymfony/FOSRestBundle
Routing/Loader/RestXmlCollectionLoader.php
RestXmlCollectionLoader.parseNode
protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file) { switch ($node->tagName) { case 'route': $this->parseRoute($collection, $node, $path); break; case 'import': $name = (string) $node->getAttribu...
php
protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file) { switch ($node->tagName) { case 'route': $this->parseRoute($collection, $node, $path); break; case 'import': $name = (string) $node->getAttribu...
[ "protected", "function", "parseNode", "(", "RouteCollection", "$", "collection", ",", "\\", "DOMElement", "$", "node", ",", "$", "path", ",", "$", "file", ")", "{", "switch", "(", "$", "node", "->", "tagName", ")", "{", "case", "'route'", ":", "$", "th...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/RestXmlCollectionLoader.php#L60-L106
FriendsOfSymfony/FOSRestBundle
Routing/Loader/RestXmlCollectionLoader.php
RestXmlCollectionLoader.parseRoute
protected function parseRoute(RouteCollection $collection, \DOMElement $node, $path) { if ($this->includeFormat) { $path = $node->getAttribute('path'); // append format placeholder if not present if (false === strpos($path, '{_format}')) { $node->setAttrib...
php
protected function parseRoute(RouteCollection $collection, \DOMElement $node, $path) { if ($this->includeFormat) { $path = $node->getAttribute('path'); // append format placeholder if not present if (false === strpos($path, '{_format}')) { $node->setAttrib...
[ "protected", "function", "parseRoute", "(", "RouteCollection", "$", "collection", ",", "\\", "DOMElement", "$", "node", ",", "$", "path", ")", "{", "if", "(", "$", "this", "->", "includeFormat", ")", "{", "$", "path", "=", "$", "node", "->", "getAttribut...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/RestXmlCollectionLoader.php#L111-L181
FriendsOfSymfony/FOSRestBundle
Routing/Loader/RestXmlCollectionLoader.php
RestXmlCollectionLoader.validate
protected function validate(\DOMDocument $dom) { $restRoutinglocation = realpath(__DIR__.'/../../Resources/config/schema/routing/rest_routing-1.0.xsd'); $restRoutinglocation = rawurlencode(str_replace('\\', '/', $restRoutinglocation)); $routinglocation = realpath(__DIR__.'/../../Resources/co...
php
protected function validate(\DOMDocument $dom) { $restRoutinglocation = realpath(__DIR__.'/../../Resources/config/schema/routing/rest_routing-1.0.xsd'); $restRoutinglocation = rawurlencode(str_replace('\\', '/', $restRoutinglocation)); $routinglocation = realpath(__DIR__.'/../../Resources/co...
[ "protected", "function", "validate", "(", "\\", "DOMDocument", "$", "dom", ")", "{", "$", "restRoutinglocation", "=", "realpath", "(", "__DIR__", ".", "'/../../Resources/config/schema/routing/rest_routing-1.0.xsd'", ")", ";", "$", "restRoutinglocation", "=", "rawurlenco...
@param \DOMDocument $dom @throws \InvalidArgumentException When xml doesn't validate its xsd schema
[ "@param", "\\", "DOMDocument", "$dom" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/RestXmlCollectionLoader.php#L216-L242
FriendsOfSymfony/FOSRestBundle
Routing/Loader/RestXmlCollectionLoader.php
RestXmlCollectionLoader.loadFile
protected function loadFile($file) { if (class_exists('Symfony\Component\Config\Util\XmlUtils')) { $dom = XmlUtils::loadFile($file); $this->validate($dom); return $dom; } return parent::loadFile($file); }
php
protected function loadFile($file) { if (class_exists('Symfony\Component\Config\Util\XmlUtils')) { $dom = XmlUtils::loadFile($file); $this->validate($dom); return $dom; } return parent::loadFile($file); }
[ "protected", "function", "loadFile", "(", "$", "file", ")", "{", "if", "(", "class_exists", "(", "'Symfony\\Component\\Config\\Util\\XmlUtils'", ")", ")", "{", "$", "dom", "=", "XmlUtils", "::", "loadFile", "(", "$", "file", ")", ";", "$", "this", "->", "v...
{@inheritdoc} @internal
[ "{", "@inheritdoc", "}" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/RestXmlCollectionLoader.php#L249-L259
FriendsOfSymfony/FOSRestBundle
Routing/Loader/DirectoryRouteLoader.php
DirectoryRouteLoader.load
public function load($resource, $type = null) { if (isset($resource[0]) && in_array($resource[0], ['@', '.'], true)) { $resource = $this->fileLocator->locate($resource); } if (!is_dir($resource)) { throw new \InvalidArgumentException(sprintf('Given resource of type "...
php
public function load($resource, $type = null) { if (isset($resource[0]) && in_array($resource[0], ['@', '.'], true)) { $resource = $this->fileLocator->locate($resource); } if (!is_dir($resource)) { throw new \InvalidArgumentException(sprintf('Given resource of type "...
[ "public", "function", "load", "(", "$", "resource", ",", "$", "type", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "resource", "[", "0", "]", ")", "&&", "in_array", "(", "$", "resource", "[", "0", "]", ",", "[", "'@'", ",", "'.'", "]", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/DirectoryRouteLoader.php#L38-L60
FriendsOfSymfony/FOSRestBundle
Routing/Loader/DirectoryRouteLoader.php
DirectoryRouteLoader.supports
public function supports($resource, $type = null) { if ('rest' !== $type || !is_string($resource)) { return false; } if (isset($resource[0]) && in_array($resource[0], ['@', '.'], true)) { $resource = $this->fileLocator->locate($resource); } return is...
php
public function supports($resource, $type = null) { if ('rest' !== $type || !is_string($resource)) { return false; } if (isset($resource[0]) && in_array($resource[0], ['@', '.'], true)) { $resource = $this->fileLocator->locate($resource); } return is...
[ "public", "function", "supports", "(", "$", "resource", ",", "$", "type", "=", "null", ")", "{", "if", "(", "'rest'", "!==", "$", "type", "||", "!", "is_string", "(", "$", "resource", ")", ")", "{", "return", "false", ";", "}", "if", "(", "isset", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/DirectoryRouteLoader.php#L65-L76
FriendsOfSymfony/FOSRestBundle
Serializer/Normalizer/FormErrorNormalizer.php
FormErrorNormalizer.normalize
public function normalize($object, $format = null, array $context = []) { return [ 'code' => isset($context['status_code']) ? $context['status_code'] : null, 'message' => 'Validation Failed', 'errors' => $this->convertFormToArray($object), ]; }
php
public function normalize($object, $format = null, array $context = []) { return [ 'code' => isset($context['status_code']) ? $context['status_code'] : null, 'message' => 'Validation Failed', 'errors' => $this->convertFormToArray($object), ]; }
[ "public", "function", "normalize", "(", "$", "object", ",", "$", "format", "=", "null", ",", "array", "$", "context", "=", "[", "]", ")", "{", "return", "[", "'code'", "=>", "isset", "(", "$", "context", "[", "'status_code'", "]", ")", "?", "$", "c...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/Normalizer/FormErrorNormalizer.php#L27-L34
FriendsOfSymfony/FOSRestBundle
Serializer/Normalizer/FormErrorNormalizer.php
FormErrorNormalizer.supportsNormalization
public function supportsNormalization($data, $format = null) { return $data instanceof FormInterface && $data->isSubmitted() && !$data->isValid(); }
php
public function supportsNormalization($data, $format = null) { return $data instanceof FormInterface && $data->isSubmitted() && !$data->isValid(); }
[ "public", "function", "supportsNormalization", "(", "$", "data", ",", "$", "format", "=", "null", ")", "{", "return", "$", "data", "instanceof", "FormInterface", "&&", "$", "data", "->", "isSubmitted", "(", ")", "&&", "!", "$", "data", "->", "isValid", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/Normalizer/FormErrorNormalizer.php#L39-L42
FriendsOfSymfony/FOSRestBundle
DependencyInjection/FOSRestExtension.php
FOSRestExtension.load
public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration($container->getParameter('kernel.debug')); $config = $this->processConfiguration($configuration, $configs); $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/c...
php
public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration($container->getParameter('kernel.debug')); $config = $this->processConfiguration($configuration, $configs); $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/c...
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "configuration", "=", "new", "Configuration", "(", "$", "container", "->", "getParameter", "(", "'kernel.debug'", ")", ")", ";", "$", "confi...
Loads the services based on your application configuration. @param array $configs @param ContainerBuilder $container @throws \InvalidArgumentException @throws \LogicException
[ "Loads", "the", "services", "based", "on", "your", "application", "configuration", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/DependencyInjection/FOSRestExtension.php#L48-L97
FriendsOfSymfony/FOSRestBundle
EventListener/ZoneMatcherListener.php
ZoneMatcherListener.onKernelRequest
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); foreach ($this->requestMatchers as $requestMatcher) { if ($requestMatcher->matches($request)) { $request->attributes->set(FOSRestBundle::ZONE_ATTRIBUTE, true); re...
php
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); foreach ($this->requestMatchers as $requestMatcher) { if ($requestMatcher->matches($request)) { $request->attributes->set(FOSRestBundle::ZONE_ATTRIBUTE, true); re...
[ "public", "function", "onKernelRequest", "(", "GetResponseEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "foreach", "(", "$", "this", "->", "requestMatchers", "as", "$", "requestMatcher", ")", "{", "if...
Adds an optional "_fos_rest_zone" request attribute to be checked for existence by other listeners. @param GetResponseEvent $event
[ "Adds", "an", "optional", "_fos_rest_zone", "request", "attribute", "to", "be", "checked", "for", "existence", "by", "other", "listeners", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/ZoneMatcherListener.php#L42-L55
FriendsOfSymfony/FOSRestBundle
Serializer/JMSHandlerRegistry.php
JMSHandlerRegistry.registerHandler
public function registerHandler($direction, $typeName, $format, $handler) { return $this->registry->registerHandler($direction, $typeName, $format, $handler); }
php
public function registerHandler($direction, $typeName, $format, $handler) { return $this->registry->registerHandler($direction, $typeName, $format, $handler); }
[ "public", "function", "registerHandler", "(", "$", "direction", ",", "$", "typeName", ",", "$", "format", ",", "$", "handler", ")", "{", "return", "$", "this", "->", "registry", "->", "registerHandler", "(", "$", "direction", ",", "$", "typeName", ",", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/JMSHandlerRegistry.php#L44-L47