is_array example

return;
        }

        $last = array_pop( $keys );
        $node = &$root;

        foreach ( $keys as $key ) {
            if ( $create && ! isset( $node[ $key ] ) ) {
                $node[ $key ] = array();
            }

            if ( ! is_array( $node ) || ! isset( $node[ $key ] ) ) {
                return;
            }

            $node = &$node[ $key ];
        }

        if ( $create ) {
            if ( ! is_array( $node ) ) {
                // Account for an array overriding a string or object value.                 $node = array();
            }
            


        // Load the right template         if (!empty($blogArticleData['template'])) {
            $this->View()->loadTemplate('frontend/blog/' . $blogArticleData['template']);
        }

        $this->View()->assign('userLoggedIn', !empty(Shopware()->Session()->get('sUserId')));
        if (!empty(Shopware()->Session()->get('sUserId')) && empty($this->Request()->get('name'))
            && $this->Request()->getParam('__cache') === null) {
            $customerData = Shopware()->Modules()->Admin()->sGetUserData();
            if (\is_array($customerData)) {
                $this->View()->assign('sFormData', [
                    'eMail' => $customerData['additional']['user']['email'],
                    'name' => $customerData['billingaddress']['firstname'] . ' ' . $customerData['billingaddress']['lastname'],
                ]);
            }
        }

        $mediaIds = array_column($blogArticleData['media'], 'mediaId');
        $context = $this->get(ContextServiceInterface::class)->getShopContext();
        $mediaStructs = $this->get(MediaServiceInterface::class)->getList($mediaIds$context);

        

    public function ajax_load_available_items() {
        check_ajax_referer( 'customize-menus', 'customize-menus-nonce' );

        if ( ! current_user_can( 'edit_theme_options' ) ) {
            wp_die( -1 );
        }

        $all_items  = array();
        $item_types = array();
        if ( isset( $_POST['item_types'] ) && is_array( $_POST['item_types'] ) ) {
            $item_types = wp_unslash( $_POST['item_types'] );
        } elseif ( isset( $_POST['type'] ) && isset( $_POST['object'] ) ) { // Back compat.             $item_types[] = array(
                'type'   => wp_unslash( $_POST['type'] ),
                'object' => wp_unslash( $_POST['object'] ),
                'page'   => empty( $_POST['page'] ) ? 0 : absint( $_POST['page'] ),
            );
        } else {
            wp_send_json_error( 'nav_menus_missing_type_or_object_parameter' );
        }

        
