AttributeSetException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 30
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A chooseTemplate() 0 7 2
1
<?php
2
/**
3
 * This file is part of graze/config-validation.
4
 *
5
 * Copyright (c) 2017 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/config-validation/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/config-validation
12
 */
13
14
namespace Graze\ConfigValidation\Exceptions;
15
16
use Respect\Validation\Exceptions\GroupedValidationException;
17
18
class AttributeSetException extends GroupedValidationException
19
{
20
    const STRUCTURE = 2;
21
22
    /**
23
     * @var array
24
     */
25
    public static $defaultTemplates = [
26
        self::MODE_DEFAULT  => [
27
            self::NONE      => 'All of the required rules must pass for {{name}}',
28
            self::SOME      => 'These rules must pass for {{name}}',
29
            self::STRUCTURE => 'Must not have unknown attributes {{attributes}}',
30
        ],
31
        self::MODE_NEGATIVE => [
32
            self::NONE      => 'None of these rules must pass for {{name}}',
33
            self::SOME      => 'These rules must not pass for {{name}}',
34
            self::STRUCTURE => 'Must have unknown attributes {{attributes}}',
35
        ],
36
    ];
37
38
    /**
39
     * {@inheritdoc}
40
     */
41 4
    public function chooseTemplate()
42
    {
43 4
        if ($this->getParam('attributes')) {
44 3
            return static::STRUCTURE;
45
        }
46
47 1
        return parent::chooseTemplate();
48
    }
49
}
50