Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationControllerBase
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 1
 renderBuilder
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\display_builder\Controller;
6
7use Drupal\Core\Controller\ControllerBase;
8use Drupal\display_builder\DisplayBuildableInterface;
9use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
10use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
11
12/**
13 * Shared logic between integrations controllers.
14 */
15abstract class IntegrationControllerBase extends ControllerBase {
16
17  /**
18   * Render a Display Builder profile entity view.
19   *
20   * @param \Drupal\display_builder\DisplayBuildableInterface $buildable
21   *   The integration using the display builder.
22   *
23   * @return array
24   *   A renderable array
25   */
26  protected function renderBuilder(DisplayBuildableInterface $buildable): array {
27    /** @var \Drupal\display_builder\ProfileInterface $profile */
28    $profile = $buildable->getProfile();
29
30    if (!$profile) {
31      throw new NotFoundHttpException();
32    }
33
34    if (!$profile->access('view')) {
35      throw new AccessDeniedHttpException();
36    }
37
38    $instance_id = $buildable->getInstanceId();
39    $buildable->initInstanceIfMissing();
40    $view_builder = $this->entityTypeManager()->getViewBuilder('display_builder_profile');
41
42    return $view_builder->view($profile, $instance_id);
43  }
44
45}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

IntegrationControllerBase->renderBuilder
26  protected function renderBuilder(DisplayBuildableInterface $buildable): array {
27    /** @var \Drupal\display_builder\ProfileInterface $profile */
28    $profile = $buildable->getProfile();
29
30    if (!$profile) {
31      throw new NotFoundHttpException();
34    if (!$profile->access('view')) {
35      throw new AccessDeniedHttpException();
38    $instance_id = $buildable->getInstanceId();
39    $buildable->initInstanceIfMissing();
40    $view_builder = $this->entityTypeManager()->getViewBuilder('display_builder_profile');
41
42    return $view_builder->view($profile, $instance_id);