Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 5 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| IntegrationControllerBase | |
0.00% |
0 / 9 |
|
0.00% |
0 / 5 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
| renderBuilder | |
0.00% |
0 / 9 |
|
0.00% |
0 / 5 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\display_builder\Controller; |
| 6 | |
| 7 | use Drupal\Core\Controller\ControllerBase; |
| 8 | use Drupal\display_builder\DisplayBuildableInterface; |
| 9 | use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; |
| 10 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
| 11 | |
| 12 | /** |
| 13 | * Shared logic between integrations controllers. |
| 14 | */ |
| 15 | abstract 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 | } |
Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not
necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once.
Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 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(); |
| 26 | protected function renderBuilder(DisplayBuildableInterface $buildable): array { |
| 27 | /** @var \Drupal\display_builder\ProfileInterface $profile */ |
| 28 | $profile = $buildable->getProfile(); |
| 29 | |
| 30 | if (!$profile) { |
| 34 | if (!$profile->access('view')) { |
| 35 | throw new AccessDeniedHttpException(); |
| 26 | protected function renderBuilder(DisplayBuildableInterface $buildable): array { |
| 27 | /** @var \Drupal\display_builder\ProfileInterface $profile */ |
| 28 | $profile = $buildable->getProfile(); |
| 29 | |
| 30 | if (!$profile) { |
| 34 | if (!$profile->access('view')) { |
| 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); |