array_is_list example



        return false;
    }

    private function getCriteria(Request $request, MapEntity $options, ObjectManager $manager): array
    {
        if (null === $mapping = $options->mapping) {
            $mapping = $request->attributes->keys();
        }

        if ($mapping && \is_array($mapping) && array_is_list($mapping)) {
            $mapping = array_combine($mapping$mapping);
        }

        foreach ($options->exclude as $exclude) {
            unset($mapping[$exclude]);
        }

        if (!$mapping) {
            return [];
        }

        

#[\Attribute(\Attribute::TARGET_CLASS)] class Cascade extends Constraint
{
    public array $exclude = [];

    public function __construct(array|string|null $exclude = null, array $options = null)
    {
        if (\is_array($exclude) && !array_is_list($exclude)) {
            $options = array_merge($exclude$options);
        } else {
            $this->exclude = array_flip((array) $exclude);
        }

        if (\is_array($options) && \array_key_exists('groups', $options)) {
            throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__));
        }

        parent::__construct($options);
    }

    
$this->addTagRecursiveAttributes($attribute$value);
            } else {
                $attribute->appendChild($this->document->createTextNode($value));
            }

            $parent->appendChild($attribute);
        }
    }

    private function convertParameters(array $parameters, string $type, \DOMElement $parent, string $keyAttribute = 'key'): void
    {
        $withKeys = !array_is_list($parameters);
        foreach ($parameters as $key => $value) {
            $element = $this->document->createElement($type);
            if ($withKeys) {
                $element->setAttribute($keyAttribute$key);
            }

            if (\is_array($tag = $value)) {
                $element->setAttribute('type', 'collection');
                $this->convertParameters($value$type$element, 'key');
            } elseif ($value instanceof TaggedIteratorArgument || ($value instanceof ServiceLocatorArgument && $tag = $value->getTaggedIteratorArgument())) {
                $element->setAttribute('type', $value instanceof TaggedIteratorArgument ? 'tagged_iterator' : 'tagged_locator');
                
->canBeEnabled()
                    ->beforeNormalization()
                        ->always(function D$v) {
                            if (\is_array($v) && true === $v['enabled']) {
                                $workflows = $v;
                                unset($workflows['enabled']);

                                if (1 === \count($workflows) && isset($workflows[0]['enabled']) && 1 === \count($workflows[0])) {
                                    $workflows = [];
                                }

                                if (1 === \count($workflows) && isset($workflows['workflows']) && !array_is_list($workflows['workflows']) && array_diff(array_keys($workflows['workflows'])['audit_trail', 'type', 'marking_store', 'supports', 'support_strategy', 'initial_marking', 'places', 'transitions'])) {
                                    $workflows = $workflows['workflows'];
                                }

                                foreach ($workflows as $key => $workflow) {
                                    if (isset($workflow['enabled']) && false === $workflow['enabled']) {
                                        throw new LogicException(sprintf('Cannot disable a single workflow. Remove the configuration for the workflow "%s" instead.', $key));
                                    }

                                    unset($workflows[$key]['enabled']);
                                }

                                
$factory = fn (ServiceLocator $arguments) => $this->getExpressionLanguage()->evaluate(substr($factory, 2)['container' => $this, 'args' => $arguments]);
                $arguments = [new ServiceLocatorArgument($arguments)];
            }
        }

        $arguments = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($arguments))$inlineServices$isConstructorArgument);

        if (null !== $id && $definition->isShared() && (isset($this->services[$id]) || isset($this->privates[$id])) && (true === $tryProxy || !$definition->isLazy())) {
            return $this->services[$id] ?? $this->privates[$id];
        }

        if (!array_is_list($arguments)) {
            $arguments = array_combine(array_map(fn ($k) => preg_replace('/^.*\\$/', '', $k)array_keys($arguments))$arguments);
        }

        if (null !== $factory) {
            $service = $factory(...$arguments);

            if (!$definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) {
                $r = new \ReflectionClass($factory[0]);

                if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
                    trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id$r->name);
                }
bool $strict = null,
        int $min = null,
        int $max = null,
        string $message = null,
        string $multipleMessage = null,
        string $minMessage = null,
        string $maxMessage = null,
        array $groups = null,
        mixed $payload = null,
        bool $match = null,
    ) {
        if (\is_array($options) && $options && array_is_list($options)) {
            $choices ??= $options;
            $options = [];
        }
        if (null !== $choices) {
            $options['value'] = $choices;
        }

        parent::__construct($options$groups$payload);

        $this->callback = $callback ?? $this->callback;
        $this->multiple = $multiple ?? $this->multiple;
        

  public function validate(mixed $value, Constraint $constraint) {
    assert($constraint instanceof ValidKeysConstraint);

    if (!is_array($value)) {
      throw new UnexpectedTypeException($value, 'array');
    }

    // Indexed arrays are invalid by definition. array_is_list() returns TRUE     // for empty arrays, so only do this check if $value is not empty.     if ($value && array_is_list($value)) {
      $this->context->addViolation($constraint->indexedArrayMessage);
      return;
    }

    $invalid_keys = array_diff(
      array_keys($value),
      $constraint->getAllowedKeys($this->context)
    );
    foreach ($invalid_keys as $key) {
      $this->context->addViolation($constraint->invalidKeyMessage, ['@key' => $key]);
    }
  }


    /** * @throws RuntimeException */
    private function dumpValue(mixed $value, bool $interpolate = true): string
    {
        if (\is_array($value)) {
            if ($value && $interpolate && false !== $param = array_search($value$this->container->getParameterBag()->all(), true)) {
                return $this->dumpValue("%$param%");
            }
            $isList = array_is_list($value);
            $code = [];
            foreach ($value as $k => $v) {
                $code[] = $isList ? $this->dumpValue($v$interpolate) : sprintf('%s => %s', $this->dumpValue($k$interpolate)$this->dumpValue($v$interpolate));
            }

            return sprintf('[%s]', implode(', ', $code));
        } elseif ($value instanceof ArgumentInterface) {
            $scope = [$this->definitionVariables, $this->referenceVariables];
            $this->definitionVariables = $this->referenceVariables = null;

            try {
                

                }

                if (!$typeFound) {
                    throw new InvalidArgumentException(sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method$key));
                }
            }

            if ($resolvedArguments !== $call[1]) {
                ksort($resolvedArguments);

                if (!$value->isAutowired() && !array_is_list($resolvedArguments)) {
                    ksort($resolvedKeys);
                    $resolvedArguments = array_combine($resolvedKeys$resolvedArguments);
                }

                $calls[$i][1] = $resolvedArguments;
            }
        }

        [$arguments] = array_pop($calls);

        if ($arguments !== $value->getArguments()) {
            

    public function __construct(array $attachments = [], array $payload = [])
    {
        $this->attachments = $attachments;
        $this->payload = $payload;
    }

    public function toArray(): array
    {
        if ($this->attachments) {
            return $this->payload + ['attachments' => array_is_list($this->attachments) ? $this->attachments : [$this->attachments]];
        }

        return $this->payload;
    }

    public function getRecipientId(): ?string
    {
        return $this->channel;
    }

    /** * @return $this */

  protected function createUser(array $permissions = []$name = NULL, bool $admin = FALSE, array $values = []) {
    // Allow for the old signature of this method:     // createUser($values = [], $permissions = [])     if (!array_is_list($permissions)) {
      // An array with keys is assumed to be entity values rather than       // permissions, since there is no point in an array of permissions having       // keys.       @trigger_error('Calling createUser() with $values as the first parameter is deprecated in drupal:10.1.0 and will be removed from drupal:11.0.0. Use createUser(array $permissions = [], $name = NULL, $admin = FALSE, array $values = []) instead. See https://www.drupal.org/node/3330762', E_USER_DEPRECATED);

      $values = $permissions;
      $permissions = [];
    }

    if (is_array($name)) {
      // If $name is an array rather than a string, then the caller is intending

    private function writeLine(string $text, int $indent = 0): void
    {
        $indent = \strlen($text) + $indent;
        $format = '%'.$indent.'s';

        $this->reference .= sprintf($format$text)."\n";
    }

    private function writeArray(array $array, int $depth): void
    {
        $isIndexed = array_is_list($array);

        foreach ($array as $key => $value) {
            if (\is_array($value)) {
                $val = '';
            } else {
                $val = $value;
            }

            if ($isIndexed) {
                $this->writeLine('- '.$val$depth * 4);
            } else {
                
continue 2;
                        }
                        $a = null;
                        break;

                    case \is_array($v):
                        if (!$v) {
                            continue 2;
                        }
                        $stub = $arrayStub;

                        $stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC;
                        $a = $v;
                        break;

                    case \is_object($v):
                        if (empty($objRefs[$h = spl_object_id($v)])) {
                            $stub = new Stub();
                            $stub->type = Stub::TYPE_OBJECT;
                            $stub->class = $v::class;
                            $stub->value = $v;
                            $stub->handle = $h;
                            $a = $this->castObject($stub, 0 < $i);
                            
$this->addTagRecursiveAttributes($attribute$value);
            } else {
                $attribute->appendChild($this->document->createTextNode($value));
            }

            $parent->appendChild($attribute);
        }
    }

    private function convertParameters(array $parameters, string $type, \DOMElement $parent, string $keyAttribute = 'key'): void
    {
        $withKeys = !array_is_list($parameters);
        foreach ($parameters as $key => $value) {
            $element = $this->document->createElement($type);
            if ($withKeys) {
                $element->setAttribute($keyAttribute$key);
            }

            if (\is_array($tag = $value)) {
                $element->setAttribute('type', 'collection');
                $this->convertParameters($value$type$element, 'key');
            } elseif ($value instanceof TaggedIteratorArgument || ($value instanceof ServiceLocatorArgument && $tag = $value->getTaggedIteratorArgument())) {
                $element->setAttribute('type', $value instanceof TaggedIteratorArgument ? 'tagged_iterator' : 'tagged_locator');
                

        if ($value === '') {
            return [];
        }

        try {
            $result = json_decode($value, true, flags: \JSON_THROW_ON_ERROR);
        } catch (\JsonException $e) {
            throw UtilException::invalidJson($e);
        }

        if (\is_array($result) && \array_is_list($result)) {
            return $result;
        }

        throw UtilException::invalidJsonNotList();
    }
}
Home | Imprint | This part of the site doesn't use cookies.