_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q14600 | HydrationCompleteHandler.hydrationComplete | train | public function hydrationComplete()
{
$toInvoke = $this->deferredPostLoadInvocations;
$this->deferredPostLoadInvocations = [];
foreach ($toInvoke as $classAndEntity) {
[$class, $invoke, $entity] = $classAndEntity;
$this->listenersInvoker->in... | php | {
"resource": ""
} |
q14601 | AbstractClassMetadataFactory.getOrCreateClassMetadataDefinition | train | private function getOrCreateClassMetadataDefinition(string $className, ?ClassMetadata $parent) : ClassMetadataDefinition
{
if (! isset($this->definitions[$className])) {
$this->definitions[$className] = $this->definitionFactory->build($className, $parent);
}
return $this->defini... | php | {
"resource": ""
} |
q14602 | StatisticsCacheLogger.clearRegionStats | train | public function clearRegionStats($regionName)
{
$this->cachePutCountMap[$regionName] = 0;
$this->cacheHitCountMap[$regionName] = 0;
$this->cacheMissCountMap[$regionName] = 0;
} | php | {
"resource": ""
} |
q14603 | BasicEntityPersister.getSelectColumnSQL | train | protected function getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r')
{
$property = $class->getProperty($field);
$columnAlias = $this->getSQLColumnAlias();
$sql = sprintf(
'%s.%s',
$this->getSQLTableAlias($property->getTableName(), ($alias === '... | php | {
"resource": ""
} |
q14604 | BasicEntityPersister.getSelectConditionCriteriaSQL | train | protected function getSelectConditionCriteriaSQL(Criteria $criteria)
{
$expression = $criteria->getWhereExpression();
if ($expression === null) {
return '';
}
$visitor = new SqlExpressionVisitor($this, $this->class);
return $visitor->dispatch($expression);
... | php | {
"resource": ""
} |
q14605 | BasicEntityPersister.getIndividualValue | train | private function getIndividualValue($value)
{
if (! is_object($value) || ! $this->em->getMetadataFactory()->hasMetadataFor(StaticClassNameConverter::getClass($value))) {
return $value;
}
return $this->em->getUnitOfWork()->getSingleIdentifierValue($value);
} | php | {
"resource": ""
} |
q14606 | BasicEntityPersister.getJoinSQLForAssociation | train | protected function getJoinSQLForAssociation(AssociationMetadata $association)
{
if (! $association->isOwningSide()) {
return 'LEFT JOIN';
}
// if one of the join columns is nullable, return left join
foreach ($association->getJoinColumns() as $joinColumn) {
i... | php | {
"resource": ""
} |
q14607 | SqlWalker.setSQLTableAlias | train | public function setSQLTableAlias($tableName, $alias, $dqlAlias = '')
{
$tableName .= $dqlAlias ? '@[' . $dqlAlias . ']' : '';
$this->tableAliasMap[$tableName] = $alias;
return $alias;
} | php | {
"resource": ""
} |
q14608 | SqlWalker.walkIdentificationVariableDeclaration | train | public function walkIdentificationVariableDeclaration($identificationVariableDecl)
{
$sql = $this->walkRangeVariableDeclaration($identificationVariableDecl->rangeVariableDeclaration);
if ($identificationVariableDecl->indexBy) {
$this->walkIndexBy($identificationVariableDecl->indexBy);
... | php | {
"resource": ""
} |
q14609 | SqlWalker.walkIndexBy | train | public function walkIndexBy($indexBy)
{
$pathExpression = $indexBy->simpleStateFieldPathExpression;
$alias = $pathExpression->identificationVariable;
$field = $pathExpression->field;
if (isset($this->scalarFields[$alias][$field])) {
$this->rsm->addIndex... | php | {
"resource": ""
} |
q14610 | SqlWalker.generateRangeVariableDeclarationSQL | train | private function generateRangeVariableDeclarationSQL($rangeVariableDeclaration, bool $buildNestedJoins) : string
{
$class = $this->em->getClassMetadata($rangeVariableDeclaration->abstractSchemaName);
$dqlAlias = $rangeVariableDeclaration->aliasIdentificationVariable;
if ($rangeVariableDe... | php | {
"resource": ""
} |
q14611 | SqlWalker.walkCoalesceExpression | train | public function walkCoalesceExpression($coalesceExpression)
{
$sql = 'COALESCE(';
$scalarExpressions = [];
foreach ($coalesceExpression->scalarExpressions as $scalarExpression) {
$scalarExpressions[] = $this->walkSimpleArithmeticExpression($scalarExpression);
}
... | php | {
"resource": ""
} |
q14612 | SqlWalker.walkNullIfExpression | train | public function walkNullIfExpression($nullIfExpression)
{
$firstExpression = is_string($nullIfExpression->firstExpression)
? $this->conn->quote($nullIfExpression->firstExpression)
: $this->walkSimpleArithmeticExpression($nullIfExpression->firstExpression);
$secondExpression ... | php | {
"resource": ""
} |
q14613 | SqlWalker.walkGeneralCaseExpression | train | public function walkGeneralCaseExpression(AST\GeneralCaseExpression $generalCaseExpression)
{
$sql = 'CASE';
foreach ($generalCaseExpression->whenClauses as $whenClause) {
$sql .= ' WHEN ' . $this->walkConditionalExpression($whenClause->caseConditionExpression);
$sql .= ' TH... | php | {
"resource": ""
} |
q14614 | SqlWalker.walkSimpleCaseExpression | train | public function walkSimpleCaseExpression($simpleCaseExpression)
{
$sql = 'CASE ' . $this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand);
foreach ($simpleCaseExpression->simpleWhenClauses as $simpleWhenClause) {
$sql .= ' WHEN ' . $this->walkSimpleArithmeticExpression(... | php | {
"resource": ""
} |
q14615 | SqlWalker.walkArithmeticPrimary | train | public function walkArithmeticPrimary($primary)
{
if ($primary instanceof AST\SimpleArithmeticExpression) {
return '(' . $this->walkSimpleArithmeticExpression($primary) . ')';
}
if ($primary instanceof AST\Node) {
return $primary->dispatch($this);
}
... | php | {
"resource": ""
} |
q14616 | EntityRepository.resolveMagicCall | train | private function resolveMagicCall($method, $by, array $arguments)
{
if (! $arguments) {
throw InvalidMagicMethodCall::onMissingParameter($method . $by);
}
$fieldName = lcfirst(Inflector::classify($by));
if ($this->class->getProperty($fieldName) === null) {
t... | php | {
"resource": ""
} |
q14617 | Configuration.setAutoGenerateProxyClasses | train | public function setAutoGenerateProxyClasses($autoGenerate) : void
{
$proxyManagerConfig = $this->getProxyManagerConfiguration();
switch ((int) $autoGenerate) {
case ProxyFactory::AUTOGENERATE_ALWAYS:
case ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS:
$proxyMana... | php | {
"resource": ""
} |
q14618 | Configuration.newDefaultAnnotationDriver | train | public function newDefaultAnnotationDriver(array $paths = []) : AnnotationDriver
{
AnnotationRegistry::registerFile(__DIR__ . '/Annotation/DoctrineAnnotations.php');
$reader = new CachedReader(new AnnotationReader(), new ArrayCache());
return new AnnotationDriver($reader, $paths);
} | php | {
"resource": ""
} |
q14619 | Configuration.addCustomStringFunction | train | public function addCustomStringFunction(string $functionName, $classNameOrFactory) : void
{
$this->customStringFunctions[strtolower($functionName)] = $classNameOrFactory;
} | php | {
"resource": ""
} |
q14620 | Configuration.setCustomStringFunctions | train | public function setCustomStringFunctions(array $functions) : void
{
foreach ($functions as $name => $className) {
$this->addCustomStringFunction($name, $className);
}
} | php | {
"resource": ""
} |
q14621 | Configuration.setCustomNumericFunctions | train | public function setCustomNumericFunctions(array $functions) : void
{
foreach ($functions as $name => $className) {
$this->addCustomNumericFunction($name, $className);
}
} | php | {
"resource": ""
} |
q14622 | Configuration.addCustomHydrationMode | train | public function addCustomHydrationMode(string $modeName, string $hydratorClassName) : void
{
$this->customHydrationModes[$modeName] = $hydratorClassName;
} | php | {
"resource": ""
} |
q14623 | Configuration.addFilter | train | public function addFilter(string $filterName, string $filterClassName) : void
{
$this->filters[$filterName] = $filterClassName;
} | php | {
"resource": ""
} |
q14624 | Setup.createXMLMetadataConfiguration | train | public static function createXMLMetadataConfiguration(array $paths, $isDevMode = false, $proxyDir = null, ?Cache $cache = null)
{
$config = self::createConfiguration($isDevMode, $proxyDir, $cache);
$config->setMetadataDriverImpl(new XmlDriver($paths));
return $config;
} | php | {
"resource": ""
} |
q14625 | PersistentObject.injectEntityManager | train | public function injectEntityManager(EntityManagerInterface $entityManager, ClassMetadata $classMetadata) : void
{
if ($entityManager !== self::$entityManager) {
throw new RuntimeException(
'Trying to use PersistentObject with different EntityManager instances. ' .
... | php | {
"resource": ""
} |
q14626 | PersistentObject.set | train | private function set($field, $args)
{
$this->initializeDoctrine();
$property = $this->cm->getProperty($field);
if (! $property) {
throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'");
}
switch (tr... | php | {
"resource": ""
} |
q14627 | PersistentObject.get | train | private function get($field)
{
$this->initializeDoctrine();
$property = $this->cm->getProperty($field);
if (! $property) {
throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'");
}
return $this->{$f... | php | {
"resource": ""
} |
q14628 | PersistentObject.completeOwningSide | train | private function completeOwningSide(AssociationMetadata $property, $targetObject)
{
// add this object on the owning side as well, for obvious infinite recursion
// reasons this is only done when called on the inverse side.
if ($property->isOwningSide()) {
return;
}
... | php | {
"resource": ""
} |
q14629 | PersistentObject.add | train | private function add($field, $args)
{
$this->initializeDoctrine();
$property = $this->cm->getProperty($field);
if (! $property) {
throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'");
}
if (! ($pr... | php | {
"resource": ""
} |
q14630 | PersistentObject.initializeDoctrine | train | private function initializeDoctrine()
{
if ($this->cm !== null) {
return;
}
if (! self::$entityManager) {
throw new RuntimeException('No runtime entity manager set. Call PersistentObject#setEntityManager().');
}
$this->cm = self::$entityManager->getC... | php | {
"resource": ""
} |
q14631 | ResultSetMapping.addEntityResult | train | public function addEntityResult($class, $alias, $resultAlias = null)
{
$this->aliasMap[$alias] = $class;
$this->entityMappings[$alias] = $resultAlias;
if ($resultAlias !== null) {
$this->isMixed = true;
}
return $this;
} | php | {
"resource": ""
} |
q14632 | ResultSetMapping.setDiscriminatorColumn | train | public function setDiscriminatorColumn($alias, $discrColumn)
{
$this->discriminatorColumns[$alias] = $discrColumn;
$this->columnOwnerMap[$discrColumn] = $alias;
return $this;
} | php | {
"resource": ""
} |
q14633 | ResultSetMapping.addIndexBy | train | public function addIndexBy($alias, $fieldName)
{
$found = false;
foreach (array_merge($this->metaMappings, $this->fieldMappings) as $columnName => $columnFieldName) {
if (! ($columnFieldName === $fieldName && $this->columnOwnerMap[$columnName] === $alias)) {
continue;
... | php | {
"resource": ""
} |
q14634 | ResultSetMapping.addFieldResult | train | public function addFieldResult($alias, $columnName, $fieldName, $declaringClass = null)
{
// column name (in result set) => field name
$this->fieldMappings[$columnName] = $fieldName;
// column name => alias of owner
$this->columnOwnerMap[$columnName] = $alias;
// field name =... | php | {
"resource": ""
} |
q14635 | ResultSetMapping.addJoinedEntityResult | train | public function addJoinedEntityResult($class, $alias, $parentAlias, $relation)
{
$this->aliasMap[$alias] = $class;
$this->parentAliasMap[$alias] = $parentAlias;
$this->relationMap[$alias] = $relation;
return $this;
} | php | {
"resource": ""
} |
q14636 | OneToManyPersister.deleteJoinedEntityCollection | train | private function deleteJoinedEntityCollection(PersistentCollection $collection)
{
$association = $collection->getMapping();
$targetClass = $this->em->getClassMetadata($association->getTargetEntity());
$rootClass = $this->em->getClassMetadata($targetClass->getRootClassName());
... | php | {
"resource": ""
} |
q14637 | LazyCriteriaCollection.count | train | public function count()
{
if ($this->isInitialized()) {
return $this->collection->count();
}
// Return cached result in case count query was already executed
if ($this->count !== null) {
return $this->count;
}
return $this->count = $this->ent... | php | {
"resource": ""
} |
q14638 | LazyCriteriaCollection.contains | train | public function contains($element)
{
if ($this->isInitialized()) {
return $this->collection->contains($element);
}
return $this->entityPersister->exists($element, $this->criteria);
} | php | {
"resource": ""
} |
q14639 | ResultSetMappingBuilder.isInheritanceSupported | train | private function isInheritanceSupported(ClassMetadata $metadata)
{
if ($metadata->inheritanceType === InheritanceType::SINGLE_TABLE
&& in_array($metadata->getClassName(), $metadata->discriminatorMap, true)) {
return true;
}
return ! in_array($metadata->inheritanceTyp... | php | {
"resource": ""
} |
q14640 | Query.processParameterMappings | train | private function processParameterMappings($paramMappings)
{
$sqlParams = [];
$types = [];
foreach ($this->parameters as $parameter) {
$key = $parameter->getName();
$value = $parameter->getValue();
$rsm = $this->getResultSetMapping();
... | php | {
"resource": ""
} |
q14641 | Query.iterate | train | public function iterate($parameters = null, $hydrationMode = self::HYDRATE_OBJECT)
{
$this->setHint(self::HINT_INTERNAL_ITERATION, true);
return parent::iterate($parameters, $hydrationMode);
} | php | {
"resource": ""
} |
q14642 | Query.getLockMode | train | public function getLockMode()
{
$lockMode = $this->getHint(self::HINT_LOCK_MODE);
if ($lockMode === false) {
return null;
}
return $lockMode;
} | php | {
"resource": ""
} |
q14643 | DatabaseDriver.setTables | train | public function setTables($entityTables, $manyToManyTables)
{
$this->tables = $this->manyToManyTables = $this->classToTableNames = [];
foreach ($entityTables as $table) {
$className = $this->getClassNameForTable($table->getName());
$this->classToTableNames[$className] = $ta... | php | {
"resource": ""
} |
q14644 | DatabaseDriver.buildTable | train | private function buildTable(Mapping\ClassMetadata $metadata)
{
$tableName = $this->classToTableNames[$metadata->getClassName()];
$indexes = $this->tables[$tableName]->getIndexes();
$tableMetadata = new Mapping\TableMetadata();
$tableMetadata->setName($this->classToTableNam... | php | {
"resource": ""
} |
q14645 | DatabaseDriver.getFieldNameForColumn | train | private function getFieldNameForColumn($tableName, $columnName, $fk = false)
{
if (isset($this->fieldNamesForColumns[$tableName], $this->fieldNamesForColumns[$tableName][$columnName])) {
return $this->fieldNamesForColumns[$tableName][$columnName];
}
$columnName = strtolower($col... | php | {
"resource": ""
} |
q14646 | ClassMetadataGenerator.generate | train | public function generate(ClassMetadataDefinition $definition) : string
{
$metadata = $this->mappingDriver->loadMetadataForClass(
$definition->entityClassName,
$definition->parentClassMetadata
);
return $this->metadataExporter->export($metadata);
} | php | {
"resource": ""
} |
q14647 | UnitOfWork.computeScheduleInsertsChangeSets | train | private function computeScheduleInsertsChangeSets()
{
foreach ($this->entityInsertions as $entity) {
$class = $this->em->getClassMetadata(get_class($entity));
$this->computeChangeSet($class, $entity);
}
} | php | {
"resource": ""
} |
q14648 | UnitOfWork.executeExtraUpdates | train | private function executeExtraUpdates()
{
foreach ($this->extraUpdates as $oid => $update) {
[$entity, $changeset] = $update;
$this->entityChangeSets[$oid] = $changeset;
$this->getEntityPersister(get_class($entity))->update($entity);
}
$this->extraUpdate... | php | {
"resource": ""
} |
q14649 | UnitOfWork.executeUpdates | train | private function executeUpdates($class)
{
$className = $class->getClassName();
$persister = $this->getEntityPersister($className);
$preUpdateInvoke = $this->listenersInvoker->getSubscribedSystems($class, Events::preUpdate);
$postUpdateInvoke = $this->listenersInvoker->... | php | {
"resource": ""
} |
q14650 | UnitOfWork.scheduleForInsert | train | public function scheduleForInsert($entity)
{
$oid = spl_object_id($entity);
if (isset($this->entityUpdates[$oid])) {
throw new InvalidArgumentException('Dirty entity can not be scheduled for insertion.');
}
if (isset($this->entityDeletions[$oid])) {
throw OR... | php | {
"resource": ""
} |
q14651 | UnitOfWork.scheduleForUpdate | train | public function scheduleForUpdate($entity) : void
{
$oid = spl_object_id($entity);
if (! isset($this->entityIdentifiers[$oid])) {
throw ORMInvalidArgumentException::entityHasNoIdentity($entity, 'scheduling for update');
}
if (isset($this->entityDeletions[$oid])) {
... | php | {
"resource": ""
} |
q14652 | UnitOfWork.isEntityScheduled | train | public function isEntityScheduled($entity)
{
$oid = spl_object_id($entity);
return isset($this->entityInsertions[$oid])
|| isset($this->entityUpdates[$oid])
|| isset($this->entityDeletions[$oid]);
} | php | {
"resource": ""
} |
q14653 | UnitOfWork.performCallbackOnCachedPersister | train | private function performCallbackOnCachedPersister(callable $callback)
{
if (! $this->hasCache) {
return;
}
foreach (array_merge($this->entityPersisters, $this->collectionPersisters) as $persister) {
if ($persister instanceof CachedPersister) {
$callba... | php | {
"resource": ""
} |
q14654 | AnnotationDriver.convertTableAnnotationToTableMetadata | train | private function convertTableAnnotationToTableMetadata(
Annotation\Table $tableAnnot,
Mapping\TableMetadata $table
) : Mapping\TableMetadata {
if (! empty($tableAnnot->name)) {
$table->setName($tableAnnot->name);
}
if (! empty($tableAnnot->schema)) {
... | php | {
"resource": ""
} |
q14655 | AbstractEntityPersister.getHash | train | protected function getHash($query, $criteria, ?array $orderBy = null, $limit = null, $offset = null)
{
[$params] = $criteria instanceof Criteria
? $this->persister->expandCriteriaParameters($criteria)
: $this->persister->expandParameters($criteria);
return sha1($query . seri... | php | {
"resource": ""
} |
q14656 | MappingException.missingRequiredOption | train | public static function missingRequiredOption($field, $expectedOption, $hint = '')
{
$message = sprintf("The mapping of field '%s' is invalid: The option '%s' is required.", $field, $expectedOption);
if (! empty($hint)) {
$message .= ' (Hint: ' . $hint . ')';
}
return ne... | php | {
"resource": ""
} |
q14657 | Parser.match | train | public function match($token)
{
$lookaheadType = $this->lexer->lookahead['type'];
// Short-circuit on first condition, usually types match
if ($lookaheadType === $token) {
$this->lexer->moveNext();
return;
}
// If parameter is not identifier (1-99) ... | php | {
"resource": ""
} |
q14658 | Parser.free | train | public function free($deep = false, $position = 0)
{
// WARNING! Use this method with care. It resets the scanner!
$this->lexer->resetPosition($position);
// Deep = true cleans peek and also any previously defined errors
if ($deep) {
$this->lexer->resetPeek();
}
... | php | {
"resource": ""
} |
q14659 | Parser.peekBeyondClosingParenthesis | train | private function peekBeyondClosingParenthesis($resetPeek = true)
{
$token = $this->lexer->peek();
$numUnmatched = 1;
while ($numUnmatched > 0 && $token !== null) {
switch ($token['type']) {
case Lexer::T_OPEN_PARENTHESIS:
++$numUnmatche... | php | {
"resource": ""
} |
q14660 | Parser.isMathOperator | train | private function isMathOperator($token)
{
return in_array($token['type'], [Lexer::T_PLUS, Lexer::T_MINUS, Lexer::T_DIVIDE, Lexer::T_MULTIPLY], true);
} | php | {
"resource": ""
} |
q14661 | Parser.AliasIdentificationVariable | train | public function AliasIdentificationVariable()
{
$this->match(Lexer::T_IDENTIFIER);
$aliasIdentVariable = $this->lexer->token['value'];
$exists = isset($this->queryComponents[$aliasIdentVariable]);
if ($exists) {
$this->semanticalError(sprintf("'%s' is alread... | php | {
"resource": ""
} |
q14662 | Parser.validateAbstractSchemaName | train | private function validateAbstractSchemaName($schemaName) : void
{
if (class_exists($schemaName, true) || interface_exists($schemaName, true)) {
return;
}
try {
$this->getEntityManager()->getClassMetadata($schemaName);
return;
} catch (MappingExce... | php | {
"resource": ""
} |
q14663 | HandlePreflight.handle | train | public function handle($request, Closure $next)
{
if ($this->cors->isPreflightRequest($request)) {
return $this->cors->handlePreflightRequest($request);
}
return $next($request);
} | php | {
"resource": ""
} |
q14664 | AuthCodeGrant.respondToAccessTokenRequest | train | public function respondToAccessTokenRequest(
ServerRequestInterface $request,
ResponseTypeInterface $responseType,
DateInterval $accessTokenTTL
) {
// Validate request
$client = $this->validateClient($request);
$encryptedAuthCode = $this->getRequestParameter('code', $... | php | {
"resource": ""
} |
q14665 | AuthCodeGrant.validateAuthorizationCode | train | private function validateAuthorizationCode(
$authCodePayload,
ClientEntityInterface $client,
ServerRequestInterface $request
) {
if (time() > $authCodePayload->expire_time) {
throw OAuthServerException::invalidRequest('code', 'Authorization code has expired');
}
... | php | {
"resource": ""
} |
q14666 | AuthCodeGrant.getClientRedirectUri | train | private function getClientRedirectUri(AuthorizationRequest $authorizationRequest)
{
return \is_array($authorizationRequest->getClient()->getRedirectUri())
? $authorizationRequest->getClient()->getRedirectUri()[0]
: $authorizationRequest->getClient()->getRedirectUri();
} | php | {
"resource": ""
} |
q14667 | CryptTrait.encrypt | train | protected function encrypt($unencryptedData)
{
try {
if ($this->encryptionKey instanceof Key) {
return Crypto::encrypt($unencryptedData, $this->encryptionKey);
}
return Crypto::encryptWithPassword($unencryptedData, $this->encryptionKey);
} catch (... | php | {
"resource": ""
} |
q14668 | CryptTrait.decrypt | train | protected function decrypt($encryptedData)
{
try {
if ($this->encryptionKey instanceof Key) {
return Crypto::decrypt($encryptedData, $this->encryptionKey);
}
return Crypto::decryptWithPassword($encryptedData, $this->encryptionKey);
} catch (Except... | php | {
"resource": ""
} |
q14669 | OAuthServerException.getPayload | train | public function getPayload()
{
$payload = $this->payload;
// The "message" property is deprecated and replaced by "error_description"
// TODO: remove "message" property
if (isset($payload['error_description']) && !isset($payload['message'])) {
$payload['message'] = $payl... | php | {
"resource": ""
} |
q14670 | OAuthServerException.invalidRequest | train | public static function invalidRequest($parameter, $hint = null, Throwable $previous = null)
{
$errorMessage = 'The request is missing a required parameter, includes an invalid parameter value, ' .
'includes a parameter more than once, or is otherwise malformed.';
$hint = ($hint === null)... | php | {
"resource": ""
} |
q14671 | OAuthServerException.invalidScope | train | public static function invalidScope($scope, $redirectUri = null)
{
$errorMessage = 'The requested scope is invalid, unknown, or malformed';
if (empty($scope)) {
$hint = 'Specify a scope in the request or set a default scope';
} else {
$hint = sprintf(
... | php | {
"resource": ""
} |
q14672 | OAuthServerException.accessDenied | train | public static function accessDenied($hint = null, $redirectUri = null, Throwable $previous = null)
{
return new static(
'The resource owner or authorization server denied the request.',
9,
'access_denied',
401,
$hint,
$redirectUri,
... | php | {
"resource": ""
} |
q14673 | OAuthServerException.generateHttpResponse | train | public function generateHttpResponse(ResponseInterface $response, $useFragment = false, $jsonOptions = 0)
{
$headers = $this->getHttpHeaders();
$payload = $this->getPayload();
if ($this->redirectUri !== null) {
if ($useFragment === true) {
$this->redirectUri .= ... | php | {
"resource": ""
} |
q14674 | OAuthServerException.getHttpHeaders | train | public function getHttpHeaders()
{
$headers = [
'Content-type' => 'application/json',
];
// Add "WWW-Authenticate" header
//
// RFC 6749, section 5.2.:
// "If the client attempted to authenticate via the 'Authorization'
// request header field, th... | php | {
"resource": ""
} |
q14675 | AbstractGrant.validateClient | train | protected function validateClient(ServerRequestInterface $request)
{
list($basicAuthUser, $basicAuthPassword) = $this->getBasicAuthCredentials($request);
$clientId = $this->getRequestParameter('client_id', $request, $basicAuthUser);
if ($clientId === null) {
throw OAuthServerExc... | php | {
"resource": ""
} |
q14676 | AbstractGrant.validateRedirectUri | train | protected function validateRedirectUri(
string $redirectUri,
ClientEntityInterface $client,
ServerRequestInterface $request
) {
if (\is_string($client->getRedirectUri())
&& (strcmp($client->getRedirectUri(), $redirectUri) !== 0)
) {
$this->getEmitter()... | php | {
"resource": ""
} |
q14677 | AbstractGrant.validateScopes | train | public function validateScopes($scopes, $redirectUri = null)
{
if (!\is_array($scopes)) {
$scopes = $this->convertScopesQueryStringToArray($scopes);
}
$validScopes = [];
foreach ($scopes as $scopeItem) {
$scope = $this->scopeRepository->getScopeEntityByIdent... | php | {
"resource": ""
} |
q14678 | AbstractGrant.convertScopesQueryStringToArray | train | private function convertScopesQueryStringToArray($scopes)
{
return array_filter(explode(self::SCOPE_DELIMITER_STRING, trim($scopes)), function ($scope) {
return !empty($scope);
});
} | php | {
"resource": ""
} |
q14679 | AbstractGrant.getRequestParameter | train | protected function getRequestParameter($parameter, ServerRequestInterface $request, $default = null)
{
$requestParameters = (array) $request->getParsedBody();
return $requestParameters[$parameter] ?? $default;
} | php | {
"resource": ""
} |
q14680 | AbstractGrant.getQueryStringParameter | train | protected function getQueryStringParameter($parameter, ServerRequestInterface $request, $default = null)
{
return isset($request->getQueryParams()[$parameter]) ? $request->getQueryParams()[$parameter] : $default;
} | php | {
"resource": ""
} |
q14681 | AbstractGrant.getCookieParameter | train | protected function getCookieParameter($parameter, ServerRequestInterface $request, $default = null)
{
return isset($request->getCookieParams()[$parameter]) ? $request->getCookieParams()[$parameter] : $default;
} | php | {
"resource": ""
} |
q14682 | AbstractGrant.getServerParameter | train | protected function getServerParameter($parameter, ServerRequestInterface $request, $default = null)
{
return isset($request->getServerParams()[$parameter]) ? $request->getServerParams()[$parameter] : $default;
} | php | {
"resource": ""
} |
q14683 | AbstractGrant.generateUniqueIdentifier | train | protected function generateUniqueIdentifier($length = 40)
{
try {
return bin2hex(random_bytes($length));
// @codeCoverageIgnoreStart
} catch (TypeError $e) {
throw OAuthServerException::serverError('An unexpected error has occurred', $e);
} catch (Error $e... | php | {
"resource": ""
} |
q14684 | AuthorizationServer.enableGrantType | train | public function enableGrantType(GrantTypeInterface $grantType, DateInterval $accessTokenTTL = null)
{
if ($accessTokenTTL instanceof DateInterval === false) {
$accessTokenTTL = new DateInterval('PT1H');
}
$grantType->setAccessTokenRepository($this->accessTokenRepository);
... | php | {
"resource": ""
} |
q14685 | AuthorizationServer.validateAuthorizationRequest | train | public function validateAuthorizationRequest(ServerRequestInterface $request)
{
foreach ($this->enabledGrantTypes as $grantType) {
if ($grantType->canRespondToAuthorizationRequest($request)) {
return $grantType->validateAuthorizationRequest($request);
}
}
... | php | {
"resource": ""
} |
q14686 | AuthorizationServer.completeAuthorizationRequest | train | public function completeAuthorizationRequest(AuthorizationRequest $authRequest, ResponseInterface $response)
{
return $this->enabledGrantTypes[$authRequest->getGrantTypeId()]
->completeAuthorizationRequest($authRequest)
->generateHttpResponse($response);
} | php | {
"resource": ""
} |
q14687 | AuthorizationServer.respondToAccessTokenRequest | train | public function respondToAccessTokenRequest(ServerRequestInterface $request, ResponseInterface $response)
{
foreach ($this->enabledGrantTypes as $grantType) {
if (!$grantType->canRespondToAccessTokenRequest($request)) {
continue;
}
$tokenResponse = $grantT... | php | {
"resource": ""
} |
q14688 | LinkedInProvider.getBasicProfile | train | protected function getBasicProfile($token)
{
$url = 'https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))';
$response = $this->getHttpClient()->get($url, [
'headers' => [
'Authorization' => 'Bearer '.$token,
... | php | {
"resource": ""
} |
q14689 | LinkedInProvider.getEmailAddress | train | protected function getEmailAddress($token)
{
$url = 'https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))';
$response = $this->getHttpClient()->get($url, [
'headers' => [
'Authorization' => 'Bearer '.$token,
'X-RestLi-Protoco... | php | {
"resource": ""
} |
q14690 | AbstractUser.map | train | public function map(array $attributes)
{
foreach ($attributes as $key => $value) {
$this->{$key} = $value;
}
return $this;
} | php | {
"resource": ""
} |
q14691 | AbstractProvider.userFromTokenAndSecret | train | public function userFromTokenAndSecret($token, $secret)
{
$tokenCredentials = new TokenCredentials();
$tokenCredentials->setIdentifier($token);
$tokenCredentials->setSecret($secret);
$user = $this->server->getUserDetails(
$tokenCredentials, $this->shouldBypassCache($tok... | php | {
"resource": ""
} |
q14692 | AbstractProvider.shouldBypassCache | train | protected function shouldBypassCache($token, $secret)
{
$newHash = sha1($token.'_'.$secret);
if (! empty($this->userHash) && $newHash !== $this->userHash) {
$this->userHash = $newHash;
return true;
}
$this->userHash = $this->userHash ?: $newHash;
r... | php | {
"resource": ""
} |
q14693 | User.setToken | train | public function setToken($token, $tokenSecret)
{
$this->token = $token;
$this->tokenSecret = $tokenSecret;
return $this;
} | php | {
"resource": ""
} |
q14694 | SocialiteManager.createTwitterDriver | train | protected function createTwitterDriver()
{
$config = $this->app['config']['services.twitter'];
return new TwitterProvider(
$this->app['request'], new TwitterServer($this->formatConfig($config))
);
} | php | {
"resource": ""
} |
q14695 | SocialiteManager.formatRedirectUrl | train | protected function formatRedirectUrl(array $config)
{
$redirect = value($config['redirect']);
return Str::startsWith($redirect, '/')
? $this->app['url']->to($redirect)
: $redirect;
} | php | {
"resource": ""
} |
q14696 | AbstractProvider.scopes | train | public function scopes($scopes)
{
$this->scopes = array_unique(array_merge($this->scopes, (array) $scopes));
return $this;
} | php | {
"resource": ""
} |
q14697 | BootstrapState.getValue | train | public function getValue( $key, $fallback = null ) {
return array_key_exists( $key, $this->state )
? $this->state[ $key ]
: $fallback;
} | php | {
"resource": ""
} |
q14698 | FileCache.has | train | public function has( $key, $ttl = null ) {
if ( ! $this->enabled ) {
return false;
}
$filename = $this->filename( $key );
if ( ! file_exists( $filename ) ) {
return false;
}
// use ttl param or global ttl
if ( null === $ttl ) {
$ttl = $this->ttl;
} elseif ( $this->ttl > 0 ) {
$ttl = min( ... | php | {
"resource": ""
} |
q14699 | FileCache.read | train | public function read( $key, $ttl = null ) {
$filename = $this->has( $key, $ttl );
if ( $filename ) {
return file_get_contents( $filename );
}
return false;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.