Completed
Pull Request — 2.0.x (#6)
by Andrew
02:11
created

InvalidDisplayVariablesException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A passedToDisplay() 0 10 1
1
<?php
2
/**
3
 * @author     Andrew Coulton <[email protected]>
4
 * @copyright  2015 inGenerator Ltd
5
 * @license    http://kohanaframework.org/license
6
 */
7
8
namespace Ingenerator\KohanaView\Exception;
9
10
/**
11
 * Thrown when the application attempts to pass invalid variables to a view's display
12
 * method.
13
 *
14
 * @package Ingenerator\KohanaView\Exception
15
 */
16
class InvalidDisplayVariablesException extends \InvalidArgumentException
17
{
18
19
    /**
20
     * @param string $view_class
21
     * @param string $errors
22
     *
23
     * @return static
24
     */
25
    public static function passedToDisplay($view_class, $errors)
26
    {
27
        return new static(
28
            sprintf(
29
                "Invalid variables provided to %s::display()\n%s",
30
                $view_class,
31
                ' - '.implode("\n - ", $errors)
32
            )
33
        );
34
    }
35
}
36