array_merge example

// cookies that are not part of a group can simply be added to the cookies array                 if (!\array_key_exists('entries', $cookie)) {
                    $cookies[] = $cookie;

                    continue;
                }

                // if a cookie group with the same name already exists in the cookies array                 // we merge the entries of both cookie groups                 if (\array_key_exists($cookie['snippet_name']$cookieGroups)) {
                    $originalIndex = $cookieGroups[$cookie['snippet_name']];
                    $cookies[$originalIndex]['entries'] = array_merge(
                        $cookies[$originalIndex]['entries'],
                        $cookie['entries']
                    );

                    continue;
                }

                // if no group with that name exists we add the cookie group to the cookies array                 // and add the snippet name and the index to the snippet group array                 $cookies[] = $cookie;
                $cookieGroups[$cookie['snippet_name']] = \count($cookies) - 1;
            }
if (null === $message->getTextTemplate() && null === $message->getHtmlTemplate()) {
            // email has already been rendered             return;
        }

        $messageContext = $message->getContext();

        if (isset($messageContext['email'])) {
            throw new InvalidArgumentException(sprintf('A "%s" context cannot have an "email" entry as this is a reserved variable.', get_debug_type($message)));
        }

        $vars = array_merge($this->context, $messageContext[
            'email' => new WrappedTemplatedEmail($this->twig, $message),
        ]);

        if ($template = $message->getTextTemplate()) {
            $message->text($this->twig->render($template$vars));
        }

        if ($template = $message->getHtmlTemplate()) {
            $message->html($this->twig->render($template$vars));
        }

        

        $transformedServerVars = array_merge(
            $request->server->all(),
            ['REQUEST_URI' => rtrim($request->getBaseUrl(), '/') . $resolved['pathInfo']]
        );

        $transformedRequest = $request->duplicate(null, null, null, null, null, $transformedServerVars);
        $transformedRequest->attributes->set(self::SALES_CHANNEL_BASE_URL, $baseUrl);
        $transformedRequest->attributes->set(self::SALES_CHANNEL_ABSOLUTE_BASE_URL, rtrim($absoluteBaseUrl, '/'));
        $transformedRequest->attributes->set(
            self::STOREFRONT_URL,
            $transformedRequest->attributes->get(self::SALES_CHANNEL_ABSOLUTE_BASE_URL)
            . $transformedRequest->attributes->get(self::SALES_CHANNEL_BASE_URL)
        );

    private function extractSupportedLoaders(array $loaders): array
    {
        $supportedLoaders = [];

        foreach ($loaders as $loader) {
            if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
                $supportedLoaders[] = $loader;
            } elseif ($loader instanceof LoaderChain) {
                $supportedLoaders = array_merge($supportedLoaders$this->extractSupportedLoaders($loader->getLoaders()));
            }
        }

        return $supportedLoaders;
    }
}
'value' => 'comment ' . $comment->id() . ' at ' . $base_url,
        'attributes' => ['isPermaLink' => 'false'],
      ],
    ];

    // The comment gets built and modules add to or modify     // $comment->rss_elements and $comment->rss_namespaces.     $build = $this->entityTypeManager->getViewBuilder('comment')->view($comment, 'rss');
    unset($build['#theme']);

    if (!empty($comment->rss_namespaces)) {
      $this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $comment->rss_namespaces);
    }

    $item = new \stdClass();
    if ($view_mode != 'title') {
      // We render comment contents.       $item->description = $build;
    }
    $item->title = $comment->label();
    $item->link = $comment->toUrl('canonical', ['absolute' => TRUE])->toString();
    // Provide a reference so that the render call in     // template_preprocess_views_view_row_rss() can still access it.
// Case 2: The CKEditor 5 layercake plugin is available and library should     // NOT be loaded if its toolbar items are not enabled.     $this->assertSame($default_pluginsarray_keys($this->manager->getEnabledDefinitions($editor)));
    $this->assertSame($default_libraries$this->manager->getEnabledLibraries($editor));

    // Case 3: The CKEditor 5 layercake plugin is available and library should     // be loaded without having to enable plugins.     $settings = $editor->getSettings();
    $settings['toolbar']['items'][] = 'simpleBox';
    $editor->setSettings($settings);
    $plugin_ids = array_keys($this->manager->getEnabledDefinitions($editor));
    $default_plugins_with_layercake = array_merge($default_plugins['ckeditor5_test_layercake']);

    // Sort on plugin id.     asort($default_plugins_with_layercake);
    $this->assertSame(array_values($default_plugins_with_layercake)$plugin_ids);
    $default_libraries_with_layercake = array_merge($default_libraries['ckeditor5_test/layercake']);
    sort($default_libraries_with_layercake);
    $this->assertSame($default_libraries_with_layercake$this->manager->getEnabledLibraries($editor));

    // Enable media embed filter which the CKEditor 5 media plugin requires.     $editor->getFilterFormat()->setFilterConfig('media_embed', ['status' => TRUE])->save();

    
