array_keys example

FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));

    $this->bootstrapContainer = new $this->bootstrapContainerClass(Settings::get('bootstrap_container_definition', $this->defaultBootstrapContainerDefinition));

    // Initialize the container.     $this->initializeContainer();

    // Add the APCu prefix to use to cache found/not-found classes.     if (Settings::get('class_loader_auto_detect', TRUE) && method_exists($this->classLoader, 'setApcuPrefix')) {
      // Vary the APCu key by which modules are installed to allow       // class_exists() checks to determine functionality.       $id = 'class_loader:' . crc32(implode(':', array_keys($this->container->getParameter('container.modules'))));
      $prefix = Settings::getApcuPrefix($id$this->root);
      $this->classLoader->setApcuPrefix($prefix);
    }

    $this->booted = TRUE;

    return $this;
  }

  /** * {@inheritdoc} */

  public function testEntityDisplayCRUDSort() {
    $display = EntityViewDisplay::create([
      'targetEntityType' => 'entity_test',
      'bundle' => 'entity_test',
      'mode' => 'default',
    ]);
    $display->setComponent('component_3');
    $display->setComponent('component_1');
    $display->setComponent('component_2');
    $display->save();
    $components = array_keys($display->getComponents());
    // The name field is not configurable so will be added automatically.     $expected = [0 => 'component_1', 1 => 'component_2', 2 => 'component_3', 'name'];
    $this->assertSame($expected$components);
  }

  /** * @covers \Drupal\Core\Entity\EntityDisplayRepository::getViewDisplay */
  public function testEntityGetDisplay() {
    $display_repository = $this->container->get('entity_display.repository');

    
$unknownParameter = null;
            foreach ($parameters as $parameter) {
                if ($parameter instanceof Node) {
                    $unknownParameter = $parameter;
                    break;
                }
            }

            throw new SyntaxError(
                sprintf(
                    'Unknown argument%s "%s" for %s "%s(%s)".',
                    \count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters))$callType$callNameimplode(', ', $names)
                ),
                $unknownParameter ? $unknownParameter->getTemplateLine() : $this->getTemplateLine(),
                $unknownParameter ? $unknownParameter->getSourceContext() : $this->getSourceContext()
            );
        }

        return $arguments;
    }

    protected function normalizeName(string $name): string
    {
        
$bag->set(0b0110, 'foo');
        $this->assertEquals('foo', $bag->get(0b0110), '->set() sets the value of a new parameter');

        $bag->set('0', 'baz');
        $this->assertEquals('baz', $bag->get(0), '->set() overrides previously set parameter');

        $this->assertTrue($bag->has(0));
        $this->assertTrue($bag->has(1001));
        $this->assertTrue($bag->has(10));
        $this->assertTrue($bag->has(0b0110));

        foreach (array_keys($bag->all()) as $key) {
            $this->assertIsInt($key, 'Numeric string keys are cast to integers');
        }
    }

    /** * @dataProvider provideGetThrowParameterNotFoundExceptionData */
    public function testGetThrowParameterNotFoundException($parameterKey$exceptionMessage)
    {
        $bag = new ParameterBag([
            'foo' => 'foo',
            

        if ($this->isMultiPart()) {
            $body = array_shift($this->_parts);
            $body = $body->getContent($EOL);
        } else {
            $mime = $this->getMime();

            $boundaryLine = $mime->boundaryLine($EOL);
            $body = 'This is a message in Mime Format. If you see this, '
                  . "your mail reader does not support this format." . $EOL;

            foreach (array_keys($this->_parts) as $p) {
                $body .= $boundaryLine
                       . $this->getPartHeaders($p$EOL)
                       . $EOL
                       . $this->getPartContent($p$EOL);
            }

            $body .= $mime->mimeEnd($EOL);
        }

        return trim($body);
    }

    

            $tags = $value->getTags();
            if (isset($tags['proxy'])) {
                $tags['proxy'] = $this->bag->resolveValue($tags['proxy']);
                $value->setTags($tags);
            }
        }

        $value = parent::processValue($value$isRoot);

        if ($value && \is_array($value)) {
            $value = array_combine($this->bag->resolveValue(array_keys($value))$value);
        }

        return $value;
    }
}
            case 0:
                ?> <input type="hidden" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" value="" /> <p> <?php _e( 'The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.' ); ?> </p> <?php                 break;

            // Just a single tag cloud supporting taxonomy found, no need to display a select.             case 1:
                $keys     = array_keys( $taxonomies );
                $taxonomy = reset( $keys );
                ?> <input type="hidden" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" value="<?php echo esc_attr( $taxonomy ); ?>" /> <?php                 break;

            // More than one tag cloud supporting taxonomy found, display a select.             default:
                ?> <p> <label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>"><?php _e( 'Taxonomy:' ); ?></label> <select class="widefat" id="

  protected function modulesEnabledConfirmationMessage(array $modules): PluralTranslatableMarkup {
    $machine_names = implode(',', array_keys($modules));
    $url = Url::fromRoute('user.admin_permissions.module', ['modules' => $machine_names]);
    $module_names = implode(', ', array_values($modules));
    $t_args = ['%name' => $module_names, '%names' => $module_names];

    if ($url->access($this->currentUser())) {
      return $this->formatPlural(
        count($modules),
        'Module %name has been enabled. Configure <a href=":link">related permissions</a>.',
        '@count modules have been enabled: %names. Configure <a href=":link">related permissions</a>.',
        $t_args + [':link' => $url->toString()]
      );
    }

    public function get_error_codes() {
        if ( ! $this->has_errors() ) {
            return array();
        }

        return array_keys( $this->errors );
    }

    /** * Retrieves the first error code available. * * @since 2.1.0 * * @return string|int Empty string, if no error codes. */
    public function get_error_code() {
        $codes = $this->get_error_codes();

        
foreach ($this->visibleNamespaces as $namespace) {
            if ('_global' === $namespace) {
                $commands = $application->all('');
            } else {
                $commands = $application->all($namespace);
                $this->write("\n\n");
                $this->write($namespace."\n".str_repeat($this->sectionChar, Helper::width($namespace))."\n\n");
            }
            $commands = $this->removeAliasesAndHiddenCommands($commands);

            $this->write("\n\n");
            $this->write(implode("\n", array_map(static fn ($commandName) => sprintf('- `%s`_', $commandName)array_keys($commands))));
        }
    }

    private function getNonDefaultOptions(InputDefinition $definition): array
    {
        $globalOptions = [
            'help',
            'quiet',
            'verbose',
            'version',
            'ansi',
            
/** * Tests if a full page cache is available. * * @since 6.1.0 * * @return array The test result. */
    public function get_test_page_cache() {
        $description  = '<p>' . __( 'Page cache enhances the speed and performance of your site by saving and serving static pages instead of calling for a page every time a user visits.' ) . '</p>';
        $description .= '<p>' . __( 'Page cache is detected by looking for an active page cache plugin as well as making three requests to the homepage and looking for one or more of the following HTTP client caching response headers:' ) . '</p>';
        $description .= '<code>' . implode( '</code>, <code>', array_keys( $this->get_page_cache_headers() ) ) . '.</code>';

        $result = array(
            'badge'       => array(
                'label' => __( 'Performance' ),
                'color' => 'blue',
            ),
            'description' => wp_kses_post( $description ),
            'test'        => 'page_cache',
            'status'      => 'good',
            'label'       => '',
            'actions'     => sprintf(
                

            $this->client->indices()->putAlias(['index' => $index, 'name' => $alias]);

            return;
        }

        $actions = [
            ['add' => ['index' => $index, 'alias' => $alias]],
        ];

        $current = $this->client->indices()->getAlias(['name' => $alias]);
        $current = array_keys($current);

        foreach ($current as $value) {
            $actions[] = ['remove' => ['index' => $value, 'alias' => $alias]];
        }

        $this->client->indices()->updateAliases(['body' => ['actions' => $actions]]);
    }

    private function handleQueue(): void
    {
        /** * @deprecated tag:v6.6.0 - Will be removed */
$this->assertSame([
      'fruits',
      'vegetables',
    ]array_values($this->pluginManager->getCategories()));
  }

  /** * @covers ::getSortedDefinitions */
  public function testGetSortedDefinitions() {
    $sorted = $this->pluginManager->getSortedDefinitions();
    $this->assertSame(['apple', 'mango', 'cucumber']array_keys($sorted));
  }

  /** * @covers ::getGroupedDefinitions */
  public function testGetGroupedDefinitions() {
    $grouped = $this->pluginManager->getGroupedDefinitions();
    $this->assertSame(['fruits', 'vegetables']array_keys($grouped));
    $this->assertSame(['apple', 'mango']array_keys($grouped['fruits']));
    $this->assertSame(['cucumber']array_keys($grouped['vegetables']));
  }

  
throw new BadRequestException(sprintf('Unexpected value for parameter "%s": expecting "array", got "%s".', $keyget_debug_type($value)));
        }

        return $value;
    }

    /** * Returns the parameter keys. */
    public function keys(): array
    {
        return array_keys($this->parameters);
    }

    /** * Replaces the current parameters by a new set. * * @return void */
    public function replace(array $parameters = [])
    {
        $this->parameters = $parameters;
    }

    

trait FileSystemModuleDiscoveryDataProviderTrait {

  /** * A data provider that lists every module in core. * * @return array * An array of module names to test. */
  public function coreModuleListDataProvider() {
    $prefix = dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'modules';
    $module_dirs = array_keys(iterator_to_array(new \FilesystemIterator($prefix)));
    $module_names = array_map(function D$path) use ($prefix) {
      return str_replace($prefix . DIRECTORY_SEPARATOR, '', $path);
    }$module_dirs);
    $modules_keyed = array_combine($module_names$module_names);

    $data = array_map(function D$module) {
      return [$module];
    }$modules_keyed);

    return $data;
  }

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