_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q242300 | BreakingChangesFinder.findValuesRemovedFromEnums | validation | public static function findValuesRemovedFromEnums(
Schema $oldSchema,
Schema $newSchema
) {
$oldTypeMap = $oldSchema->getTypeMap();
$newTypeMap = $newSchema->getTypeMap();
$valuesRemovedFromEnums = [];
foreach ($oldTypeMap as $typeName => $oldType) {
$new... | php | {
"resource": ""
} |
q242301 | BreakingChangesFinder.findDangerousChanges | validation | public static function findDangerousChanges(Schema $oldSchema, Schema $newSchema)
{
return array_merge(
self::findArgChanges($oldSchema, $newSchema)['dangerousChanges'],
self::findValuesAddedToEnums($oldSchema, $newSchema),
self::findInterfacesAddedToObjectTypes($oldSchem... | php | {
"resource": ""
} |
q242302 | BreakingChangesFinder.findValuesAddedToEnums | validation | public static function findValuesAddedToEnums(
Schema $oldSchema,
Schema $newSchema
) {
$oldTypeMap = $oldSchema->getTypeMap();
$newTypeMap = $newSchema->getTypeMap();
$valuesAddedToEnums = [];
foreach ($oldTypeMap as $typeName => $oldType) {
$newType = $... | php | {
"resource": ""
} |
q242303 | BreakingChangesFinder.findTypesAddedToUnions | validation | public static function findTypesAddedToUnions(
Schema $oldSchema,
Schema $newSchema
) {
$oldTypeMap = $oldSchema->getTypeMap();
$newTypeMap = $newSchema->getTypeMap();
$typesAddedToUnion = [];
foreach ($newTypeMap as $typeName => $newType) {
$oldType = $o... | php | {
"resource": ""
} |
q242304 | OverlappingFieldsCanBeMerged.findConflictsWithinSelectionSet | validation | private function findConflictsWithinSelectionSet(
ValidationContext $context,
$parentType,
SelectionSetNode $selectionSet
) {
[$fieldMap, $fragmentNames] = $this->getFieldsAndFragmentNames(
$context,
$parentType,
$selectionSet
);
$... | php | {
"resource": ""
} |
q242305 | OverlappingFieldsCanBeMerged.collectConflictsWithin | validation | private function collectConflictsWithin(
ValidationContext $context,
array &$conflicts,
array $fieldMap
) {
// A field map is a keyed collection, where each key represents a response
// name and the value at that key is a list of all fields which provide that
// respo... | php | {
"resource": ""
} |
q242306 | OverlappingFieldsCanBeMerged.findConflict | validation | private function findConflict(
ValidationContext $context,
$parentFieldsAreMutuallyExclusive,
$responseName,
array $field1,
array $field2
) {
[$parentType1, $ast1, $def1] = $field1;
[$parentType2, $ast2, $def2] = $field2;
// If it is known that two fi... | php | {
"resource": ""
} |
q242307 | OverlappingFieldsCanBeMerged.doTypesConflict | validation | private function doTypesConflict(OutputType $type1, OutputType $type2)
{
if ($type1 instanceof ListOfType) {
return $type2 instanceof ListOfType ?
$this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) :
true;
}
if ($type2 insta... | php | {
"resource": ""
} |
q242308 | OverlappingFieldsCanBeMerged.findConflictsBetweenSubSelectionSets | validation | private function findConflictsBetweenSubSelectionSets(
ValidationContext $context,
$areMutuallyExclusive,
$parentType1,
SelectionSetNode $selectionSet1,
$parentType2,
SelectionSetNode $selectionSet2
) {
$conflicts = [];
[$fieldMap1, $fragmentNames1] =... | php | {
"resource": ""
} |
q242309 | OverlappingFieldsCanBeMerged.collectConflictsBetween | validation | private function collectConflictsBetween(
ValidationContext $context,
array &$conflicts,
$parentFieldsAreMutuallyExclusive,
array $fieldMap1,
array $fieldMap2
) {
// A field map is a keyed collection, where each key represents a response
// name and the value ... | php | {
"resource": ""
} |
q242310 | OverlappingFieldsCanBeMerged.collectConflictsBetweenFieldsAndFragment | validation | private function collectConflictsBetweenFieldsAndFragment(
ValidationContext $context,
array &$conflicts,
array &$comparedFragments,
$areMutuallyExclusive,
array $fieldMap,
$fragmentName
) {
if (isset($comparedFragments[$fragmentName])) {
return;
... | php | {
"resource": ""
} |
q242311 | OverlappingFieldsCanBeMerged.collectConflictsBetweenFragments | validation | private function collectConflictsBetweenFragments(
ValidationContext $context,
array &$conflicts,
$areMutuallyExclusive,
$fragmentName1,
$fragmentName2
) {
// No need to compare a fragment to itself.
if ($fragmentName1 === $fragmentName2) {
return;... | php | {
"resource": ""
} |
q242312 | OverlappingFieldsCanBeMerged.subfieldConflicts | validation | private function subfieldConflicts(
array $conflicts,
$responseName,
FieldNode $ast1,
FieldNode $ast2
) {
if (count($conflicts) === 0) {
return null;
}
return [
[
$responseName,
array_map(
... | php | {
"resource": ""
} |
q242313 | FieldsOnCorrectType.getSuggestedTypeNames | validation | private function getSuggestedTypeNames(Schema $schema, $type, $fieldName)
{
if (Type::isAbstractType($type)) {
$suggestedObjectTypes = [];
$interfaceUsageCount = [];
foreach ($schema->getPossibleTypes($type) as $possibleType) {
$fields = $possibleType->g... | php | {
"resource": ""
} |
q242314 | FieldsOnCorrectType.getSuggestedFieldNames | validation | private function getSuggestedFieldNames(Schema $schema, $type, $fieldName)
{
if ($type instanceof ObjectType || $type instanceof InterfaceType) {
$possibleFieldNames = array_keys($type->getFields());
return Utils::suggestionList($fieldName, $possibleFieldNames);
}
/... | php | {
"resource": ""
} |
q242315 | ExecutionResult.toArray | validation | public function toArray($debug = false)
{
$result = [];
if (! empty($this->errors)) {
$errorsHandler = $this->errorsHandler ?: static function (array $errors, callable $formatter) {
return array_map($formatter, $errors);
};
$result['errors'] = $e... | php | {
"resource": ""
} |
q242316 | AST.fromArray | validation | public static function fromArray(array $node) : Node
{
if (! isset($node['kind']) || ! isset(NodeKind::$classMap[$node['kind']])) {
throw new InvariantViolation('Unexpected node structure: ' . Utils::printSafeJson($node));
}
$kind = $node['kind'] ?? null;
$class =... | php | {
"resource": ""
} |
q242317 | AST.isMissingVariable | validation | private static function isMissingVariable($valueNode, $variables)
{
return $valueNode instanceof VariableNode &&
(count($variables) === 0 || ! array_key_exists($valueNode->name->value, $variables));
} | php | {
"resource": ""
} |
q242318 | AST.typeFromAST | validation | public static function typeFromAST(Schema $schema, $inputTypeNode)
{
if ($inputTypeNode instanceof ListTypeNode) {
$innerType = self::typeFromAST($schema, $inputTypeNode->type);
return $innerType ? new ListOfType($innerType) : null;
}
if ($inputTypeNode instanceof No... | php | {
"resource": ""
} |
q242319 | GraphQL.executeQuery | validation | public static function executeQuery(
SchemaType $schema,
$source,
$rootValue = null,
$context = null,
$variableValues = null,
?string $operationName = null,
?callable $fieldResolver = null,
?array $validationRules = null
) : ExecutionResult {
$... | php | {
"resource": ""
} |
q242320 | Warning.enable | validation | public static function enable($enable = true)
{
if ($enable === true) {
self::$enableWarnings = self::ALL;
} elseif ($enable === false) {
self::$enableWarnings = 0;
} else {
self::$enableWarnings |= $enable;
}
} | php | {
"resource": ""
} |
q242321 | Parser.parse | validation | public static function parse($source, array $options = [])
{
$sourceObj = $source instanceof Source ? $source : new Source($source);
$parser = new self($sourceObj, $options);
return $parser->parseDocument();
} | php | {
"resource": ""
} |
q242322 | Parser.loc | validation | private function loc(Token $startToken)
{
if (empty($this->lexer->options['noLocation'])) {
return new Location($startToken, $this->lexer->lastToken, $this->lexer->source);
}
return null;
} | php | {
"resource": ""
} |
q242323 | Parser.skip | validation | private function skip($kind)
{
$match = $this->lexer->token->kind === $kind;
if ($match) {
$this->lexer->advance();
}
return $match;
} | php | {
"resource": ""
} |
q242324 | Parser.expect | validation | private function expect($kind)
{
$token = $this->lexer->token;
if ($token->kind === $kind) {
$this->lexer->advance();
return $token;
}
throw new SyntaxError(
$this->lexer->source,
$token->start,
sprintf('Expected %s, foun... | php | {
"resource": ""
} |
q242325 | Parser.expectKeyword | validation | private function expectKeyword($value)
{
$token = $this->lexer->token;
if ($token->kind === Token::NAME && $token->value === $value) {
$this->lexer->advance();
return $token;
}
throw new SyntaxError(
$this->lexer->source,
$token->star... | php | {
"resource": ""
} |
q242326 | Parser.parseName | validation | private function parseName()
{
$token = $this->expect(Token::NAME);
return new NameNode([
'value' => $token->value,
'loc' => $this->loc($token),
]);
} | php | {
"resource": ""
} |
q242327 | Parser.parseDocument | validation | private function parseDocument()
{
$start = $this->lexer->token;
$this->expect(Token::SOF);
$definitions = [];
do {
$definitions[] = $this->parseDefinition();
} while (! $this->skip(Token::EOF));
return new DocumentNode([
'definitions' => new... | php | {
"resource": ""
} |
q242328 | TypeInfo.extractTypes | validation | public static function extractTypes($type, ?array $typeMap = null)
{
if (! $typeMap) {
$typeMap = [];
}
if (! $type) {
return $typeMap;
}
if ($type instanceof WrappingType) {
return self::extractTypes($type->getWrappedType(true), $typeMap)... | php | {
"resource": ""
} |
q242329 | TypeInfo.getFieldDefinition | validation | private static function getFieldDefinition(Schema $schema, Type $parentType, FieldNode $fieldNode)
{
$name = $fieldNode->name->value;
$schemaMeta = Introspection::schemaMetaFieldDef();
if ($name === $schemaMeta->name && $schema->getQueryType() === $parentType) {
return $sch... | php | {
"resource": ""
} |
q242330 | Generator.getStub | validation | protected function getStub($name) {
if ( stripos($name, '.php') === FALSE )
$name = $name . '.php';
return $this->files->get($this->getStubPath() . '/' . $name);
} | php | {
"resource": ""
} |
q242331 | Builder.reOrderBy | validation | public function reOrderBy($column, $direction = 'asc') {
$this->orders = null;
if ( !is_null($column) ) return $this->orderBy($column, $direction);
return $this;
} | php | {
"resource": ""
} |
q242332 | Builder.aggregate | validation | public function aggregate($function, $columns = array('*')) {
// Postgres doesn't like ORDER BY when there's no GROUP BY clause
if ( !isset($this->groups) )
$this->reOrderBy(null);
return parent::aggregate($function, $columns);
} | php | {
"resource": ""
} |
q242333 | Model.reload | validation | public function reload() {
if ( $this->exists || ($this->areSoftDeletesEnabled() && $this->trashed()) ) {
$fresh = $this->getFreshInstance();
if ( is_null($fresh) )
throw with(new ModelNotFoundException)->setModel(get_called_class());
$this->setRawAttributes($fresh->getAttributes(), true... | php | {
"resource": ""
} |
q242334 | Model.getFreshInstance | validation | protected function getFreshInstance() {
if ( $this->areSoftDeletesEnabled() )
return static::withTrashed()->find($this->getKey());
return static::find($this->getKey());
} | php | {
"resource": ""
} |
q242335 | SetBuilder.roots | validation | public function roots() {
return $this->node->newQuery()
->whereNull($this->node->getQualifiedParentColumnName())
->orderBy($this->node->getQualifiedLeftColumnName())
->orderBy($this->node->getQualifiedRightColumnName())
->orderBy($this->node->getQualifiedKeyName())
->get();
} | php | {
"resource": ""
} |
q242336 | SetBuilder.children | validation | public function children($node) {
$query = $this->node->newQuery();
$query->where($this->node->getQualifiedParentColumnName(), '=', $node->getKey());
// We must also add the scoped column values to the query to compute valid
// left and right indexes.
foreach($this->scopedAttributes($node) as $fld... | php | {
"resource": ""
} |
q242337 | SetBuilder.scopedAttributes | validation | protected function scopedAttributes($node) {
$keys = $this->node->getScopedColumns();
if ( count($keys) == 0 )
return array();
$values = array_map(function($column) use ($node) {
return $node->getAttribute($column); }, $keys);
return array_combine($keys, $values);
} | php | {
"resource": ""
} |
q242338 | Move.to | validation | public static function to($node, $target, $position) {
$instance = new static($node, $target, $position);
return $instance->perform();
} | php | {
"resource": ""
} |
q242339 | Move.updateStructure | validation | public function updateStructure() {
list($a, $b, $c, $d) = $this->boundaries();
// select the rows between the leftmost & the rightmost boundaries and apply a lock
$this->applyLockBetween($a, $d);
$connection = $this->node->getConnection();
$grammar = $connection->getQueryGrammar();
$curre... | php | {
"resource": ""
} |
q242340 | Move.resolveNode | validation | protected function resolveNode($node) {
if ( $node instanceof \Baum\Node ) return $node->reload();
return $this->node->newNestedSetQuery()->find($node);
} | php | {
"resource": ""
} |
q242341 | Move.guardAgainstImpossibleMove | validation | protected function guardAgainstImpossibleMove() {
if ( !$this->node->exists )
throw new MoveNotPossibleException('A new node cannot be moved.');
if ( array_search($this->position, array('child', 'left', 'right', 'root')) === FALSE )
throw new MoveNotPossibleException("Position should be one of ['ch... | php | {
"resource": ""
} |
q242342 | Move.parentId | validation | protected function parentId() {
switch( $this->position ) {
case 'root':
return NULL;
case 'child':
return $this->target->getKey();
default:
return $this->target->getParentId();
}
} | php | {
"resource": ""
} |
q242343 | Move.hasChange | validation | protected function hasChange() {
return !( $this->bound1() == $this->node->getRight() || $this->bound1() == $this->node->getLeft() );
} | php | {
"resource": ""
} |
q242344 | Move.fireMoveEvent | validation | protected function fireMoveEvent($event, $halt = true) {
if ( !isset(static::$dispatcher) ) return true;
// Basically the same as \Illuminate\Database\Eloquent\Model->fireModelEvent
// but we relay the event into the node instance.
$event = "eloquent.{$event}: ".get_class($this->node);
$method = $... | php | {
"resource": ""
} |
q242345 | Move.quoteIdentifier | validation | protected function quoteIdentifier($value) {
if ( is_null($value) )
return 'NULL';
$connection = $this->node->getConnection();
$pdo = $connection->getPdo();
return $pdo->quote($value);
} | php | {
"resource": ""
} |
q242346 | Move.applyLockBetween | validation | protected function applyLockBetween($lft, $rgt) {
$this->node->newQuery()
->where($this->node->getLeftColumnName(), '>=', $lft)
->where($this->node->getRightColumnName(), '<=', $rgt)
->select($this->node->getKeyName())
->lockForUpdate()
->get();
} | php | {
"resource": ""
} |
q242347 | InstallCommand.writeMigration | validation | protected function writeMigration($name) {
$output = pathinfo($this->migrator->create($name, $this->getMigrationsPath()), PATHINFO_FILENAME);
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
} | php | {
"resource": ""
} |
q242348 | InstallCommand.writeModel | validation | protected function writeModel($name) {
$output = pathinfo($this->modeler->create($name, $this->getModelsPath()), PATHINFO_FILENAME);
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
} | php | {
"resource": ""
} |
q242349 | SetValidator.validateDuplicates | validation | protected function validateDuplicates() {
return (
!$this->duplicatesExistForColumn($this->node->getQualifiedLeftColumnName()) &&
!$this->duplicatesExistForColumn($this->node->getQualifiedRightColumnName())
);
} | php | {
"resource": ""
} |
q242350 | SetValidator.groupRootsByScope | validation | protected function groupRootsByScope($roots) {
$rootsGroupedByScope = array();
foreach($roots as $root) {
$key = $this->keyForScope($root);
if ( !isset($rootsGroupedByScope[$key]) )
$rootsGroupedByScope[$key] = array();
$rootsGroupedByScope[$key][] = $root;
}
return $rootsG... | php | {
"resource": ""
} |
q242351 | SetValidator.keyForScope | validation | protected function keyForScope($node) {
return implode('-', array_map(function($column) use ($node) {
$value = $node->getAttribute($column);
if ( is_null($value) )
return 'NULL';
return $value;
}, $node->getScopedColumns()));
} | php | {
"resource": ""
} |
q242352 | SetMapper.map | validation | public function map($nodeList) {
$self = $this;
return $this->wrapInTransaction(function() use ($self, $nodeList) {
forward_static_call(array(get_class($self->node), 'unguard'));
$result = $self->mapTree($nodeList);
forward_static_call(array(get_class($self->node), 'reguard'));
retur... | php | {
"resource": ""
} |
q242353 | SetMapper.mapTree | validation | public function mapTree($nodeList) {
$tree = $nodeList instanceof ArrayableInterface ? $nodeList->toArray() : $nodeList;
$affectedKeys = array();
$result = $this->mapTreeRecursive($tree, $this->node->getKey(), $affectedKeys);
if ( $result && count($affectedKeys) > 0 )
$this->deleteUnaffected($a... | php | {
"resource": ""
} |
q242354 | SetMapper.mapTreeRecursive | validation | protected function mapTreeRecursive(array $tree, $parentKey = null, &$affectedKeys = array()) {
// For every attribute entry: We'll need to instantiate a new node either
// from the database (if the primary key was supplied) or a new instance. Then,
// append all the remaining data attributes (including the... | php | {
"resource": ""
} |
q242355 | Node.boot | validation | protected static function boot() {
parent::boot();
static::creating(function($node) {
$node->setDefaultLeftAndRight();
});
static::saving(function($node) {
$node->storeNewParent();
});
static::saved(function($node) {
$node->moveToNewParent();
$node->setDepth();
});... | php | {
"resource": ""
} |
q242356 | Node.getQualifiedScopedColumns | validation | public function getQualifiedScopedColumns() {
if ( !$this->isScoped() )
return $this->getScopedColumns();
$prefix = $this->getTable() . '.';
return array_map(function($c) use ($prefix) {
return $prefix . $c; }, $this->getScopedColumns());
} | php | {
"resource": ""
} |
q242357 | Node.newNestedSetQuery | validation | public function newNestedSetQuery($excludeDeleted = true) {
$builder = $this->newQuery($excludeDeleted)->orderBy($this->getQualifiedOrderColumnName());
if ( $this->isScoped() ) {
foreach($this->scoped as $scopeFld)
$builder->where($scopeFld, '=', $this->$scopeFld);
}
return $builder;
} | php | {
"resource": ""
} |
q242358 | Node.roots | validation | public static function roots() {
$instance = new static;
return $instance->newQuery()
->whereNull($instance->getParentColumnName())
->orderBy($instance->getQualifiedOrderColumnName());
} | php | {
"resource": ""
} |
q242359 | Node.allLeaves | validation | public static function allLeaves() {
$instance = new static;
$grammar = $instance->getConnection()->getQueryGrammar();
$rgtCol = $grammar->wrap($instance->getQualifiedRightColumnName());
$lftCol = $grammar->wrap($instance->getQualifiedLeftColumnName());
return $instance->newQuery()
... | php | {
"resource": ""
} |
q242360 | Node.scopeLimitDepth | validation | public function scopeLimitDepth($query, $limit) {
$depth = $this->exists ? $this->getDepth() : $this->getLevel();
$max = $depth + $limit;
$scopes = array($depth, $max);
return $query->whereBetween($this->getDepthColumnName(), array(min($scopes), max($scopes)));
} | php | {
"resource": ""
} |
q242361 | Node.getRoot | validation | public function getRoot() {
if ( $this->exists ) {
return $this->ancestorsAndSelf()->whereNull($this->getParentColumnName())->first();
} else {
$parentId = $this->getParentId();
if ( !is_null($parentId) && $currentParent = static::find($parentId) ) {
return $currentParent->getRoot();
... | php | {
"resource": ""
} |
q242362 | Node.ancestorsAndSelf | validation | public function ancestorsAndSelf() {
return $this->newNestedSetQuery()
->where($this->getLeftColumnName(), '<=', $this->getLeft())
->where($this->getRightColumnName(), '>=', $this->getRight());
} | php | {
"resource": ""
} |
q242363 | Node.leaves | validation | public function leaves() {
$grammar = $this->getConnection()->getQueryGrammar();
$rgtCol = $grammar->wrap($this->getQualifiedRightColumnName());
$lftCol = $grammar->wrap($this->getQualifiedLeftColumnName());
return $this->descendants()
->whereRaw($rgtCol . ' - ' . $lftCol . ' = 1');
... | php | {
"resource": ""
} |
q242364 | Node.descendantsAndSelf | validation | public function descendantsAndSelf() {
return $this->newNestedSetQuery()
->where($this->getLeftColumnName(), '>=', $this->getLeft())
->where($this->getLeftColumnName(), '<', $this->getRight());
} | php | {
"resource": ""
} |
q242365 | Node.getDescendants | validation | public function getDescendants($columns = array('*')) {
if ( is_array($columns) )
return $this->descendants()->get($columns);
$arguments = func_get_args();
$limit = intval(array_shift($arguments));
$columns = array_shift($arguments) ?: array('*');
return $this->descendants()->limitDepth... | php | {
"resource": ""
} |
q242366 | Node.isDescendantOf | validation | public function isDescendantOf($other) {
return (
$this->getLeft() > $other->getLeft() &&
$this->getLeft() < $other->getRight() &&
$this->inSameScope($other)
);
} | php | {
"resource": ""
} |
q242367 | Node.isSelfOrDescendantOf | validation | public function isSelfOrDescendantOf($other) {
return (
$this->getLeft() >= $other->getLeft() &&
$this->getLeft() < $other->getRight() &&
$this->inSameScope($other)
);
} | php | {
"resource": ""
} |
q242368 | Node.isAncestorOf | validation | public function isAncestorOf($other) {
return (
$this->getLeft() < $other->getLeft() &&
$this->getRight() > $other->getLeft() &&
$this->inSameScope($other)
);
} | php | {
"resource": ""
} |
q242369 | Node.isSelfOrAncestorOf | validation | public function isSelfOrAncestorOf($other) {
return (
$this->getLeft() <= $other->getLeft() &&
$this->getRight() > $other->getLeft() &&
$this->inSameScope($other)
);
} | php | {
"resource": ""
} |
q242370 | Node.getLeftSibling | validation | public function getLeftSibling() {
return $this->siblings()
->where($this->getLeftColumnName(), '<', $this->getLeft())
->orderBy($this->getOrderColumnName(), 'desc')
->get()
->last();
} | php | {
"resource": ""
} |
q242371 | Node.makeFirstChildOf | validation | public function makeFirstChildOf($node) {
if ( $node->children()->count() == 0 )
return $this->makeChildOf($node);
return $this->moveToLeftOf($node->children()->first());
} | php | {
"resource": ""
} |
q242372 | Node.inSameScope | validation | public function inSameScope($other) {
foreach($this->getScopedColumns() as $fld) {
if ( $this->$fld != $other->$fld ) return false;
}
return true;
} | php | {
"resource": ""
} |
q242373 | Node.insideSubtree | validation | public function insideSubtree($node) {
return (
$this->getLeft() >= $node->getLeft() &&
$this->getLeft() <= $node->getRight() &&
$this->getRight() >= $node->getLeft() &&
$this->getRight() <= $node->getRight()
);
} | php | {
"resource": ""
} |
q242374 | Node.setDefaultLeftAndRight | validation | public function setDefaultLeftAndRight() {
$withHighestRight = $this->newNestedSetQuery()->reOrderBy($this->getRightColumnName(), 'desc')->take(1)->sharedLock()->first();
$maxRgt = 0;
if ( !is_null($withHighestRight) ) $maxRgt = $withHighestRight->getRight();
$this->setAttribute($this->getLeftColumnNa... | php | {
"resource": ""
} |
q242375 | Node.storeNewParent | validation | public function storeNewParent() {
if ( $this->isDirty($this->getParentColumnName()) && ($this->exists || !$this->isRoot()) )
static::$moveToNewParentId = $this->getParentId();
else
static::$moveToNewParentId = FALSE;
} | php | {
"resource": ""
} |
q242376 | Node.moveToNewParent | validation | public function moveToNewParent() {
$pid = static::$moveToNewParentId;
if ( is_null($pid) )
$this->makeRoot();
else if ( $pid !== FALSE )
$this->makeChildOf($pid);
} | php | {
"resource": ""
} |
q242377 | Node.setDepth | validation | public function setDepth() {
$self = $this;
$this->getConnection()->transaction(function() use ($self) {
$self->reload();
$level = $self->getLevel();
$self->newNestedSetQuery()->where($self->getKeyName(), '=', $self->getKey())->update(array($self->getDepthColumnName() => $level));
$se... | php | {
"resource": ""
} |
q242378 | Node.setDepthWithSubtree | validation | public function setDepthWithSubtree() {
$self = $this;
$this->getConnection()->transaction(function() use ($self) {
$self->reload();
$self->descendantsAndSelf()->select($self->getKeyName())->lockForUpdate()->get();
$oldDepth = !is_null($self->getDepth()) ? $self->getDepth() : 0;
$new... | php | {
"resource": ""
} |
q242379 | Node.destroyDescendants | validation | public function destroyDescendants() {
if ( is_null($this->getRight()) || is_null($this->getLeft()) ) return;
$self = $this;
$this->getConnection()->transaction(function() use ($self) {
$self->reload();
$lftCol = $self->getLeftColumnName();
$rgtCol = $self->getRightColumnName();
$... | php | {
"resource": ""
} |
q242380 | Node.shiftSiblingsForRestore | validation | public function shiftSiblingsForRestore() {
if ( is_null($this->getRight()) || is_null($this->getLeft()) ) return;
$self = $this;
$this->getConnection()->transaction(function() use ($self) {
$lftCol = $self->getLeftColumnName();
$rgtCol = $self->getRightColumnName();
$lft = $self->get... | php | {
"resource": ""
} |
q242381 | Node.computeLevel | validation | protected function computeLevel() {
list($node, $nesting) = $this->determineDepth($this);
if ( $node->equals($this) )
return $this->ancestors()->count();
return $node->getLevel() + $nesting;
} | php | {
"resource": ""
} |
q242382 | ChoiceFormField.setValue | validation | public function setValue($value)
{
if (\is_bool($value)) {
if ('checkbox' !== $this->type) {
throw new \InvalidArgumentException(\sprintf('Invalid argument of type "%s"', \gettype($value)));
}
if ($value) {
if (!$this->element->isSelected(... | php | {
"resource": ""
} |
q242383 | ChoiceFormField.availableOptionValues | validation | public function availableOptionValues()
{
$options = [];
foreach ($this->selector->getOptions() as $option) {
$options[] = $option->getAttribute('value');
}
return $options;
} | php | {
"resource": ""
} |
q242384 | JsValidationServiceProvider.bootstrapViews | validation | protected function bootstrapViews()
{
$viewPath = realpath(__DIR__.'/../resources/views');
$this->loadViewsFrom($viewPath, 'jsvalidation');
$this->publishes([
$viewPath => $this->app['path.base'].'/resources/views/vendor/jsvalidation',
], 'views');
} | php | {
"resource": ""
} |
q242385 | JsValidationServiceProvider.bootstrapConfigs | validation | protected function bootstrapConfigs()
{
$configFile = realpath(__DIR__.'/../config/jsvalidation.php');
$this->mergeConfigFrom($configFile, 'jsvalidation');
$this->publishes([$configFile => $this->app['path.config'].'/jsvalidation.php'], 'config');
} | php | {
"resource": ""
} |
q242386 | RuleParser.getRule | validation | public function getRule($attribute, $rule, $parameters, $rawRule)
{
$isConditional = $this->isConditionalRule($attribute, $rawRule);
$isRemote = $this->isRemoteRule($rule);
if ($isConditional || $isRemote) {
list($attribute, $parameters) = $this->remoteRule($attribute, $isCondit... | php | {
"resource": ""
} |
q242387 | RuleParser.addConditionalRules | validation | public function addConditionalRules($attribute, $rules = [])
{
foreach ((array) $attribute as $key) {
$current = isset($this->conditional[$key]) ? $this->conditional[$key] : [];
$merge = head($this->validator->explodeRules((array) $rules));
$this->conditional[$key] = arra... | php | {
"resource": ""
} |
q242388 | RuleParser.isConditionalRule | validation | protected function isConditionalRule($attribute, $rule)
{
return isset($this->conditional[$attribute]) &&
in_array($rule, $this->conditional[$attribute]);
} | php | {
"resource": ""
} |
q242389 | RuleParser.getAttributeName | validation | protected function getAttributeName($attribute)
{
$attributeArray = explode('.', $attribute);
if (count($attributeArray) > 1) {
return $attributeArray[0].'['.implode('][', array_slice($attributeArray, 1)).']';
}
return $attribute;
} | php | {
"resource": ""
} |
q242390 | JavascriptValidator.setDefaults | validation | protected function setDefaults($options)
{
$this->selector = empty($options['selector']) ? 'form' : $options['selector'];
$this->view = empty($options['view']) ? 'jsvalidation::bootstrap' : $options['view'];
$this->remote = isset($options['remote']) ? $options['remote'] : true;
} | php | {
"resource": ""
} |
q242391 | JavascriptValidator.render | validation | public function render($view = null, $selector = null)
{
$this->view($view);
$this->selector($selector);
return View::make($this->view, ['validator' => $this->getViewData()])
->render();
} | php | {
"resource": ""
} |
q242392 | JavascriptValidator.getViewData | validation | protected function getViewData()
{
$this->validator->setRemote($this->remote);
$data = $this->validator->validationData();
$data['selector'] = $this->selector;
if (! is_null($this->ignore)) {
$data['ignore'] = $this->ignore;
}
return $data;
} | php | {
"resource": ""
} |
q242393 | JavascriptValidator.selector | validation | public function selector($selector)
{
$this->selector = is_null($selector) ? $this->selector : $selector;
return $this;
} | php | {
"resource": ""
} |
q242394 | JavascriptValidator.view | validation | public function view($view)
{
$this->view = is_null($view) ? $this->view : $view;
return $this;
} | php | {
"resource": ""
} |
q242395 | DelegatedValidator.makeReplacements | validation | public function makeReplacements($message, $attribute, $rule, $parameters)
{
if (is_object($rule)) {
$rule = get_class($rule);
}
return $this->callValidator('makeReplacements', [$message, $attribute, $rule, $parameters]);
} | php | {
"resource": ""
} |
q242396 | DelegatedValidator.getMessage | validation | public function getMessage($attribute, $rule)
{
if (is_object($rule)) {
$rule = get_class($rule);
}
return $this->callValidator('getMessage', [$attribute, $rule]);
} | php | {
"resource": ""
} |
q242397 | DelegatedValidator.sometimes | validation | public function sometimes($attribute, $rules, callable $callback)
{
$this->validator->sometimes($attribute, $rules, $callback);
} | php | {
"resource": ""
} |
q242398 | JavascriptRulesTrait.ruleConfirmed | validation | protected function ruleConfirmed($attribute, array $parameters)
{
$parameters[0] = $this->getAttributeName($attribute);
$attribute = "{$attribute}_confirmation";
return [$attribute, $parameters];
} | php | {
"resource": ""
} |
q242399 | JavascriptRulesTrait.ruleAfter | validation | protected function ruleAfter($attribute, array $parameters)
{
if (! ($date = strtotime($parameters[0]))) {
$date = $this->getAttributeName($parameters[0]);
}
return [$attribute, [$date]];
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.