_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q247700 | FormContext.fillInWithValueOfFieldOfCurrentUser | validation | public function fillInWithValueOfFieldOfCurrentUser($field, $user_field)
{
if (!empty($this->user) && !$this->user->uid) {
throw new \Exception('Anonymous user have no fields');
}
$entity = new EntityDrupalWrapper('user');
$wrapper = $entity->wrapper($this->user->uid);
... | php | {
"resource": ""
} |
q247701 | FormContext.radioAction | validation | public function radioAction($customized, $selector)
{
$field = $this->getWorkingElement()->findField($selector);
$customized = (bool) $customized;
if ($field !== null && !$customized) {
$field->selectOption($field->getAttribute('value'));
return;
}
/... | php | {
"resource": ""
} |
q247702 | FormContext.shouldSeeThumbnail | validation | public function shouldSeeThumbnail()
{
$thumb = false;
foreach (['.upload-preview', '.media-thumbnail img', '.image-preview img'] as $selector) {
if ($thumb) {
break;
}
$thumb = $this->findByCss($selector);
}
if (null === $thumb)... | php | {
"resource": ""
} |
q247703 | HttpHeaders.add | validation | public function add($name, $values, bool $append = false): void
{
$normalizedName = self::normalizeHeaderName($name);
if (!$append || !$this->containsKey($normalizedName)) {
parent::add($normalizedName, (array)$values);
} else {
$currentValues = [];
$this... | php | {
"resource": ""
} |
q247704 | HttpHeaders.tryGetFirst | validation | public function tryGetFirst($name, &$value): bool
{
try {
$value = $this->get($name)[0];
return true;
} catch (OutOfBoundsException $ex) {
return false;
}
} | php | {
"resource": ""
} |
q247705 | HttpHeaderParser.isJson | validation | public function isJson(HttpHeaders $headers): bool
{
$contentType = null;
$headers->tryGetFirst('Content-Type', $contentType);
return preg_match("/application\/json/i", $contentType) === 1;
} | php | {
"resource": ""
} |
q247706 | HttpHeaderParser.isMultipart | validation | public function isMultipart(HttpHeaders $headers): bool
{
$contentType = null;
$headers->tryGetFirst('Content-Type', $contentType);
return preg_match("/multipart\//i", $contentType) === 1;
} | php | {
"resource": ""
} |
q247707 | MultipartBody.createDefaultBoundary | validation | private static function createDefaultBoundary(): string
{
try {
// The following creates a UUID v4
$string = random_bytes(16);
$string[6] = chr(ord($string[6]) & 0x0f | 0x40);
$string[8] = chr(ord($string[8]) & 0x3f | 0x80);
return vsprintf('%s%s-... | php | {
"resource": ""
} |
q247708 | MultipartBody.createStreamFromString | validation | private function createStreamFromString(string $string): Stream
{
$stream = new Stream(fopen('php://temp', 'r+b'));
$stream->write($string);
$stream->rewind();
return $stream;
} | php | {
"resource": ""
} |
q247709 | RequestHeaderParser.parseAcceptCharsetHeader | validation | public function parseAcceptCharsetHeader(HttpHeaders $headers): array
{
$headerValues = [];
if (!$headers->tryGet('Accept-Charset', $headerValues)) {
return [];
}
$parsedHeaderValues = [];
$numHeaderValues = count($headerValues);
for ($i = 0;$i < $numHe... | php | {
"resource": ""
} |
q247710 | RequestHeaderParser.parseAcceptHeader | validation | public function parseAcceptHeader(HttpHeaders $headers): array
{
$headerValues = [];
if (!$headers->tryGet('Accept', $headerValues)) {
return [];
}
$parsedHeaderValues = [];
$numHeaderValues = count($headerValues);
for ($i = 0;$i < $numHeaderValues;$i++... | php | {
"resource": ""
} |
q247711 | RequestHeaderParser.parseAcceptLanguageHeader | validation | public function parseAcceptLanguageHeader(HttpHeaders $headers): array
{
$headerValues = [];
if (!$headers->tryGet('Accept-Language', $headerValues)) {
return [];
}
$parsedHeaderValues = [];
$numHeaderValues = count($headerValues);
for ($i = 0;$i < $num... | php | {
"resource": ""
} |
q247712 | RequestHeaderParser.parseContentTypeHeader | validation | public function parseContentTypeHeader(HttpHeaders $headers): ?ContentTypeHeaderValue
{
if (!$headers->containsKey('Content-Type')) {
return null;
}
$contentTypeHeaderParameters = $this->parseParameters($headers, 'Content-Type');
$contentType = $contentTypeHeaderParamete... | php | {
"resource": ""
} |
q247713 | EncodingMatcher.getBestEncodingMatch | validation | public function getBestEncodingMatch(
IMediaTypeFormatter $formatter,
array $acceptCharsetHeaders,
?MediaTypeHeaderValue $mediaTypeHeader
): ?string {
$rankedAcceptCharsetHeaders = $this->rankAcceptCharsetHeaders($acceptCharsetHeaders);
foreach ($rankedAcceptCharsetHeaders a... | php | {
"resource": ""
} |
q247714 | EncodingMatcher.compareAcceptCharsetHeaders | validation | private function compareAcceptCharsetHeaders(AcceptCharsetHeaderValue $a, AcceptCharsetHeaderValue $b): int
{
$aQuality = $a->getQuality();
$bQuality = $b->getQuality();
if ($aQuality < $bQuality) {
return 1;
}
if ($aQuality > $bQuality) {
return -1;... | php | {
"resource": ""
} |
q247715 | EncodingMatcher.rankAcceptCharsetHeaders | validation | private function rankAcceptCharsetHeaders(array $charsetHeaders): array
{
usort($charsetHeaders, [$this, 'compareAcceptCharsetHeaders']);
$rankedCharsetHeaders = array_filter($charsetHeaders, [$this, 'filterZeroScores']);
// Have to return the values because the keys aren't updated in array... | php | {
"resource": ""
} |
q247716 | HttpBodyParser.readAsFormInput | validation | public function readAsFormInput(?IHttpBody $body): IDictionary
{
if ($body === null) {
return new HashTable();
}
$parsedFormInputCacheKey = spl_object_hash($body);
if (isset($this->parsedFormInputCache[$parsedFormInputCacheKey])) {
return $this->parsedFormIn... | php | {
"resource": ""
} |
q247717 | HttpBodyParser.readAsJson | validation | public function readAsJson(?IHttpBody $body): array
{
if ($body === null) {
return [];
}
$json = json_decode($body->readAsString(), true);
if ($json === null) {
throw new RuntimeException('Body could not be decoded as JSON');
}
return $json;... | php | {
"resource": ""
} |
q247718 | HttpBodyParser.readAsMultipart | validation | public function readAsMultipart(?IHttpBody $body, string $boundary): ?MultipartBody
{
if ($body === null) {
return null;
}
$rawBodyParts = explode("--$boundary", $body->readAsString());
// The first part will be empty, and the last will be "--". Remove them.
arr... | php | {
"resource": ""
} |
q247719 | MediaTypeFormatter.encodingIsSupported | validation | protected function encodingIsSupported(string $encoding): bool
{
$lowercaseSupportedEncodings = array_map('strtolower', $this->getSupportedEncodings());
$lowercaseEncoding = strtolower($encoding);
return in_array($lowercaseEncoding, $lowercaseSupportedEncodings, true);
} | php | {
"resource": ""
} |
q247720 | RequestParser.getClientIPAddress | validation | public function getClientIPAddress(IHttpRequestMessage $request): ?string
{
$clientIPAddress = null;
$request->getProperties()->tryGet(self::CLIENT_IP_ADDRESS_PROPERTY, $clientIPAddress);
return $clientIPAddress;
} | php | {
"resource": ""
} |
q247721 | ResponseHeaderFormatter.getSetCookieHeaderValue | validation | private function getSetCookieHeaderValue(Cookie $cookie): string
{
$headerValue = "{$cookie->getName()}=" . urlencode($cookie->getValue());
if (($expiration = $cookie->getExpiration()) !== null) {
$headerValue .= '; Expires=' . $expiration->format(self::EXPIRATION_DATE_FORMAT);
... | php | {
"resource": ""
} |
q247722 | ContentNegotiator.createDefaultResponseContentNegotiationResult | validation | private function createDefaultResponseContentNegotiationResult(
string $type,
?string $language,
array $acceptCharsetHeaders
): ContentNegotiationResult {
// Default to the first registered media type formatter that can write the input type
$selectedMediaTypeFormatter = null;... | php | {
"resource": ""
} |
q247723 | MessageContext.assertNoErrorMessages | validation | public function assertNoErrorMessages()
{
foreach ($this->getMessagesContainers('error') as $element) {
// Some modules are inserted an empty container for errors before
// they are arise. The "Clientside Validation" - one of them.
$text = trim($element->getText());
... | php | {
"resource": ""
} |
q247724 | Uri.filterPath | validation | private static function filterPath(?string $path): ?string
{
if ($path === null) {
return null;
}
/** @link https://tools.ietf.org/html/rfc3986#section-3.3 */
return preg_replace_callback(
'/(?:[^a-zA-Z0-9_\-\.~:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/',
... | php | {
"resource": ""
} |
q247725 | Uri.filterQueryString | validation | private static function filterQueryString(?string $queryString): ?string
{
if ($queryString === null) {
return null;
}
/** @link https://tools.ietf.org/html/rfc3986#section-3.4 */
return preg_replace_callback(
'/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=%:@\/\?]+|... | php | {
"resource": ""
} |
q247726 | Uri.isUsingStandardPort | validation | private function isUsingStandardPort(): bool
{
return $this->port === null ||
(($this->scheme === 'http' && $this->port === 80) || ($this->scheme === 'https' && $this->port === 443));
} | php | {
"resource": ""
} |
q247727 | RequestFactory.createRequestFromSuperglobals | validation | public function createRequestFromSuperglobals(array $server): IHttpRequestMessage
{
$method = $server['REQUEST_METHOD'] ?? 'GET';
// Permit the overriding of the request method for POST requests
if ($method === 'POST' && isset($server['X-HTTP-METHOD-OVERRIDE'])) {
$method = $ser... | php | {
"resource": ""
} |
q247728 | RequestFactory.createHeadersFromSuperglobals | validation | protected function createHeadersFromSuperglobals(array $server): HttpHeaders
{
$headers = new HttpHeaders();
foreach ($server as $name => $values) {
// If this header supports multiple values and has unquoted string delimiters...
$containsMultipleValues = isset(self::$header... | php | {
"resource": ""
} |
q247729 | RequestFactory.getClientIPAddress | validation | protected function getClientIPAddress(array $server): ?string
{
$serverRemoteAddress = $server['REMOTE_ADDR'] ?? null;
if ($this->isUsingTrustedProxy($server)) {
return $serverRemoteAddress ?? null;
}
$ipAddresses = [];
// RFC 7239
if (isset($server[$th... | php | {
"resource": ""
} |
q247730 | RequestFactory.addHeaderValue | validation | private function addHeaderValue(HttpHeaders $headers, string $name, $value, bool $append): void
{
$decodedValue = trim((string)(isset(self::$headersToUrlDecode[$name]) ? urldecode($value) : $value));
if (isset(self::$specialCaseHeaders[$name])) {
$headers->add($name, $decodedValue, $app... | php | {
"resource": ""
} |
q247731 | RawTqContext.getDrupalSelector | validation | public function getDrupalSelector($name)
{
$selectors = $this->getDrupalParameter('selectors');
if (!isset($selectors[$name])) {
throw new \Exception(sprintf('No such selector configured: %s', $name));
}
return $selectors[$name];
} | php | {
"resource": ""
} |
q247732 | Wysiwyg.getInstance | validation | protected function getInstance($selector = '')
{
if (empty($this->object)) {
throw new \RuntimeException('Editor instance was not set.');
}
if (empty($this->selector) && empty($selector)) {
throw new \RuntimeException('No such editor was not selected.');
}
... | php | {
"resource": ""
} |
q247733 | MediaTypeFormatterMatcher.getBestMediaTypeFormatterMatch | validation | private function getBestMediaTypeFormatterMatch(
string $type,
array $formatters,
array $mediaTypeHeaders,
string $ioType
): ?MediaTypeFormatterMatch {
// Rank the media type headers if they are rankable
if (count($mediaTypeHeaders) > 0 && $mediaTypeHeaders[0] instanc... | php | {
"resource": ""
} |
q247734 | MediaTypeFormatterMatcher.compareAcceptMediaTypeHeaders | validation | private function compareAcceptMediaTypeHeaders(AcceptMediaTypeHeaderValue $a, AcceptMediaTypeHeaderValue $b): int
{
$aQuality = $a->getQuality();
$bQuality = $b->getQuality();
if ($aQuality < $bQuality) {
return 1;
}
if ($aQuality > $bQuality) {
retu... | php | {
"resource": ""
} |
q247735 | MediaTypeFormatterMatcher.rankAcceptMediaTypeHeaders | validation | private function rankAcceptMediaTypeHeaders(array $mediaTypeHeaders): array
{
usort($mediaTypeHeaders, [$this, 'compareAcceptMediaTypeHeaders']);
$rankedMediaTypeHeaders = array_filter($mediaTypeHeaders, [$this, 'filterZeroScores']);
// Have to return the values because the keys aren't upda... | php | {
"resource": ""
} |
q247736 | RedirectContext.visitPage | validation | public function visitPage($path, $code = 200)
{
if (!$this->assertStatusCode($path, $code)) {
throw new \Exception(sprintf('The page "%s" is not accessible!', $path));
}
self::debug(['Visited page: %s'], [$path]);
$this->visitPath($path);
} | php | {
"resource": ""
} |
q247737 | BaseEntity.getCurrentId | validation | public function getCurrentId()
{
// We have programmatically bootstrapped Drupal core, so able to use such functionality.
$args = arg();
return count($args) > 1 && $this->entityType() === $args[0] && $args[1] > 0 ? (int) $args[1] : 0;
} | php | {
"resource": ""
} |
q247738 | TqContext.iSwitchToWindow | validation | public function iSwitchToWindow()
{
$windows = $this->getWindowNames();
// If the window was not switched yet, then store it name and working element for future switching back.
if (empty($this->mainWindow)) {
$this->mainWindow['name'] = array_shift($windows);
$this->... | php | {
"resource": ""
} |
q247739 | TqContext.useScreenResolution | validation | public function useScreenResolution($width_height)
{
list($width, $height) = explode('x', $width_height);
$this->getSessionDriver()->resizeWindow((int) $width, (int) $height);
} | php | {
"resource": ""
} |
q247740 | TqContext.beforeStep | validation | public function beforeStep(Scope\StepScope $scope)
{
self::$pageUrl = $this->getCurrentUrl();
// To allow Drupal use its internal, web-based functionality, such as "arg()" or "current_path()" etc.
$_GET['q'] = ltrim(parse_url(static::$pageUrl)['path'], '/');
drupal_path_initialize();... | php | {
"resource": ""
} |
q247741 | TqContext.afterStep | validation | public function afterStep(Scope\StepScope $scope)
{
// If "mainWindow" variable is not empty that means that additional window has been opened.
// Then, if number of opened windows equals to one, we need to switch back to original window,
// otherwise an error will occur: "Window not found. ... | php | {
"resource": ""
} |
q247742 | Request.getRequestTarget | validation | private function getRequestTarget(): string
{
switch ($this->requestTargetType) {
case RequestTargetTypes::ORIGIN_FORM:
$requestTarget = $this->uri->getPath();
/** @link https://tools.ietf.org/html/rfc7230#section-5.3.1 */
if ($requestTarget === n... | php | {
"resource": ""
} |
q247743 | UriParser.parseQueryString | validation | public function parseQueryString(Uri $uri): IImmutableDictionary
{
if (($queryString = $uri->getQueryString()) === null) {
return new ImmutableHashTable([]);
}
if (!isset($this->parsedQueryStringCache[$queryString])) {
$parsedQueryString = [];
parse_str($... | php | {
"resource": ""
} |
q247744 | ProducerAdapter.produce | validation | public function produce(Message $message)
{
$type = $message->getType();
$body = array('ticket' => $message->getTicket());
try {
$this->logger->debug(sprintf('Publish message for job %s to sonata backend', $message->getTicket()), [
'type' => $type,
... | php | {
"resource": ""
} |
q247745 | SerializationHelper.serializeParameters | validation | public function serializeParameters($type, array $parameters)
{
$jobType = $this->registry->get($type);
$indices = $jobType->getIndicesOfSerializableParameters();
if (count($indices) < count($parameters)) {
throw new \InvalidArgumentException(sprintf('More parameters provided for... | php | {
"resource": ""
} |
q247746 | SerializationHelper.deserializeParameters | validation | public function deserializeParameters($type, $data)
{
$jobType = $this->registry->get($type);
$indices = $jobType->getIndicesOfSerializableParameters();
$serializedParameters = json_decode($data, 1);
if (false === $serializedParameters) {
throw new \RuntimeException(spri... | php | {
"resource": ""
} |
q247747 | SerializationHelper.serializeReturnValue | validation | public function serializeReturnValue($type, $value)
{
$jobType = $this->registry->get($type);
return $this->serializer->serialize($value, 'json', $this->getResponseSerializationContext($jobType));
} | php | {
"resource": ""
} |
q247748 | SerializationHelper.deserializeReturnValue | validation | public function deserializeReturnValue($type, $data)
{
$jobType = $this->registry->get($type);
return $this->serializer->deserialize($data, $jobType->getReturnType(), 'json', $this->getResponseDeserializationContext($jobType));
} | php | {
"resource": ""
} |
q247749 | JobController.doStop | validation | public function doStop()
{
if ($this->controller->doStop()) {
$this->job->setStatus(Status::CANCELLED());
return true;
}
return false;
} | php | {
"resource": ""
} |
q247750 | HandlerFactoryRegistry.createHandlers | validation | public function createHandlers(JobInterface $job, $level, $bubble)
{
$handlers = [];
foreach ($this->factories as $factory) {
$handlers[] = $factory->createHandler($job, $level, $bubble);
}
return $handlers;
} | php | {
"resource": ""
} |
q247751 | BaseHandlerFactory.initHandler | validation | protected function initHandler(HandlerInterface $handler)
{
if ($this->formatter != null) {
$handler->setFormatter($this->formatter);
}
foreach ($this->processors as $processor) {
$handler->pushProcessor($processor);
}
return $handler;
} | php | {
"resource": ""
} |
q247752 | JobDeserializationSubscriber.onPreDeserialize | validation | public function onPreDeserialize(PreDeserializeEvent $event)
{
$type = $event->getType();
if (isset($type['name']) && ($type['name'] == Job::class || is_subclass_of($type['name'], Job::class))) {
$data = $event->getData();
if (isset($data['type']) && isset($data['parameters']... | php | {
"resource": ""
} |
q247753 | JobHelper.updateJob | validation | public function updateJob(EntityJobInterface $job, Status $status, $processingTime = 0, $response = null)
{
$job->setStatus($status);
$job->setProcessingTime($job->getProcessingTime() + ($processingTime === null ? 0 : $processingTime));
$job->setResponse($response);
if (Status::isTe... | php | {
"resource": ""
} |
q247754 | JobHelper.copyJob | validation | public function copyJob(JobInterface $from, \Abc\Bundle\JobBundle\Model\JobInterface $to)
{
$to->setType($from->getType());
$to->setResponse($from->getResponse());
$to->setParameters($from->getParameters());
if (null != $from->getStatus()) {
$to->setStatus($from->getStat... | php | {
"resource": ""
} |
q247755 | Invoker.invoke | validation | public function invoke(JobInterface $job, ContextInterface $context)
{
$jobType = $this->registry->get($job->getType());
$callableArray = $jobType->getCallable();
$parameters = static::resolveParameters($jobType, $context, $job->getParameters());
if (is_array($callableArray... | php | {
"resource": ""
} |
q247756 | ProducerAdapter.consumeJob | validation | public function consumeJob(PlainMessage $message){
$ticket = $message->ticket;
$type = $message->type;
$this->logger->debug('Consume message from bernard backend', [
'message' => $message
]);
$this->manager->onMessage(new Message($type, $ticket));
} | php | {
"resource": ""
} |
q247757 | DoctrineOrmServiceProvider.register | validation | public function register(Container $container)
{
$container['doctrine.orm.em'] = $this->getOrmEmDefinition($container);
$container['doctrine.orm.em.config'] = $this->getOrmEmConfigDefinition($container);
$container['doctrine.orm.em.default_options'] = $this->getOrmEmDefaultOptions();
... | php | {
"resource": ""
} |
q247758 | ClassMetadata.setParameterType | validation | public function setParameterType($method, $name, $type)
{
if (!isset($this->parameterTypes[$method])) {
throw new \InvalidArgumentException(sprintf('A method with name "%s" is not defined', $name, $method));
}
if (!array_key_exists($name, $this->parameterTypes[$method])) {
... | php | {
"resource": ""
} |
q247759 | Microtime.fromDateTime | validation | public static function fromDateTime(\DateTimeInterface $date)
{
$str = $date->format('U') . str_pad($date->format('u'), 6, '0');
$m = new self();
$m->int = (int)$str;
$m->sec = (int)substr($str, 0, 10);
$m->usec = (int)substr($str, -6);
return $m;
} | php | {
"resource": ""
} |
q247760 | AbstractMessage.unFreeze | validation | private function unFreeze()
{
$this->isFrozen = false;
$this->isReplay = null;
foreach (static::schema()->getFields() as $field) {
if ($field->getType()->isMessage()) {
/** @var self $value */
$value = $this->get($field->getName());
... | php | {
"resource": ""
} |
q247761 | AbstractMessage.populateDefault | validation | private function populateDefault(Field $field)
{
if ($this->has($field->getName())) {
return true;
}
$default = $field->getDefault($this);
if (null === $default) {
return false;
}
if ($field->isASingleValue()) {
$this->data[$field... | php | {
"resource": ""
} |
q247762 | SmsGatewayServiceProvider.boot | validation | public function boot()
{
$this->app->when(SmsGatewayChannel::class)
->needs(SmsGatewayClient::class)
->give(function () {
$config = $this->app['config']['services.smsgateway'];
return new SmsGatewayClient(
new HttpClient,
... | php | {
"resource": ""
} |
q247763 | Field.isCompatibleForMerge | validation | public function isCompatibleForMerge(Field $other)
{
if ($this->name !== $other->name) {
return false;
}
if ($this->type !== $other->type) {
return false;
}
if ($this->rule !== $other->rule) {
return false;
}
if ($this->c... | php | {
"resource": ""
} |
q247764 | Field.isCompatibleForOverride | validation | public function isCompatibleForOverride(Field $other)
{
if (!$this->overridable) {
return false;
}
if ($this->name !== $other->name) {
return false;
}
if ($this->type !== $other->type) {
return false;
}
if ($this->rule !=... | php | {
"resource": ""
} |
q247765 | Schema.getHandlerMethodName | validation | public function getHandlerMethodName($withMajor = true)
{
if (true === $withMajor) {
return lcfirst($this->classShortName);
}
return lcfirst(str_replace('V' . $this->id->getVersion()->getMajor(), '', $this->classShortName));
} | php | {
"resource": ""
} |
q247766 | Schema.createMessage | validation | public function createMessage(array $data = [])
{
/** @var Message $className */
$className = $this->className;
if (empty($data)) {
return $className::create();
}
return $className::fromArray($data);
} | php | {
"resource": ""
} |
q247767 | MessageResolver.resolveId | validation | public static function resolveId(SchemaId $id): string
{
$curieMajor = $id->getCurieMajor();
if (isset(self::$curies[$curieMajor])) {
return self::$classes[self::$curies[$curieMajor]];
}
$curie = $id->getCurie()->toString();
if (isset(self::$curies[$curie])) {
... | php | {
"resource": ""
} |
q247768 | MessageResolver.resolveCurie | validation | public static function resolveCurie($curie): string
{
$key = (string)$curie;
if (isset(self::$curies[$key])) {
return self::$classes[self::$curies[$key]];
}
throw new NoMessageForCurie(SchemaCurie::fromString($key));
} | php | {
"resource": ""
} |
q247769 | MessageResolver.registerMap | validation | public static function registerMap(array $map)
{
@trigger_error(sprintf('"%s" is deprecated. Use "registerManifest" instead.', __CLASS__), E_USER_DEPRECATED);
$nextId = count(self::$curies) + 30000;
foreach ($map as $curie => $class) {
++$nextId;
self::$curies[$curie]... | php | {
"resource": ""
} |
q247770 | MessageResolver.findOneUsingMixin | validation | public static function findOneUsingMixin($mixin): Schema
{
$schemas = self::findAllUsingMixin($mixin);
if (1 !== count($schemas)) {
throw new MoreThanOneMessageForMixin($mixin, $schemas);
}
return current($schemas);
} | php | {
"resource": ""
} |
q247771 | MessageResolver.findAllUsingMixin | validation | public static function findAllUsingMixin($mixin): array
{
if ($mixin instanceof Mixin) {
$key = $mixin->getId()->getCurieMajor();
} else {
$key = $mixin;
}
if (!isset(self::$resolvedMixins[$key])) {
$schemas = [];
foreach ((self::$mixi... | php | {
"resource": ""
} |
q247772 | MappingFactory.applyAnalyzer | validation | protected function applyAnalyzer(array $mapping, Field $field, \stdClass $rootObject, $path = null)
{
if (null === $this->defaultAnalyzer) {
return $mapping;
}
if (!isset($mapping['type']) || 'text' !== $mapping['type']) {
return $mapping;
}
if (isse... | php | {
"resource": ""
} |
q247773 | SmsGatewayChannel.buildParams | validation | protected function buildParams(SmsGatewayMessage $message, $to)
{
$optionalFields = array_filter([
'expires_at' => data_get($message, 'expiresAt'),
'send_at' => data_get($message, 'sendAt'),
]);
return array_merge([
'number' => $to,
'me... | php | {
"resource": ""
} |
q247774 | ConnectionManager.getConnectionFactory | validation | protected function getConnectionFactory($type)
{
if (false === isset($this->connectionFactories[$type])) {
throw new \InvalidArgumentException("Missing connection factory \"$type\"");
}
return $this->connectionFactories[$type];
} | php | {
"resource": ""
} |
q247775 | ErrorAction.run | validation | public function run()
{
if (($exception = Yii::$app->getErrorHandler()->exception) === null) {
return '';
}
if ($exception instanceof \HttpException) {
$code = $exception->statusCode;
} else {
$code = $exception->getCode();
}
if (... | php | {
"resource": ""
} |
q247776 | ModelAbstract.hydrate | validation | protected function hydrate($propertyName)
{
if (isset($this->yuccaMappingManager) && (false === isset($this->yuccaInitialized[$propertyName])) && (false === empty($this->yuccaIdentifier))) {
$values = $this->yuccaMappingManager->getMapper(get_class($this))->load($this->yuccaIdentifier, $propert... | php | {
"resource": ""
} |
q247777 | EditableIterator.retrieve | validation | protected function retrieve()
{
if (false === $this->retrieved) {
$this->updatedDatas = $this->getArray();
$this->retrieved = true;
}
} | php | {
"resource": ""
} |
q247778 | AdminAsset.registerAssetFiles | validation | public function registerAssetFiles($view)
{
if (\Yii::$app->request->isPjax) {
return parent::registerAssetFiles($view);
}
parent::registerAssetFiles($view);
} | php | {
"resource": ""
} |
q247779 | AdminPanelWidget.init | validation | public function init()
{
Html::addCssClass($this->options, ['panel', 'sx-panel', $this->color]);
$options = ArrayHelper::merge($this->options, [
'id' => $this->id,
]);
echo Html::beginTag('div', $options);
echo Html::beginTag('div', $this->headingOptions);
... | php | {
"resource": ""
} |
q247780 | IteratorToArrayTransformer.transform | validation | public function transform($iterator)
{
if (null === $iterator) {
return array();
}
if (is_array($iterator)) {
return $iterator;
}
if (!$iterator instanceof Iterator) {
throw new TransformationFailedException('Expected a Yucca\Component\It... | php | {
"resource": ""
} |
q247781 | Mapper.load | validation | public function load(array $identifier, $propertyName, $shardingKey = null)
{
if (isset($identifier[$propertyName])) {
return array($propertyName=>$identifier[$propertyName]);
}
$field = $this->getFieldNameFromProperty($propertyName);
$sources = $this->getSourcesFromPro... | php | {
"resource": ""
} |
q247782 | SchemaManager.fetchOne | validation | public function fetchOne($tableName, array $identifier, $shardingKey = null, $forceFromMaster = true)
{
return $this->fetch($tableName, $identifier, $shardingKey, array('*'), false, $forceFromMaster);
} | php | {
"resource": ""
} |
q247783 | Iterator.current | validation | public function current()
{
if (true === $this->wantNewModel) {
return $this->entityManager->load($this->modelClassName, $this->selector->current());
} else {
$this->initializeModel($this->selector->current(), $this->selector->currentShardingKey());
$this->entity... | php | {
"resource": ""
} |
q247784 | SelectorAbstract.current | validation | public function current()
{
$this->prepareQuery();
if (false !== current($this->idsArray)) {
return current($this->idsArray);
} else {
throw new PointerException('Can\'t retrieve the current element');
}
} | php | {
"resource": ""
} |
q247785 | SelectorAbstract.currentShardingKey | validation | public function currentShardingKey()
{
return isset($this->options[SelectorSourceInterface::SHARDING_KEY]) ? $this->options[SelectorSourceInterface::SHARDING_KEY] : null;
} | php | {
"resource": ""
} |
q247786 | PHPExcel.create | validation | public function create( $name )
{
$sheet = $this->container->createSheet();
$sheet->setTitle( $name );
return new \Aimeos\MW\Container\Content\PHPExcel( $sheet, $name, $this->getOptions() );
} | php | {
"resource": ""
} |
q247787 | PHPExcel.get | validation | public function get( $name )
{
if( ( $sheet = $this->container->getSheetByName( $name ) ) === null ) {
throw new \Aimeos\MW\Container\Exception( sprintf( 'No sheet "%1$s" available', $name ) );
}
return new \Aimeos\MW\Container\Content\PHPExcel( $sheet, $sheet->getTitle(), $this->getOptions() );
} | php | {
"resource": ""
} |
q247788 | PHPExcel.close | validation | public function close()
{
$writer = \PHPExcel_IOFactory::createWriter( $this->container, $this->format );
$writer->save( $this->resourcepath );
} | php | {
"resource": ""
} |
q247789 | PHPExcel.current | validation | public function current()
{
$sheet = $this->iterator->current();
return new \Aimeos\MW\Container\Content\PHPExcel( $sheet, $sheet->getTitle(), $this->getOptions() );
} | php | {
"resource": ""
} |
q247790 | PHPExcel.add | validation | public function add( $data )
{
$columnNum = 0;
$rowNum = $this->iterator->current()->getRowIndex();
foreach( (array) $data as $value ) {
$this->sheet->setCellValueByColumnAndRow( $columnNum++, $rowNum, $value );
}
$this->iterator->next();
} | php | {
"resource": ""
} |
q247791 | PHPExcel.current | validation | public function current()
{
if( $this->iterator->valid() === false ) {
return null;
}
$iterator = $this->iterator->current()->getCellIterator();
$iterator->setIterateOnlyExistingCells( false );
$result = [];
foreach( $iterator as $cell ) {
$result[] = $cell->getValue();
}
return $result;
} | php | {
"resource": ""
} |
q247792 | TelegramBot.send | validation | static function send($channel_code = null) {
try {
if(is_numeric($channel_code)) {
$channel_id = $channel_code;
} else {
$channel_id = env('telegram.' . $channel_code);
$channel_id = $channel_id ? : env('telegram');
}
... | php | {
"resource": ""
} |
q247793 | Simple.lock | validation | public function lock()
{
// query whether or not, the PID has already been set
if ($this->pid === $this->getSerial()) {
return;
}
// if not, initialize the PID
$this->pid = $this->getSerial();
// open the PID file
$this->fh = fopen($filename = $... | php | {
"resource": ""
} |
q247794 | Simple.unlock | validation | public function unlock()
{
try {
// remove the PID from the PID file if set
if ($this->pid === $this->getSerial() && is_resource($this->fh)) {
// remove the PID from the file
$this->removeLineFromFile($this->pid, $this->fh);
// finally... | php | {
"resource": ""
} |
q247795 | Simple.removeLineFromFile | validation | public function removeLineFromFile($line, $fh)
{
// initialize the array for the PIDs found in the PID file
$lines = array();
// initialize the flag if the line has been found
$found = false;
// rewind the file pointer
rewind($fh);
// read the lines with t... | php | {
"resource": ""
} |
q247796 | Simple.stop | validation | public function stop($reason)
{
// log a message that the operation has been stopped
$this->log($reason, LogLevel::INFO);
// stop processing the plugins by setting the flag to TRUE
$this->stopped = true;
} | php | {
"resource": ""
} |
q247797 | Simple.log | validation | public function log($msg, $logLevel = null)
{
// initialize the formatter helper
$helper = new FormatterHelper();
// map the log level to the console style
$style = $this->mapLogLevelToStyle($logLevel);
// format the message, according to the passed log level and write it ... | php | {
"resource": ""
} |
q247798 | Simple.mapLogLevelToStyle | validation | protected function mapLogLevelToStyle($logLevel)
{
// query whether or not the log level is mapped
if (isset($this->logLevelStyleMapping[$logLevel])) {
return $this->logLevelStyleMapping[$logLevel];
}
// return the default style => info
return Simple::DEFAULT_ST... | php | {
"resource": ""
} |
q247799 | SluggableBehavior.slug | validation | public function slug(Entity $entity)
{
$config = $this->config();
$value = $entity->get($config['field']);
$entity->set($config['slug'], strtolower(Inflector::slug($value, $config['replacement'])));
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.