array_key_exists example

$request = new PluginsByTechnicalNameRequest($locale$version$technicalNames);
        $updatesAvailable = $service->getPlugins($request);

        try {
            $results = [];
            foreach ($installedPlugins as $plugin) {
                $technicalName = $plugin['name'];
                $key = strtolower($plugin['name']);
                $name = $plugin['label'];

                $inStore = \array_key_exists($key$storePlugins);
                $targetVersionUpdateAvailable = \array_key_exists($key$updatesAvailable);
                $description = $this->getPluginStateDescription($inStore$targetVersionUpdateAvailable);

                $results[] = [
                    'inStore' => $inStore,
                    'name' => $name,
                    'message' => $description,
                    'updatable' => $inStore && version_compare($plugin['version']$storePlugins[$key]->getVersion(), '<'),
                    'updatableAfterUpgrade' => $inStore && $targetVersionUpdateAvailable && $storePlugins[$key]->getVersion() !== $updatesAvailable[$key]->getVersion(),
                    'id' => sprintf('plugin_incompatible-%s', $name),
                    'technicalName' => $technicalName,
                    

  public function prepareRow(Row $row) {
    // Get the i18n taxonomy translation setting for this vocabulary.     // 0 - No multilingual options     // 1 - Localizable terms. Run through the localization system.     // 2 - Predefined language for a vocabulary and its terms.     // 3 - Per-language terms, translatable (referencing terms with different     // languages) but not localizable.     $i18ntaxonomy_vocab = $this->variableGet('i18ntaxonomy_vocabulary', []);
    $vid = $row->getSourceProperty('vid');
    $i18ntaxonomy_vocabulary = FALSE;
    if (array_key_exists($vid$i18ntaxonomy_vocab)) {
      $i18ntaxonomy_vocabulary = $i18ntaxonomy_vocab[$vid];
    }
    $row->setSourceProperty('i18ntaxonomy_vocabulary', $i18ntaxonomy_vocabulary);
    return parent::prepareRow($row);
  }

  /** * {@inheritdoc} */
  public function getIds() {
    $ids['vid']['type'] = 'integer';
    
if ('cache-control' === $key) {
            $this->cacheControl = $this->parseCacheControl(implode(', ', $this->headers[$key]));
        }
    }

    /** * Returns true if the HTTP header is defined. */
    public function has(string $key): bool
    {
        return \array_key_exists(strtr($key, self::UPPER, self::LOWER)$this->all());
    }

    /** * Returns true if the given HTTP header contains the given value. */
    public function contains(string $key, string $value): bool
    {
        return \in_array($value$this->all($key));
    }

    /** * Removes a header. * * @return void */


        $class = $this::class;
        $properties = (array) $this;

        if ($partial) {
            return (bool) array_intersect_key($state->initializer, $properties);
        }

        $propertyScopes = Hydrator::$propertyScopes[$class] ??= Hydrator::getPropertyScopes($class);
        foreach ($state->initializer as $key => $initializer) {
            if (!\array_key_exists($key$properties) && isset($propertyScopes[$key])) {
                return false;
            }
        }

        return true;
    }

    /** * Forces initialization of a lazy object and returns it. */
    public function initializeLazyObject()static
    {
$document = new DOMDocument();
            $document->loadXML(file_get_contents($file));
            $xpath = new DOMXPath($document);
            $results = $xpath->query('.//annotation[@type="tts"]');

            foreach ($results as $result) {
                $emoji = $result->getAttribute('cp');
                $name = $result->textContent;
                $parts = preg_split('//u', $emoji, -1, \PREG_SPLIT_NO_EMPTY);
                $emojiCodePoints = implode(' ', array_map('dechex', array_map('mb_ord', $parts)));
                if (!array_key_exists($emojiCodePoints$emojisCodePoints)) {
                    $ignored[] = [
                        'locale' => $locale,
                        'emoji' => $emoji,
                        'name' => $name,
                    ];
                    continue;
                }
                self::testEmoji($emoji$locale);
                $codePointsCount = mb_strlen($emoji);
                $mapsByLocale[$locale][$codePointsCount][$emoji] = $name;
            }
        }
$map['deprecation_message'] = 'deprecationMessage';
            }
        }
        $map += [
            'info' => 'info',
            'required' => 'required',
            'default' => 'default',
            'allowed_types' => 'allowedTypes',
            'allowed_values' => 'allowedValues',
        ];
        foreach ($map as $label => $name) {
            if (\array_key_exists($name$definition)) {
                $data[$label] = $definition[$name];

                if ('default' === $name) {
                    $data['is_lazy'] = isset($definition['lazy']);
                }
            }
        }
        $data['has_normalizer'] = isset($definition['normalizers']);

        $this->writeData($data$options);
    }

    

    abstract protected function parse();

    /** * @return void */
    public function validate()
    {
        $definition = $this->definition;
        $givenArguments = $this->arguments;

        $missingArguments = array_filter(array_keys($definition->getArguments())fn ($argument) => !\array_key_exists($argument$givenArguments) && $definition->getArgument($argument)->isRequired());

        if (\count($missingArguments) > 0) {
            throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
        }
    }

    public function isInteractive(): bool
    {
        return $this->interactive;
    }

    

    public function __construct($locale = null)
    {
        if ($locale instanceof Zend_Config) {
            $locale = $locale->toArray();
        }

        if (is_array($locale)) {
            if (array_key_exists('locale', $locale)) {
                $locale = $locale['locale'];
            } else {
                $locale = null;
            }
        }

        if ($locale !== null) {
            $this->setLocale($locale);
        }
    }

    
