Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Drupal\Core\RouteProcessor; use Drupal\Core\Render\BubbleableMetadata; u..

Decoded Output download

<?php

namespace Drupal\Core\RouteProcessor;

use Drupal\Core\Render\BubbleableMetadata;
use Symfony\Component\Routing\Route;

/**
 * Route processor manager.
 *
 * Holds an array of route processor objects and uses them to sequentially
 * process an outbound route, in order of processor priority.
 */
class RouteProcessorManager implements OutboundRouteProcessorInterface {

  /**
   * Holds the array of outbound processors to cycle through.
   *
   * @var array
   *   An array whose keys are priorities and whose values are arrays of path
   *   processor objects.
   */
  protected $outboundProcessors = [];

  /**
   * Holds the array of outbound processors, sorted by priority.
   *
   * @var array
   *   An array of path processor objects.
   */
  protected $sortedOutbound = [];

  /**
   * Adds an outbound processor object to the $outboundProcessors property.
   *
   * @param \Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface $processor
   *   The processor object to add.
   * @param int $priority
   *   The priority of the processor being added.
   */
  public function addOutbound(OutboundRouteProcessorInterface $processor, $priority = 0) {
    $this->outboundProcessors[$priority][] = $processor;
    $this->sortedOutbound = [];
  }

  /**
   * {@inheritdoc}
   */
  public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
    $processors = $this->getOutbound();
    foreach ($processors as $processor) {
      $processor->processOutbound($route_name, $route, $parameters, $bubbleable_metadata);
    }
  }

  /**
   * Returns the sorted array of outbound processors.
   *
   * @return array
   *   An array of processor objects.
   */
  protected function getOutbound() {
    if (empty($this->sortedOutbound)) {
      $this->sortedOutbound = $this->sortProcessors();
    }

    return $this->sortedOutbound;
  }

  /**
   * Sorts the processors according to priority.
   */
  protected function sortProcessors() {
    $sorted = [];
    krsort($this->outboundProcessors);

    foreach ($this->outboundProcessors as $processors) {
      $sorted = array_merge($sorted, $processors);
    }
    return $sorted;
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Drupal\Core\RouteProcessor;

use Drupal\Core\Render\BubbleableMetadata;
use Symfony\Component\Routing\Route;

/**
 * Route processor manager.
 *
 * Holds an array of route processor objects and uses them to sequentially
 * process an outbound route, in order of processor priority.
 */
class RouteProcessorManager implements OutboundRouteProcessorInterface {

  /**
   * Holds the array of outbound processors to cycle through.
   *
   * @var array
   *   An array whose keys are priorities and whose values are arrays of path
   *   processor objects.
   */
  protected $outboundProcessors = [];

  /**
   * Holds the array of outbound processors, sorted by priority.
   *
   * @var array
   *   An array of path processor objects.
   */
  protected $sortedOutbound = [];

  /**
   * Adds an outbound processor object to the $outboundProcessors property.
   *
   * @param \Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface $processor
   *   The processor object to add.
   * @param int $priority
   *   The priority of the processor being added.
   */
  public function addOutbound(OutboundRouteProcessorInterface $processor, $priority = 0) {
    $this->outboundProcessors[$priority][] = $processor;
    $this->sortedOutbound = [];
  }

  /**
   * {@inheritdoc}
   */
  public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
    $processors = $this->getOutbound();
    foreach ($processors as $processor) {
      $processor->processOutbound($route_name, $route, $parameters, $bubbleable_metadata);
    }
  }

  /**
   * Returns the sorted array of outbound processors.
   *
   * @return array
   *   An array of processor objects.
   */
  protected function getOutbound() {
    if (empty($this->sortedOutbound)) {
      $this->sortedOutbound = $this->sortProcessors();
    }

    return $this->sortedOutbound;
  }

  /**
   * Sorts the processors according to priority.
   */
  protected function sortProcessors() {
    $sorted = [];
    krsort($this->outboundProcessors);

    foreach ($this->outboundProcessors as $processors) {
      $sorted = array_merge($sorted, $processors);
    }
    return $sorted;
  }

}

Function Calls

None

Variables

None

Stats

MD5 8afd06751c27b7e62edb213e79910ef2
Eval Count 0
Decode Time 76 ms