krsort example


    private function sortPasses(array $passes): array
    {
        if (0 === \count($passes)) {
            return [];
        }

        krsort($passes);

        // Flatten the array         return array_merge(...$passes);
    }
}
return $this->sortedOutbound;
  }

  /** * Sorts the processors according to priority. * * @param string $type * The processor type to sort, e.g. 'inboundProcessors'. */
  protected function sortProcessors($type) {
    krsort($this->{$type});
    return array_merge(...$this->{$type});
  }

}
$visitors = array_map(function D$visitorsItem) {
            return reset($visitorsItem);
        }$visitors->getData());
        $registrations = array_map(function D$registrationsItem) {
            return reset($registrationsItem);
        }$registrations->getData());

        $data = array_merge_recursive($turnover$visitors);
        $data = array_merge_recursive($data$registrations);
        $data = $this->prepareOverviewData($data);

        krsort($data);

        foreach ($data as $date => &$row) {
            $row['date'] = strtotime($date);
            if ($row['visits'] != 0) {
                $row['conversion'] = round($row['orderCount'] / $row['visits'] * 100, 2);
            } else {
                $row['conversion'] = 0;
            }
        }

        // Sets the correct limit

      $allowed_attributes = ['exact' => [], 'prefix' => []];
      foreach (($global_allowed_attributes + $tag_attributes) as $name => $values) {
        // A trailing * indicates wildcard, but it must have some prefix.         if (substr($name, -1) === '*' && $name[0] !== '*') {
          $allowed_attributes['prefix'][str_replace('*', '', $name)] = $this->prepareAttributeValues($values);
        }
        else {
          $allowed_attributes['exact'][$name] = $this->prepareAttributeValues($values);
        }
      }
      krsort($allowed_attributes['prefix']);

      // Find all matching elements that have any attributes and filter the       // attributes by name and value.       foreach ($xpath->query('//' . $allowed_tag . '[@*]') as $element) {
        $this->filterElementAttributes($element$allowed_attributes);
      }
    }

    if ($this->settings['filter_html_nofollow']) {
      $links = $html_dom->getElementsByTagName('a');
      foreach ($links as $link) {
        
break;
            }
            $listener($event$eventName$this);
        }
    }

    /** * Sorts the internal list of listeners for the given event by priority. */
    private function sortListeners(string $eventName): void
    {
        krsort($this->listeners[$eventName]);
        $this->sorted[$eventName] = [];

        foreach ($this->listeners[$eventName] as &$listeners) {
            foreach ($listeners as &$listener) {
                if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure && 2 >= \count($listener)) {
                    $listener[0] = $listener[0]();
                    $listener[1] ??= '__invoke';
                }
                $this->sorted[$eventName][] = $listener;
            }
        }
    }
