BrokenInboundPathProcessor.php

Same filename in other branches
  1. 9 core/modules/system/tests/modules/update_script_test/src/PathProcessor/BrokenInboundPathProcessor.php
  2. 8.9.x core/modules/system/tests/modules/update_script_test/src/PathProcessor/BrokenInboundPathProcessor.php
  3. 10 core/modules/system/tests/modules/update_script_test/src/PathProcessor/BrokenInboundPathProcessor.php

Namespace

Drupal\update_script_test\PathProcessor

File

core/modules/system/tests/modules/update_script_test/src/PathProcessor/BrokenInboundPathProcessor.php

View source
<?php

declare (strict_types=1);
namespace Drupal\update_script_test\PathProcessor;

use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Drupal\Core\State\StateInterface;
use Symfony\Component\HttpFoundation\Request;

/**
 * Example path processor which breaks on inbound.
 */
class BrokenInboundPathProcessor implements InboundPathProcessorInterface {
    
    /**
     * The state.
     *
     * @var \Drupal\Core\State\StateInterface
     */
    protected $state;
    
    /**
     * Constructs a new BrokenInboundPathProcessor instance.
     *
     * @param \Drupal\Core\State\StateInterface $state
     *   The state.
     */
    public function __construct(StateInterface $state) {
        $this->state = $state;
    }
    
    /**
     * {@inheritdoc}
     */
    public function processInbound($path, Request $request) {
        if ($this->state
            ->get('update_script_test_broken_inbound', FALSE)) {
            throw new \RuntimeException();
        }
        else {
            return $path;
        }
    }

}

Classes

Title Deprecated Summary
BrokenInboundPathProcessor Example path processor which breaks on inbound.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.