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

NoViewTemplateException::getView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
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