class DumperTestController

Same name in other branches
  1. 4.x tests/modules/devel_dumper_test/src/Controller/DumperTestController.php \Drupal\devel_dumper_test\Controller\DumperTestController
  2. 5.x tests/modules/devel_dumper_test/src/Controller/DumperTestController.php \Drupal\devel_dumper_test\Controller\DumperTestController

Class DumperTestController

Hierarchy

  • class \Drupal\devel_dumper_test\Controller\DumperTestController extends \Drupal\Core\Controller\ControllerBase

Expanded class hierarchy of DumperTestController

File

tests/modules/devel_dumper_test/src/Controller/DumperTestController.php, line 12

Namespace

Drupal\devel_dumper_test\Controller
View source
class DumperTestController extends ControllerBase {
    
    /**
     * The dumper manager.
     *
     * @var \Drupal\devel\DevelDumperManagerInterface
     */
    protected $dumper;
    
    /**
     * Constructs a new DumperTestController object.
     *
     * @param \Drupal\devel\DevelDumperManagerInterface $devel_dumper_manager
     *   The dumper manager.
     */
    public function __construct(DevelDumperManagerInterface $devel_dumper_manager) {
        $this->dumper = $devel_dumper_manager;
    }
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container) {
        return new static($container->get('devel.dumper'));
    }
    
    /**
     * @return array
     */
    public function dump() {
        $this->dumper
            ->dump('Test output');
        return [
            '#markup' => 'test',
        ];
    }
    
    /**
     * @return array
     */
    public function message() {
        $this->dumper
            ->message('Test output');
        return [
            '#markup' => 'test',
        ];
    }
    
    /**
     * @return array
     */
    public function debug() {
        $this->dumper
            ->debug('Test output');
        return [
            '#markup' => 'test',
        ];
    }
    
    /**
     * @return array
     */
    public function export() {
        return [
            '#markup' => $this->dumper
                ->export('Test output'),
        ];
    }
    
    /**
     * @return array
     */
    public function exportRenderable() {
        return $this->dumper
            ->exportAsRenderable('Test output');
    }

}

Members

Title Sort descending Modifiers Object type Summary
DumperTestController::$dumper protected property The dumper manager.
DumperTestController::create public static function
DumperTestController::debug public function
DumperTestController::dump public function
DumperTestController::export public function
DumperTestController::exportRenderable public function
DumperTestController::message public function
DumperTestController::__construct public function Constructs a new DumperTestController object.