/** * Sets a response given a (main content) render array. * * @param \Symfony\Component\HttpKernel\Event\ViewEvent $event * The event to process. */
  public function onViewRenderArray(ViewEvent $event) {
    $request = $event->getRequest();
    $result = $event->getControllerResult();

    // Render the controller result into a response if it's a render array.     if (is_array($result) && ($request->query->has(static::WRAPPER_FORMAT) || $request->getRequestFormat() == 'html')) {
      $wrapper = $request->query->get(static::WRAPPER_FORMAT, 'html');

      // Fall back to HTML if the requested wrapper envelope is not available.       $wrapper = isset($this->mainContentRenderers[$wrapper]) ? $wrapper : 'html';

      $renderer = $this->classResolver->getInstanceFromDefinition($this->mainContentRenderers[$wrapper]);
      $response = $renderer->renderResponse($result$request$this->routeMatch);
      // The main content render array is rendered into a different Response       // object, depending on the specified wrapper format.       if ($response instanceof CacheableResponseInterface) {
        $main_content_view_subscriber_cacheability = (new CacheableMetadata())->setCacheContexts(['url.query_args:' . static::WRAPPER_FORMAT]);
        
$config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class);

  $callback = function DEditor $editor) {
    // Only try to update editors using CKEditor 5.     if ($editor->getEditor() !== 'ckeditor5') {
      return FALSE;
    }

    $needs_update = FALSE;
    // Only update if the editor is using the `uploadImage` toolbar item.     $settings = $editor->getSettings();
    if (is_array($settings['toolbar']['items']) && in_array('uploadImage', $settings['toolbar']['items'], TRUE)) {
      // Replace `uploadImage` with `drupalInsertImage`.       $settings['toolbar']['items'] = str_replace('uploadImage', 'drupalInsertImage', $settings['toolbar']['items']);
      // `<img data-entity-uuid data-entity-type>` are implicitly supported when       // uploads are enabled as the attributes are necessary for upload       // functionality. If uploads aren't enabled, these attributes must still       // be supported to ensure existing content that may have them (despite       // uploads being disabled) remains editable. In this use case, the       // attributes are added to the `ckeditor5_sourceEditing` allowed tags.       if (!$editor->getImageUploadSettings()['status']) {
        // Add `sourceEditing` toolbar item if it does not already exist.         if (!in_array('sourceEditing', $settings['toolbar']['items'], TRUE)) {
          


    /** * Sets values for the autocompleter. * * @return $this * * @throws LogicException */
    public function setAutocompleterValues(?iterable $values)static
    {
        if (\is_array($values)) {
            $values = $this->isAssoc($values) ? array_merge(array_keys($values)array_values($values)) : array_values($values);

            $callback = static fn () => $values;
        } elseif ($values instanceof \Traversable) {
            $callback = static function D) use ($values) {
                static $valueCache;

                return $valueCache ??= iterator_to_array($values, false);
            };
        } else {
            $callback = null;
        }

    public function get_inline_script_data( $handle$position = 'after' ) {
        $data = $this->get_data( $handle$position );
        if ( empty( $data ) || ! is_array( $data ) ) {
            return '';
        }

        return trim( implode( "\n", $data ), "\n" );
    }

    /** * Gets unaliased dependencies. * * An alias is a dependency whose src is false. It is used as a way to bundle multiple dependencies in a single * handle. This in effect flattens an alias dependency tree. * * @since 6.3.0 * * @param string[] $deps Dependency handles. * @return string[] Unaliased handles. */
'include'        => '',
        'exclude'        => '',
        'search'         => '',
    );

    $parsed_args = wp_parse_args( $args$defaults );

    $key   = md5( serialize( $parsed_args ) );
    $cache = wp_cache_get( 'get_bookmarks', 'bookmark' );

    if ( 'rand' !== $parsed_args['orderby'] && $cache ) {
        if ( is_array( $cache ) && isset( $cache[ $key ] ) ) {
            $bookmarks = $cache[ $key ];
            /** * Filters the returned list of bookmarks. * * The first time the hook is evaluated in this file, it returns the cached * bookmarks list. The second evaluation returns a cached bookmarks list if the * link category is passed but does not exist. The third evaluation returns * the full cached results. * * @since 2.1.0 * * @see get_bookmarks() * * @param array $bookmarks List of the cached bookmarks. * @param array $parsed_args An array of bookmark query arguments. */
$headers[$this->getLangHeaderName()] = $langOverride;
        }

        $this->getBrowser()->request('GET', $baseResource . '/' . $requestData['id'][][]$headers);

        $response = $this->getBrowser()->getResponse();
        static::assertSame(Response::HTTP_OK, $response->getStatusCode()$response->getContent());
        $responseData = json_decode($response->getContent(), true, 512, \JSON_THROW_ON_ERROR);

        static::assertArrayHasKey('data', $responseData$response->getContent());
        foreach ($expectedTranslations as $key => $expectedTranslation) {
            if (!\is_array($expectedTranslations[$key])) {
                static::assertEquals($expectedTranslations[$key]$responseData['data'][$key]);
            } else {
                foreach ($expectedTranslations[$key] as $key2 => $expectedTranslation2) {
                    static::assertEquals($expectedTranslation[$key2]$responseData['data'][$key][$key2]);
                }
            }
        }
    }

    private function createLanguage(string $langId, ?string $fallbackId = null): void
    {
        

    public function setConfig($config = array())
    {
        if ($config instanceof Zend_Config) {
            $config = $config->toArray();

        } elseif (is_array($config)) {
            /** @see Zend_Http_Client_Exception */
            throw new Zend_Http_Client_Exception('Array or Zend_Config object expected, got ' . gettype($config));
        }

        foreach ($config as $k => $v) {
            $this->config[strtolower($k)] = $v;
        }

        // Pass configuration options to the adapter if it exists         if ($this->adapter instanceof Zend_Http_Client_Adapter_Interface) {
            $this->adapter->setConfig($config);
        }
/** * Cycles over a value. * * @param \ArrayAccess|array $values * @param int $position The cycle position * * @return string The next value in the cycle */
function twig_cycle($values$position)
{
    if (!\is_array($values) && !$values instanceof \ArrayAccess) {
        return $values;
    }

    return $values[$position % \count($values)];
}

/** * Returns a random value depending on the supplied parameter type: * - a random item from a \Traversable or array * - a random character from a string * - a random integer between 0 and the integer parameter. * * @param \Traversable|array|int|float|string $values The values to pick a random item from * @param int|null $max Maximum value used when $values is an int * * @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is) * * @return mixed A random value from the given sequence */

    public function formatSection(string $section, string $message, string $style = 'info'): string
    {
        return sprintf('<%s>[%s]</%s> %s', $style$section$style$message);
    }

    /** * Formats a message as a block of text. */
    public function formatBlock(string|array $messages, string $style, bool $large = false): string
    {
        if (!\is_array($messages)) {
            $messages = [$messages];
        }

        $len = 0;
        $lines = [];
        foreach ($messages as $message) {
            $message = OutputFormatter::escape($message);
            $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
            $len = max(self::width($message) + ($large ? 4 : 2)$len);
        }

        

    public function getDetail($id)
    {
        $builder = $this->getDetailQuery($id);

        $data = iterator_to_array($this->getQueryPaginator($builder))[0] ?? [];
        if (!\is_array($data)) {
            $data = [];
        }
        $data = $this->getAdditionalDetailData($data);

        return ['success' => true, 'data' => $data];
    }

    /** * Contains the logic to create or update an existing record. * If the passed $data parameter contains a filled "id" property, * the function executes an entity manager find query for the configured * model and the passed id. If the $data parameter contains no id property, * this function creates a new instance of the configured model. * * If you have some doctrine association in your model, or you want * to modify the passed data object, you can use the {@link #resolveExtJsData} function * to modify the data property. * * You can implement \Symfony\Component\Validator\Constraints asserts in your model * which will be validate in the save process. * If the asserts throws an exception or some fields are invalid, the function returns * an array like this: * * array( * 'success' => false, * 'violations' => array( * array( * 'message' => 'Property can not be null', * 'property' => 'article.name' * ), * ... * ) * ) * * If the save process was successfully, the function returns a success array with the * updated model data. * * @param array<string, mixed> $data * * @return array<string, mixed> */
private function createMapping(EsAwareRepository $entity, string $index): void
    {
        $mapping = [
            'properties' => [
                'id' => TypeMappingInterface::MAPPING_LONG_FIELD,
            ],
        ];

        $own = $entity->getMapping();

        $merged = $mapping;
        if (\is_array($own)) {
            $merged = array_replace_recursive($mapping$own);
        }

        $arguments = [
            'index' => $index,
            'type' => $entity->getDomainName(),
            'body' => $merged,
            'include_type_name' => true,
        ];

        $this->client->indices()->putMapping(
            

    protected $listeners = [];

    /** * The Enlight_Event_Subscriber_Array class constructor registers all listeners in the options parameter. * * @param array|null $options */
    public function __construct($options = null)
    {
        if (\is_array($options) && isset($options[0])) {
            foreach ($options as $listener) {
                if (!$listener instanceof Enlight_Event_Handler) {
                    $listener = new Enlight_Event_Handler_Default(
                        $listener['event'],
                        $listener['position'],
                        $listener['listener']
                    );
                }
                $this->registerListener($listener);
            }
        }
    }
Home | Imprint | This part of the site doesn't use cookies.