EmptyGuard   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 10
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A emptyGuard() 0 4 2
1
<?php namespace Mbh\Traits;
2
3
/**
4
 * MBHFramework
5
 *
6
 * @link      https://github.com/MBHFramework/mbh-framework
7
 * @copyright Copyright (c) 2017 Ulises Jeremias Cornejo Fandos
8
 * @license   https://github.com/MBHFramework/mbh-framework/blob/master/LICENSE (MIT License)
9
 */
10
11
use Mbh\Exceptions\EmptyException;
12
13
/**
14
 * Common to structures that require an empty guard.
15
 */
16
trait EmptyGuard
17
{
18
    protected function emptyGuard($method)
19
    {
20
        if ($this->isEmpty()) {
21
            throw EmptyException::cannotAccessWhenEmpty(__CLASS__, $method);
22
        }
23
    }
24
25
    abstract public function isEmpty(): bool;
26
}
27