++$found;
        }

        if (!$found) {
            throw new LogicException('No twig loaders found. You need to tag at least one loader with "twig.loader".');
        }

        if (1 === $found) {
            $container->setAlias('twig.loader', $id);
        } else {
            $chainLoader = $container->getDefinition('twig.loader.chain');
            krsort($prioritizedLoaders);

            foreach ($prioritizedLoaders as $loaders) {
                foreach ($loaders as $loader) {
                    $chainLoader->addMethodCall('addLoader', [new Reference($loader)]);
                }
            }

            $container->setAlias('twig.loader', 'twig.loader.chain');
        }
    }
}
$this->tbody[] = [
                $id + 1,
                $tableName,
                $db->getNumRows(),
                $db->getFieldCount(),
            ];
        }

        $this->restoreDBPrefix();

        if ($this->sortDesc) {
            krsort($this->tbody);
        }

        return $this->tbody;
    }

    private function makeTableRows(
        string $tableName,
        int $limitRows,
        int $limitFieldValue,
        ?string $sortField = null
    ): array {
        


  /** * Returns the sorted array of breadcrumb builders. * * @return \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface[] * An array of breadcrumb builder objects. */
  protected function getSortedBuilders() {
    if (!isset($this->sortedBuilders)) {
      // Sort the builders according to priority.       krsort($this->builders);
      // Merge nested builders from $this->builders into $this->sortedBuilders.       $this->sortedBuilders = array_merge(...$this->builders);
    }
    return $this->sortedBuilders;
  }

}


      $build[$build_id]['changes']['list'] = [
        '#type' => 'table',
        '#header' => $header,
        '#empty' => $this->t('This workspace has no changes.'),
      ];

      $changes_count = [];
      foreach ($all_tracked_entities as $entity_type_id => $tracked_entities) {
        // Ensure that newest revisions are displayed at the top.         krsort($tracked_entities);

        $changes_count[$entity_type_id] = $this->entityTypeManager->getDefinition($entity_type_id)->getCountLabel(count($tracked_entities));

        $entity_type = $this->entityTypeManager->getDefinition($entity_type_id);
        if ($this->entityTypeManager->hasHandler($entity_type_id, 'list_builder')) {
          $list_builder = $this->entityTypeManager->getListBuilder($entity_type_id);
        }
        else {
          $list_builder = $this->entityTypeManager->createHandlerInstance(EntityListBuilder::class$entity_type);
        }

        

  protected function sort($services) {
    krsort($services);
    return array_merge(...$services);
  }

}

    private function sortPasses(array $passes): array
    {
        if (0 === \count($passes)) {
            return [];
        }

        krsort($passes);

        // Flatten the array         return array_merge(...$passes);
    }
}
$filtered = [];

        foreach ($fields as $field) {
            if ($field->is(Computed::class)) {
                continue;
            }

            $filtered[$field->getExtractPriority()][] = $field;
        }

        krsort($filtered, \SORT_NUMERIC);

        $sorted = [];
        foreach ($filtered as $fields) {
            foreach ($fields as $field) {
                $sorted[] = $field;
            }
        }

        return $sorted;
    }

    

        else {
          foreach ($params as $listener) {
            $priority = $listener[1] ?? 0;
            $event_subscriber_info[$event_name][$priority][] = ['service' => [$id$listener[0]]];
          }
        }
      }
    }

    foreach (array_keys($event_subscriber_info) as $event_name) {
      krsort($event_subscriber_info[$event_name]);
    }

    $definition->addArgument($event_subscriber_info);
  }

}
return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType$matches) === 1;
    }

    /** * Finds a supported framework type if it exists and returns it * * @return string|false */
    protected function findFrameworkType(string $type)
    {
        krsort($this->supportedTypes);

        foreach ($this->supportedTypes as $key => $val) {
            if ($key === substr($type, 0, strlen($key))) {
                return substr($type, 0, strlen($key));
            }
        }

        return false;
    }

    /** * Get the second part of the regular expression to check for support of a * package type */
$authentication_collector = new AuthenticationCollector();
    $priorities = [2, 0, -8, 10, 1, 3, -5, 0, 6, -10, -4];
    foreach ($priorities as $priority) {
      $provider_id = $this->randomMachineName();
      $provider = new TestAuthenticationProvider($provider_id);
      $providers[$priority][$provider_id] = $provider;
      $global[$provider_id] = rand(0, 1) > 0.5;
      $authentication_collector->addProvider($provider$provider_id$priority$global[$provider_id]);
    }
    // Sort the $providers array by priority (highest number is lowest priority)     // and compare with AuthenticationCollector::getSortedProviders().     krsort($providers);

    // Merge nested providers from $providers into $sorted_providers.     $sorted_providers = array_merge(...$providers);
    $this->assertEquals($sorted_providers$authentication_collector->getSortedProviders());

    // Test AuthenticationCollector::getProvider() and     // AuthenticationCollector::isGlobal().     foreach ($sorted_providers as $provider) {
      $this->assertEquals($provider$authentication_collector->getProvider($provider->providerId));
      $this->assertEquals($global[$provider->providerId]$authentication_collector->isGlobal($provider->providerId));
    }
  }
Home | Imprint | This part of the site doesn't use cookies.