4946417a45828cd72efd720395f7ff33253e9a26
[yaffs-website] / Controller / LonelyMonkeyController.php
1 <?php
2
3 namespace Drupal\error_service_test\Controller;
4
5 use Drupal\Core\Controller\ControllerBase;
6 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
7 use Drupal\error_service_test\LonelyMonkeyClass;
8 use Symfony\Component\DependencyInjection\ContainerInterface;
9
10 /**
11  * Provides a controller which calls out to a service with missing dependencies.
12  */
13 class LonelyMonkeyController extends ControllerBase implements ContainerInjectionInterface {
14
15   public function __construct(LonelyMonkeyClass $class) {
16     $this->class = $class;
17   }
18
19   public function testBrokenClass() {
20     return [
21       '#markup' => $this->t('This should be broken.'),
22     ];
23   }
24
25   /**
26    * {@inheritdoc}
27    */
28   public static function create(ContainerInterface $container) {
29     return new static($container->get('broken_class_with_missing_dependency'));
30   }
31
32 }