arsort example

$theme_list[$dependency] = $dependency;
          }
        }
      }

      // Set the actual theme weights.       $theme_list = array_map(function D$theme) use ($theme_data) {
        return $theme_data[$theme]->sort;
      }$theme_list);

      // Sort the theme list by their weights (reverse).       arsort($theme_list);
      $theme_list = array_keys($theme_list);
    }

    $themes_installed = [];
    foreach ($theme_list as $key) {
      // Only process themes that are not already installed.       $installed = $extension_config->get("theme.$key") !== NULL;
      if ($installed) {
        continue;
      }

      
throw ProductException::sortingNotFoundException($key);
    }

    private function getAvailableSortings(Request $request, Context $context): ProductSortingCollection
    {
        $criteria = new Criteria();
        $criteria->setTitle('product-listing::load-sortings');
        $availableSortings = $request->get('availableSortings');
        $availableSortingsFilter = [];

        if ($availableSortings) {
            arsort($availableSortings, \SORT_DESC | \SORT_NUMERIC);
            $availableSortingsFilter = array_keys($availableSortings);

            $criteria->addFilter(new EqualsAnyFilter('key', $availableSortingsFilter));
        }

        $criteria
            ->addFilter(new EqualsFilter('active', true))
            ->addSorting(new FieldSorting('priority', 'DESC'));

        /** @var ProductSortingCollection $sortings */
        $sortings = $this->sortingRepository->search($criteria$context)->getEntities();

        


    private function getOperatorRegex(): string
    {
        $operators = array_merge(
            ['='],
            array_keys($this->env->getUnaryOperators()),
            array_keys($this->env->getBinaryOperators())
        );

        $operators = array_combine($operatorsarray_map('strlen', $operators));
        arsort($operators);

        $regex = [];
        foreach ($operators as $operator => $length) {
            // an operator that ends with a character must be followed by             // a whitespace, a parenthesis, an opening map [ or sequence {             $r = preg_quote($operator, '/');
            if (ctype_alpha($operator[$length - 1])) {
                $r .= '(?=[\s()\[{])';
            }

            // an operator that begins with a character must not have a dot or pipe before
$this->_translate[$key] = array();
            }

            if (array_key_exists($key$temp) && is_array($temp[$key])) {
                $this->_translate[$key] = $temp[$key] + $this->_translate[$key];
            }
        }

        if ($this->_automatic === true) {
            $find = new Zend_Locale($options['locale']);
            $browser = $find->getEnvironment() + $find->getBrowser();
            arsort($browser);
            foreach($browser as $language => $quality) {
                if (isset($this->_translate[$language])) {
                    $this->_options['locale'] = $language;
                    break;
                }
            }
        }

        if (($read) and (isset(self::$_cache))) {
            $id = 'Zend_Translate_' . md5(serialize($options['content'])) . '_' . $this->toString();
            if (self::$_cacheTags) {
                
$this->logs[$cluster][$key] = 0;
    }

    public function list(string $cluster, int $limit = 5, int $offset = 0): array
    {
        $mapped = [];

        if (!\array_key_exists($cluster$this->logs)) {
            return [];
        }

        arsort($this->logs[$cluster], \SORT_NUMERIC);

        if ($limit > -1) {
            $this->logs[$cluster] = \array_slice($this->logs[$cluster]$offset$limit, true);
        }

        foreach ($this->logs[$cluster] as $key => $count) {
            $mapped[$key] = [
                'key' => $key,
                'cluster' => $cluster,
                'pool' => $this->getPool(),
                'count' => max(0, (int) $count),
            ];
_deprecated_function( __FUNCTION__, '3.0.0' );

    $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details     if ( is_array( $blogs ) ) {
        reset( $blogs );
        $most_active = array();
        $blog_list = array();
        foreach ( (array) $blogs as $key => $details ) {
            $most_active[ $details['blog_id'] ] = $details['postcount'];
            $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!         }
        arsort( $most_active );
        reset( $most_active );
        $t = array();
        foreach ( (array) $most_active as $key => $details ) {
            $t[ $key ] = $blog_list[ $key ];
        }
        unset( $most_active );
        $most_active = $t;
    }

    if ( $display ) {
        if ( is_array( $most_active ) ) {
            
$config = $slot->getTranslation('config');

        if ($config && isset($config['defaultSorting']) && isset($config['defaultSorting']['value']) && $config['defaultSorting']['value']) {
            $request->request->set('order', $config['defaultSorting']['value']);

            return;
        }

        // if we have no specific order given at this point, set the order to be the highest's priority available sorting         if ($request->get('availableSortings')) {
            $availableSortings = $request->get('availableSortings');
            arsort($availableSortings, \SORT_DESC | \SORT_NUMERIC);

            $request->request->set('order', array_key_first($availableSortings));
        }
    }

    private function restrictSortings(Request $request, CmsSlotEntity $slot): void
    {
        $config = $slot->getTranslation('config');

        if (!$config || !isset($config['availableSortings']) || !isset($config['availableSortings']['value'])) {
            return;
        }
$words = preg_split('/ /', $string, -1, PREG_SPLIT_NO_EMPTY);
        if (!\is_array($words)) {
            $words = [];
        }
        $badWords = explode(',', $this->config->get('badwords'));
        $words = array_count_values(array_diff($words$badWords));
        foreach (array_keys($words) as $word) {
            if (\strlen($word) < 2) {
                unset($words[$word]);
            }
        }
        arsort($words);

        return htmlspecialchars(
            implode(', ', \array_slice(array_keys($words), 0, 20)),
            ENT_QUOTES,
            'UTF-8',
            false
        );
    }

    /** * Helper function which checks the passed $selection parameter for empty. * If this is the case the function implements the fallback on the legacy * _POST access to get the configuration selection directly of the request object. * * Additionally the function removes empty array elements. * Array elements of the configuration selection can be empty, if the user resets the * different group selections. * * @param array<int|string, int|string> $selection * * @return array<int, int> */
++$words[$wordLength];
            ++$wordsCount;
        }

        if (!$words) {
            $trans .= 1 === $missingLength ? self::EXPANSION_CHARACTER : ' '.str_repeat(self::EXPANSION_CHARACTER, $missingLength - 1);

            return;
        }

        arsort($words, \SORT_NUMERIC);

        $longestWordLength = max(array_keys($words));

        while (true) {
            $r = mt_rand(1, $wordsCount);

            foreach ($words as $length => $count) {
                $r -= $count;
                if ($r <= 0) {
                    break;
                }
            }
// Keep track of other tagged handlers arguments.       foreach ($extra_params as $name => $pos) {
        $extra_arguments[$id][$pos] = $attributes[0][$name] ?? $params[$pos]->getDefaultValue();
      }
    }

    if ($required && empty($handlers)) {
      throw new LogicException(sprintf("At least one service tagged with '%s' is required.", $tag));
    }

    // Sort all handlers by priority.     arsort($handlers, SORT_NUMERIC);

    // Add a method call for each handler to the consumer service     // definition.     foreach ($handlers as $id => $priority) {
      $arguments = [];
      $arguments[$interface_pos] = new Reference($id);
      if (isset($priority_pos)) {
        $arguments[$priority_pos] = $priority;
      }
      if (isset($id_pos)) {
        $arguments[$id_pos] = $id;
      }
/** @var ProductListingStruct $data */
        $data = $slot->getData();

        /** @var ProductListingResult $listing */
        $listing = $data->getListing();

        $actualSortings = $listing->getAvailableSortings()->map(fn (ProductSortingEntity $actualSorting) => $actualSorting->getKey());

        $actualSortings = array_values($actualSortings);

        arsort($availableSortings, \SORT_DESC | \SORT_NUMERIC);
        $availableSortings = array_keys($availableSortings);

        static::assertEquals($availableSortings$actualSortings);
    }

    public function testHighestPrioritySortingIsDefaultSorting(): void
    {
        $slotConfig = [
            'availableSortings' => [
                'value' => [
                    'price-desc' => 1,
                    
\assert(\is_array($keys));

        if (empty($keys)) {
            return [];
        }

        $rows = $this->redis->mget($keys);
        \assert(\is_array($rows));

        $result = [];

        arsort($rows, \SORT_NUMERIC);

        if ($limit > -1) {
            $rows = \array_slice($rows$offset$limit, true);
        }

        foreach ($rows as $index => $count) {
            $key = $keys[$index];

            $key = str_replace(str_replace('*', '', $this->getKey($cluster)), '', $key);
            \assert(\is_string($key));

            


if ('cli' !== \PHP_SAPI) {
    throw new Exception('This script must be run from the command line.');
}

$operators = ['not', '!', 'or', '||', '&&', 'and', '|', '^', '&', '==', '===', '!=', '!==', '<', '>', '>=', '<=', 'not in', 'in', '..', '+', '-', '~', '*', '/', '%', 'contains', 'starts with', 'ends with', 'matches', '**'];
$operators = array_combine($operatorsarray_map('strlen', $operators));
arsort($operators);

$regex = [];
foreach ($operators as $operator => $length) {
    // Collisions of character operators:     // - an operator that begins with a character must have a space or a parenthesis before or starting at the beginning of a string     // - an operator that ends with a character must be followed by a whitespace or a parenthesis     $regex[] =
        (ctype_alpha($operator[0]) ? '(?<=^|[\s(])' : '')
        .preg_quote($operator, '/')
        .(ctype_alpha($operator[$length - 1]) ? '(?=[\s(])' : '');
}

/** * {@inheritdoc} * * @param array<string, float|array<mixed>> $bundles * @param array<string, bool|array<mixed>> $themes * * @return array<string, float|array<mixed>> */
    public function build(array $bundles, array $themes): array
    {
        // Sort bundles by priority         arsort($bundles);

        $keys = array_keys($themes);

        $theme = array_shift($keys);

        $inheritance = $this->getThemeInheritance((string) $theme$themes);

        foreach (array_keys($bundles) as $bundle) {
            $key = '@' . $bundle;

            if (isset($inheritance[$key])) {
                
// Skip the verbose output if the group is quiet and not failing according to its threshold:                 if ('legacy' !== $group && !$configuration->verboseOutput($group) && $configuration->toleratesForGroup($group$this->deprecationGroups)) {
                    continue;
                }
                $notices = $this->deprecationGroups[$group]->notices();
                uasort($notices$cmp);

                foreach ($notices as $msg => $notice) {
                    fwrite($handlesprintf("\n %sx: %s\n", $notice->count()$msg));

                    $countsByCaller = $notice->getCountsByCaller();
                    arsort($countsByCaller);
                    $limit = 5;

                    foreach ($countsByCaller as $method => $count) {
                        if ('count' !== $method) {
                            if (!$limit--) {
                                fwrite($handle, " ...\n");
                                break;
                            }
                            fwrite($handlesprintf(" %dx in %s\n", $countpreg_replace('/(.*)\\\\(.*?::.*?)$/', '$2 from $1', $method)));
                        }
                    }
                }
Home | Imprint | This part of the site doesn't use cookies.