_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q21500 | CompletionProvider.getCompletionsFromAliasedNamespace | train | private function getCompletionsFromAliasedNamespace(
string $prefix,
string $alias,
string $aliasFqn,
bool $requireCanBeInstantiated
): \Generator {
$prefixFirstPart = nameGetFirstPart($prefix);
// Matched alias.
$resolvedPrefix = nameConcat($aliasFqn, nameWit... | php | {
"resource": ""
} |
q21501 | CompletionProvider.getCompletionsForKeywords | train | private function getCompletionsForKeywords(string $prefix): \Generator
{
foreach (self::KEYWORDS as $keyword) {
if (nameStartsWith($keyword, $prefix)) {
| php | {
"resource": ""
} |
q21502 | CompletionProvider.expandParentFqns | train | private function expandParentFqns(array $fqns) : Generator
{
foreach ($fqns as $fqn) {
yield $fqn;
$def = $this->index->getDefinition($fqn);
| php | {
"resource": ""
} |
q21503 | CompletionProvider.suggestVariablesAtNode | train | private function suggestVariablesAtNode(Node $node, string $namePrefix = ''): array
{
$vars = [];
// Find variables in the node itself
// When getting completion in the middle of a function, $node will be the function node
// so we need to search it
foreach ($this->findVaria... | php | {
"resource": ""
} |
q21504 | CompletionProvider.findVariableDefinitionsInNode | train | private function findVariableDefinitionsInNode(Node $node, string $namePrefix = ''): array
{
$vars = [];
// If the child node is a variable assignment, save it
$isAssignmentToVariable = function ($node) {
return $node instanceof Node\Expression\AssignmentExpression;
};
... | php | {
"resource": ""
} |
q21505 | AbstractAggregateIndex.isComplete | train | public function isComplete(): bool
{
foreach ($this->getIndexes() as $index) {
| php | {
"resource": ""
} |
q21506 | AbstractAggregateIndex.isStaticComplete | train | public function isStaticComplete(): bool
{
foreach ($this->getIndexes() as $index) {
if (!$index->isStaticComplete()) {
| php | {
"resource": ""
} |
q21507 | SignatureInformationFactory.create | train | public function create(FunctionLike $node): SignatureInformation
{
$params = $this->createParameters($node);
$label = $this->createLabel($params); | php | {
"resource": ""
} |
q21508 | SignatureInformationFactory.createParameters | train | private function createParameters(FunctionLike $node): array
{
$params = [];
if ($node->parameters) {
foreach ($node->parameters->getElements() as $element) {
$param = (string) $this->definitionResolver->getTypeFromNode($element);
$param .= ' ';
... | php | {
"resource": ""
} |
q21509 | SignatureInformationFactory.createLabel | train | private function createLabel(array $params): string
{
$label = '(';
if ($params) {
foreach ($params as $param) {
$label .= $param->label . ', ';
| php | {
"resource": ""
} |
q21510 | CompletionItemFactory.fromDefinition | train | public static function fromDefinition(Definition $def)
{
$item = new CompletionItem;
$item->label = $def->symbolInformation->name;
$item->kind = CompletionItemKind::fromSymbolKind($def->symbolInformation->kind);
if ($def->type) {
$item->detail = (string)$def->type;
... | php | {
"resource": ""
} |
q21511 | Window.showMessage | train | public function showMessage(int $type, string $message): Promise
{
| php | {
"resource": ""
} |
q21512 | SignatureHelpProvider.getSignatureHelp | train | public function getSignatureHelp(PhpDocument $doc, Position $position): Promise
{
return coroutine(function () use ($doc, $position) {
// Find the node under the cursor
$node = $doc->getNodeAtPosition($position);
// Find the definition of the item being called
... | php | {
"resource": ""
} |
q21513 | SignatureHelpProvider.getCallingInfo | train | private function getCallingInfo(Node $node)
{
return coroutine(function () use ($node) {
$fqn = null;
$callingNode = null;
if ($node instanceof Node\DelimitedList\ArgumentExpressionList) {
// Cursor is already inside a (
$argumentExpression... | php | {
"resource": ""
} |
q21514 | SignatureHelpProvider.findActiveParameter | train | 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 | {
"resource": ""
} |
q21515 | PhpDocument.getReferenceNodesByFqn | train | public function getReferenceNodesByFqn(string $fqn)
{
return isset($this->referenceNodes) | php | {
"resource": ""
} |
q21516 | PhpDocument.updateContent | train | 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 | {
"resource": ""
} |
q21517 | PhpDocument.getNodeAtPosition | train | public function getNodeAtPosition(Position $position)
{
if ($this->sourceFileNode === null) {
return null;
}
$offset = $position->toOffset($this->sourceFileNode->getFileContents());
$node | php | {
"resource": ""
} |
q21518 | PhpDocument.getRange | train | public function getRange(Range $range)
{
$content = $this->getContent();
$start = $range->start->toOffset($content);
| php | {
"resource": ""
} |
q21519 | LocationFactory.fromNode | train | public static function fromNode(Node $node): Location
{
$range = PositionUtilities::getRangeFromPosition(
$node->getStart(),
$node->getWidth(),
$node->getFileContents()
);
return new Location($node->getUri(), new Range( | php | {
"resource": ""
} |
q21520 | Workspace.xfiles | train | public function xfiles(string $base = null): Promise
{
return $this->handler->request(
'workspace/xfiles',
['base' => $base]
)->then(function (array $textDocuments) {
| php | {
"resource": ""
} |
q21521 | TextDocument.documentSymbol | train | public function documentSymbol(TextDocumentIdentifier $textDocument): Promise
{
return $this->documentLoader->getOrLoad($textDocument->uri)->then(function (PhpDocument $document) | php | {
"resource": ""
} |
q21522 | TextDocument.references | train | public function references(
ReferenceContext $context,
TextDocumentIdentifier $textDocument,
Position $position
): Promise {
return coroutine(function () use ($textDocument, $position) {
$document = yield $this->documentLoader->getOrLoad($textDocument->uri);
$... | php | {
"resource": ""
} |
q21523 | TextDocument.signatureHelp | train | public function signatureHelp(TextDocumentIdentifier $textDocument, Position $position): Promise
{
return coroutine(function () use ($textDocument, $position) | php | {
"resource": ""
} |
q21524 | Workspace.symbol | train | 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 | {
"resource": ""
} |
q21525 | Workspace.didChangeWatchedFiles | train | public function didChangeWatchedFiles(array $changes)
{
foreach ($changes as $change) {
if ($change->type === FileChangeType::DELETED) {
| php | {
"resource": ""
} |
q21526 | DefinitionResolver.getDeclarationLineFromNode | train | 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 | {
"resource": ""
} |
q21527 | DefinitionResolver.getDocumentationFromNode | train | 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 | {
"resource": ""
} |
q21528 | DefinitionResolver.getDocBlock | train | 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 | {
"resource": ""
} |
q21529 | DefinitionResolver.createDefinitionFromNode | train | 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 | {
"resource": ""
} |
q21530 | DefinitionResolver.resolveReferenceNodeToDefinition | train | 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 | {
"resource": ""
} |
q21531 | DefinitionResolver.resolveReferenceNodeToFqn | train | 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 | {
"resource": ""
} |
q21532 | DefinitionResolver.getContainingClassFqn | train | private static function getContainingClassFqn(Node $node)
{
$classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class);
if ($classNode === null) {
| php | {
"resource": ""
} |
q21533 | DefinitionResolver.getContainingClassType | train | private function getContainingClassType(Node $node)
{
$classFqn = $this->getContainingClassFqn($node);
return | php | {
"resource": ""
} |
q21534 | DefinitionResolver.resolveVariableToNode | train | 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 | {
"resource": ""
} |
q21535 | DefinitionResolver.isVariableDeclaration | train | 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 | {
"resource": ""
} |
q21536 | Index.setComplete | train | public function setComplete()
{
if (!$this->isStaticComplete()) {
$this->setStaticComplete();
| php | {
"resource": ""
} |
q21537 | Index.getChildDefinitionsForFqn | train | 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 | {
"resource": ""
} |
q21538 | Index.setDefinition | train | public function setDefinition(string $fqn, Definition $definition)
{
$parts = $this->splitFqn($fqn);
$this->indexDefinition(0, | php | {
"resource": ""
} |
q21539 | Index.removeDefinition | train | public function removeDefinition(string $fqn)
{
$parts = $this->splitFqn($fqn);
$this->removeIndexedDefinition(0, | php | {
"resource": ""
} |
q21540 | Index.addReferenceUri | train | public function addReferenceUri(string $fqn, string $uri)
{
if (!isset($this->references[$fqn])) {
$this->references[$fqn] = [];
}
// TODO: use DS\Set instead of searching array
if | php | {
"resource": ""
} |
q21541 | Index.removeReferenceUri | train | public function removeReferenceUri(string $fqn, string $uri)
{
if (!isset($this->references[$fqn])) {
return;
| php | {
"resource": ""
} |
q21542 | Scope.getIdentifier | train | public function getIdentifier($appendIdentifier = null)
{
$identifierParts = array_merge($this->parentScopes, | php | {
"resource": ""
} |
q21543 | Scope.toArray | train | 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 | {
"resource": ""
} |
q21544 | Scope.transformPrimitiveResource | train | 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 | {
"resource": ""
} |
q21545 | Scope.serializeResource | train | protected function serializeResource(SerializerAbstract $serializer, $data)
{
$resourceKey = $this->resource->getResourceKey();
if ($this->resource instanceof Collection) {
return $serializer->collection($resourceKey, $data);
}
if | php | {
"resource": ""
} |
q21546 | Scope.fireTransformer | train | protected function fireTransformer($transformer, $data)
{
$includedData = [];
if (is_callable($transformer)) {
$transformedData = call_user_func($transformer, $data);
} else {
$transformer->setCurrentScope($this);
$transformedData = $transformer->transfor... | php | {
"resource": ""
} |
q21547 | Scope.fireIncludedTransformers | train | protected function fireIncludedTransformers($transformer, $data)
{
$this->availableIncludes = $transformer->getAvailableIncludes();
| php | {
"resource": ""
} |
q21548 | Scope.filterFieldsets | train | 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 | {
"resource": ""
} |
q21549 | TransformerAbstract.processIncludedResources | train | public function processIncludedResources(Scope $scope, $data)
{
$includedData = [];
$includes = $this->figureOutWhichIncludes($scope);
foreach ($includes as $include) {
| php | {
"resource": ""
} |
q21550 | TransformerAbstract.callIncludeMethod | train | 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 | {
"resource": ""
} |
q21551 | TransformerAbstract.primitive | train | protected function primitive($data, $transformer = null, $resourceKey = | php | {
"resource": ""
} |
q21552 | JsonApiSerializer.meta | train | public function meta(array $meta)
{
if (empty($meta)) {
return [];
}
$result['meta'] = $meta;
if (array_key_exists('pagination', $result['meta'])) | php | {
"resource": ""
} |
q21553 | JsonApiSerializer.includedData | train | 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 | {
"resource": ""
} |
q21554 | JsonApiSerializer.filterIncludes | train | public function filterIncludes($includedData, $data)
{
if (!isset($includedData['included'])) {
return $includedData;
}
// Create the RootObjects
$this->createRootObjects($data);
// Filter out the root objects
| php | {
"resource": ""
} |
q21555 | JsonApiSerializer.pullOutNestedIncludedData | train | protected function pullOutNestedIncludedData(array $data)
{
$includedData = [];
$linkedIds = [];
foreach ($data as $value) {
foreach ($value as $includeObject) {
if (isset($includeObject['included'])) {
| php | {
"resource": ""
} |
q21556 | JsonApiSerializer.createIncludeObjects | train | private function createIncludeObjects($includeObject)
{
if ($this->isCollection($includeObject)) {
$includeObjects = $includeObject['data'];
return $includeObjects;
} else {
| php | {
"resource": ""
} |
q21557 | JsonApiSerializer.createRootObjects | train | private function createRootObjects($data)
{
if ($this->isCollection($data)) {
$this->setRootObjects($data['data']);
| php | {
"resource": ""
} |
q21558 | JsonApiSerializer.fillRelationshipAsCollection | train | 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 | {
"resource": ""
} |
q21559 | Manager.createData | train | public function createData(ResourceInterface $resource, $scopeIdentifier = null, Scope $parentScopeInstance = null)
{
if ($parentScopeInstance !== null) {
return $this->scopeFactory->createChildScopeFor($this, $parentScopeInstance, $resource, | php | {
"resource": ""
} |
q21560 | Manager.parseIncludes | train | 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 | {
"resource": ""
} |
q21561 | Manager.getFieldset | train | public function getFieldset($type)
{
return !isset($this->requestedFieldsets[$type]) ?
null :
| php | {
"resource": ""
} |
q21562 | Manager.autoIncludeParents | train | protected function autoIncludeParents()
{
$parsed = [];
foreach ($this->requestedIncludes as $include) {
$nested = explode('.', $include);
$part = array_shift($nested);
$parsed[] = $part;
while (count($nested) > 0) {
| php | {
"resource": ""
} |
q21563 | GUMP.filter_input | train | public static function filter_input(array $data, array $filters)
{
$gump = self::get_instance();
| php | {
"resource": ""
} |
q21564 | GUMP.sanitize | train | 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 | {
"resource": ""
} |
q21565 | GUMP.set_error_message | train | public static function set_error_message($rule, $message)
{
| php | {
"resource": ""
} |
q21566 | GUMP.get_messages | train | 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) {
| php | {
"resource": ""
} |
q21567 | GUMP.get_readable_errors | train | 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 | {
"resource": ""
} |
q21568 | GUMP.get_errors_array | train | 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 | {
"resource": ""
} |
q21569 | GUMP.filter_slug | train | protected function filter_slug($value, $params = null)
{
$delimiter = '-';
$slug = strtolower(trim(preg_replace('/[\s-]+/', $delimiter, preg_replace('/[^A-Za-z0-9-]+/', $delimiter, preg_replace('/[&]/', | php | {
"resource": ""
} |
q21570 | GUMP.validate_contains | train | 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 | {
"resource": ""
} |
q21571 | GUMP.validate_required | train | 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;
}
| php | {
"resource": ""
} |
q21572 | GUMP.validate_valid_email | train | 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' => | php | {
"resource": ""
} |
q21573 | GUMP.validate_max_len | train | 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 | {
"resource": ""
} |
q21574 | GUMP.validate_numeric | train | protected function validate_numeric($field, $input, $param = null)
{
if (!isset($input[$field]) || empty($input[$field])) {
return;
}
if (!is_numeric($input[$field])) {
return array(
| php | {
"resource": ""
} |
q21575 | GUMP.validate_valid_url | train | 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' => | php | {
"resource": ""
} |
q21576 | GUMP.validate_valid_ip | train | 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' => | php | {
"resource": ""
} |
q21577 | GUMP.validate_valid_ipv6 | train | 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 | {
"resource": ""
} |
q21578 | GUMP.validate_valid_cc | train | 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 | {
"resource": ""
} |
q21579 | GUMP.validate_street_address | train | 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 | {
"resource": ""
} |
q21580 | GUMP.validate_starts | train | protected function validate_starts($field, $input, $param = null)
{
if (!isset($input[$field]) || empty($input[$field])) {
return;
}
if (strpos($input[$field], $param) !== 0) {
return array(
| php | {
"resource": ""
} |
q21581 | GUMP.validate_required_file | train | protected function validate_required_file($field, $input, $param = null)
{
if (!isset($input[$field])) {
return;
}
if (is_array($input[$field]) && $input[$field]['error'] !== 4) {
return;
}
| php | {
"resource": ""
} |
q21582 | GUMP.validate_extension | train | 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 | {
"resource": ""
} |
q21583 | GUMP.validate_equalsfield | train | protected function validate_equalsfield($field, $input, $param = null)
{
if (!isset($input[$field]) || empty($input[$field])) {
return;
}
if ($input[$field] == $input[$param]) {
return;
}
| php | {
"resource": ""
} |
q21584 | GUMP.validate_phone_number | train | 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 | {
"resource": ""
} |
q21585 | GUMP.validate_valid_json_string | train | 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 | {
"resource": ""
} |
q21586 | GUMP.validate_valid_array_size_greater | train | 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(
| php | {
"resource": ""
} |
q21587 | GUMP.validate_valid_twitter | train | 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 | {
"resource": ""
} |
q21588 | Sharpen.run | train | public function run(Image $image)
{
$sharpen = $this->getSharpen();
if ($sharpen !== null) {
| php | {
"resource": ""
} |
q21589 | Sharpen.getSharpen | train | public function getSharpen()
{
if (!is_numeric($this->sharp)) {
return;
}
| php | {
"resource": ""
} |
q21590 | Filter.run | train | public function run(Image $image)
{
if ($this->filt === 'greyscale') {
return $this->runGreyscaleFilter($image);
}
| php | {
"resource": ""
} |
q21591 | Filter.runSepiaFilter | train | public function runSepiaFilter(Image $image)
{
$image->greyscale();
$image->brightness(-10);
$image->contrast(10);
$image->colorize(38, | php | {
"resource": ""
} |
q21592 | Contrast.run | train | public function run(Image $image)
{
$contrast = $this->getContrast();
if ($contrast !== null) {
| php | {
"resource": ""
} |
q21593 | Contrast.getContrast | train | public function getContrast()
{
if (!preg_match('/^-*[0-9]+$/', $this->con)) {
| php | {
"resource": ""
} |
q21594 | ServerFactory.getSource | train | 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 | php | {
"resource": ""
} |
q21595 | ServerFactory.getCache | train | 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 | php | {
"resource": ""
} |
q21596 | ServerFactory.getWatermarks | train | public function getWatermarks()
{
if (!isset($this->config['watermarks'])) {
return;
}
if (is_string($this->config['watermarks'])) {
| php | {
"resource": ""
} |
q21597 | ServerFactory.getImageManager | train | public function getImageManager()
{
$driver = 'gd';
if (isset($this->config['driver'])) {
| php | {
"resource": ""
} |
q21598 | ServerFactory.getManipulators | train | 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 | {
"resource": ""
} |
q21599 | Blur.run | train | public function run(Image $image)
{
$blur = $this->getBlur();
if ($blur !== null) {
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.