Version 1
[yaffs-website] / web / core / modules / system / tests / modules / update_script_test / src / PathProcessor / BrokenInboundPathProcessor.php
1 <?php
2
3 namespace Drupal\update_script_test\PathProcessor;
4
5 use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
6 use Drupal\Core\State\StateInterface;
7 use Symfony\Component\HttpFoundation\Request;
8
9 /**
10  * Example path processor which breaks on inbound.
11  */
12 class BrokenInboundPathProcessor implements InboundPathProcessorInterface {
13
14   /**
15    * The state.
16    *
17    * @var \Drupal\Core\State\StateInterface
18    */
19   protected $state;
20
21   /**
22    * Constructs a new BrokenInboundPathProcessor instance.
23    *
24    * @param \Drupal\Core\State\StateInterface $state
25    *   The state.
26    */
27   public function __construct(StateInterface $state) {
28     $this->state = $state;
29   }
30
31   /**
32    * {@inheritdoc}
33    */
34   public function processInbound($path, Request $request) {
35     if ($this->state->get('update_script_test_broken_inbound', FALSE)) {
36       throw new \RuntimeException();
37     }
38     else {
39       return $path;
40     }
41   }
42
43 }