_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q16800 | WebBuilder.setDependencies | train | private function setDependencies(array $packages): self
{
$dependencies = [];
foreach ($packages as $package) {
foreach ($package->getRequires() as $link) {
| php | {
"resource": ""
} |
q16801 | WebBuilder.getMappedPackageList | train | private function getMappedPackageList(array $packages): array
{
$groupedPackages = $this->groupPackagesByName($packages);
$mappedPackages = [];
foreach ($groupedPackages as $name => $packages) {
$highest = $this->getHighestVersion($packages);
| php | {
"resource": ""
} |
q16802 | WebBuilder.groupPackagesByName | train | private function groupPackagesByName(array $packages): array
{
$groupedPackages = [];
foreach ($packages as $package) {
| php | {
"resource": ""
} |
q16803 | WebBuilder.getHighestVersion | train | private function getHighestVersion(array $packages): ?PackageInterface
{
/** @var $highestVersion PackageInterface|null */
$highestVersion = null;
foreach ($packages as $package) {
if (null | php | {
"resource": ""
} |
q16804 | WebBuilder.getDescSortedVersions | train | private function getDescSortedVersions(array $packages): array
{
usort($packages, function (PackageInterface $a, | php | {
"resource": ""
} |
q16805 | HbbTv.parse | train | public function parse()
{
// only parse user agents containing hbbtv fragment
if (!$this->isHbbTv()) {
return false;
}
parent::parse();
// always set device type to tv, | php | {
"resource": ""
} |
q16806 | DeviceDetector.setUserAgent | train | public function setUserAgent($userAgent)
{
if ($this->userAgent != $userAgent) {
$this->reset();
| php | {
"resource": ""
} |
q16807 | DeviceDetector.isDesktop | train | public function isDesktop()
{
$osShort = $this->getOs('short_name');
if (empty($osShort) || self::UNKNOWN == $osShort) {
return false;
}
// Check for browsers available for mobile devices only
if ($this->usesMobileBrowser()) {
return | php | {
"resource": ""
} |
q16808 | DeviceDetector.getOs | train | public function getOs($attr = '')
{
if ($attr == '') {
return $this->os;
| php | {
"resource": ""
} |
q16809 | DeviceDetector.getClient | train | public function getClient($attr = '')
{
if ($attr == '') {
return $this->client;
| php | {
"resource": ""
} |
q16810 | DeviceDetector.parse | train | public function parse()
{
if ($this->isParsed()) {
return;
}
$this->parsed = true;
// skip parsing for empty useragents or those not containing any letter
if (empty($this->userAgent) || !preg_match('/([a-z])/i', $this->userAgent)) {
return;
}... | php | {
"resource": ""
} |
q16811 | DeviceDetector.parseBot | train | protected function parseBot()
{
if ($this->skipBotDetection) {
$this->bot = false;
return false;
}
$parsers = $this->getBotParsers();
foreach ($parsers as $parser) {
$parser->setUserAgent($this->getUserAgent());
$parser->setYamlParser... | php | {
"resource": ""
} |
q16812 | DeviceDetector.getInfoFromUserAgent | train | public static function getInfoFromUserAgent($ua)
{
$deviceDetector = new DeviceDetector($ua);
$deviceDetector->parse();
if ($deviceDetector->isBot()) {
return array(
'user_agent' => $deviceDetector->getUserAgent(),
'bot' => $deviceDetector->getBot... | php | {
"resource": ""
} |
q16813 | DeviceDetector.setCache | train | public function setCache($cache)
{
if ($cache instanceof Cache ||
(class_exists('\Doctrine\Common\Cache\CacheProvider') && $cache instanceof \Doctrine\Common\Cache\CacheProvider)
) {
| php | {
"resource": ""
} |
q16814 | Browser.isMobileOnlyBrowser | train | public static function isMobileOnlyBrowser($browser)
{
return in_array($browser, self::$mobileOnlyBrowsers) || (in_array($browser, self::$availableBrowsers) && | php | {
"resource": ""
} |
q16815 | ClientParserAbstract.parse | train | public function parse()
{
$result = null;
if ($this->preMatchOverall()) {
foreach ($this->getRegexes() as $regex) {
$matches = $this->matchUserAgent($regex['regex']);
if ($matches) {
$result = array(
'type' ... | php | {
"resource": ""
} |
q16816 | ClientParserAbstract.getAvailableClients | train | public static function getAvailableClients()
{
$instance = new static();
$regexes = $instance->getRegexes();
$names = array();
foreach ($regexes as $regex) {
if ($regex['name'] != '$1') {
| php | {
"resource": ""
} |
q16817 | Bot.parse | train | public function parse()
{
$result = null;
if ($this->preMatchOverall()) {
if ($this->discardDetails) {
$result = true;
} else {
foreach ($this->getRegexes() as $regex) {
$matches = $this->matchUserAgent($regex['regex']);
... | php | {
"resource": ""
} |
q16818 | OperatingSystem.getOsFamily | train | public static function getOsFamily($osLabel)
{
foreach (self::$osFamilies as $family => $labels) {
if (in_array($osLabel, $labels)) | php | {
"resource": ""
} |
q16819 | OperatingSystem.getNameFromId | train | public static function getNameFromId($os, $ver = false)
{
if (array_key_exists($os, self::$operatingSystems)) {
$osFullName = self::$operatingSystems[$os];
| php | {
"resource": ""
} |
q16820 | ParserAbstract.setVersionTruncation | train | public static function setVersionTruncation($type)
{
if (in_array($type, array(self::VERSION_TRUNCATION_BUILD,
self::VERSION_TRUNCATION_NONE,
| php | {
"resource": ""
} |
q16821 | ParserAbstract.matchUserAgent | train | protected function matchUserAgent($regex)
{
// only match if useragent begins with given regex or there is no letter before it
$regex = '/(?:^|[^A-Z0-9\-_]|[^A-Z0-9\-]_|sprd-)(?:' . str_replace('/', '\/', $regex) . ')/i';
if | php | {
"resource": ""
} |
q16822 | ParserAbstract.preMatchOverall | train | protected function preMatchOverall()
{
$regexes = $this->getRegexes();
static $overAllMatch;
$cacheKey = $this->parserName.DeviceDetector::VERSION.'-all';
$cacheKey = preg_replace('/([^a-z0-9_-]+)/i', '', $cacheKey);
if (empty($overAllMatch)) {
$overAllMatch = ... | php | {
"resource": ""
} |
q16823 | QueryBuilder.for | train | public static function for($baseQuery, ?Request $request = null): self
{
if (is_string($baseQuery)) {
$baseQuery = ($baseQuery)::query();
| php | {
"resource": ""
} |
q16824 | BootstrapTrait.bootstrapApplicationEnvironment | train | private function bootstrapApplicationEnvironment($appBootstrap, $appenv, $debug)
{
$appBootstrap = $this->normalizeBootstrapClass($appBootstrap);
$this->middleware = new $appBootstrap;
| php | {
"resource": ""
} |
q16825 | SlavePool.add | train | public function add(Slave $slave)
{
$port = $slave->getPort();
if (isset($this->slaves[$port])) {
throw new \Exception("Slave port $port | php | {
"resource": ""
} |
q16826 | SlavePool.remove | train | public function remove(Slave $slave)
{
$port = $slave->getPort();
// validate existence
$this->getByPort($port);
| php | {
"resource": ""
} |
q16827 | SlavePool.getByPort | train | public function getByPort($port)
{
if (!isset($this->slaves[$port])) {
throw new \Exception("Slave port $port | php | {
"resource": ""
} |
q16828 | SlavePool.getByConnection | train | public function getByConnection(ConnectionInterface $connection)
{
$hash = spl_object_hash($connection);
foreach ($this->slaves as $slave) {
| php | {
"resource": ""
} |
q16829 | SlavePool.getByStatus | train | public function getByStatus($status)
{
return array_filter($this->slaves, function ($slave) use ($status) {
return $status | php | {
"resource": ""
} |
q16830 | SlavePool.getStatusSummary | train | public function getStatusSummary()
{
$map = [
'total' => Slave::ANY,
'ready' => Slave::READY,
'busy' => Slave::BUSY,
'created' => Slave::CREATED,
'registered' => Slave::REGISTERED,
| php | {
"resource": ""
} |
q16831 | Slave.register | train | public function register($pid, ConnectionInterface $connection)
{
if ($this->status !== self::CREATED) {
throw new \LogicException('Cannot register a slave that is not in created state');
| php | {
"resource": ""
} |
q16832 | Slave.ready | train | public function ready()
{
if ($this->status !== self::REGISTERED) {
throw new \LogicException('Cannot ready a slave that is not | php | {
"resource": ""
} |
q16833 | Slave.occupy | train | public function occupy()
{
if ($this->status !== self::READY) {
throw new \LogicException('Cannot occupy a slave that is not | php | {
"resource": ""
} |
q16834 | Slave.release | train | public function release()
{
if ($this->status !== self::BUSY) {
throw new \LogicException('Cannot release a slave that is not in busy state');
} | php | {
"resource": ""
} |
q16835 | RequestHandler.handle | train | public function handle(ConnectionInterface $incoming)
{
$this->incoming = $incoming;
$this->incoming->on('data', [$this, 'handleData']);
$this->incoming->on('close', function () {
$this->connectionOpen = false;
});
$this->start = microtime(true);
$this->... | php | {
"resource": ""
} |
q16836 | RequestHandler.handleData | train | public function handleData($data)
{
$this->incomingBuffer .= $data;
if ($this->connection && $this->isHeaderEnd($this->incomingBuffer)) {
$remoteAddress = (string) $this->incoming->getRemoteAddress();
$headersToReplace = [
'X-PHP-PM-Remote-IP' => trim(parse_u... | php | {
"resource": ""
} |
q16837 | RequestHandler.getNextSlave | train | public function getNextSlave()
{
// client went away while waiting for worker
if (!$this->connectionOpen) {
return;
}
$available = $this->slaves->getByStatus(Slave::READY);
if (count($available)) {
// pick first slave
$slave = array_shift(... | php | {
"resource": ""
} |
q16838 | RequestHandler.tryOccupySlave | train | public function tryOccupySlave(Slave $slave)
{
if ($slave->isExpired()) {
$slave->close();
$this->output->writeln(sprintf('Restart worker #%d because it reached its TTL', $slave->getPort()));
$slave->getConnection()->close();
return false;
}
$... | php | {
"resource": ""
} |
q16839 | RequestHandler.slaveConnected | train | public function slaveConnected(ConnectionInterface $connection)
{
$this->connection = $connection;
$this->verboseTimer(function ($took) {
return sprintf('<info>Took abnormal %.3f seconds for connecting to worker %d</info>', $took, $this->slave->getPort());
});
// call h... | php | {
"resource": ""
} |
q16840 | RequestHandler.maxExecutionTimeExceeded | train | public function maxExecutionTimeExceeded()
{
// client went away while waiting for worker
if (!$this->connectionOpen) {
return false;
}
$this->incoming->write($this->createErrorResponse('504 Gateway Timeout', 'Maximum execution time exceeded'));
$this->lastOutgoi... | php | {
"resource": ""
} |
q16841 | RequestHandler.slaveClosed | train | public function slaveClosed()
{
$this->verboseTimer(function ($took) {
return sprintf('<info>Worker %d took abnormal %.3f seconds for handling a connection</info>', $this->slave->getPort(), $took);
});
// Return a "502 Bad Gateway" response if the response was empty
if (... | php | {
"resource": ""
} |
q16842 | RequestHandler.slaveConnectFailed | train | public function slaveConnectFailed(\Exception $e)
{
$this->slave->release();
$this->verboseTimer(function ($took) use ($e) {
return sprintf(
'<error>Connection to worker %d failed. Try #%d, took %.3fs ' .
'(timeout %ds). Error message: [%d] %s</error>',
... | php | {
"resource": ""
} |
q16843 | RequestHandler.verboseTimer | train | protected function verboseTimer($callback, $always = false)
{
$took = microtime(true) - $this->start;
if (($always || $took > 1) && $this->output->isVeryVerbose()) {
| php | {
"resource": ""
} |
q16844 | RequestHandler.replaceHeader | train | protected function replaceHeader($header, $headersToReplace)
{
$result = $header;
foreach ($headersToReplace as $key => $value) {
if (false !== $headerPosition = stripos($result, $key . ':')) {
// check how long the header is
| php | {
"resource": ""
} |
q16845 | ProcessSlave.prepareShutdown | train | public function prepareShutdown()
{
if ($this->inShutdown) {
return false;
}
if ($this->errorLogger && $logs = $this->errorLogger->cleanLogs()) {
$messages = array_map(
function ($item) {
//array($level, $message, $context);
... | php | {
"resource": ""
} |
q16846 | ProcessSlave.bootstrap | train | protected function bootstrap($appBootstrap, $appenv, $debug)
{
if ($bridge = $this->getBridge()) { | php | {
"resource": ""
} |
q16847 | ProcessSlave.sendCurrentFiles | train | protected function sendCurrentFiles()
{
if (!$this->isDebug()) {
return;
}
$files = array_merge($this->watchedFiles, get_included_files());
$flipped = array_flip($files);
//speedy way checking if two arrays are different.
if (!$this->lastSentFiles || arr... | php | {
"resource": ""
} |
q16848 | ProcessSlave.doConnect | train | private function doConnect()
{
$connector = new UnixConnector($this->loop);
$unixSocket = $this->getControllerSocketPath(false);
$connector->connect($unixSocket)->done(
function ($controller) {
$this->controller = $controller;
$this->loop->addSig... | php | {
"resource": ""
} |
q16849 | ProcessSlave.run | train | public function run()
{
$this->loop = Factory::create();
$this->errorLogger = BufferingLogger::create();
ErrorHandler::register(new | php | {
"resource": ""
} |
q16850 | ProcessSlave.handleRequest | train | protected function handleRequest(ServerRequestInterface $request)
{
if ($this->getStaticDirectory()) {
$staticResponse = $this->serveStatic($request);
if ($staticResponse instanceof ResponseInterface) {
return $staticResponse;
}
}
if ($bri... | php | {
"resource": ""
} |
q16851 | ProcessManager.shutdown | train | public function shutdown($graceful = true)
{
if ($this->status === self::STATE_SHUTDOWN) {
return;
}
$this->output->writeln("<info>Server is shutting down.</info>");
$this->status = self::STATE_SHUTDOWN;
$remainingSlaves = count($this->slaves->getByStatus(Slave:... | php | {
"resource": ""
} |
q16852 | ProcessManager.quit | train | private function quit()
{
$this->output->writeln('Stopping the process manager.');
// this method is also called during startup when something crashed, so
// make sure we don't operate on nulls.
if ($this->controller) {
@$this->controller->close();
} | php | {
"resource": ""
} |
q16853 | ProcessManager.run | train | public function run()
{
Debug::enable();
// make whatever is necessary to disable all stuff that could buffer output
ini_set('zlib.output_compression', 0);
ini_set('output_buffering', 0);
ini_set('implicit_flush', 1);
ob_implicit_flush(1);
$this->loop = Fact... | php | {
"resource": ""
} |
q16854 | ProcessManager.onSlaveConnection | train | public function onSlaveConnection(ConnectionInterface $connection)
{
$this->bindProcessMessage($connection);
$connection->on('close', | php | {
"resource": ""
} |
q16855 | ProcessManager.onSlaveClosed | train | public function onSlaveClosed(ConnectionInterface $connection)
{
if ($this->status === self::STATE_SHUTDOWN) {
return;
}
try {
$slave = $this->slaves->getByConnection($connection);
} catch (\Exception $e) {
// this connection is not registered, so... | php | {
"resource": ""
} |
q16856 | ProcessManager.commandStatus | train | protected function commandStatus(array $data, ConnectionInterface $conn)
{
// remove nasty info about worker's bootstrap fail
$conn->removeAllListeners('close');
if ($this->output->isVeryVerbose()) {
$conn->on('close', function () {
$this->output->writeln('Status ... | php | {
"resource": ""
} |
q16857 | ProcessManager.commandStop | train | protected function commandStop(array $data, ConnectionInterface $conn)
{
if ($this->output->isVeryVerbose()) {
$conn->on('close', function () {
| php | {
"resource": ""
} |
q16858 | ProcessManager.commandReload | train | protected function commandReload(array $data, ConnectionInterface $conn)
{
// remove nasty info about worker's bootstrap fail
$conn->removeAllListeners('close');
if ($this->output->isVeryVerbose()) {
$conn->on('close', function () {
| php | {
"resource": ""
} |
q16859 | ProcessManager.commandRegister | train | protected function commandRegister(array $data, ConnectionInterface $conn)
{
$pid = (int)$data['pid'];
$port = (int)$data['port'];
try {
$slave = $this->slaves->getByPort($port);
$slave->register($pid, $conn);
} catch (\Exception $e) {
$this->outp... | php | {
"resource": ""
} |
q16860 | ProcessManager.commandReady | train | protected function commandReady(array $data, ConnectionInterface $conn)
{
try {
$slave = $this->slaves->getByConnection($conn);
} catch (\Exception $e) {
$this->output->writeln(
'<error>A ready command was sent by a worker with no connection. This was unexpect... | php | {
"resource": ""
} |
q16861 | ProcessManager.commandFiles | train | protected function commandFiles(array $data, ConnectionInterface $conn)
{
try {
$slave = $this->slaves->getByConnection($conn);
$start = microtime(true);
clearstatcache();
$newFilesCount = 0;
$knownFiles = array_keys($this->filesLastMTime);
... | php | {
"resource": ""
} |
q16862 | ProcessManager.commandStats | train | protected function commandStats(array $data, ConnectionInterface $conn)
{
try {
$slave = $this->slaves->getByConnection($conn);
$slave->setUsedMemory($data['memory_usage']);
if ($this->output->isVeryVerbose()) {
$this->output->writeln(
... | php | {
"resource": ""
} |
q16863 | ProcessManager.bootstrapFailed | train | protected function bootstrapFailed($port)
{
if ($this->isDebug()) {
$this->output->writeln('');
if ($this->status !== self::STATE_EMERGENCY) {
$this->status = self::STATE_EMERGENCY;
$this->output->writeln(
sprintf(
... | php | {
"resource": ""
} |
q16864 | ProcessManager.checkChangedFiles | train | protected function checkChangedFiles($restartSlaves = true)
{
if ($this->inChangesDetectionCycle) {
return false;
}
$start = microtime(true);
$hasChanged = false;
$this->inChangesDetectionCycle = true;
clearstatcache();
foreach ($this->filesLas... | php | {
"resource": ""
} |
q16865 | ProcessManager.createSlaves | train | public function createSlaves()
{
for ($i = 1; $i <= $this->slaveCount; $i++) {
| php | {
"resource": ""
} |
q16866 | ProcessManager.closeSlave | train | protected function closeSlave($slave)
{
$slave->close();
$this->slaves->remove($slave);
if (!empty($slave->getConnection())) {
| php | {
"resource": ""
} |
q16867 | ProcessManager.reloadSlaves | train | public function reloadSlaves($graceful = true)
{
$this->output->writeln('<info>Reloading all workers gracefully</info>');
$this->closeSlaves($graceful, function ($slave) {
/** @var $slave Slave */
if ($this->output->isVeryVerbose()) {
$this->output->writeln(... | php | {
"resource": ""
} |
q16868 | ProcessManager.closeSlaves | train | public function closeSlaves($graceful = false, $onSlaveClosed = null)
{
if (!$onSlaveClosed) {
// create a default no-op if callable is undefined
$onSlaveClosed = function ($slave) {
};
}
/*
* NB: we don't lock slave reload with a semaphore, sinc... | php | {
"resource": ""
} |
q16869 | ProcessManager.restartSlaves | train | public function restartSlaves()
{
if ($this->inRestart) {
return;
}
$this->inRestart = true;
| php | {
"resource": ""
} |
q16870 | ProcessManager.allSlavesReady | train | protected function allSlavesReady()
{
if ($this->status === self::STATE_STARTING || $this->status === self::STATE_EMERGENCY) {
$readySlaves = $this->slaves->getByStatus(Slave::READY);
$busySlaves = $this->slaves->getByStatus(Slave::BUSY);
| php | {
"resource": ""
} |
q16871 | ProcessManager.newSlaveInstance | train | protected function newSlaveInstance($port)
{
if ($this->status === self::STATE_SHUTDOWN) {
// during shutdown phase all connections are closed and as result new
// instances are created - which is forbidden during this phase
return;
}
if ($this->output->i... | php | {
"resource": ""
} |
q16872 | PropertyHelperTrait.addLookupsForNestedProperty | train | protected function addLookupsForNestedProperty(string $property, Builder $aggregationBuilder, string $resourceClass): array
{
$propertyParts = $this->splitPropertyParts($property, $resourceClass);
$alias = '';
foreach ($propertyParts['associations'] as $association) {
$classMeta... | php | {
"resource": ""
} |
q16873 | PropertyFilter.formatWhitelist | train | private function formatWhitelist(array $whitelist): array
{
if (array_values($whitelist) === $whitelist) {
return $whitelist;
}
foreach ($whitelist as $name => $value) {
if (null === | php | {
"resource": ""
} |
q16874 | ItemNormalizer.populateIdentifier | train | private function populateIdentifier(array $data, string $class): array
{
$identifier = $this->identifierExtractor->getIdentifierFromResourceClass($class);
$identifier = null === $this->nameConverter ? $identifier : $this->nameConverter->normalize($identifier, $class, self::FORMAT);
| php | {
"resource": ""
} |
q16875 | AbstractCollectionNormalizer.getPaginationConfig | train | protected function getPaginationConfig($object, array $context = []): array
{
$currentPage = $lastPage = $itemsPerPage = $pageTotalItems = $totalItems = null;
$paginated = $paginator = false;
if ($object instanceof PartialPaginatorInterface) {
$paginated = $paginator = true;
... | php | {
"resource": ""
} |
q16876 | SwaggerContext.getProperties | train | private function getProperties(string $className, int $specVersion = 2): stdClass
{
| php | {
"resource": ""
} |
q16877 | SwaggerContext.getLastJsonResponse | train | private function getLastJsonResponse(): stdClass
{
if (null === ($decoded = json_decode($this->restContext->getMink()->getSession()->getDriver()->getContent()))) { | php | {
"resource": ""
} |
q16878 | DocumentMetadata.withIndex | train | public function withIndex(string $index): self
{
$metadata = clone $this;
| php | {
"resource": ""
} |
q16879 | DocumentMetadata.withType | train | public function withType(string $type): self
{
$metadata = clone $this;
| php | {
"resource": ""
} |
q16880 | ReadListener.onKernelRequest | train | public function onKernelRequest(GetResponseEvent $event): void
{
$request = $event->getRequest();
if (
!($attributes = RequestAttributesExtractor::extractAttributes($request))
|| !$attributes['receive']
) {
return;
}
if (null === $filters ... | php | {
"resource": ""
} |
q16881 | RangeFilter.addWhere | train | protected function addWhere(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, $alias, $field, $operator, $value)
{
$valueParameter = $queryNameGenerator->generateParameterName($field);
switch ($operator) {
case self::PARAMETER_BETWEEN:
$rangeVa... | php | {
"resource": ""
} |
q16882 | SwaggerUiAction.getContext | train | private function getContext(Request $request, Documentation $documentation): array
{
$context = [
'title' => $this->title,
'description' => $this->description,
'formats' => $this->formats,
'showWebby' => $this->showWebby,
'swaggerUiEnabled' => $thi... | php | {
"resource": ""
} |
q16883 | QueryChecker.hasRootEntityWithForeignKeyIdentifier | train | public static function hasRootEntityWithForeignKeyIdentifier(QueryBuilder $queryBuilder, ManagerRegistry $managerRegistry): bool
{
foreach ($queryBuilder->getRootEntities() as $rootEntity) {
/** @var ClassMetadata $rootMetadata */
$rootMetadata = $managerRegistry
->ge... | php | {
"resource": ""
} |
q16884 | QueryChecker.hasRootEntityWithCompositeIdentifier | train | public static function hasRootEntityWithCompositeIdentifier(QueryBuilder $queryBuilder, ManagerRegistry $managerRegistry): bool
{
foreach ($queryBuilder->getRootEntities() as $rootEntity) {
/** @var ClassMetadata $rootMetadata */
$rootMetadata = $managerRegistry
->get... | php | {
"resource": ""
} |
q16885 | QueryChecker.hasLeftJoin | train | public static function hasLeftJoin(QueryBuilder $queryBuilder): bool
{
foreach ($queryBuilder->getDQLPart('join') as $joins) {
foreach ($joins as $join) {
if (Join::LEFT_JOIN === | php | {
"resource": ""
} |
q16886 | QueryChecker.hasJoinedToManyAssociation | train | public static function hasJoinedToManyAssociation(QueryBuilder $queryBuilder, ManagerRegistry $managerRegistry): bool
{
if (
0 === \count($queryBuilder->getDQLPart('join'))
) {
return false;
}
$joinAliases = array_diff($queryBuilder->getAllAliases(), $queryBu... | php | {
"resource": ""
} |
q16887 | ErrorFormatGuesser.guessErrorFormat | train | public static function guessErrorFormat(Request $request, array $errorFormats): array
{
$requestFormat = $request->getRequestFormat('');
if ('' !== $requestFormat && isset($errorFormats[$requestFormat])) {
return ['key' => $requestFormat, 'value' => $errorFormats[$requestFormat]];
... | php | {
"resource": ""
} |
q16888 | EagerLoadingExtension.getNormalizationContext | train | private function getNormalizationContext(string $resourceClass, string $contextType, array $options): array
{
if (null !== $this->requestStack && null !== $this->serializerContextBuilder && null !== $request = $this->requestStack->getCurrentRequest()) {
return $this->serializerContextBuilder->cr... | php | {
"resource": ""
} |
q16889 | SerializeListener.onKernelView | train | public function onKernelView(GetResponseForControllerResultEvent $event): void
{
$controllerResult = $event->getControllerResult();
$request = $event->getRequest();
if ($controllerResult instanceof Response || !(($attributes = RequestAttributesExtractor::extractAttributes($request))['respon... | php | {
"resource": ""
} |
q16890 | FilterEagerLoadingExtension.getQueryBuilderWithNewAliases | train | private function getQueryBuilderWithNewAliases(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $originAlias = 'o', string $replacement = 'o_2'): QueryBuilder
{
$queryBuilderClone = clone $queryBuilder;
$joinParts = $queryBuilder->getDQLPart('join');
$wher... | php | {
"resource": ""
} |
q16891 | OperationMethodResolver.getOperationRoute | train | private function getOperationRoute(string $resourceClass, string $operationName, string $operationType): Route
{
$routeName = $this->getRouteName($this->resourceMetadataFactory->create($resourceClass), $operationName, $operationType);
if (null !== $routeName) {
return $this->getRoute($ro... | php | {
"resource": ""
} |
q16892 | OperationMethodResolver.getRouteName | train | private function getRouteName(ResourceMetadata $resourceMetadata, string $operationName, string $operationType): ?string
{
if (OperationType::ITEM === | php | {
"resource": ""
} |
q16893 | OperationMethodResolver.getRoute | train | private function getRoute(string $routeName): Route
{
foreach ($this->router->getRouteCollection() as $name => $route) {
if ($routeName === $name) {
return $route; | php | {
"resource": ""
} |
q16894 | XmlExtractor.getOperations | train | private function getOperations(\SimpleXMLElement $resource, string $operationType): ?array
{
$graphql = 'operation' === $operationType;
if (!$graphql && $legacyOperations = $this->getAttributes($resource, $operationType)) {
@trigger_error(
sprintf('Configuring "%1$s" tags... | php | {
"resource": ""
} |
q16895 | XmlExtractor.getAttributes | train | private function getAttributes(\SimpleXMLElement $resource, string $elementName, bool $topLevel = false): array
{
$attributes = [];
foreach ($resource->{$elementName} as $attribute) {
$value = isset($attribute->attribute[0]) ? $this->getAttributes($attribute, 'attribute') : XmlUtils::php... | php | {
"resource": ""
} |
q16896 | XmlExtractor.getProperties | train | private function getProperties(\SimpleXMLElement $resource): array
{
$properties = [];
foreach ($resource->property as $property) {
$properties[(string) $property['name']] = [
'description' => $this->phpize($property, 'description', 'string'),
'readable' =... | php | {
"resource": ""
} |
q16897 | XmlExtractor.phpize | train | private function phpize(\SimpleXMLElement $array, string $key, string $type)
{
if (!isset($array[$key])) {
return null;
}
switch ($type) {
| php | {
"resource": ""
} |
q16898 | DeserializeListener.onKernelRequest | train | public function onKernelRequest(GetResponseEvent $event): void
{
$request = $event->getRequest();
$method = $request->getMethod();
if (
'DELETE' === $method
|| $request->isMethodSafe(false)
|| !($attributes = RequestAttributesExtractor::extractAttributes(... | php | {
"resource": ""
} |
q16899 | DeserializeListener.getFormat | train | private function getFormat(Request $request): string
{
/**
* @var string|null
*/
$contentType = $request->headers->get('CONTENT_TYPE');
if (null === $contentType) {
throw new NotAcceptableHttpException('The "Content-Type" header must exist.');
}
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.