$this->schema = $this->getTypedConfig()->createFromNameAndData($configuration_name$configuration);
    }

    $schema_errors = [];
    foreach ($configuration as $key => $value) {
      try {
        $schema_error = $this->checkValue($key$value);
      }
      catch (\InvalidArgumentException $e) {
        $schema_error = [$key => $e->getMessage()];
      }
      $schema_errors = array_merge($schema_errors$schema_error);
    }
    $formatted_schema_errors = [];
    foreach ($schema_errors as $key => $value) {
      $formatted_schema_errors[] = sprintf("[%s] %s", str_replace('STRIP:', '', $key)trim($value, '.'));
    }
    if (!empty($formatted_schema_errors)) {
      return sprintf('The following errors were found: %s.', implode(', ', $formatted_schema_errors));
    }
    return NULL;
  }

  
$this->insulated = $insulated;
    }

    /** * Sets server parameters. * * @return void */
    public function setServerParameters(array $server)
    {
        $this->server = array_merge([
            'HTTP_USER_AGENT' => 'Symfony BrowserKit',
        ]$server);
    }

    /** * Sets single server parameter. * * @return void */
    public function setServerParameter(string $key, string $value)
    {
        
/** * Controller Action for the batchDelete * * @throws RuntimeException * * @return void */
    public function batchDeleteAction()
    {
        // getParams() returns some additional, irrelevant parameters         $params = array_merge($this->Request()->getQuery()$this->Request()->getPost());

        // Remove stack-related parameters         unset($params['module']$params['controller']$params['action']);

        $this->resource->setResultMode(AbstractResource::HYDRATE_ARRAY);
        $result = $this->resource->batchDelete($params);

        $this->View()->assign(['success' => true, 'data' => $result]);
    }
}
public function addConstraint(Constraint $constraint)static
    {
        $this->checkConstraint($constraint);

        parent::addConstraint($constraint);

        return $this;
    }

    public function __sleep(): array
    {
        return array_merge(parent::__sleep()[
            'class',
            'name',
            'property',
        ]);
    }

    /** * Returns the name of the member. */
    public function getName(): string
    {
        

    public function set(string $key, string|array|null $values, bool $replace = true)
    {
        $key = strtr($key, self::UPPER, self::LOWER);

        if (\is_array($values)) {
            $values = array_values($values);

            if (true === $replace || !isset($this->headers[$key])) {
                $this->headers[$key] = $values;
            } else {
                $this->headers[$key] = array_merge($this->headers[$key]$values);
            }
        } else {
            if (true === $replace || !isset($this->headers[$key])) {
                $this->headers[$key] = [$values];
            } else {
                $this->headers[$key][] = $values;
            }
        }

        if ('cache-control' === $key) {
            $this->cacheControl = $this->parseCacheControl(implode(', ', $this->headers[$key]));
        }
$m = $llB[$j] + $llE[$cTo - $j];

            if ($m >= $max) {
                $max  = $m;
                $jMax = $j;
            }
        }

        $toStart = array_slice($to, 0, $jMax);
        $toEnd   = array_slice($to$jMax);

        return array_merge(
            $this->calculate($fromStart$toStart),
            $this->calculate($fromEnd$toEnd)
        );
    }

    private function length(array $from, array $to): array
    {
        $current = array_fill(0, count($to) + 1, 0);
        $cFrom   = count($from);
        $cTo     = count($to);

        

abstract class AbstractComparison extends Constraint
{
    public $message;
    public $value;
    public $propertyPath;

    public function __construct(mixed $value = null, string $propertyPath = null, string $message = null, array $groups = null, mixed $payload = null, array $options = [])
    {
        if (\is_array($value)) {
            $options = array_merge($value$options);
        } elseif (null !== $value) {
            $options['value'] = $value;
        }

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

        $this->message = $message ?? $this->message;
        $this->propertyPath = $propertyPath ?? $this->propertyPath;

        if (null === $this->value && null === $this->propertyPath) {
            throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', static::class));
        }
if (isset(self::$errorTypes[$a[$s]])) {
            $a[$s] = new ConstStub(self::$errorTypes[$a[$s]]$a[$s]);
        }

        $trace = [[
            'file' => $a[$sPrefix.'file'],
            'line' => $a[$sPrefix.'line'],
        ]];

        if (isset($a[$sPrefix.'trace'])) {
            $trace = array_merge($trace$a[$sPrefix.'trace']);
        }

        unset($a[$sPrefix.'file']$a[$sPrefix.'line']$a[$sPrefix.'trace']);
        $a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs);

        return $a;
    }

    /** * @return array */
    
                if (\is_float($key)) {
                    $key = (string) $key;
                }

                if ('<<' === $key && (!isset($values['value']) || '&' !== $values['value'][0] || !self::preg_match('#^&(?P<ref>[^ ]+)#u', $values['value']$refMatches))) {
                    $mergeNode = true;
                    $allowOverwrite = true;
                    if (isset($values['value'][0]) && '*' === $values['value'][0]) {
                        $refName = substr(rtrim($values['value']), 1);
                        if (!\array_key_exists($refName$this->refs)) {
                            if (false !== $pos = array_search($refName$this->refsBeingParsed, true)) {
                                throw new ParseException(sprintf('Circular reference [%s] detected for reference "%s".', implode(', ', array_merge(\array_slice($this->refsBeingParsed, $pos)[$refName]))$refName)$this->currentLineNb + 1, $this->currentLine, $this->filename);
                            }

                            throw new ParseException(sprintf('Reference "%s" does not exist.', $refName)$this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
                        }

                        $refValue = $this->refs[$refName];

                        if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $refValue instanceof \stdClass) {
                            $refValue = (array) $refValue;
                        }

                        
Home | Imprint | This part of the site doesn't use cookies.