Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

PriorityTaggedServiceTrait.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 1.59 KiB


01  <?php
02   
03  /*
04   * This file is part of the Symfony package.
05   *
06   * (c) Fabien Potencier <fabien@symfony.com>
07   *
08   * For the full copyright and license information, please view the LICENSE
09   * file that was distributed with this source code.
10   */
11   
12  namespace Symfony\Component\DependencyInjection\Compiler;
13   
14  use Symfony\Component\DependencyInjection\ContainerBuilder;
15  use Symfony\Component\DependencyInjection\Reference;
16   
17  /**
18   * Trait that allows a generic method to find and sort service by priority option in the tag.
19   *
20   * @author Iltar van der Berg <kjarli@gmail.com>
21   */
22  trait PriorityTaggedServiceTrait
23  {
24      /**
25       * Finds all services with the given tag name and order them by their priority.
26       *
27       * The order of additions must be respected for services having the same priority,
28       * and knowing that the \SplPriorityQueue class does not respect the FIFO method,
29       * we should not use that class.
30       *
31       * @see https://bugs.php.net/53710
32       * @see https://bugs.php.net/60926
33       *
34       * @param string $tagName
35       *
36       * @return Reference[]
37       */
38      private function findAndSortTaggedServices($tagName, ContainerBuilder $container)
39      {
40          $services = [];
41   
42          foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) {
43              $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
44              $services[$priority][] = new Reference($serviceId);
45          }
46   
47          if ($services) {
48              krsort($services);
49              $services = \call_user_func_array('array_merge', $services);
50          }
51   
52          return $services;
53      }
54  }
55