Completed
Push — ezp26175-exception_on_non_defa... ( 77d2f3...ca5fc8 )
by
unknown
39:33
created

NoViewTemplateException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getView() 0 4 1
1
<?php
2
/**
3
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
4
 * @license For full copyright and license information view LICENSE file distributed with this source code.
5
 */
6
namespace eZ\Publish\Core\MVC\Exception;
7
8
use Exception;
9
use eZ\Publish\Core\MVC\Symfony\View\View;
10
11
/**
12
 * Thrown when a view is attempted to be rendered without a template set.
13
 */
14
class NoViewTemplateException extends Exception
15
{
16
    /**
17
     * @var View
18
     */
19
    private $view;
20
21
    public function __construct(View $view)
22
    {
23
        $this->view = $view;
24
        parent::__construct(
25
            sprintf(
26
                "No view template was set to render the view with the '%s' view type. Check your view configuration.",
27
                $view->getViewType()
28
            )
29
        );
30
    }
31
32
    public function getView()
33
    {
34
        return $this->view;
35
    }
36
}
37