_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q242200
Charge.cancel
validation
public function cancel() { if (!$this->isType(self::CHARGE_ONETIME) && !$this->isType(self::CHARGE_RECURRING)) { throw new Exception('Cancel may only be called for single and recurring charges.'); } $this->status = self::STATUS_CANCELLED; $this->cancelled_on = Carbon::to...
php
{ "resource": "" }
q242201
Billable.handle
validation
public function handle(Request $request, Closure $next) { if (Config::get('shopify-app.billing_enabled') === true) { $shop = ShopifyApp::shop(); if (!$shop->isFreemium() && !$shop->isGrandfathered() && !$shop->plan) { // They're not grandfathered in, and there is no c...
php
{ "resource": "" }
q242202
WebhookControllerTrait.handle
validation
public function handle($type) { // Get the job class and dispatch $jobClass = '\\App\\Jobs\\'.str_replace('-', '', ucwords($type, '-')).'Job'; $jobClass::dispatch( Request::header('x-shopify-shop-domain'), json_decode(Request::getContent()) ); return ...
php
{ "resource": "" }
q242203
AuthShopHandler.buildAuthUrl
validation
public function buildAuthUrl($mode = null) { // Determine the type of mode // Grab the authentication URL return $this->api->getAuthUrl( Config::get('shopify-app.api_scopes'), URL::secure(Config::get('shopify-app.api_redirect')), $mode ?? 'offline' ...
php
{ "resource": "" }
q242204
AuthShopHandler.postProcess
validation
public function postProcess() { if (!$this->shop->trashed()) { return; } // Trashed, fix it $this->shop->restore(); $this->shop->charges()->restore(); $this->shop->save(); }
php
{ "resource": "" }
q242205
AuthShopHandler.dispatchWebhooks
validation
public function dispatchWebhooks() { $webhooks = Config::get('shopify-app.webhooks'); if (count($webhooks) > 0) { WebhookInstaller::dispatch($this->shop)->onQueue(Config::get('shopify-app.job_queues.webhooks')); } }
php
{ "resource": "" }
q242206
AuthShopHandler.dispatchScripttags
validation
public function dispatchScripttags() { $scripttags = Config::get('shopify-app.scripttags'); if (count($scripttags) > 0) { ScripttagInstaller::dispatch($this->shop, $scripttags)->onQueue(Config::get('shopify-app.job_queues.scripttags')); } }
php
{ "resource": "" }
q242207
AuthShopHandler.dispatchAfterAuthenticate
validation
public function dispatchAfterAuthenticate() { // Grab the jobs config $jobsConfig = Config::get('shopify-app.after_authenticate_job'); /** * Fires the job. * * @param array $config The job's configuration * * @return bool */ $fir...
php
{ "resource": "" }
q242208
AppUninstalledJob.cleanShop
validation
protected function cleanShop() { $this->shop->shopify_token = null; $this->shop->plan_id = null; $this->shop->save(); }
php
{ "resource": "" }
q242209
AppUninstalledJob.cancelCharge
validation
protected function cancelCharge() { $planCharge = $this->shop->planCharge(); if ($planCharge && !$planCharge->isDeclined() && !$planCharge->isCancelled()) { $planCharge->cancel(); } }
php
{ "resource": "" }
q242210
ShopSession.getType
validation
public function getType() { $config = Config::get('shopify-app.api_grant_mode'); if ($config === self::GRANT_PERUSER) { return self::GRANT_PERUSER; } return self::GRANT_OFFLINE; }
php
{ "resource": "" }
q242211
ShopSession.setDomain
validation
public function setDomain(string $shopDomain) { $this->fixLifetime(); Session::put(self::DOMAIN, $shopDomain); }
php
{ "resource": "" }
q242212
ShopSession.getToken
validation
public function getToken(bool $strict = false) { // Tokens $tokens = [ self::GRANT_PERUSER => Session::get(self::TOKEN), self::GRANT_OFFLINE => $this->shop->{self::TOKEN}, ]; if ($strict) { // We need the token matching the type return...
php
{ "resource": "" }
q242213
ShopSession.forget
validation
public function forget() { $keys = [self::DOMAIN, self::USER, self::TOKEN]; foreach ($keys as $key) { Session::forget($key); } }
php
{ "resource": "" }
q242214
ShopObserver.creating
validation
public function creating($shop) { if (!isset($shop->namespace)) { // Automatically add the current namespace to new records $shop->namespace = Config::get('shopify-app.namespace'); } if (Config::get('shopify-app.billing_freemium_enabled') === true && !isset($shop->fr...
php
{ "resource": "" }
q242215
AuthWebhook.handle
validation
public function handle(Request $request, Closure $next) { $hmac = $request->header('x-shopify-hmac-sha256') ?: ''; $shop = $request->header('x-shopify-shop-domain'); $data = $request->getContent(); $hmacLocal = ShopifyApp::createHmac(['data' => $data, 'raw' => true, 'encode' => true...
php
{ "resource": "" }
q242216
WebhookManager.shopWebhooks
validation
public function shopWebhooks() { if (!$this->shopWebhooks) { $this->shopWebhooks = $this->api->rest( 'GET', '/admin/webhooks.json', [ 'limit' => 250, 'fields' => 'id,address', ] )...
php
{ "resource": "" }
q242217
WebhookManager.deleteWebhooks
validation
public function deleteWebhooks() { $shopWebhooks = $this->shopWebhooks(); $deleted = []; foreach ($shopWebhooks as $webhook) { // Its a webhook in the config, delete it $this->api->rest('DELETE', "/admin/webhooks/{$webhook->id}.json"); $deleted[] = $webho...
php
{ "resource": "" }
q242218
WebhookJobMakeCommand.getUrlFromName
validation
protected function getUrlFromName(string $name) { if (Str::endsWith($name, 'Job')) { $name = substr($name, 0, -3); } return strtolower(preg_replace('/(?<!^)[A-Z]/', '-$0', $name)); }
php
{ "resource": "" }
q242219
AuthShop.validateShop
validation
protected function validateShop(Request $request) { $shopParam = ShopifyApp::sanitizeShopDomain($request->get('shop')); $shop = ShopifyApp::shop($shopParam); $session = new ShopSession($shop); // Check if shop has a session, also check the shops to ensure a match if ( ...
php
{ "resource": "" }
q242220
AuthShop.response
validation
protected function response(Request $request, Closure $next) { // Shop is OK, now check if ESDK is enabled and this is not a JSON/AJAX request... $response = $next($request); if ( Config::get('shopify-app.esdk_enabled') && ($request->ajax() || $request->expectsJson() ...
php
{ "resource": "" }
q242221
ShopModelTrait.api
validation
public function api() { if (!$this->api) { // Get the domain and token $shopDomain = $this->shopify_domain; $token = $this->session()->getToken(); // Create new API instance $this->api = ShopifyApp::api(); $this->api->setSession($shopD...
php
{ "resource": "" }
q242222
ShopModelTrait.planCharge
validation
public function planCharge() { return $this->charges() ->whereIn('type', [Charge::CHARGE_RECURRING, Charge::CHARGE_ONETIME]) ->where('plan_id', $this->plan_id) ->orderBy('created_at', 'desc') ->first(); }
php
{ "resource": "" }
q242223
BillingControllerTrait.index
validation
public function index(Plan $plan) { // If the plan is null, get a plan if (is_null($plan) || ($plan && !$plan->exists)) { $plan = Plan::where('on_install', true)->first(); } // Get the confirmation URL $bp = new BillingPlan(ShopifyApp::shop(), $plan); $ur...
php
{ "resource": "" }
q242224
BillingControllerTrait.process
validation
public function process(Plan $plan) { // Activate the plan and save $shop = ShopifyApp::shop(); $bp = new BillingPlan($shop, $plan); $bp->setChargeId(Request::query('charge_id')); $bp->activate(); $bp->save(); // All good, update the shop's plan and take them...
php
{ "resource": "" }
q242225
BillingControllerTrait.usageCharge
validation
public function usageCharge(StoreUsageCharge $request) { // Activate and save the usage charge $validated = $request->validated(); $uc = new UsageCharge(ShopifyApp::shop(), $validated); $uc->activate(); $uc->save(); // All done, return with success return iss...
php
{ "resource": "" }
q242226
BillingPlan.getCharge
validation
public function getCharge() { // Check if we have a charge ID to use if (!$this->chargeId) { throw new Exception('Can not get charge information without charge ID.'); } // Run API to grab details return $this->api->rest( 'GET', "/admin/{$t...
php
{ "resource": "" }
q242227
BillingPlan.confirmationUrl
validation
public function confirmationUrl() { // Begin the charge request $charge = $this->api->rest( 'POST', "/admin/{$this->plan->typeAsString(true)}.json", ["{$this->plan->typeAsString()}" => $this->chargeParams()] )->body->{$this->plan->typeAsString()}; ...
php
{ "resource": "" }
q242228
BillingPlan.chargeParams
validation
public function chargeParams() { // Build the charge array $chargeDetails = [ 'name' => $this->plan->name, 'price' => $this->plan->price, 'test' => $this->plan->isTest(), 'trial_days' => $this->plan->hasTrial() ? $this->pla...
php
{ "resource": "" }
q242229
BillingPlan.activate
validation
public function activate() { // Check if we have a charge ID to use if (!$this->chargeId) { throw new Exception('Can not activate plan without a charge ID.'); } // Activate and return the API response $this->response = $this->api->rest( 'POST', ...
php
{ "resource": "" }
q242230
BillingPlan.save
validation
public function save() { if (!$this->response) { throw new Exception('No activation response was recieved.'); } // Cancel the last charge $planCharge = $this->shop->planCharge(); if ($planCharge && !$planCharge->isDeclined() && !$planCharge->isCancelled()) { ...
php
{ "resource": "" }
q242231
DocumentValidator.validate
validation
public static function validate( Schema $schema, DocumentNode $ast, ?array $rules = null, ?TypeInfo $typeInfo = null ) { if ($rules === null) { $rules = static::allRules(); } if (is_array($rules) === true && count($rules) === 0) { // S...
php
{ "resource": "" }
q242232
DocumentValidator.allRules
validation
public static function allRules() { if (! self::$initRules) { static::$rules = array_merge(static::defaultRules(), self::securityRules(), self::$rules); static::$initRules = true; } return self::$rules; }
php
{ "resource": "" }
q242233
DocumentValidator.visitUsingRules
validation
public static function visitUsingRules(Schema $schema, TypeInfo $typeInfo, DocumentNode $documentNode, array $rules) { $context = new ValidationContext($schema, $documentNode, $typeInfo); $visitors = []; foreach ($rules as $rule) { $visitors[] = $rule->getVisitor($context); ...
php
{ "resource": "" }
q242234
DocumentValidator.isValidLiteralValue
validation
public static function isValidLiteralValue(Type $type, $valueNode) { $emptySchema = new Schema([]); $emptyDoc = new DocumentNode(['definitions' => []]); $typeInfo = new TypeInfo($emptySchema, $type); $context = new ValidationContext($emptySchema, $emptyDoc, $typeInfo); ...
php
{ "resource": "" }
q242235
ASTDefinitionBuilder.getDescription
validation
private function getDescription($node) { if ($node->description) { return $node->description->value; } if (isset($this->options['commentDescriptions'])) { $rawValue = $this->getLeadingCommentBlock($node); if ($rawValue !== null) { return Bl...
php
{ "resource": "" }
q242236
ASTDefinitionBuilder.getDeprecationReason
validation
private function getDeprecationReason($node) { $deprecated = Values::getDirectiveValues(Directive::deprecatedDirective(), $node); return $deprecated['reason'] ?? null; }
php
{ "resource": "" }
q242237
MixedStore.offsetExists
validation
public function offsetExists($offset) { if ($offset === false) { return $this->falseValueIsSet; } if ($offset === true) { return $this->trueValueIsSet; } if (is_int($offset) || is_string($offset)) { return array_key_exists($offset, $this->s...
php
{ "resource": "" }
q242238
MixedStore.offsetUnset
validation
public function offsetUnset($offset) { if ($offset === true) { $this->trueValue = null; $this->trueValueIsSet = false; } elseif ($offset === false) { $this->falseValue = null; $this->falseValueIsSet = false; } elseif (is_int($offset) ...
php
{ "resource": "" }
q242239
Schema.getTypeMap
validation
public function getTypeMap() { if (! $this->fullyLoaded) { $this->resolvedTypes = $this->collectAllTypes(); $this->fullyLoaded = true; } return $this->resolvedTypes; }
php
{ "resource": "" }
q242240
Schema.getType
validation
public function getType($name) { if (! isset($this->resolvedTypes[$name])) { $type = $this->loadType($name); if (! $type) { return null; } $this->resolvedTypes[$name] = $type; } return $this->resolvedTypes[$name]; }
php
{ "resource": "" }
q242241
Schema.getDirective
validation
public function getDirective($name) { foreach ($this->getDirectives() as $directive) { if ($directive->name === $name) { return $directive; } } return null; }
php
{ "resource": "" }
q242242
TypeComparators.doTypesOverlap
validation
public static function doTypesOverlap(Schema $schema, CompositeType $typeA, CompositeType $typeB) { // Equivalent types overlap if ($typeA === $typeB) { return true; } if ($typeA instanceof AbstractType) { if ($typeB instanceof AbstractType) { ...
php
{ "resource": "" }
q242243
Visitor.visitWithTypeInfo
validation
public static function visitWithTypeInfo(TypeInfo $typeInfo, $visitor) { return [ 'enter' => static function (Node $node) use ($typeInfo, $visitor) { $typeInfo->enter($node); $fn = self::getVisitFn($visitor, $node->kind, false); if ($fn) { ...
php
{ "resource": "" }
q242244
Helper.parseHttpRequest
validation
public function parseHttpRequest(?callable $readRawBodyFn = null) { $method = $_SERVER['REQUEST_METHOD'] ?? null; $bodyParams = []; $urlParams = $_GET; if ($method === 'POST') { $contentType = $_SERVER['CONTENT_TYPE'] ?? null; if ($contentType === null)...
php
{ "resource": "" }
q242245
Helper.parseRequestParams
validation
public function parseRequestParams($method, array $bodyParams, array $queryParams) { if ($method === 'GET') { $result = OperationParams::create($queryParams, true); } elseif ($method === 'POST') { if (isset($bodyParams[0])) { $result = []; fore...
php
{ "resource": "" }
q242246
Helper.toPsrResponse
validation
public function toPsrResponse($result, ResponseInterface $response, StreamInterface $writableBodyStream) { if ($result instanceof Promise) { return $result->then(function ($actualResult) use ($response, $writableBodyStream) { return $this->doConvertToPsrResponse($actualResult, $r...
php
{ "resource": "" }
q242247
UnionType.resolveType
validation
public function resolveType($objectValue, $context, ResolveInfo $info) { if (isset($this->config['resolveType'])) { $fn = $this->config['resolveType']; return $fn($objectValue, $context, $info); } return null; }
php
{ "resource": "" }
q242248
Utils.isValidNameError
validation
public static function isValidNameError($name, $node = null) { self::invariant(is_string($name), 'Expected string'); if (isset($name[1]) && $name[0] === '_' && $name[1] === '_') { return new Error( sprintf('Name "%s" must not begin with "__", which is reserved by ', $nam...
php
{ "resource": "" }
q242249
Utils.suggestionList
validation
public static function suggestionList($input, array $options) { $optionsByDistance = []; $inputThreshold = mb_strlen($input) / 2; foreach ($options as $option) { if ($input === $option) { $distance = 0; } else { $distance = (strtolow...
php
{ "resource": "" }
q242250
Executor.defaultFieldResolver
validation
public static function defaultFieldResolver($source, $args, $context, ResolveInfo $info) { $fieldName = $info->fieldName; $property = null; if (is_array($source) || $source instanceof ArrayAccess) { if (isset($source[$fieldName])) { $property = $source[$fieldNam...
php
{ "resource": "" }
q242251
Lexer.readName
validation
private function readName($line, $col, Token $prev) { $value = ''; $start = $this->position; [$char, $code] = $this->readChar(); while ($code && ( $code === 95 || // _ $code >= 48 && $code <= 57 || // 0-9 $code >= 65 &&...
php
{ "resource": "" }
q242252
Lexer.readNumber
validation
private function readNumber($line, $col, Token $prev) { $value = ''; $start = $this->position; [$char, $code] = $this->readChar(); $isFloat = false; if ($code === 45) { // - $value .= $char; [$char, $code] = $this->moveStringCu...
php
{ "resource": "" }
q242253
Lexer.readDigits
validation
private function readDigits() { [$char, $code] = $this->readChar(); if ($code >= 48 && $code <= 57) { // 0 - 9 $value = ''; do { $value .= $char; [$char, $code] = $this->moveStringCursor(1, 1)->readChar(); } while ($code >=...
php
{ "resource": "" }
q242254
Lexer.readComment
validation
private function readComment($line, $col, Token $prev) { $start = $this->position; $value = ''; $bytes = 1; do { [$char, $code, $bytes] = $this->moveStringCursor(1, $bytes)->readChar(); $value .= $char; } while ($code && // Sour...
php
{ "resource": "" }
q242255
Lexer.moveStringCursor
validation
private function moveStringCursor($positionOffset, $byteStreamOffset) { $this->position += $positionOffset; $this->byteStreamPosition += $byteStreamOffset; return $this; }
php
{ "resource": "" }
q242256
ServerConfig.setValidationRules
validation
public function setValidationRules($validationRules) { if (! is_callable($validationRules) && ! is_array($validationRules) && $validationRules !== null) { throw new InvariantViolation( 'Server config expects array of validation rules or callable returning such array, but got ' . ...
php
{ "resource": "" }
q242257
Type.isBuiltInType
validation
public static function isBuiltInType(Type $type) { return in_array($type->name, array_keys(self::getAllBuiltInTypes()), true); }
php
{ "resource": "" }
q242258
Type.getAllBuiltInTypes
validation
public static function getAllBuiltInTypes() { if (self::$builtInTypes === null) { self::$builtInTypes = array_merge( Introspection::getTypes(), self::getStandardTypes() ); } return self::$builtInTypes; }
php
{ "resource": "" }
q242259
QueryPlan.arrayMergeDeep
validation
private function arrayMergeDeep(array $array1, array $array2) : array { $merged = $array1; foreach ($array2 as $key => & $value) { if (is_numeric($key)) { if (! in_array($value, $merged, true)) { $merged[] = $value; } } els...
php
{ "resource": "" }
q242260
Error.createLocatedError
validation
public static function createLocatedError($error, $nodes = null, $path = null) { if ($error instanceof self) { if ($error->path && $error->nodes) { return $error; } $nodes = $nodes ?: $error->nodes; $path = $path ?: $error->path; } ...
php
{ "resource": "" }
q242261
Error.getLocations
validation
public function getLocations() { if ($this->locations === null) { $positions = $this->getPositions(); $source = $this->getSource(); $nodes = $this->nodes; if ($positions && $source) { $this->locations = array_map( st...
php
{ "resource": "" }
q242262
Error.toSerializableArray
validation
public function toSerializableArray() { $arr = [ 'message' => $this->getMessage(), ]; $locations = Utils::map( $this->getLocations(), static function (SourceLocation $loc) { return $loc->toSerializableArray(); } ); ...
php
{ "resource": "" }
q242263
ReferenceExecutor.buildExecutionContext
validation
private static function buildExecutionContext( Schema $schema, DocumentNode $documentNode, $rootValue, $contextValue, $rawVariableValues, $operationName = null, ?callable $fieldResolver = null, ?PromiseAdapter $promiseAdapter = null ) { $errors...
php
{ "resource": "" }
q242264
ReferenceExecutor.executeOperation
validation
private function executeOperation(OperationDefinitionNode $operation, $rootValue) { $type = $this->getOperationRootType($this->exeContext->schema, $operation); $fields = $this->collectFields($type, $operation->selectionSet, new ArrayObject(), new ArrayObject()); $path = []; // Er...
php
{ "resource": "" }
q242265
ReferenceExecutor.getOperationRootType
validation
private function getOperationRootType(Schema $schema, OperationDefinitionNode $operation) { switch ($operation->operation) { case 'query': $queryType = $schema->getQueryType(); if (! $queryType) { throw new Error( 'Schem...
php
{ "resource": "" }
q242266
ReferenceExecutor.getFieldEntryKey
validation
private static function getFieldEntryKey(FieldNode $node) { return $node->alias ? $node->alias->value : $node->name->value; }
php
{ "resource": "" }
q242267
ReferenceExecutor.doesFragmentConditionMatch
validation
private function doesFragmentConditionMatch( $fragment, ObjectType $type ) { $typeConditionNode = $fragment->typeCondition; if ($typeConditionNode === null) { return true; } $conditionalType = TypeInfo::typeFromAST($this->exeContext->schema, $typeCondition...
php
{ "resource": "" }
q242268
ReferenceExecutor.executeFieldsSerially
validation
private function executeFieldsSerially(ObjectType $parentType, $sourceValue, $path, $fields) { $result = $this->promiseReduce( array_keys($fields->getArrayCopy()), function ($results, $responseName) use ($path, $parentType, $sourceValue, $fields) { $fieldNodes = $fie...
php
{ "resource": "" }
q242269
ReferenceExecutor.resolveField
validation
private function resolveField(ObjectType $parentType, $source, $fieldNodes, $path) { $exeContext = $this->exeContext; $fieldNode = $fieldNodes[0]; $fieldName = $fieldNode->name->value; $fieldDef = $this->getFieldDef($exeContext->schema, $parentType, $fieldName); if (! $fi...
php
{ "resource": "" }
q242270
ReferenceExecutor.resolveOrError
validation
private function resolveOrError($fieldDef, $fieldNode, $resolveFn, $source, $context, $info) { try { // Build hash of arguments from the field.arguments AST, using the // variables scope to fulfill any variable references. $args = Values::getArgumentValues( ...
php
{ "resource": "" }
q242271
ReferenceExecutor.completeValueCatchingError
validation
private function completeValueCatchingError( Type $returnType, $fieldNodes, ResolveInfo $info, $path, $result ) { $exeContext = $this->exeContext; // If the field type is non-nullable, then it is resolved without any // protection from errors. ...
php
{ "resource": "" }
q242272
ReferenceExecutor.completeValueWithLocatedError
validation
public function completeValueWithLocatedError( Type $returnType, $fieldNodes, ResolveInfo $info, $path, $result ) { try { $completed = $this->completeValue( $returnType, $fieldNodes, $info, $p...
php
{ "resource": "" }
q242273
ReferenceExecutor.completeValue
validation
private function completeValue( Type $returnType, $fieldNodes, ResolveInfo $info, $path, &$result ) { $promise = $this->getPromise($result); // If result is a Promise, apply-lift over completeValue. if ($promise) { return $promise->then(fun...
php
{ "resource": "" }
q242274
ReferenceExecutor.getPromise
validation
private function getPromise($value) { if ($value === null || $value instanceof Promise) { return $value; } if ($this->exeContext->promises->isThenable($value)) { $promise = $this->exeContext->promises->convertThenable($value); if (! $promise instanceof Pro...
php
{ "resource": "" }
q242275
ReferenceExecutor.completeListValue
validation
private function completeListValue(ListOfType $returnType, $fieldNodes, ResolveInfo $info, $path, &$result) { $itemType = $returnType->getWrappedType(); Utils::invariant( is_array($result) || $result instanceof Traversable, 'User Error: expected iterable, but did not find one...
php
{ "resource": "" }
q242276
ReferenceExecutor.completeLeafValue
validation
private function completeLeafValue(LeafType $returnType, &$result) { try { return $returnType->serialize($result); } catch (Exception $error) { throw new InvariantViolation( 'Expected a value of type "' . Utils::printSafe($returnType) . '" but received: ' . Ut...
php
{ "resource": "" }
q242277
ReferenceExecutor.completeAbstractValue
validation
private function completeAbstractValue(AbstractType $returnType, $fieldNodes, ResolveInfo $info, $path, &$result) { $exeContext = $this->exeContext; $runtimeType = $returnType->resolveType($result, $exeContext->contextValue, $info); if ($runtimeType === null) { $runtimeType = se...
php
{ "resource": "" }
q242278
ReferenceExecutor.completeObjectValue
validation
private function completeObjectValue(ObjectType $returnType, $fieldNodes, ResolveInfo $info, $path, &$result) { // If there is an isTypeOf predicate function, call it with the // current result. If isTypeOf returns false, then raise an error rather // than continuing execution. $isTy...
php
{ "resource": "" }
q242279
ReferenceExecutor.executeFields
validation
private function executeFields(ObjectType $parentType, $source, $path, $fields) { $containsPromise = false; $finalResults = []; foreach ($fields as $responseName => $fieldNodes) { $fieldPath = $path; $fieldPath[] = $responseName; $result = $this-...
php
{ "resource": "" }
q242280
Value.printPath
validation
private static function printPath(?array $path = null) { $pathStr = ''; $currentPath = $path; while ($currentPath) { $pathStr = (is_string($currentPath['key']) ? '.' . $currentPath['key'] : '[' . $currentPath['key'] ...
php
{ "resource": "" }
q242281
StandardServer.processPsrRequest
validation
public function processPsrRequest( ServerRequestInterface $request, ResponseInterface $response, StreamInterface $writableBodyStream ) { $result = $this->executePsrRequest($request); return $this->helper->toPsrResponse($result, $response, $writableBodyStream); }
php
{ "resource": "" }
q242282
SyncPromiseAdapter.wait
validation
public function wait(Promise $promise) { $this->beforeWait($promise); $dfdQueue = Deferred::getQueue(); $promiseQueue = SyncPromise::getQueue(); while ($promise->adoptedPromise->state === SyncPromise::PENDING && ! ($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) ...
php
{ "resource": "" }
q242283
Printer.printBlockString
validation
private function printBlockString($value, $isDescription) { $escaped = str_replace('"""', '\\"""', $value); return ($value[0] === ' ' || $value[0] === "\t") && strpos($value, "\n") === false ? ('"""' . preg_replace('/"$/', "\"\n", $escaped) . '"""') : ('"""' . "\n" . ($isDes...
php
{ "resource": "" }
q242284
FormattedError.printError
validation
public static function printError(Error $error) { $printedLocations = []; if ($error->nodes) { /** @var Node $node */ foreach ($error->nodes as $node) { if (! $node->loc) { continue; } if ($node->loc->source...
php
{ "resource": "" }
q242285
FormattedError.highlightSourceAtLocation
validation
private static function highlightSourceAtLocation(Source $source, SourceLocation $location) { $line = $location->line; $lineOffset = $source->locationOffset->line - 1; $columnOffset = self::getColumnOffset($source, $location); $contextLine = $line + $lineOffset; ...
php
{ "resource": "" }
q242286
FormattedError.createFromException
validation
public static function createFromException($e, $debug = false, $internalErrorMessage = null) { Utils::invariant( $e instanceof Exception || $e instanceof Throwable, 'Expected exception, got %s', Utils::getVariableType($e) ); $internalErrorMessage = $inter...
php
{ "resource": "" }
q242287
FormattedError.toSafeTrace
validation
public static function toSafeTrace($error) { $trace = $error->getTrace(); if (isset($trace[0]['function']) && isset($trace[0]['class']) && // Remove invariant entries as they don't provide much value: ($trace[0]['class'] . '::' . $trace[0]['function'] === 'GraphQL\Utils\Util...
php
{ "resource": "" }
q242288
OperationParams.create
validation
public static function create(array $params, bool $readonly = false) : OperationParams { $instance = new static(); $params = array_change_key_case($params, CASE_LOWER); $instance->originalInput = $params; $params += [ 'query' => null, 'query...
php
{ "resource": "" }
q242289
BlockString.value
validation
public static function value($rawString) { // Expand a block string's raw value into independent lines. $lines = preg_split("/\\r\\n|[\\n\\r]/", $rawString); // Remove common indentation from all lines but first. $commonIndent = null; $linesLength = count($lines); ...
php
{ "resource": "" }
q242290
Values.getVariableValues
validation
public static function getVariableValues(Schema $schema, $varDefNodes, array $inputs) { $errors = []; $coercedValues = []; foreach ($varDefNodes as $varDefNode) { $varName = $varDefNode->variable->name->value; /** @var InputType|Type $varType */ $va...
php
{ "resource": "" }
q242291
Values.getDirectiveValues
validation
public static function getDirectiveValues(Directive $directiveDef, $node, $variableValues = null) { if (isset($node->directives) && $node->directives instanceof NodeList) { $directiveNode = Utils::find( $node->directives, static function (DirectiveNode $directive)...
php
{ "resource": "" }
q242292
Values.getArgumentValues
validation
public static function getArgumentValues($def, $node, $variableValues = null) { if (empty($def->args)) { return []; } $argumentNodes = $node->arguments; if (empty($argumentNodes)) { return []; } $argumentValueMap = []; foreach ($argum...
php
{ "resource": "" }
q242293
BuildSchema.build
validation
public static function build($source, ?callable $typeConfigDecorator = null, array $options = []) { $doc = $source instanceof DocumentNode ? $source : Parser::parse($source); return self::buildAST($doc, $typeConfigDecorator, $options); }
php
{ "resource": "" }
q242294
BuildSchema.buildAST
validation
public static function buildAST(DocumentNode $ast, ?callable $typeConfigDecorator = null, array $options = []) { $builder = new self($ast, $typeConfigDecorator, $options); return $builder->buildSchema(); }
php
{ "resource": "" }
q242295
VariablesInAllowedPosition.varTypeAllowedForType
validation
private function varTypeAllowedForType($varType, $expectedType) { if ($expectedType instanceof NonNull) { if ($varType instanceof NonNull) { return $this->varTypeAllowedForType($varType->getWrappedType(), $expectedType->getWrappedType()); } return false; ...
php
{ "resource": "" }
q242296
BreakingChangesFinder.findBreakingChanges
validation
public static function findBreakingChanges(Schema $oldSchema, Schema $newSchema) { return array_merge( self::findRemovedTypes($oldSchema, $newSchema), self::findTypesThatChangedKind($oldSchema, $newSchema), self::findFieldsThatChangedTypeOnObjectOrInterfaceTypes($oldSchem...
php
{ "resource": "" }
q242297
BreakingChangesFinder.findRemovedTypes
validation
public static function findRemovedTypes( Schema $oldSchema, Schema $newSchema ) { $oldTypeMap = $oldSchema->getTypeMap(); $newTypeMap = $newSchema->getTypeMap(); $breakingChanges = []; foreach (array_keys($oldTypeMap) as $typeName) { if (isset($newTypeMap...
php
{ "resource": "" }
q242298
BreakingChangesFinder.findTypesThatChangedKind
validation
public static function findTypesThatChangedKind( Schema $schemaA, Schema $schemaB ) : iterable { $schemaATypeMap = $schemaA->getTypeMap(); $schemaBTypeMap = $schemaB->getTypeMap(); $breakingChanges = []; foreach ($schemaATypeMap as $typeName => $schemaAType) { ...
php
{ "resource": "" }
q242299
BreakingChangesFinder.findTypesRemovedFromUnions
validation
public static function findTypesRemovedFromUnions( Schema $oldSchema, Schema $newSchema ) { $oldTypeMap = $oldSchema->getTypeMap(); $newTypeMap = $newSchema->getTypeMap(); $typesRemovedFromUnion = []; foreach ($oldTypeMap as $typeName => $oldType) { $newT...
php
{ "resource": "" }