repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
felixfbecker/php-language-server
src/SignatureHelpProvider.php
SignatureHelpProvider.findActiveParameter
private function findActiveParameter( Node\DelimitedList\ArgumentExpressionList $argumentExpressionList, Position $position, PhpDocument $doc ): int { $args = $argumentExpressionList->children; $i = 0; $found = null; foreach ($args as $arg) { if ($...
php
private function findActiveParameter( Node\DelimitedList\ArgumentExpressionList $argumentExpressionList, Position $position, PhpDocument $doc ): int { $args = $argumentExpressionList->children; $i = 0; $found = null; foreach ($args as $arg) { if ($...
[ "private", "function", "findActiveParameter", "(", "Node", "\\", "DelimitedList", "\\", "ArgumentExpressionList", "$", "argumentExpressionList", ",", "Position", "$", "position", ",", "PhpDocument", "$", "doc", ")", ":", "int", "{", "$", "args", "=", "$", "argum...
Given a position and arguments, finds the "active" argument at the position @param Node\DelimitedList\ArgumentExpressionList $argumentExpressionList The argument expression list @param Position $position The position to detect the active argument from @param PhpDocument ...
[ "Given", "a", "position", "and", "arguments", "finds", "the", "active", "argument", "at", "the", "position" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/SignatureHelpProvider.php#L156-L185
train
felixfbecker/php-language-server
src/PhpDocument.php
PhpDocument.getReferenceNodesByFqn
public function getReferenceNodesByFqn(string $fqn) { return isset($this->referenceNodes) && isset($this->referenceNodes[$fqn]) ? $this->referenceNodes[$fqn] : null; }
php
public function getReferenceNodesByFqn(string $fqn) { return isset($this->referenceNodes) && isset($this->referenceNodes[$fqn]) ? $this->referenceNodes[$fqn] : null; }
[ "public", "function", "getReferenceNodesByFqn", "(", "string", "$", "fqn", ")", "{", "return", "isset", "(", "$", "this", "->", "referenceNodes", ")", "&&", "isset", "(", "$", "this", "->", "referenceNodes", "[", "$", "fqn", "]", ")", "?", "$", "this", ...
Get all references of a fully qualified name @param string $fqn The fully qualified name of the symbol @return Node[]
[ "Get", "all", "references", "of", "a", "fully", "qualified", "name" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/PhpDocument.php#L114-L117
train
felixfbecker/php-language-server
src/PhpDocument.php
PhpDocument.updateContent
public function updateContent(string $content) { // Unregister old definitions if (isset($this->definitions)) { foreach ($this->definitions as $fqn => $definition) { $this->index->removeDefinition($fqn); } } // Unregister old references ...
php
public function updateContent(string $content) { // Unregister old definitions if (isset($this->definitions)) { foreach ($this->definitions as $fqn => $definition) { $this->index->removeDefinition($fqn); } } // Unregister old references ...
[ "public", "function", "updateContent", "(", "string", "$", "content", ")", "{", "// Unregister old definitions", "if", "(", "isset", "(", "$", "this", "->", "definitions", ")", ")", "{", "foreach", "(", "$", "this", "->", "definitions", "as", "$", "fqn", "...
Updates the content on this document. Re-parses a source file, updates symbols and reports parsing errors that may have occurred as diagnostics. @param string $content @return void
[ "Updates", "the", "content", "on", "this", "document", ".", "Re", "-", "parses", "a", "source", "file", "updates", "symbols", "and", "reports", "parsing", "errors", "that", "may", "have", "occurred", "as", "diagnostics", "." ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/PhpDocument.php#L127-L169
train
felixfbecker/php-language-server
src/PhpDocument.php
PhpDocument.getNodeAtPosition
public function getNodeAtPosition(Position $position) { if ($this->sourceFileNode === null) { return null; } $offset = $position->toOffset($this->sourceFileNode->getFileContents()); $node = $this->sourceFileNode->getDescendantNodeAtPosition($offset); if ($node !=...
php
public function getNodeAtPosition(Position $position) { if ($this->sourceFileNode === null) { return null; } $offset = $position->toOffset($this->sourceFileNode->getFileContents()); $node = $this->sourceFileNode->getDescendantNodeAtPosition($offset); if ($node !=...
[ "public", "function", "getNodeAtPosition", "(", "Position", "$", "position", ")", "{", "if", "(", "$", "this", "->", "sourceFileNode", "===", "null", ")", "{", "return", "null", ";", "}", "$", "offset", "=", "$", "position", "->", "toOffset", "(", "$", ...
Returns the node at a specified position @param Position $position @return Node|null
[ "Returns", "the", "node", "at", "a", "specified", "position" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/PhpDocument.php#L217-L229
train
felixfbecker/php-language-server
src/PhpDocument.php
PhpDocument.getRange
public function getRange(Range $range) { $content = $this->getContent(); $start = $range->start->toOffset($content); $length = $range->end->toOffset($content) - $start; return substr($content, $start, $length); }
php
public function getRange(Range $range) { $content = $this->getContent(); $start = $range->start->toOffset($content); $length = $range->end->toOffset($content) - $start; return substr($content, $start, $length); }
[ "public", "function", "getRange", "(", "Range", "$", "range", ")", "{", "$", "content", "=", "$", "this", "->", "getContent", "(", ")", ";", "$", "start", "=", "$", "range", "->", "start", "->", "toOffset", "(", "$", "content", ")", ";", "$", "leng...
Returns a range of the content @param Range $range @return string|null
[ "Returns", "a", "range", "of", "the", "content" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/PhpDocument.php#L237-L243
train
felixfbecker/php-language-server
src/Factory/LocationFactory.php
LocationFactory.fromNode
public static function fromNode(Node $node): Location { $range = PositionUtilities::getRangeFromPosition( $node->getStart(), $node->getWidth(), $node->getFileContents() ); return new Location($node->getUri(), new Range( new Position($range->st...
php
public static function fromNode(Node $node): Location { $range = PositionUtilities::getRangeFromPosition( $node->getStart(), $node->getWidth(), $node->getFileContents() ); return new Location($node->getUri(), new Range( new Position($range->st...
[ "public", "static", "function", "fromNode", "(", "Node", "$", "node", ")", ":", "Location", "{", "$", "range", "=", "PositionUtilities", "::", "getRangeFromPosition", "(", "$", "node", "->", "getStart", "(", ")", ",", "$", "node", "->", "getWidth", "(", ...
Returns the location of the node @param Node $node @return self
[ "Returns", "the", "location", "of", "the", "node" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Factory/LocationFactory.php#L19-L31
train
felixfbecker/php-language-server
src/Client/Workspace.php
Workspace.xfiles
public function xfiles(string $base = null): Promise { return $this->handler->request( 'workspace/xfiles', ['base' => $base] )->then(function (array $textDocuments) { return $this->mapper->mapArray($textDocuments, [], TextDocumentIdentifier::class); }); ...
php
public function xfiles(string $base = null): Promise { return $this->handler->request( 'workspace/xfiles', ['base' => $base] )->then(function (array $textDocuments) { return $this->mapper->mapArray($textDocuments, [], TextDocumentIdentifier::class); }); ...
[ "public", "function", "xfiles", "(", "string", "$", "base", "=", "null", ")", ":", "Promise", "{", "return", "$", "this", "->", "handler", "->", "request", "(", "'workspace/xfiles'", ",", "[", "'base'", "=>", "$", "base", "]", ")", "->", "then", "(", ...
Returns a list of all files in a directory @param string $base The base directory (defaults to the workspace) @return Promise <TextDocumentIdentifier[]> Array of documents
[ "Returns", "a", "list", "of", "all", "files", "in", "a", "directory" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Client/Workspace.php#L38-L46
train
felixfbecker/php-language-server
src/Server/TextDocument.php
TextDocument.documentSymbol
public function documentSymbol(TextDocumentIdentifier $textDocument): Promise { return $this->documentLoader->getOrLoad($textDocument->uri)->then(function (PhpDocument $document) { $symbols = []; foreach ($document->getDefinitions() as $fqn => $definition) { $symbols[...
php
public function documentSymbol(TextDocumentIdentifier $textDocument): Promise { return $this->documentLoader->getOrLoad($textDocument->uri)->then(function (PhpDocument $document) { $symbols = []; foreach ($document->getDefinitions() as $fqn => $definition) { $symbols[...
[ "public", "function", "documentSymbol", "(", "TextDocumentIdentifier", "$", "textDocument", ")", ":", "Promise", "{", "return", "$", "this", "->", "documentLoader", "->", "getOrLoad", "(", "$", "textDocument", "->", "uri", ")", "->", "then", "(", "function", "...
The document symbol request is sent from the client to the server to list all symbols found in a given text document. @param \LanguageServerProtocol\TextDocumentIdentifier $textDocument @return Promise <SymbolInformation[]>
[ "The", "document", "symbol", "request", "is", "sent", "from", "the", "client", "to", "the", "server", "to", "list", "all", "symbols", "found", "in", "a", "given", "text", "document", "." ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Server/TextDocument.php#L116-L125
train
felixfbecker/php-language-server
src/Server/TextDocument.php
TextDocument.references
public function references( ReferenceContext $context, TextDocumentIdentifier $textDocument, Position $position ): Promise { return coroutine(function () use ($textDocument, $position) { $document = yield $this->documentLoader->getOrLoad($textDocument->uri); $...
php
public function references( ReferenceContext $context, TextDocumentIdentifier $textDocument, Position $position ): Promise { return coroutine(function () use ($textDocument, $position) { $document = yield $this->documentLoader->getOrLoad($textDocument->uri); $...
[ "public", "function", "references", "(", "ReferenceContext", "$", "context", ",", "TextDocumentIdentifier", "$", "textDocument", ",", "Position", "$", "position", ")", ":", "Promise", "{", "return", "coroutine", "(", "function", "(", ")", "use", "(", "$", "tex...
The references request is sent from the client to the server to resolve project-wide references for the symbol denoted by the given text document position. @param ReferenceContext $context @return Promise <Location[]>
[ "The", "references", "request", "is", "sent", "from", "the", "client", "to", "the", "server", "to", "resolve", "project", "-", "wide", "references", "for", "the", "symbol", "denoted", "by", "the", "given", "text", "document", "position", "." ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Server/TextDocument.php#L177-L246
train
felixfbecker/php-language-server
src/Server/TextDocument.php
TextDocument.signatureHelp
public function signatureHelp(TextDocumentIdentifier $textDocument, Position $position): Promise { return coroutine(function () use ($textDocument, $position) { $document = yield $this->documentLoader->getOrLoad($textDocument->uri); return $this->signatureHelpProvider->getSignatureHe...
php
public function signatureHelp(TextDocumentIdentifier $textDocument, Position $position): Promise { return coroutine(function () use ($textDocument, $position) { $document = yield $this->documentLoader->getOrLoad($textDocument->uri); return $this->signatureHelpProvider->getSignatureHe...
[ "public", "function", "signatureHelp", "(", "TextDocumentIdentifier", "$", "textDocument", ",", "Position", "$", "position", ")", ":", "Promise", "{", "return", "coroutine", "(", "function", "(", ")", "use", "(", "$", "textDocument", ",", "$", "position", ")",...
The signature help request is sent from the client to the server to request signature information at a given cursor position. @param TextDocumentIdentifier $textDocument The text document @param Position $position The position inside the text document @return Promise <SignatureHelp>
[ "The", "signature", "help", "request", "is", "sent", "from", "the", "client", "to", "the", "server", "to", "request", "signature", "information", "at", "a", "given", "cursor", "position", "." ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Server/TextDocument.php#L257-L263
train
felixfbecker/php-language-server
src/Server/Workspace.php
Workspace.symbol
public function symbol(string $query): Promise { return coroutine(function () use ($query) { // Wait until indexing for definitions finished if (!$this->sourceIndex->isStaticComplete()) { yield waitForEvent($this->sourceIndex, 'static-complete'); } ...
php
public function symbol(string $query): Promise { return coroutine(function () use ($query) { // Wait until indexing for definitions finished if (!$this->sourceIndex->isStaticComplete()) { yield waitForEvent($this->sourceIndex, 'static-complete'); } ...
[ "public", "function", "symbol", "(", "string", "$", "query", ")", ":", "Promise", "{", "return", "coroutine", "(", "function", "(", ")", "use", "(", "$", "query", ")", "{", "// Wait until indexing for definitions finished", "if", "(", "!", "$", "this", "->",...
The workspace symbol request is sent from the client to the server to list project-wide symbols matching the query string. @param string $query @return Promise <SymbolInformation[]>
[ "The", "workspace", "symbol", "request", "is", "sent", "from", "the", "client", "to", "the", "server", "to", "list", "project", "-", "wide", "symbols", "matching", "the", "query", "string", "." ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Server/Workspace.php#L84-L99
train
felixfbecker/php-language-server
src/Server/Workspace.php
Workspace.didChangeWatchedFiles
public function didChangeWatchedFiles(array $changes) { foreach ($changes as $change) { if ($change->type === FileChangeType::DELETED) { $this->client->textDocument->publishDiagnostics($change->uri, []); } } }
php
public function didChangeWatchedFiles(array $changes) { foreach ($changes as $change) { if ($change->type === FileChangeType::DELETED) { $this->client->textDocument->publishDiagnostics($change->uri, []); } } }
[ "public", "function", "didChangeWatchedFiles", "(", "array", "$", "changes", ")", "{", "foreach", "(", "$", "changes", "as", "$", "change", ")", "{", "if", "(", "$", "change", "->", "type", "===", "FileChangeType", "::", "DELETED", ")", "{", "$", "this",...
The watched files notification is sent from the client to the server when the client detects changes to files watched by the language client. @param FileEvent[] $changes @return void
[ "The", "watched", "files", "notification", "is", "sent", "from", "the", "client", "to", "the", "server", "when", "the", "client", "detects", "changes", "to", "files", "watched", "by", "the", "language", "client", "." ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Server/Workspace.php#L107-L114
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.getDeclarationLineFromNode
public function getDeclarationLineFromNode($node): string { // If node is part of a declaration list, build a declaration line that discludes other elements in the list // - [PropertyDeclaration] // public $a, [$b = 3], $c; => public $b = 3; // - [ConstDeclaration|ClassConstDeclaration] //...
php
public function getDeclarationLineFromNode($node): string { // If node is part of a declaration list, build a declaration line that discludes other elements in the list // - [PropertyDeclaration] // public $a, [$b = 3], $c; => public $b = 3; // - [ConstDeclaration|ClassConstDeclaration] //...
[ "public", "function", "getDeclarationLineFromNode", "(", "$", "node", ")", ":", "string", "{", "// If node is part of a declaration list, build a declaration line that discludes other elements in the list", "// - [PropertyDeclaration] // public $a, [$b = 3], $c; => public $b = 3;", "// - [...
Builds the declaration line for a given node. Declarations with multiple lines are trimmed. @param Node $node @return string
[ "Builds", "the", "declaration", "line", "for", "a", "given", "node", ".", "Declarations", "with", "multiple", "lines", "are", "trimmed", "." ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L63-L91
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.getDocumentationFromNode
public function getDocumentationFromNode($node) { // Any NamespaceDefinition comments likely apply to the file, not the declaration itself. if ($node instanceof Node\Statement\NamespaceDefinition) { return null; } // For properties and constants, set the node to the decl...
php
public function getDocumentationFromNode($node) { // Any NamespaceDefinition comments likely apply to the file, not the declaration itself. if ($node instanceof Node\Statement\NamespaceDefinition) { return null; } // For properties and constants, set the node to the decl...
[ "public", "function", "getDocumentationFromNode", "(", "$", "node", ")", "{", "// Any NamespaceDefinition comments likely apply to the file, not the declaration itself.", "if", "(", "$", "node", "instanceof", "Node", "\\", "Statement", "\\", "NamespaceDefinition", ")", "{", ...
Gets the documentation string for a node, if it has one @param Node $node @return string|null
[ "Gets", "the", "documentation", "string", "for", "a", "node", "if", "it", "has", "one" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L99-L138
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.getDocBlock
private function getDocBlock(Node $node) { // TODO make more efficient (caching, ensure import table is in right format to begin with) $docCommentText = $node->getDocCommentText(); if ($docCommentText !== null) { list($namespaceImportTable,,) = $node->getImportTablesForCurrentSco...
php
private function getDocBlock(Node $node) { // TODO make more efficient (caching, ensure import table is in right format to begin with) $docCommentText = $node->getDocCommentText(); if ($docCommentText !== null) { list($namespaceImportTable,,) = $node->getImportTablesForCurrentSco...
[ "private", "function", "getDocBlock", "(", "Node", "$", "node", ")", "{", "// TODO make more efficient (caching, ensure import table is in right format to begin with)", "$", "docCommentText", "=", "$", "node", "->", "getDocCommentText", "(", ")", ";", "if", "(", "$", "d...
Gets Doc Block with resolved names for a Node @param Node $node @return DocBlock|null
[ "Gets", "Doc", "Block", "with", "resolved", "names", "for", "a", "Node" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L146-L172
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.createDefinitionFromNode
public function createDefinitionFromNode(Node $node, string $fqn = null): Definition { $def = new Definition; $def->fqn = $fqn; // Determines whether the suggestion will show after "new" $def->canBeInstantiated = ( $node instanceof Node\Statement\ClassDeclaration && ...
php
public function createDefinitionFromNode(Node $node, string $fqn = null): Definition { $def = new Definition; $def->fqn = $fqn; // Determines whether the suggestion will show after "new" $def->canBeInstantiated = ( $node instanceof Node\Statement\ClassDeclaration && ...
[ "public", "function", "createDefinitionFromNode", "(", "Node", "$", "node", ",", "string", "$", "fqn", "=", "null", ")", ":", "Definition", "{", "$", "def", "=", "new", "Definition", ";", "$", "def", "->", "fqn", "=", "$", "fqn", ";", "// Determines whet...
Create a Definition for a definition node @param Node $node @param string $fqn @return Definition
[ "Create", "a", "Definition", "for", "a", "definition", "node" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L181-L250
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.resolveReferenceNodeToDefinition
public function resolveReferenceNodeToDefinition(Node $node) { $parent = $node->parent; // Variables are not indexed globally, as they stay in the file scope anyway. // Ignore variable nodes that are part of ScopedPropertyAccessExpression, // as the scoped property access expression ...
php
public function resolveReferenceNodeToDefinition(Node $node) { $parent = $node->parent; // Variables are not indexed globally, as they stay in the file scope anyway. // Ignore variable nodes that are part of ScopedPropertyAccessExpression, // as the scoped property access expression ...
[ "public", "function", "resolveReferenceNodeToDefinition", "(", "Node", "$", "node", ")", "{", "$", "parent", "=", "$", "node", "->", "parent", ";", "// Variables are not indexed globally, as they stay in the file scope anyway.", "// Ignore variable nodes that are part of ScopedPr...
Given any node, returns the Definition object of the symbol that is referenced @param Node $node Any reference node @return Definition|null
[ "Given", "any", "node", "returns", "the", "Definition", "object", "of", "the", "symbol", "that", "is", "referenced" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L258-L315
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.resolveReferenceNodeToFqn
public function resolveReferenceNodeToFqn(Node $node) { // TODO all name tokens should be a part of a node if ($node instanceof Node\QualifiedName) { return $this->resolveQualifiedNameNodeToFqn($node); } else if ($node instanceof Node\Expression\MemberAccessExpression) { ...
php
public function resolveReferenceNodeToFqn(Node $node) { // TODO all name tokens should be a part of a node if ($node instanceof Node\QualifiedName) { return $this->resolveQualifiedNameNodeToFqn($node); } else if ($node instanceof Node\Expression\MemberAccessExpression) { ...
[ "public", "function", "resolveReferenceNodeToFqn", "(", "Node", "$", "node", ")", "{", "// TODO all name tokens should be a part of a node", "if", "(", "$", "node", "instanceof", "Node", "\\", "QualifiedName", ")", "{", "return", "$", "this", "->", "resolveQualifiedNa...
Given any node, returns the FQN of the symbol that is referenced Returns null if the FQN could not be resolved or the reference node references a variable May also return "static", "self" or "parent" @param Node $node @return string|null
[ "Given", "any", "node", "returns", "the", "FQN", "of", "the", "symbol", "that", "is", "referenced", "Returns", "null", "if", "the", "FQN", "could", "not", "be", "resolved", "or", "the", "reference", "node", "references", "a", "variable", "May", "also", "re...
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L325-L348
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.getContainingClassFqn
private static function getContainingClassFqn(Node $node) { $classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class); if ($classNode === null) { return null; } return (string)$classNode->getNamespacedName(); }
php
private static function getContainingClassFqn(Node $node) { $classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class); if ($classNode === null) { return null; } return (string)$classNode->getNamespacedName(); }
[ "private", "static", "function", "getContainingClassFqn", "(", "Node", "$", "node", ")", "{", "$", "classNode", "=", "$", "node", "->", "getFirstAncestor", "(", "Node", "\\", "Statement", "\\", "ClassDeclaration", "::", "class", ")", ";", "if", "(", "$", "...
Returns FQN of the class a node is contained in Returns null if the class is anonymous or the node is not contained in a class @param Node $node @return string|null
[ "Returns", "FQN", "of", "the", "class", "a", "node", "is", "contained", "in", "Returns", "null", "if", "the", "class", "is", "anonymous", "or", "the", "node", "is", "not", "contained", "in", "a", "class" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L527-L534
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.getContainingClassType
private function getContainingClassType(Node $node) { $classFqn = $this->getContainingClassFqn($node); return $classFqn ? new Types\Object_(new Fqsen('\\' . $classFqn)) : null; }
php
private function getContainingClassType(Node $node) { $classFqn = $this->getContainingClassFqn($node); return $classFqn ? new Types\Object_(new Fqsen('\\' . $classFqn)) : null; }
[ "private", "function", "getContainingClassType", "(", "Node", "$", "node", ")", "{", "$", "classFqn", "=", "$", "this", "->", "getContainingClassFqn", "(", "$", "node", ")", ";", "return", "$", "classFqn", "?", "new", "Types", "\\", "Object_", "(", "new", ...
Returns the type of the class a node is contained in Returns null if the class is anonymous or the node is not contained in a class @param Node $node The node used to find the containing class @return Types\Object_|null
[ "Returns", "the", "type", "of", "the", "class", "a", "node", "is", "contained", "in", "Returns", "null", "if", "the", "class", "is", "anonymous", "or", "the", "node", "is", "not", "contained", "in", "a", "class" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L544-L548
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.resolveVariableToNode
public function resolveVariableToNode($var) { $n = $var; // When a use is passed, start outside the closure to not return immediately // Use variable vs variable parsing? if ($var instanceof Node\UseVariableName) { $n = $var->getFirstAncestor(Node\Expression\AnonymousFunc...
php
public function resolveVariableToNode($var) { $n = $var; // When a use is passed, start outside the closure to not return immediately // Use variable vs variable parsing? if ($var instanceof Node\UseVariableName) { $n = $var->getFirstAncestor(Node\Expression\AnonymousFunc...
[ "public", "function", "resolveVariableToNode", "(", "$", "var", ")", "{", "$", "n", "=", "$", "var", ";", "// When a use is passed, start outside the closure to not return immediately", "// Use variable vs variable parsing?", "if", "(", "$", "var", "instanceof", "Node", "...
Returns the assignment or parameter node where a variable was defined @param Node\Expression\Variable|Node\Expression\ClosureUse $var The variable access @return Node\Expression\Assign|Node\Expression\AssignOp|Node\Param|Node\Expression\ClosureUse|null
[ "Returns", "the", "assignment", "or", "parameter", "node", "where", "a", "variable", "was", "defined" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L556-L621
train
felixfbecker/php-language-server
src/DefinitionResolver.php
DefinitionResolver.isVariableDeclaration
private static function isVariableDeclaration(Node $n, string $name) { if ( // TODO - clean this up ($n instanceof Node\Expression\AssignmentExpression && $n->operator->kind === PhpParser\TokenKind::EqualsToken) && $n->leftOperand instanceof Node\Expression\Variable && $n...
php
private static function isVariableDeclaration(Node $n, string $name) { if ( // TODO - clean this up ($n instanceof Node\Expression\AssignmentExpression && $n->operator->kind === PhpParser\TokenKind::EqualsToken) && $n->leftOperand instanceof Node\Expression\Variable && $n...
[ "private", "static", "function", "isVariableDeclaration", "(", "Node", "$", "n", ",", "string", "$", "name", ")", "{", "if", "(", "// TODO - clean this up", "(", "$", "n", "instanceof", "Node", "\\", "Expression", "\\", "AssignmentExpression", "&&", "$", "n", ...
Checks whether the given Node declares the given variable name @param Node $n The Node to check @param string $name The name of the wanted variable @return bool
[ "Checks", "whether", "the", "given", "Node", "declares", "the", "given", "variable", "name" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/DefinitionResolver.php#L630-L649
train
felixfbecker/php-language-server
src/Index/Index.php
Index.setComplete
public function setComplete() { if (!$this->isStaticComplete()) { $this->setStaticComplete(); } $this->complete = true; $this->emit('complete'); }
php
public function setComplete() { if (!$this->isStaticComplete()) { $this->setStaticComplete(); } $this->complete = true; $this->emit('complete'); }
[ "public", "function", "setComplete", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isStaticComplete", "(", ")", ")", "{", "$", "this", "->", "setStaticComplete", "(", ")", ";", "}", "$", "this", "->", "complete", "=", "true", ";", "$", "this", ...
Marks this index as complete @return void
[ "Marks", "this", "index", "as", "complete" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Index/Index.php#L58-L65
train
felixfbecker/php-language-server
src/Index/Index.php
Index.getChildDefinitionsForFqn
public function getChildDefinitionsForFqn(string $fqn): \Generator { $parts = $this->splitFqn($fqn); if ('' === end($parts)) { // we want to return all the definitions in the given FQN, not only // the one (non member) matching exactly the FQN. array_pop($parts); ...
php
public function getChildDefinitionsForFqn(string $fqn): \Generator { $parts = $this->splitFqn($fqn); if ('' === end($parts)) { // we want to return all the definitions in the given FQN, not only // the one (non member) matching exactly the FQN. array_pop($parts); ...
[ "public", "function", "getChildDefinitionsForFqn", "(", "string", "$", "fqn", ")", ":", "\\", "Generator", "{", "$", "parts", "=", "$", "this", "->", "splitFqn", "(", "$", "fqn", ")", ";", "if", "(", "''", "===", "end", "(", "$", "parts", ")", ")", ...
Returns a Generator that yields all the direct child Definitions of a given FQN @param string $fqn @return \Generator yields Definition
[ "Returns", "a", "Generator", "that", "yields", "all", "the", "direct", "child", "Definitions", "of", "a", "given", "FQN" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Index/Index.php#L115-L139
train
felixfbecker/php-language-server
src/Index/Index.php
Index.setDefinition
public function setDefinition(string $fqn, Definition $definition) { $parts = $this->splitFqn($fqn); $this->indexDefinition(0, $parts, $this->definitions, $definition); $this->emit('definition-added'); }
php
public function setDefinition(string $fqn, Definition $definition) { $parts = $this->splitFqn($fqn); $this->indexDefinition(0, $parts, $this->definitions, $definition); $this->emit('definition-added'); }
[ "public", "function", "setDefinition", "(", "string", "$", "fqn", ",", "Definition", "$", "definition", ")", "{", "$", "parts", "=", "$", "this", "->", "splitFqn", "(", "$", "fqn", ")", ";", "$", "this", "->", "indexDefinition", "(", "0", ",", "$", "...
Registers a definition @param string $fqn The fully qualified name of the symbol @param Definition $definition The Definition object @return void
[ "Registers", "a", "definition" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Index/Index.php#L172-L178
train
felixfbecker/php-language-server
src/Index/Index.php
Index.removeDefinition
public function removeDefinition(string $fqn) { $parts = $this->splitFqn($fqn); $this->removeIndexedDefinition(0, $parts, $this->definitions, $this->definitions); unset($this->references[$fqn]); }
php
public function removeDefinition(string $fqn) { $parts = $this->splitFqn($fqn); $this->removeIndexedDefinition(0, $parts, $this->definitions, $this->definitions); unset($this->references[$fqn]); }
[ "public", "function", "removeDefinition", "(", "string", "$", "fqn", ")", "{", "$", "parts", "=", "$", "this", "->", "splitFqn", "(", "$", "fqn", ")", ";", "$", "this", "->", "removeIndexedDefinition", "(", "0", ",", "$", "parts", ",", "$", "this", "...
Unsets the Definition for a specific symbol and removes all references pointing to that symbol @param string $fqn The fully qualified name of the symbol @return void
[ "Unsets", "the", "Definition", "for", "a", "specific", "symbol", "and", "removes", "all", "references", "pointing", "to", "that", "symbol" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Index/Index.php#L187-L193
train
felixfbecker/php-language-server
src/Index/Index.php
Index.addReferenceUri
public function addReferenceUri(string $fqn, string $uri) { if (!isset($this->references[$fqn])) { $this->references[$fqn] = []; } // TODO: use DS\Set instead of searching array if (array_search($uri, $this->references[$fqn], true) === false) { $this->referenc...
php
public function addReferenceUri(string $fqn, string $uri) { if (!isset($this->references[$fqn])) { $this->references[$fqn] = []; } // TODO: use DS\Set instead of searching array if (array_search($uri, $this->references[$fqn], true) === false) { $this->referenc...
[ "public", "function", "addReferenceUri", "(", "string", "$", "fqn", ",", "string", "$", "uri", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "references", "[", "$", "fqn", "]", ")", ")", "{", "$", "this", "->", "references", "[", "$", ...
Adds a document URI as a referencee of a specific symbol @param string $fqn The fully qualified name of the symbol @return void
[ "Adds", "a", "document", "URI", "as", "a", "referencee", "of", "a", "specific", "symbol" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Index/Index.php#L225-L234
train
felixfbecker/php-language-server
src/Index/Index.php
Index.removeReferenceUri
public function removeReferenceUri(string $fqn, string $uri) { if (!isset($this->references[$fqn])) { return; } $index = array_search($fqn, $this->references[$fqn], true); if ($index === false) { return; } array_splice($this->references[$fqn], ...
php
public function removeReferenceUri(string $fqn, string $uri) { if (!isset($this->references[$fqn])) { return; } $index = array_search($fqn, $this->references[$fqn], true); if ($index === false) { return; } array_splice($this->references[$fqn], ...
[ "public", "function", "removeReferenceUri", "(", "string", "$", "fqn", ",", "string", "$", "uri", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "references", "[", "$", "fqn", "]", ")", ")", "{", "return", ";", "}", "$", "index", "=", ...
Removes a document URI as the container for a specific symbol @param string $fqn The fully qualified name of the symbol @param string $uri The URI @return void
[ "Removes", "a", "document", "URI", "as", "the", "container", "for", "a", "specific", "symbol" ]
9dc16565922ae1fcf18a69b15b3cd15152ea21e6
https://github.com/felixfbecker/php-language-server/blob/9dc16565922ae1fcf18a69b15b3cd15152ea21e6/src/Index/Index.php#L243-L253
train
thephpleague/fractal
src/Scope.php
Scope.getIdentifier
public function getIdentifier($appendIdentifier = null) { $identifierParts = array_merge($this->parentScopes, [$this->scopeIdentifier, $appendIdentifier]); return implode('.', array_filter($identifierParts)); }
php
public function getIdentifier($appendIdentifier = null) { $identifierParts = array_merge($this->parentScopes, [$this->scopeIdentifier, $appendIdentifier]); return implode('.', array_filter($identifierParts)); }
[ "public", "function", "getIdentifier", "(", "$", "appendIdentifier", "=", "null", ")", "{", "$", "identifierParts", "=", "array_merge", "(", "$", "this", "->", "parentScopes", ",", "[", "$", "this", "->", "scopeIdentifier", ",", "$", "appendIdentifier", "]", ...
Get the unique identifier for this scope. @param string $appendIdentifier @return string
[ "Get", "the", "unique", "identifier", "for", "this", "scope", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Scope.php#L104-L109
train
thephpleague/fractal
src/Scope.php
Scope.toArray
public function toArray() { list($rawData, $rawIncludedData) = $this->executeResourceTransformers(); $serializer = $this->manager->getSerializer(); $data = $this->serializeResource($serializer, $rawData); // If the serializer wants the includes to be side-loaded then we'll ...
php
public function toArray() { list($rawData, $rawIncludedData) = $this->executeResourceTransformers(); $serializer = $this->manager->getSerializer(); $data = $this->serializeResource($serializer, $rawData); // If the serializer wants the includes to be side-loaded then we'll ...
[ "public", "function", "toArray", "(", ")", "{", "list", "(", "$", "rawData", ",", "$", "rawIncludedData", ")", "=", "$", "this", "->", "executeResourceTransformers", "(", ")", ";", "$", "serializer", "=", "$", "this", "->", "manager", "->", "getSerializer"...
Convert the current data for this scope to an array. @return array
[ "Convert", "the", "current", "data", "for", "this", "scope", "to", "an", "array", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Scope.php#L233-L289
train
thephpleague/fractal
src/Scope.php
Scope.transformPrimitiveResource
public function transformPrimitiveResource() { if (! ($this->resource instanceof Primitive)) { throw new InvalidArgumentException( 'Argument $resource should be an instance of League\Fractal\Resource\Primitive' ); } $transformer = $this->resource->get...
php
public function transformPrimitiveResource() { if (! ($this->resource instanceof Primitive)) { throw new InvalidArgumentException( 'Argument $resource should be an instance of League\Fractal\Resource\Primitive' ); } $transformer = $this->resource->get...
[ "public", "function", "transformPrimitiveResource", "(", ")", "{", "if", "(", "!", "(", "$", "this", "->", "resource", "instanceof", "Primitive", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Argument $resource should be an instance of League\\Fracta...
Transformer a primitive resource @return mixed
[ "Transformer", "a", "primitive", "resource" ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Scope.php#L308-L329
train
thephpleague/fractal
src/Scope.php
Scope.serializeResource
protected function serializeResource(SerializerAbstract $serializer, $data) { $resourceKey = $this->resource->getResourceKey(); if ($this->resource instanceof Collection) { return $serializer->collection($resourceKey, $data); } if ($this->resource instanceof Item) { ...
php
protected function serializeResource(SerializerAbstract $serializer, $data) { $resourceKey = $this->resource->getResourceKey(); if ($this->resource instanceof Collection) { return $serializer->collection($resourceKey, $data); } if ($this->resource instanceof Item) { ...
[ "protected", "function", "serializeResource", "(", "SerializerAbstract", "$", "serializer", ",", "$", "data", ")", "{", "$", "resourceKey", "=", "$", "this", "->", "resource", "->", "getResourceKey", "(", ")", ";", "if", "(", "$", "this", "->", "resource", ...
Serialize a resource @internal @param SerializerAbstract $serializer @param mixed $data @return array
[ "Serialize", "a", "resource" ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Scope.php#L374-L387
train
thephpleague/fractal
src/Scope.php
Scope.fireTransformer
protected function fireTransformer($transformer, $data) { $includedData = []; if (is_callable($transformer)) { $transformedData = call_user_func($transformer, $data); } else { $transformer->setCurrentScope($this); $transformedData = $transformer->transfor...
php
protected function fireTransformer($transformer, $data) { $includedData = []; if (is_callable($transformer)) { $transformedData = call_user_func($transformer, $data); } else { $transformer->setCurrentScope($this); $transformedData = $transformer->transfor...
[ "protected", "function", "fireTransformer", "(", "$", "transformer", ",", "$", "data", ")", "{", "$", "includedData", "=", "[", "]", ";", "if", "(", "is_callable", "(", "$", "transformer", ")", ")", "{", "$", "transformedData", "=", "call_user_func", "(", ...
Fire the main transformer. @internal @param TransformerAbstract|callable $transformer @param mixed $data @return array
[ "Fire", "the", "main", "transformer", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Scope.php#L399-L419
train
thephpleague/fractal
src/Scope.php
Scope.fireIncludedTransformers
protected function fireIncludedTransformers($transformer, $data) { $this->availableIncludes = $transformer->getAvailableIncludes(); return $transformer->processIncludedResources($this, $data) ?: []; }
php
protected function fireIncludedTransformers($transformer, $data) { $this->availableIncludes = $transformer->getAvailableIncludes(); return $transformer->processIncludedResources($this, $data) ?: []; }
[ "protected", "function", "fireIncludedTransformers", "(", "$", "transformer", ",", "$", "data", ")", "{", "$", "this", "->", "availableIncludes", "=", "$", "transformer", "->", "getAvailableIncludes", "(", ")", ";", "return", "$", "transformer", "->", "processIn...
Fire the included transformers. @internal @param \League\Fractal\TransformerAbstract $transformer @param mixed $data @return array
[ "Fire", "the", "included", "transformers", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Scope.php#L431-L436
train
thephpleague/fractal
src/Scope.php
Scope.filterFieldsets
protected function filterFieldsets(array $data) { if (!$this->hasFilterFieldset()) { return $data; } $serializer = $this->manager->getSerializer(); $requestedFieldset = iterator_to_array($this->getFilterFieldset()); //Build the array of requested fieldsets with th...
php
protected function filterFieldsets(array $data) { if (!$this->hasFilterFieldset()) { return $data; } $serializer = $this->manager->getSerializer(); $requestedFieldset = iterator_to_array($this->getFilterFieldset()); //Build the array of requested fieldsets with th...
[ "protected", "function", "filterFieldsets", "(", "array", "$", "data", ")", "{", "if", "(", "!", "$", "this", "->", "hasFilterFieldset", "(", ")", ")", "{", "return", "$", "data", ";", "}", "$", "serializer", "=", "$", "this", "->", "manager", "->", ...
Filter the provided data with the requested filter fieldset for the scope resource @internal @param array $data @return array
[ "Filter", "the", "provided", "data", "with", "the", "requested", "filter", "fieldset", "for", "the", "scope", "resource" ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Scope.php#L479-L494
train
thephpleague/fractal
src/TransformerAbstract.php
TransformerAbstract.processIncludedResources
public function processIncludedResources(Scope $scope, $data) { $includedData = []; $includes = $this->figureOutWhichIncludes($scope); foreach ($includes as $include) { $includedData = $this->includeResourceIfAvailable( $scope, $data, ...
php
public function processIncludedResources(Scope $scope, $data) { $includedData = []; $includes = $this->figureOutWhichIncludes($scope); foreach ($includes as $include) { $includedData = $this->includeResourceIfAvailable( $scope, $data, ...
[ "public", "function", "processIncludedResources", "(", "Scope", "$", "scope", ",", "$", "data", ")", "{", "$", "includedData", "=", "[", "]", ";", "$", "includes", "=", "$", "this", "->", "figureOutWhichIncludes", "(", "$", "scope", ")", ";", "foreach", ...
This method is fired to loop through available includes, see if any of them are requested and permitted for this scope. @internal @param Scope $scope @param mixed $data @return array
[ "This", "method", "is", "fired", "to", "loop", "through", "available", "includes", "see", "if", "any", "of", "them", "are", "requested", "and", "permitted", "for", "this", "scope", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/TransformerAbstract.php#L120-L136
train
thephpleague/fractal
src/TransformerAbstract.php
TransformerAbstract.callIncludeMethod
protected function callIncludeMethod(Scope $scope, $includeName, $data) { $scopeIdentifier = $scope->getIdentifier($includeName); $params = $scope->getManager()->getIncludeParams($scopeIdentifier); // Check if the method name actually exists $methodName = 'include'.str_replace(' ', ...
php
protected function callIncludeMethod(Scope $scope, $includeName, $data) { $scopeIdentifier = $scope->getIdentifier($includeName); $params = $scope->getManager()->getIncludeParams($scopeIdentifier); // Check if the method name actually exists $methodName = 'include'.str_replace(' ', ...
[ "protected", "function", "callIncludeMethod", "(", "Scope", "$", "scope", ",", "$", "includeName", ",", "$", "data", ")", "{", "$", "scopeIdentifier", "=", "$", "scope", "->", "getIdentifier", "(", "$", "includeName", ")", ";", "$", "params", "=", "$", "...
Call Include Method. @internal @param Scope $scope @param string $includeName @param mixed $data @throws \Exception @return \League\Fractal\Resource\ResourceInterface
[ "Call", "Include", "Method", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/TransformerAbstract.php#L182-L207
train
thephpleague/fractal
src/TransformerAbstract.php
TransformerAbstract.primitive
protected function primitive($data, $transformer = null, $resourceKey = null) { return new Primitive($data, $transformer, $resourceKey); }
php
protected function primitive($data, $transformer = null, $resourceKey = null) { return new Primitive($data, $transformer, $resourceKey); }
[ "protected", "function", "primitive", "(", "$", "data", ",", "$", "transformer", "=", "null", ",", "$", "resourceKey", "=", "null", ")", "{", "return", "new", "Primitive", "(", "$", "data", ",", "$", "transformer", ",", "$", "resourceKey", ")", ";", "}...
Create a new primitive resource object. @param mixed $data @param callable|null $transformer @param string $resourceKey @return Primitive
[ "Create", "a", "new", "primitive", "resource", "object", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/TransformerAbstract.php#L260-L263
train
thephpleague/fractal
src/Serializer/JsonApiSerializer.php
JsonApiSerializer.meta
public function meta(array $meta) { if (empty($meta)) { return []; } $result['meta'] = $meta; if (array_key_exists('pagination', $result['meta'])) { $result['links'] = $result['meta']['pagination']['links']; unset($result['meta']['pagination']['l...
php
public function meta(array $meta) { if (empty($meta)) { return []; } $result['meta'] = $meta; if (array_key_exists('pagination', $result['meta'])) { $result['links'] = $result['meta']['pagination']['links']; unset($result['meta']['pagination']['l...
[ "public", "function", "meta", "(", "array", "$", "meta", ")", "{", "if", "(", "empty", "(", "$", "meta", ")", ")", "{", "return", "[", "]", ";", "}", "$", "result", "[", "'meta'", "]", "=", "$", "meta", ";", "if", "(", "array_key_exists", "(", ...
Serialize the meta. @param array $meta @return array
[ "Serialize", "the", "meta", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Serializer/JsonApiSerializer.php#L146-L160
train
thephpleague/fractal
src/Serializer/JsonApiSerializer.php
JsonApiSerializer.includedData
public function includedData(ResourceInterface $resource, array $data) { list($serializedData, $linkedIds) = $this->pullOutNestedIncludedData($data); foreach ($data as $value) { foreach ($value as $includeObject) { if ($this->isNull($includeObject) || $this->isEmpty($inc...
php
public function includedData(ResourceInterface $resource, array $data) { list($serializedData, $linkedIds) = $this->pullOutNestedIncludedData($data); foreach ($data as $value) { foreach ($value as $includeObject) { if ($this->isNull($includeObject) || $this->isEmpty($inc...
[ "public", "function", "includedData", "(", "ResourceInterface", "$", "resource", ",", "array", "$", "data", ")", "{", "list", "(", "$", "serializedData", ",", "$", "linkedIds", ")", "=", "$", "this", "->", "pullOutNestedIncludedData", "(", "$", "data", ")", ...
Serialize the included data. @param ResourceInterface $resource @param array $data @return array
[ "Serialize", "the", "included", "data", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Serializer/JsonApiSerializer.php#L180-L196
train
thephpleague/fractal
src/Serializer/JsonApiSerializer.php
JsonApiSerializer.filterIncludes
public function filterIncludes($includedData, $data) { if (!isset($includedData['included'])) { return $includedData; } // Create the RootObjects $this->createRootObjects($data); // Filter out the root objects $filteredIncludes = array_filter($includedDa...
php
public function filterIncludes($includedData, $data) { if (!isset($includedData['included'])) { return $includedData; } // Create the RootObjects $this->createRootObjects($data); // Filter out the root objects $filteredIncludes = array_filter($includedDa...
[ "public", "function", "filterIncludes", "(", "$", "includedData", ",", "$", "data", ")", "{", "if", "(", "!", "isset", "(", "$", "includedData", "[", "'included'", "]", ")", ")", "{", "return", "$", "includedData", ";", "}", "// Create the RootObjects", "$...
Hook to manipulate the final sideloaded includes. The JSON API specification does not allow the root object to be included into the sideloaded `included`-array. We have to make sure it is filtered out, in case some object links to the root object in a relationship. @param array $includedData @param array $data @retur...
[ "Hook", "to", "manipulate", "the", "final", "sideloaded", "includes", ".", "The", "JSON", "API", "specification", "does", "not", "allow", "the", "root", "object", "to", "be", "included", "into", "the", "sideloaded", "included", "-", "array", ".", "We", "have...
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Serializer/JsonApiSerializer.php#L237-L253
train
thephpleague/fractal
src/Serializer/JsonApiSerializer.php
JsonApiSerializer.pullOutNestedIncludedData
protected function pullOutNestedIncludedData(array $data) { $includedData = []; $linkedIds = []; foreach ($data as $value) { foreach ($value as $includeObject) { if (isset($includeObject['included'])) { list($includedData, $linkedIds) = $this-...
php
protected function pullOutNestedIncludedData(array $data) { $includedData = []; $linkedIds = []; foreach ($data as $value) { foreach ($value as $includeObject) { if (isset($includeObject['included'])) { list($includedData, $linkedIds) = $this-...
[ "protected", "function", "pullOutNestedIncludedData", "(", "array", "$", "data", ")", "{", "$", "includedData", "=", "[", "]", ";", "$", "linkedIds", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "value", ")", "{", "foreach", "(", "$", ...
Keep all sideloaded inclusion data on the top level. @param array $data @return array
[ "Keep", "all", "sideloaded", "inclusion", "data", "on", "the", "top", "level", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Serializer/JsonApiSerializer.php#L397-L411
train
thephpleague/fractal
src/Serializer/JsonApiSerializer.php
JsonApiSerializer.createIncludeObjects
private function createIncludeObjects($includeObject) { if ($this->isCollection($includeObject)) { $includeObjects = $includeObject['data']; return $includeObjects; } else { $includeObjects = [$includeObject['data']]; return $includeObjects; ...
php
private function createIncludeObjects($includeObject) { if ($this->isCollection($includeObject)) { $includeObjects = $includeObject['data']; return $includeObjects; } else { $includeObjects = [$includeObject['data']]; return $includeObjects; ...
[ "private", "function", "createIncludeObjects", "(", "$", "includeObject", ")", "{", "if", "(", "$", "this", "->", "isCollection", "(", "$", "includeObject", ")", ")", "{", "$", "includeObjects", "=", "$", "includeObject", "[", "'data'", "]", ";", "return", ...
Check if the objects are part of a collection or not @param $includeObject @return array
[ "Check", "if", "the", "objects", "are", "part", "of", "a", "collection", "or", "not" ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Serializer/JsonApiSerializer.php#L430-L441
train
thephpleague/fractal
src/Serializer/JsonApiSerializer.php
JsonApiSerializer.createRootObjects
private function createRootObjects($data) { if ($this->isCollection($data)) { $this->setRootObjects($data['data']); } else { $this->setRootObjects([$data['data']]); } }
php
private function createRootObjects($data) { if ($this->isCollection($data)) { $this->setRootObjects($data['data']); } else { $this->setRootObjects([$data['data']]); } }
[ "private", "function", "createRootObjects", "(", "$", "data", ")", "{", "if", "(", "$", "this", "->", "isCollection", "(", "$", "data", ")", ")", "{", "$", "this", "->", "setRootObjects", "(", "$", "data", "[", "'data'", "]", ")", ";", "}", "else", ...
Sets the RootObjects, either as collection or not. @param $data
[ "Sets", "the", "RootObjects", "either", "as", "collection", "or", "not", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Serializer/JsonApiSerializer.php#L448-L455
train
thephpleague/fractal
src/Serializer/JsonApiSerializer.php
JsonApiSerializer.fillRelationshipAsCollection
private function fillRelationshipAsCollection($data, $relationship, $key) { foreach ($relationship as $index => $relationshipData) { $data['data'][$index]['relationships'][$key] = $relationshipData; if ($this->shouldIncludeLinks()) { $data['data'][$index]['relationsh...
php
private function fillRelationshipAsCollection($data, $relationship, $key) { foreach ($relationship as $index => $relationshipData) { $data['data'][$index]['relationships'][$key] = $relationshipData; if ($this->shouldIncludeLinks()) { $data['data'][$index]['relationsh...
[ "private", "function", "fillRelationshipAsCollection", "(", "$", "data", ",", "$", "relationship", ",", "$", "key", ")", "{", "foreach", "(", "$", "relationship", "as", "$", "index", "=>", "$", "relationshipData", ")", "{", "$", "data", "[", "'data'", "]",...
Loops over the relationships of the provided data and formats it @param $data @param $relationship @param $key @return array
[ "Loops", "over", "the", "relationships", "of", "the", "provided", "data", "and", "formats", "it" ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Serializer/JsonApiSerializer.php#L467-L483
train
thephpleague/fractal
src/Manager.php
Manager.createData
public function createData(ResourceInterface $resource, $scopeIdentifier = null, Scope $parentScopeInstance = null) { if ($parentScopeInstance !== null) { return $this->scopeFactory->createChildScopeFor($this, $parentScopeInstance, $resource, $scopeIdentifier); } return $this->s...
php
public function createData(ResourceInterface $resource, $scopeIdentifier = null, Scope $parentScopeInstance = null) { if ($parentScopeInstance !== null) { return $this->scopeFactory->createChildScopeFor($this, $parentScopeInstance, $resource, $scopeIdentifier); } return $this->s...
[ "public", "function", "createData", "(", "ResourceInterface", "$", "resource", ",", "$", "scopeIdentifier", "=", "null", ",", "Scope", "$", "parentScopeInstance", "=", "null", ")", "{", "if", "(", "$", "parentScopeInstance", "!==", "null", ")", "{", "return", ...
Create Data. Main method to kick this all off. Make a resource then pass it over, and use toArray() @param ResourceInterface $resource @param string $scopeIdentifier @param Scope $parentScopeInstance @return Scope
[ "Create", "Data", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Manager.php#L99-L106
train
thephpleague/fractal
src/Manager.php
Manager.parseIncludes
public function parseIncludes($includes) { // Wipe these before we go again $this->requestedIncludes = $this->includeParams = []; if (is_string($includes)) { $includes = explode(',', $includes); } if (! is_array($includes)) { throw new \InvalidArgume...
php
public function parseIncludes($includes) { // Wipe these before we go again $this->requestedIncludes = $this->includeParams = []; if (is_string($includes)) { $includes = explode(',', $includes); } if (! is_array($includes)) { throw new \InvalidArgume...
[ "public", "function", "parseIncludes", "(", "$", "includes", ")", "{", "// Wipe these before we go again", "$", "this", "->", "requestedIncludes", "=", "$", "this", "->", "includeParams", "=", "[", "]", ";", "if", "(", "is_string", "(", "$", "includes", ")", ...
Parse Include String. @param array|string $includes Array or csv string of resources to include @return $this
[ "Parse", "Include", "String", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Manager.php#L163-L221
train
thephpleague/fractal
src/Manager.php
Manager.getFieldset
public function getFieldset($type) { return !isset($this->requestedFieldsets[$type]) ? null : new ParamBag($this->requestedFieldsets[$type]); }
php
public function getFieldset($type) { return !isset($this->requestedFieldsets[$type]) ? null : new ParamBag($this->requestedFieldsets[$type]); }
[ "public", "function", "getFieldset", "(", "$", "type", ")", "{", "return", "!", "isset", "(", "$", "this", "->", "requestedFieldsets", "[", "$", "type", "]", ")", "?", "null", ":", "new", "ParamBag", "(", "$", "this", "->", "requestedFieldsets", "[", "...
Get fieldset params for the specified type. @param string $type @return \League\Fractal\ParamBag|null
[ "Get", "fieldset", "params", "for", "the", "specified", "type", "." ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Manager.php#L263-L268
train
thephpleague/fractal
src/Manager.php
Manager.autoIncludeParents
protected function autoIncludeParents() { $parsed = []; foreach ($this->requestedIncludes as $include) { $nested = explode('.', $include); $part = array_shift($nested); $parsed[] = $part; while (count($nested) > 0) { $part .= '.'.arr...
php
protected function autoIncludeParents() { $parsed = []; foreach ($this->requestedIncludes as $include) { $nested = explode('.', $include); $part = array_shift($nested); $parsed[] = $part; while (count($nested) > 0) { $part .= '.'.arr...
[ "protected", "function", "autoIncludeParents", "(", ")", "{", "$", "parsed", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "requestedIncludes", "as", "$", "include", ")", "{", "$", "nested", "=", "explode", "(", "'.'", ",", "$", "include", ")"...
Auto-include Parents Look at the requested includes and automatically include the parents if they are not explicitly requested. E.g: [foo, bar.baz] becomes [foo, bar, bar.baz] @internal @return void
[ "Auto", "-", "include", "Parents" ]
c08a0f6db4dbc58d12e934e12203d2c2d5553409
https://github.com/thephpleague/fractal/blob/c08a0f6db4dbc58d12e934e12203d2c2d5553409/src/Manager.php#L342-L359
train
Wixel/GUMP
gump.class.php
GUMP.filter_input
public static function filter_input(array $data, array $filters) { $gump = self::get_instance(); return $gump->filter($data, $filters); }
php
public static function filter_input(array $data, array $filters) { $gump = self::get_instance(); return $gump->filter($data, $filters); }
[ "public", "static", "function", "filter_input", "(", "array", "$", "data", ",", "array", "$", "filters", ")", "{", "$", "gump", "=", "self", "::", "get_instance", "(", ")", ";", "return", "$", "gump", "->", "filter", "(", "$", "data", ",", "$", "filt...
Shorthand method for running only the data filters. @param array $data @param array $filters @return mixed
[ "Shorthand", "method", "for", "running", "only", "the", "data", "filters", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L117-L122
train
Wixel/GUMP
gump.class.php
GUMP.sanitize
public function sanitize(array $input, array $fields = array(), $utf8_encode = true) { $magic_quotes = (bool) get_magic_quotes_gpc(); if (empty($fields)) { $fields = array_keys($input); } $return = array(); foreach ($fields as $field) { if (!isset($...
php
public function sanitize(array $input, array $fields = array(), $utf8_encode = true) { $magic_quotes = (bool) get_magic_quotes_gpc(); if (empty($fields)) { $fields = array_keys($input); } $return = array(); foreach ($fields as $field) { if (!isset($...
[ "public", "function", "sanitize", "(", "array", "$", "input", ",", "array", "$", "fields", "=", "array", "(", ")", ",", "$", "utf8_encode", "=", "true", ")", "{", "$", "magic_quotes", "=", "(", "bool", ")", "get_magic_quotes_gpc", "(", ")", ";", "if", ...
Sanitize the input data. @param array $input @param null $fields @param bool $utf8_encode @return array
[ "Sanitize", "the", "input", "data", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L317-L360
train
Wixel/GUMP
gump.class.php
GUMP.set_error_message
public static function set_error_message($rule, $message) { $gump = self::get_instance(); self::$validation_methods_errors[$rule] = $message; }
php
public static function set_error_message($rule, $message) { $gump = self::get_instance(); self::$validation_methods_errors[$rule] = $message; }
[ "public", "static", "function", "set_error_message", "(", "$", "rule", ",", "$", "message", ")", "{", "$", "gump", "=", "self", "::", "get_instance", "(", ")", ";", "self", "::", "$", "validation_methods_errors", "[", "$", "rule", "]", "=", "$", "message...
Set a custom error message for a validation rule. @param string $rule @param string $message
[ "Set", "a", "custom", "error", "message", "for", "a", "validation", "rule", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L508-L512
train
Wixel/GUMP
gump.class.php
GUMP.get_messages
protected function get_messages() { $lang_file = __DIR__.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$this->lang.'.php'; $messages = require $lang_file; if ($validation_methods_errors = self::$validation_methods_errors) { $messages = array_merge($messages, $validation_methods...
php
protected function get_messages() { $lang_file = __DIR__.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$this->lang.'.php'; $messages = require $lang_file; if ($validation_methods_errors = self::$validation_methods_errors) { $messages = array_merge($messages, $validation_methods...
[ "protected", "function", "get_messages", "(", ")", "{", "$", "lang_file", "=", "__DIR__", ".", "DIRECTORY_SEPARATOR", ".", "'lang'", ".", "DIRECTORY_SEPARATOR", ".", "$", "this", "->", "lang", ".", "'.php'", ";", "$", "messages", "=", "require", "$", "lang_f...
Get error messages. @return array
[ "Get", "error", "messages", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L538-L547
train
Wixel/GUMP
gump.class.php
GUMP.get_readable_errors
public function get_readable_errors($convert_to_string = false, $field_class = 'gump-field', $error_class = 'gump-error-message') { if (empty($this->errors)) { return ($convert_to_string) ? null : array(); } $resp = array(); // Error messages $messages = $this->...
php
public function get_readable_errors($convert_to_string = false, $field_class = 'gump-field', $error_class = 'gump-error-message') { if (empty($this->errors)) { return ($convert_to_string) ? null : array(); } $resp = array(); // Error messages $messages = $this->...
[ "public", "function", "get_readable_errors", "(", "$", "convert_to_string", "=", "false", ",", "$", "field_class", "=", "'gump-field'", ",", "$", "error_class", "=", "'gump-error-message'", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "errors", ")", ...
Process the validation errors and return human readable error messages. @param bool $convert_to_string = false @param string $field_class @param string $error_class @return array @return string
[ "Process", "the", "validation", "errors", "and", "return", "human", "readable", "error", "messages", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L559-L605
train
Wixel/GUMP
gump.class.php
GUMP.get_errors_array
public function get_errors_array($convert_to_string = null) { if (empty($this->errors)) { return ($convert_to_string) ? null : array(); } $resp = array(); // Error messages $messages = $this->get_messages(); foreach ($this->errors as $e) { ...
php
public function get_errors_array($convert_to_string = null) { if (empty($this->errors)) { return ($convert_to_string) ? null : array(); } $resp = array(); // Error messages $messages = $this->get_messages(); foreach ($this->errors as $e) { ...
[ "public", "function", "get_errors_array", "(", "$", "convert_to_string", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "errors", ")", ")", "{", "return", "(", "$", "convert_to_string", ")", "?", "null", ":", "array", "(", ")", ";",...
Process the validation errors and return an array of errors with field names as keys. @param $convert_to_string @return array | null (if empty)
[ "Process", "the", "validation", "errors", "and", "return", "an", "array", "of", "errors", "with", "field", "names", "as", "keys", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L614-L656
train
Wixel/GUMP
gump.class.php
GUMP.filter_slug
protected function filter_slug($value, $params = null) { $delimiter = '-'; $slug = strtolower(trim(preg_replace('/[\s-]+/', $delimiter, preg_replace('/[^A-Za-z0-9-]+/', $delimiter, preg_replace('/[&]/', 'and', preg_replace('/[\']/', '', iconv('UTF-8', 'ASCII//TRANSLIT', $str))))), $delimiter)); ...
php
protected function filter_slug($value, $params = null) { $delimiter = '-'; $slug = strtolower(trim(preg_replace('/[\s-]+/', $delimiter, preg_replace('/[^A-Za-z0-9-]+/', $delimiter, preg_replace('/[&]/', 'and', preg_replace('/[\']/', '', iconv('UTF-8', 'ASCII//TRANSLIT', $str))))), $delimiter)); ...
[ "protected", "function", "filter_slug", "(", "$", "value", ",", "$", "params", "=", "null", ")", "{", "$", "delimiter", "=", "'-'", ";", "$", "slug", "=", "strtolower", "(", "trim", "(", "preg_replace", "(", "'/[\\s-]+/'", ",", "$", "delimiter", ",", "...
Converts value to url-web-slugs. Credit: https://stackoverflow.com/questions/40641973/php-to-convert-string-to-slug http://cubiq.org/the-perfect-php-clean-url-generator @param string $value @param array $params @return string
[ "Converts", "value", "to", "url", "-", "web", "-", "slugs", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L951-L956
train
Wixel/GUMP
gump.class.php
GUMP.validate_contains
protected function validate_contains($field, $input, $param = null) { if (!isset($input[$field])) { return; } $param = trim(strtolower($param)); $value = trim(strtolower($input[$field])); if (preg_match_all('#\'(.+?)\'#', $param, $matches, PREG_PATTERN_ORDER)) ...
php
protected function validate_contains($field, $input, $param = null) { if (!isset($input[$field])) { return; } $param = trim(strtolower($param)); $value = trim(strtolower($input[$field])); if (preg_match_all('#\'(.+?)\'#', $param, $matches, PREG_PATTERN_ORDER)) ...
[ "protected", "function", "validate_contains", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", ")", "{", "return", ";", "}", "$", "param", "="...
Verify that a value is contained within the pre-defined value set. Usage: '<index>' => 'contains,value value value' @param string $field @param array $input @param null $param @return mixed
[ "Verify", "that", "a", "value", "is", "contained", "within", "the", "pre", "-", "defined", "value", "set", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L972-L998
train
Wixel/GUMP
gump.class.php
GUMP.validate_required
protected function validate_required($field, $input, $param = null) { if (isset($input[$field]) && ($input[$field] === false || $input[$field] === 0 || $input[$field] === 0.0 || $input[$field] === '0' || !empty($input[$field]))) { return; } return array( 'field' => $...
php
protected function validate_required($field, $input, $param = null) { if (isset($input[$field]) && ($input[$field] === false || $input[$field] === 0 || $input[$field] === 0.0 || $input[$field] === '0' || !empty($input[$field]))) { return; } return array( 'field' => $...
[ "protected", "function", "validate_required", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "&&", "(", "$", "input", "[", "$", "field", "]", "==...
Check if the specified key is present and not empty. Usage: '<index>' => 'required' @param string $field @param array $input @param null $param @return mixed
[ "Check", "if", "the", "specified", "key", "is", "present", "and", "not", "empty", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1083-L1095
train
Wixel/GUMP
gump.class.php
GUMP.validate_valid_email
protected function validate_valid_email($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!filter_var($input[$field], FILTER_VALIDATE_EMAIL)) { return array( 'field' => $field, 'value...
php
protected function validate_valid_email($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!filter_var($input[$field], FILTER_VALIDATE_EMAIL)) { return array( 'field' => $field, 'value...
[ "protected", "function", "validate_valid_email", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", ...
Determine if the provided email is valid. Usage: '<index>' => 'valid_email' @param string $field @param array $input @param null $param @return mixed
[ "Determine", "if", "the", "provided", "email", "is", "valid", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1108-L1122
train
Wixel/GUMP
gump.class.php
GUMP.validate_max_len
protected function validate_max_len($field, $input, $param = null) { if (!isset($input[$field])) { return; } if (function_exists('mb_strlen')) { if (mb_strlen($input[$field]) <= (int) $param) { return; } } else { if (st...
php
protected function validate_max_len($field, $input, $param = null) { if (!isset($input[$field])) { return; } if (function_exists('mb_strlen')) { if (mb_strlen($input[$field]) <= (int) $param) { return; } } else { if (st...
[ "protected", "function", "validate_max_len", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", ")", "{", "return", ";", "}", "if", "(", "functi...
Determine if the provided value length is less or equal to a specific value. Usage: '<index>' => 'max_len,240' @param string $field @param array $input @param null $param @return mixed
[ "Determine", "if", "the", "provided", "value", "length", "is", "less", "or", "equal", "to", "a", "specific", "value", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1135-L1157
train
Wixel/GUMP
gump.class.php
GUMP.validate_numeric
protected function validate_numeric($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!is_numeric($input[$field])) { return array( 'field' => $field, 'value' => $input[$field], ...
php
protected function validate_numeric($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!is_numeric($input[$field])) { return array( 'field' => $field, 'value' => $input[$field], ...
[ "protected", "function", "validate_numeric", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", "fie...
Determine if the provided value is a valid number or numeric string. Usage: '<index>' => 'numeric' @param string $field @param array $input @param null $param @return mixed
[ "Determine", "if", "the", "provided", "value", "is", "a", "valid", "number", "or", "numeric", "string", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1375-L1389
train
Wixel/GUMP
gump.class.php
GUMP.validate_valid_url
protected function validate_valid_url($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!filter_var($input[$field], FILTER_VALIDATE_URL)) { return array( 'field' => $field, 'value' =>...
php
protected function validate_valid_url($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!filter_var($input[$field], FILTER_VALIDATE_URL)) { return array( 'field' => $field, 'value' =>...
[ "protected", "function", "validate_valid_url", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", "f...
Determine if the provided value is a valid URL. Usage: '<index>' => 'valid_url' @param string $field @param array $input @param null $param @return mixed
[ "Determine", "if", "the", "provided", "value", "is", "a", "valid", "URL", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1486-L1500
train
Wixel/GUMP
gump.class.php
GUMP.validate_valid_ip
protected function validate_valid_ip($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!filter_var($input[$field], FILTER_VALIDATE_IP) !== false) { return array( 'field' => $field, 'v...
php
protected function validate_valid_ip($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!filter_var($input[$field], FILTER_VALIDATE_IP) !== false) { return array( 'field' => $field, 'v...
[ "protected", "function", "validate_valid_ip", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", "fi...
Determine if the provided value is a valid IP address. Usage: '<index>' => 'valid_ip' @param string $field @param array $input @return mixed
[ "Determine", "if", "the", "provided", "value", "is", "a", "valid", "IP", "address", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1556-L1570
train
Wixel/GUMP
gump.class.php
GUMP.validate_valid_ipv6
protected function validate_valid_ipv6($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!filter_var($input[$field], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { return array( 'field' => $field, ...
php
protected function validate_valid_ipv6($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!filter_var($input[$field], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { return array( 'field' => $field, ...
[ "protected", "function", "validate_valid_ipv6", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", "...
Determine if the provided value is a valid IPv6 address. Usage: '<index>' => 'valid_ipv6' @param string $field @param array $input @return mixed
[ "Determine", "if", "the", "provided", "value", "is", "a", "valid", "IPv6", "address", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1617-L1631
train
Wixel/GUMP
gump.class.php
GUMP.validate_valid_cc
protected function validate_valid_cc($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } $number = preg_replace('/\D/', '', $input[$field]); if (function_exists('mb_strlen')) { $number_length = mb_strlen($number)...
php
protected function validate_valid_cc($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } $number = preg_replace('/\D/', '', $input[$field]); if (function_exists('mb_strlen')) { $number_length = mb_strlen($number)...
[ "protected", "function", "validate_valid_cc", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", "fi...
Determine if the input is a valid credit card number. See: http://stackoverflow.com/questions/174730/what-is-the-best-way-to-validate-a-credit-card-in-php Usage: '<index>' => 'valid_cc' @param string $field @param array $input @return mixed
[ "Determine", "if", "the", "input", "is", "a", "valid", "credit", "card", "number", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1644-L1703
train
Wixel/GUMP
gump.class.php
GUMP.validate_street_address
protected function validate_street_address($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } // Theory: 1 number, 1 or more spaces, 1 or more words $hasLetter = preg_match('/[a-zA-Z]/', $input[$field]); $hasDigit = ...
php
protected function validate_street_address($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } // Theory: 1 number, 1 or more spaces, 1 or more words $hasLetter = preg_match('/[a-zA-Z]/', $input[$field]); $hasDigit = ...
[ "protected", "function", "validate_street_address", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$",...
Determine if the provided input is likely to be a street address using weak detection. Usage: '<index>' => 'street_address' @param string $field @param array $input @return mixed
[ "Determine", "if", "the", "provided", "input", "is", "likely", "to", "be", "a", "street", "address", "using", "weak", "detection", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1742-L1763
train
Wixel/GUMP
gump.class.php
GUMP.validate_starts
protected function validate_starts($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (strpos($input[$field], $param) !== 0) { return array( 'field' => $field, 'value' => $input[$field]...
php
protected function validate_starts($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (strpos($input[$field], $param) !== 0) { return array( 'field' => $field, 'value' => $input[$field]...
[ "protected", "function", "validate_starts", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", "fiel...
Determine if the provided value starts with param. Usage: '<index>' => 'starts,Z' @param string $field @param array $input @return mixed
[ "Determine", "if", "the", "provided", "value", "starts", "with", "param", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1960-L1974
train
Wixel/GUMP
gump.class.php
GUMP.validate_required_file
protected function validate_required_file($field, $input, $param = null) { if (!isset($input[$field])) { return; } if (is_array($input[$field]) && $input[$field]['error'] !== 4) { return; } return array( 'field' => $fiel...
php
protected function validate_required_file($field, $input, $param = null) { if (!isset($input[$field])) { return; } if (is_array($input[$field]) && $input[$field]['error'] !== 4) { return; } return array( 'field' => $fiel...
[ "protected", "function", "validate_required_file", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", ")", "{", "return", ";", "}", "if", "(", "...
Checks if a file was uploaded. Usage: '<index>' => 'required_file' @param string $field @param array $input @return mixed
[ "Checks", "if", "a", "file", "was", "uploaded", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L1986-L2002
train
Wixel/GUMP
gump.class.php
GUMP.validate_extension
protected function validate_extension($field, $input, $param = null) { if (!isset($input[$field])) { return; } if (is_array($input[$field]) && $input[$field]['error'] !== 4) { $param = trim(strtolower($param)); $allowed_extensions = explode(';', $param); ...
php
protected function validate_extension($field, $input, $param = null) { if (!isset($input[$field])) { return; } if (is_array($input[$field]) && $input[$field]['error'] !== 4) { $param = trim(strtolower($param)); $allowed_extensions = explode(';', $param); ...
[ "protected", "function", "validate_extension", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", ")", "{", "return", ";", "}", "if", "(", "is_a...
Check the uploaded file for extension for now checks only the ext should add mime type check. Usage: '<index>' => 'extension,png;jpg;gif @param string $field @param array $input @return mixed
[ "Check", "the", "uploaded", "file", "for", "extension", "for", "now", "checks", "only", "the", "ext", "should", "add", "mime", "type", "check", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L2015-L2039
train
Wixel/GUMP
gump.class.php
GUMP.validate_equalsfield
protected function validate_equalsfield($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if ($input[$field] == $input[$param]) { return; } return array( 'field' => $field, 'valu...
php
protected function validate_equalsfield($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if ($input[$field] == $input[$param]) { return; } return array( 'field' => $field, 'valu...
[ "protected", "function", "validate_equalsfield", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", ...
Determine if the provided field value equals current field value. Usage: '<index>' => 'equalsfield,Z' @param string $field @param string $input @param string $param field to compare with @return mixed
[ "Determine", "if", "the", "provided", "field", "value", "equals", "current", "field", "value", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L2053-L2069
train
Wixel/GUMP
gump.class.php
GUMP.validate_phone_number
protected function validate_phone_number($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } $regex = '/^(\d[\s-\.]?)?[\(\[\s-\.]{0,2}?\d{3}[\)\]\s-\.]{0,2}?\d{3}[\s-\.]?\d{4}$/i'; if (!preg_match($regex, $input[$field])) { ...
php
protected function validate_phone_number($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } $regex = '/^(\d[\s-\.]?)?[\(\[\s-\.]{0,2}?\d{3}[\)\]\s-\.]{0,2}?\d{3}[\s-\.]?\d{4}$/i'; if (!preg_match($regex, $input[$field])) { ...
[ "protected", "function", "validate_phone_number", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", ...
Determine if the provided value is a valid phone number. Usage: '<index>' => 'phone_number' @param string $field @param array $input @return mixed Examples: 555-555-5555: valid 555.555.5555: valid 5555425555: valid 555 555 5555: valid 1(519) 555-4444: valid 1 (519) 555-4422: valid 1-555-555-5555: valid 1-(555)-55...
[ "Determine", "if", "the", "provided", "value", "is", "a", "valid", "phone", "number", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L2136-L2151
train
Wixel/GUMP
gump.class.php
GUMP.validate_valid_json_string
protected function validate_valid_json_string($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!is_string($input[$field]) || !is_object(json_decode($input[$field]))) { return array( 'field' => $field,...
php
protected function validate_valid_json_string($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!is_string($input[$field]) || !is_object(json_decode($input[$field]))) { return array( 'field' => $field,...
[ "protected", "function", "validate_valid_json_string", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "...
JSON validator. Usage: '<index>' => 'valid_json_string' @param string $field @param array $input @return mixed
[ "JSON", "validator", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L2190-L2204
train
Wixel/GUMP
gump.class.php
GUMP.validate_valid_array_size_greater
protected function validate_valid_array_size_greater($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!is_array($input[$field]) || sizeof($input[$field]) < (int)$param) { return array( 'field' => $fie...
php
protected function validate_valid_array_size_greater($field, $input, $param = null) { if (!isset($input[$field]) || empty($input[$field])) { return; } if (!is_array($input[$field]) || sizeof($input[$field]) < (int)$param) { return array( 'field' => $fie...
[ "protected", "function", "validate_valid_array_size_greater", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "...
Check if an input is an array and if the size is more or equal to a specific value. Usage: '<index>' => 'valid_array_size_greater,1' @param string $field @param array $input @return mixed
[ "Check", "if", "an", "input", "is", "an", "array", "and", "if", "the", "size", "is", "more", "or", "equal", "to", "a", "specific", "value", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L2216-L2230
train
Wixel/GUMP
gump.class.php
GUMP.validate_valid_twitter
protected function validate_valid_twitter($field, $input, $param = NULL) { if(!isset($input[$field]) || empty($input[$field])) { return; } $json_twitter = file_get_contents("http://twitter.com/users/username_available?username=".$input[$field]); $twitter_...
php
protected function validate_valid_twitter($field, $input, $param = NULL) { if(!isset($input[$field]) || empty($input[$field])) { return; } $json_twitter = file_get_contents("http://twitter.com/users/username_available?username=".$input[$field]); $twitter_...
[ "protected", "function", "validate_valid_twitter", "(", "$", "field", ",", "$", "input", ",", "$", "param", "=", "NULL", ")", "{", "if", "(", "!", "isset", "(", "$", "input", "[", "$", "field", "]", ")", "||", "empty", "(", "$", "input", "[", "$", ...
Determine if the provided value is a valid twitter handle. @access protected @param string $field @param array $input @return mixed
[ "Determine", "if", "the", "provided", "value", "is", "a", "valid", "twitter", "handle", "." ]
6f7451eddcdca596495ce6883855e9c59d35e1e6
https://github.com/Wixel/GUMP/blob/6f7451eddcdca596495ce6883855e9c59d35e1e6/gump.class.php#L2425-L2442
train
thephpleague/glide
src/Manipulators/Sharpen.php
Sharpen.run
public function run(Image $image) { $sharpen = $this->getSharpen(); if ($sharpen !== null) { $image->sharpen($sharpen); } return $image; }
php
public function run(Image $image) { $sharpen = $this->getSharpen(); if ($sharpen !== null) { $image->sharpen($sharpen); } return $image; }
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "sharpen", "=", "$", "this", "->", "getSharpen", "(", ")", ";", "if", "(", "$", "sharpen", "!==", "null", ")", "{", "$", "image", "->", "sharpen", "(", "$", "sharpen", ")", "...
Perform sharpen image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "sharpen", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Sharpen.php#L17-L26
train
thephpleague/glide
src/Manipulators/Sharpen.php
Sharpen.getSharpen
public function getSharpen() { if (!is_numeric($this->sharp)) { return; } if ($this->sharp < 0 or $this->sharp > 100) { return; } return (int) $this->sharp; }
php
public function getSharpen() { if (!is_numeric($this->sharp)) { return; } if ($this->sharp < 0 or $this->sharp > 100) { return; } return (int) $this->sharp; }
[ "public", "function", "getSharpen", "(", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "this", "->", "sharp", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "sharp", "<", "0", "or", "$", "this", "->", "sharp", ">", "100", ...
Resolve sharpen amount. @return string The resolved sharpen amount.
[ "Resolve", "sharpen", "amount", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Sharpen.php#L32-L43
train
thephpleague/glide
src/Manipulators/Filter.php
Filter.run
public function run(Image $image) { if ($this->filt === 'greyscale') { return $this->runGreyscaleFilter($image); } if ($this->filt === 'sepia') { return $this->runSepiaFilter($image); } return $image; }
php
public function run(Image $image) { if ($this->filt === 'greyscale') { return $this->runGreyscaleFilter($image); } if ($this->filt === 'sepia') { return $this->runSepiaFilter($image); } return $image; }
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "if", "(", "$", "this", "->", "filt", "===", "'greyscale'", ")", "{", "return", "$", "this", "->", "runGreyscaleFilter", "(", "$", "image", ")", ";", "}", "if", "(", "$", "this", "-...
Perform filter image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "filter", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Filter.php#L17-L28
train
thephpleague/glide
src/Manipulators/Filter.php
Filter.runSepiaFilter
public function runSepiaFilter(Image $image) { $image->greyscale(); $image->brightness(-10); $image->contrast(10); $image->colorize(38, 27, 12); $image->brightness(-10); $image->contrast(10); return $image; }
php
public function runSepiaFilter(Image $image) { $image->greyscale(); $image->brightness(-10); $image->contrast(10); $image->colorize(38, 27, 12); $image->brightness(-10); $image->contrast(10); return $image; }
[ "public", "function", "runSepiaFilter", "(", "Image", "$", "image", ")", "{", "$", "image", "->", "greyscale", "(", ")", ";", "$", "image", "->", "brightness", "(", "-", "10", ")", ";", "$", "image", "->", "contrast", "(", "10", ")", ";", "$", "ima...
Perform sepia manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "sepia", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Filter.php#L45-L55
train
thephpleague/glide
src/Manipulators/Contrast.php
Contrast.run
public function run(Image $image) { $contrast = $this->getContrast(); if ($contrast !== null) { $image->contrast($contrast); } return $image; }
php
public function run(Image $image) { $contrast = $this->getContrast(); if ($contrast !== null) { $image->contrast($contrast); } return $image; }
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "contrast", "=", "$", "this", "->", "getContrast", "(", ")", ";", "if", "(", "$", "contrast", "!==", "null", ")", "{", "$", "image", "->", "contrast", "(", "$", "contrast", ")"...
Perform contrast image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "contrast", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Contrast.php#L17-L26
train
thephpleague/glide
src/Manipulators/Contrast.php
Contrast.getContrast
public function getContrast() { if (!preg_match('/^-*[0-9]+$/', $this->con)) { return; } if ($this->con < -100 or $this->con > 100) { return; } return (int) $this->con; }
php
public function getContrast() { if (!preg_match('/^-*[0-9]+$/', $this->con)) { return; } if ($this->con < -100 or $this->con > 100) { return; } return (int) $this->con; }
[ "public", "function", "getContrast", "(", ")", "{", "if", "(", "!", "preg_match", "(", "'/^-*[0-9]+$/'", ",", "$", "this", "->", "con", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "con", "<", "-", "100", "or", "$", "this", "-...
Resolve contrast amount. @return string The resolved contrast amount.
[ "Resolve", "contrast", "amount", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Contrast.php#L32-L43
train
thephpleague/glide
src/ServerFactory.php
ServerFactory.getSource
public function getSource() { if (!isset($this->config['source'])) { throw new InvalidArgumentException('A "source" file system must be set.'); } if (is_string($this->config['source'])) { return new Filesystem( new Local($this->config['source']) ...
php
public function getSource() { if (!isset($this->config['source'])) { throw new InvalidArgumentException('A "source" file system must be set.'); } if (is_string($this->config['source'])) { return new Filesystem( new Local($this->config['source']) ...
[ "public", "function", "getSource", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "config", "[", "'source'", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'A \"source\" file system must be set.'", ")", ";", "}", "if",...
Get source file system. @return FilesystemInterface Source file system.
[ "Get", "source", "file", "system", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/ServerFactory.php#L73-L86
train
thephpleague/glide
src/ServerFactory.php
ServerFactory.getCache
public function getCache() { if (!isset($this->config['cache'])) { throw new InvalidArgumentException('A "cache" file system must be set.'); } if (is_string($this->config['cache'])) { return new Filesystem( new Local($this->config['cache']) ...
php
public function getCache() { if (!isset($this->config['cache'])) { throw new InvalidArgumentException('A "cache" file system must be set.'); } if (is_string($this->config['cache'])) { return new Filesystem( new Local($this->config['cache']) ...
[ "public", "function", "getCache", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "config", "[", "'cache'", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'A \"cache\" file system must be set.'", ")", ";", "}", "if", ...
Get cache file system. @return FilesystemInterface Cache file system.
[ "Get", "cache", "file", "system", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/ServerFactory.php#L103-L116
train
thephpleague/glide
src/ServerFactory.php
ServerFactory.getWatermarks
public function getWatermarks() { if (!isset($this->config['watermarks'])) { return; } if (is_string($this->config['watermarks'])) { return new Filesystem( new Local($this->config['watermarks']) ); } return $this->config['...
php
public function getWatermarks() { if (!isset($this->config['watermarks'])) { return; } if (is_string($this->config['watermarks'])) { return new Filesystem( new Local($this->config['watermarks']) ); } return $this->config['...
[ "public", "function", "getWatermarks", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "config", "[", "'watermarks'", "]", ")", ")", "{", "return", ";", "}", "if", "(", "is_string", "(", "$", "this", "->", "config", "[", "'watermarks'...
Get watermarks file system. @return FilesystemInterface|null Watermarks file system.
[ "Get", "watermarks", "file", "system", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/ServerFactory.php#L159-L172
train
thephpleague/glide
src/ServerFactory.php
ServerFactory.getImageManager
public function getImageManager() { $driver = 'gd'; if (isset($this->config['driver'])) { $driver = $this->config['driver']; } return new ImageManager([ 'driver' => $driver, ]); }
php
public function getImageManager() { $driver = 'gd'; if (isset($this->config['driver'])) { $driver = $this->config['driver']; } return new ImageManager([ 'driver' => $driver, ]); }
[ "public", "function", "getImageManager", "(", ")", "{", "$", "driver", "=", "'gd'", ";", "if", "(", "isset", "(", "$", "this", "->", "config", "[", "'driver'", "]", ")", ")", "{", "$", "driver", "=", "$", "this", "->", "config", "[", "'driver'", "]...
Get Intervention image manager. @return ImageManager Intervention image manager.
[ "Get", "Intervention", "image", "manager", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/ServerFactory.php#L201-L212
train
thephpleague/glide
src/ServerFactory.php
ServerFactory.getManipulators
public function getManipulators() { return [ new Orientation(), new Crop(), new Size($this->getMaxImageSize()), new Brightness(), new Contrast(), new Gamma(), new Sharpen(), new Filter(), new Flip(), ...
php
public function getManipulators() { return [ new Orientation(), new Crop(), new Size($this->getMaxImageSize()), new Brightness(), new Contrast(), new Gamma(), new Sharpen(), new Filter(), new Flip(), ...
[ "public", "function", "getManipulators", "(", ")", "{", "return", "[", "new", "Orientation", "(", ")", ",", "new", "Crop", "(", ")", ",", "new", "Size", "(", "$", "this", "->", "getMaxImageSize", "(", ")", ")", ",", "new", "Brightness", "(", ")", ","...
Get image manipulators. @return array Image manipulators.
[ "Get", "image", "manipulators", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/ServerFactory.php#L218-L237
train
thephpleague/glide
src/Manipulators/Blur.php
Blur.run
public function run(Image $image) { $blur = $this->getBlur(); if ($blur !== null) { $image->blur($blur); } return $image; }
php
public function run(Image $image) { $blur = $this->getBlur(); if ($blur !== null) { $image->blur($blur); } return $image; }
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "blur", "=", "$", "this", "->", "getBlur", "(", ")", ";", "if", "(", "$", "blur", "!==", "null", ")", "{", "$", "image", "->", "blur", "(", "$", "blur", ")", ";", "}", "r...
Perform blur image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "blur", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Blur.php#L17-L26
train
thephpleague/glide
src/Manipulators/Blur.php
Blur.getBlur
public function getBlur() { if (!is_numeric($this->blur)) { return; } if ($this->blur < 0 or $this->blur > 100) { return; } return (int) $this->blur; }
php
public function getBlur() { if (!is_numeric($this->blur)) { return; } if ($this->blur < 0 or $this->blur > 100) { return; } return (int) $this->blur; }
[ "public", "function", "getBlur", "(", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "this", "->", "blur", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "blur", "<", "0", "or", "$", "this", "->", "blur", ">", "100", ")", ...
Resolve blur amount. @return string The resolved blur amount.
[ "Resolve", "blur", "amount", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Blur.php#L32-L43
train
thephpleague/glide
src/Manipulators/Orientation.php
Orientation.run
public function run(Image $image) { $orientation = $this->getOrientation(); if ($orientation === 'auto') { return $image->orientate(); } return $image->rotate($orientation); }
php
public function run(Image $image) { $orientation = $this->getOrientation(); if ($orientation === 'auto') { return $image->orientate(); } return $image->rotate($orientation); }
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "orientation", "=", "$", "this", "->", "getOrientation", "(", ")", ";", "if", "(", "$", "orientation", "===", "'auto'", ")", "{", "return", "$", "image", "->", "orientate", "(", ...
Perform orientation image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "orientation", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Orientation.php#L17-L26
train
thephpleague/glide
src/Manipulators/Encode.php
Encode.run
public function run(Image $image) { $format = $this->getFormat($image); $quality = $this->getQuality(); if (in_array($format, ['jpg', 'pjpg'], true)) { $image = $image->getDriver() ->newImage($image->width(), $image->height(), '#fff') ...
php
public function run(Image $image) { $format = $this->getFormat($image); $quality = $this->getQuality(); if (in_array($format, ['jpg', 'pjpg'], true)) { $image = $image->getDriver() ->newImage($image->width(), $image->height(), '#fff') ...
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "format", "=", "$", "this", "->", "getFormat", "(", "$", "image", ")", ";", "$", "quality", "=", "$", "this", "->", "getQuality", "(", ")", ";", "if", "(", "in_array", "(", "...
Perform output image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "output", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Encode.php#L18-L35
train
thephpleague/glide
src/Manipulators/Encode.php
Encode.getFormat
public function getFormat(Image $image) { $allowed = [ 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'pjpg' => 'image/jpeg', 'png' => 'image/png', 'webp' => 'image/webp', ]; if (array_key_exists($this->fm, $allowed)) { r...
php
public function getFormat(Image $image) { $allowed = [ 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'pjpg' => 'image/jpeg', 'png' => 'image/png', 'webp' => 'image/webp', ]; if (array_key_exists($this->fm, $allowed)) { r...
[ "public", "function", "getFormat", "(", "Image", "$", "image", ")", "{", "$", "allowed", "=", "[", "'gif'", "=>", "'image/gif'", ",", "'jpg'", "=>", "'image/jpeg'", ",", "'pjpg'", "=>", "'image/jpeg'", ",", "'png'", "=>", "'image/png'", ",", "'webp'", "=>"...
Resolve format. @param Image $image The source image. @return string The resolved format.
[ "Resolve", "format", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Encode.php#L42-L61
train
thephpleague/glide
src/Manipulators/Encode.php
Encode.getQuality
public function getQuality() { $default = 90; if (!is_numeric($this->q)) { return $default; } if ($this->q < 0 or $this->q > 100) { return $default; } return (int) $this->q; }
php
public function getQuality() { $default = 90; if (!is_numeric($this->q)) { return $default; } if ($this->q < 0 or $this->q > 100) { return $default; } return (int) $this->q; }
[ "public", "function", "getQuality", "(", ")", "{", "$", "default", "=", "90", ";", "if", "(", "!", "is_numeric", "(", "$", "this", "->", "q", ")", ")", "{", "return", "$", "default", ";", "}", "if", "(", "$", "this", "->", "q", "<", "0", "or", ...
Resolve quality. @return string The resolved quality.
[ "Resolve", "quality", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Encode.php#L67-L80
train
thephpleague/glide
src/Manipulators/Crop.php
Crop.run
public function run(Image $image) { $coordinates = $this->getCoordinates($image); if ($coordinates) { $coordinates = $this->limitToImageBoundaries($image, $coordinates); $image->crop( $coordinates[0], $coordinates[1], $coordin...
php
public function run(Image $image) { $coordinates = $this->getCoordinates($image); if ($coordinates) { $coordinates = $this->limitToImageBoundaries($image, $coordinates); $image->crop( $coordinates[0], $coordinates[1], $coordin...
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "coordinates", "=", "$", "this", "->", "getCoordinates", "(", "$", "image", ")", ";", "if", "(", "$", "coordinates", ")", "{", "$", "coordinates", "=", "$", "this", "->", "limitT...
Perform crop image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "crop", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Crop.php#L17-L33
train
thephpleague/glide
src/Manipulators/Crop.php
Crop.getCoordinates
public function getCoordinates(Image $image) { $coordinates = explode(',', $this->crop); if (count($coordinates) !== 4 or (!is_numeric($coordinates[0])) or (!is_numeric($coordinates[1])) or (!is_numeric($coordinates[2])) or (!is_numeric($coordinates[3...
php
public function getCoordinates(Image $image) { $coordinates = explode(',', $this->crop); if (count($coordinates) !== 4 or (!is_numeric($coordinates[0])) or (!is_numeric($coordinates[1])) or (!is_numeric($coordinates[2])) or (!is_numeric($coordinates[3...
[ "public", "function", "getCoordinates", "(", "Image", "$", "image", ")", "{", "$", "coordinates", "=", "explode", "(", "','", ",", "$", "this", "->", "crop", ")", ";", "if", "(", "count", "(", "$", "coordinates", ")", "!==", "4", "or", "(", "!", "i...
Resolve coordinates. @param Image $image The source image. @return int[] The resolved coordinates.
[ "Resolve", "coordinates", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Crop.php#L40-L64
train
thephpleague/glide
src/Manipulators/Crop.php
Crop.limitToImageBoundaries
public function limitToImageBoundaries(Image $image, array $coordinates) { if ($coordinates[0] > ($image->width() - $coordinates[2])) { $coordinates[0] = $image->width() - $coordinates[2]; } if ($coordinates[1] > ($image->height() - $coordinates[3])) { $coordinates[1...
php
public function limitToImageBoundaries(Image $image, array $coordinates) { if ($coordinates[0] > ($image->width() - $coordinates[2])) { $coordinates[0] = $image->width() - $coordinates[2]; } if ($coordinates[1] > ($image->height() - $coordinates[3])) { $coordinates[1...
[ "public", "function", "limitToImageBoundaries", "(", "Image", "$", "image", ",", "array", "$", "coordinates", ")", "{", "if", "(", "$", "coordinates", "[", "0", "]", ">", "(", "$", "image", "->", "width", "(", ")", "-", "$", "coordinates", "[", "2", ...
Limit coordinates to image boundaries. @param Image $image The source image. @param int[] $coordinates The coordinates. @return int[] The limited coordinates.
[ "Limit", "coordinates", "to", "image", "boundaries", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Crop.php#L72-L83
train
thephpleague/glide
src/Signatures/Signature.php
Signature.generateSignature
public function generateSignature($path, array $params) { unset($params['s']); ksort($params); return md5($this->signKey.':'.ltrim($path, '/').'?'.http_build_query($params)); }
php
public function generateSignature($path, array $params) { unset($params['s']); ksort($params); return md5($this->signKey.':'.ltrim($path, '/').'?'.http_build_query($params)); }
[ "public", "function", "generateSignature", "(", "$", "path", ",", "array", "$", "params", ")", "{", "unset", "(", "$", "params", "[", "'s'", "]", ")", ";", "ksort", "(", "$", "params", ")", ";", "return", "md5", "(", "$", "this", "->", "signKey", "...
Generate an HTTP signature. @param string $path The resource path. @param array $params The manipulation parameters. @return string The generated HTTP signature.
[ "Generate", "an", "HTTP", "signature", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Signatures/Signature.php#L56-L62
train
thephpleague/glide
src/Manipulators/Size.php
Size.run
public function run(Image $image) { $width = $this->getWidth(); $height = $this->getHeight(); $fit = $this->getFit(); $dpr = $this->getDpr(); list($width, $height) = $this->resolveMissingDimensions($image, $width, $height); list($width, $height) = $this->applyDpr($wi...
php
public function run(Image $image) { $width = $this->getWidth(); $height = $this->getHeight(); $fit = $this->getFit(); $dpr = $this->getDpr(); list($width, $height) = $this->resolveMissingDimensions($image, $width, $height); list($width, $height) = $this->applyDpr($wi...
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "width", "=", "$", "this", "->", "getWidth", "(", ")", ";", "$", "height", "=", "$", "this", "->", "getHeight", "(", ")", ";", "$", "fit", "=", "$", "this", "->", "getFit", ...
Perform size image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "size", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L53-L69
train
thephpleague/glide
src/Manipulators/Size.php
Size.getFit
public function getFit() { if (in_array($this->fit, ['contain', 'fill', 'max', 'stretch'], true)) { return $this->fit; } if (preg_match('/^(crop)(-top-left|-top|-top-right|-left|-center|-right|-bottom-left|-bottom|-bottom-right|-[\d]{1,3}-[\d]{1,3}(?:-[\d]{1,3}(?:\.\d+)?)?)*$/',...
php
public function getFit() { if (in_array($this->fit, ['contain', 'fill', 'max', 'stretch'], true)) { return $this->fit; } if (preg_match('/^(crop)(-top-left|-top|-top-right|-left|-center|-right|-bottom-left|-bottom|-bottom-right|-[\d]{1,3}-[\d]{1,3}(?:-[\d]{1,3}(?:\.\d+)?)?)*$/',...
[ "public", "function", "getFit", "(", ")", "{", "if", "(", "in_array", "(", "$", "this", "->", "fit", ",", "[", "'contain'", ",", "'fill'", ",", "'max'", ",", "'stretch'", "]", ",", "true", ")", ")", "{", "return", "$", "this", "->", "fit", ";", "...
Resolve fit. @return string The resolved fit.
[ "Resolve", "fit", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L109-L120
train
thephpleague/glide
src/Manipulators/Size.php
Size.getDpr
public function getDpr() { if (!is_numeric($this->dpr)) { return 1.0; } if ($this->dpr < 0 or $this->dpr > 8) { return 1.0; } return (double) $this->dpr; }
php
public function getDpr() { if (!is_numeric($this->dpr)) { return 1.0; } if ($this->dpr < 0 or $this->dpr > 8) { return 1.0; } return (double) $this->dpr; }
[ "public", "function", "getDpr", "(", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "this", "->", "dpr", ")", ")", "{", "return", "1.0", ";", "}", "if", "(", "$", "this", "->", "dpr", "<", "0", "or", "$", "this", "->", "dpr", ">", "8", ")"...
Resolve the device pixel ratio. @return double The device pixel ratio.
[ "Resolve", "the", "device", "pixel", "ratio", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L126-L137
train
thephpleague/glide
src/Manipulators/Size.php
Size.resolveMissingDimensions
public function resolveMissingDimensions(Image $image, $width, $height) { if (is_null($width) and is_null($height)) { $width = $image->width(); $height = $image->height(); } if (is_null($width)) { $width = $height * ($image->width() / $image->height()); ...
php
public function resolveMissingDimensions(Image $image, $width, $height) { if (is_null($width) and is_null($height)) { $width = $image->width(); $height = $image->height(); } if (is_null($width)) { $width = $height * ($image->width() / $image->height()); ...
[ "public", "function", "resolveMissingDimensions", "(", "Image", "$", "image", ",", "$", "width", ",", "$", "height", ")", "{", "if", "(", "is_null", "(", "$", "width", ")", "and", "is_null", "(", "$", "height", ")", ")", "{", "$", "width", "=", "$", ...
Resolve missing image dimensions. @param Image $image The source image. @param integer|null $width The image width. @param integer|null $height The image height. @return integer[] The resolved width and height.
[ "Resolve", "missing", "image", "dimensions", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L146-L165
train
thephpleague/glide
src/Manipulators/Size.php
Size.applyDpr
public function applyDpr($width, $height, $dpr) { $width = $width * $dpr; $height = $height * $dpr; return [ (int) $width, (int) $height, ]; }
php
public function applyDpr($width, $height, $dpr) { $width = $width * $dpr; $height = $height * $dpr; return [ (int) $width, (int) $height, ]; }
[ "public", "function", "applyDpr", "(", "$", "width", ",", "$", "height", ",", "$", "dpr", ")", "{", "$", "width", "=", "$", "width", "*", "$", "dpr", ";", "$", "height", "=", "$", "height", "*", "$", "dpr", ";", "return", "[", "(", "int", ")", ...
Apply the device pixel ratio. @param integer $width The target image width. @param integer $height The target image height. @param integer $dpr The device pixel ratio. @return integer[] The modified width and height.
[ "Apply", "the", "device", "pixel", "ratio", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L174-L183
train