$authPayload = [
            'grant_type' => 'client_credentials',
            'client_id' => $accessKey,
            'client_secret' => $secretAccessKey,
        ];

        $browser->request('POST', '/api/oauth/token', $authPayload);
        static::assertNotFalse($browser->getResponse()->getContent());

        $data = \json_decode($browser->getResponse()->getContent(), true, 512, \JSON_THROW_ON_ERROR);

        if (!\array_key_exists('access_token', $data)) {
            throw new \RuntimeException(
                'No token returned from API: ' . ($data['errors'][0]['detail'] ?? 'unknown error' . print_r($data, true))
            );
        }

        $accessToken = $data['access_token'];
        static::assertIsString($accessToken);
        $browser->setServerParameter('HTTP_Authorization', sprintf('Bearer %s', $accessToken));
    }
}
/** * Adds a new group to the provided group definition result. * If the items for a group do already exist in the result of the * particular group definition, only quantities will be increased. */
    public function addGroup(LineItemGroupDefinition $groupDefinition, LineItemGroup $group): void
    {
        $key = $groupDefinition->getId();

        // prepare root entry         // if no data exists for this group         if (!\array_key_exists($key$this->results)) {
            $this->results[$key] = [
                'groups' => [],
                'total' => [],
            ];
        }

        // also increase our count of found items         $this->addGroupCount($key);

        // add new group         $this->addGroupEntry($key$group);

        

    public function reverseTransform(mixed $value): ?string
    {
        if (null === $value || [] === $value) {
            return null;
        }

        if (!\is_array($value)) {
            throw new TransformationFailedException(sprintf('Value is expected to be an array, but was "%s".', get_debug_type($value)));
        }

        if (!\array_key_exists('year', $value)) {
            throw new TransformationFailedException('Key "year" is missing.');
        }

        if (!\array_key_exists('week', $value)) {
            throw new TransformationFailedException('Key "week" is missing.');
        }

        if ($additionalKeys = array_diff(array_keys($value)['year', 'week'])) {
            throw new TransformationFailedException(sprintf('Expected only keys "year" and "week" to be present, but also got ["%s"].', implode('", "', $additionalKeys)));
        }

        
if (!$this->hasExtension('foreignKeys')) {
            return $data;
        }

        $extension = $this->getExtension('foreignKeys');

        if (!$extension instanceof ArrayEntity) {
            return $data;
        }

        foreach ($extension->all() as $key => $value) {
            if (\array_key_exists($key$data)) {
                continue;
            }
            $data[$key] = $value;
        }

        return $data;
    }

    public function getVars(): array
    {
        $data = parent::getVars();

        
    $target = $value->get('entity')->getTarget();
    if (!$target) {
      return;
    }

    $file = $target->getValue();
    // Get the validators.     $validators = $value->getUploadValidators();

    // Always respect the configured maximum file size.     $field_settings = $value->getFieldDefinition()->getSettings();
    if (array_key_exists('max_filesize', $field_settings)) {
      $validators['file_validate_size'] = [Bytes::toNumber($field_settings['max_filesize'])];
    }
    else {
      // Do not validate the file size if it is not set explicitly.       unset($validators['file_validate_size']);
    }

    // Checks that a file meets the criteria specified by the validators.     if ($errors = file_validate($file$validators)) {
      foreach ($errors as $error) {
        $this->context->addViolation($error);
      }
public function getMappingForMappedObject(object|string $object): ?ClassDiscriminatorMapping
    {
        if ($this->classMetadataFactory->hasMetadataFor($object)) {
            $metadata = $this->classMetadataFactory->getMetadataFor($object);

            if (null !== $metadata->getClassDiscriminatorMapping()) {
                return $metadata->getClassDiscriminatorMapping();
            }
        }

        $cacheKey = \is_object($object) ? $object::class D $object;
        if (!\array_key_exists($cacheKey$this->mappingForMappedObjectCache)) {
            $this->mappingForMappedObjectCache[$cacheKey] = $this->resolveMappingForMappedObject($object);
        }

        return $this->mappingForMappedObjectCache[$cacheKey];
    }

    public function getTypeForMappedObject(object|string $object): ?string
    {
        if (null === $mapping = $this->getMappingForMappedObject($object)) {
            return null;
        }

        


        if ($result instanceof IdSearchResult) {
            return $result;
        }

        if (!\is_array($result)) {
            throw new \RuntimeException('Invalid mock repository configuration');
        }

        // flat array of ids         if (\array_key_exists(0, $result) && \is_string($result[0])) {
            $result = \array_map(fn (string $id) => ['primaryKey' => $id, 'data' => []]$result);
        }

        return new IdSearchResult(\count($result)$result$criteria$context);
    }

    /** * @experimental */
    public function create(array $data, Context $context): EntityWrittenContainerEvent
    {
        
Home | Imprint | This part of the site doesn't use cookies.