Completed
Push — master ( 660252...6055b4 )
by ARCANEDEV
13:08 queued 05:17
created

Abortable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pageNotFound() 0 4 1
A accessNotAllowed() 0 4 1
1
<?php namespace Arcanedev\Support\Traits;
2
3
/**
4
 * Trait     Abortable
5
 *
6
 * @package  Arcanedev\Support\Traits
7
 * @author   ARCANEDEV <[email protected]>
8
 */
9
trait Abortable
10
{
11
    /* ------------------------------------------------------------------------------------------------
12
     |  Main Functions
13
     | ------------------------------------------------------------------------------------------------
14
     */
15
    /**
16
     * Throw Page not found [404].
17
     *
18
     * @param  string  $message
19
     * @param  array   $headers
20
     */
21 9
    protected static function pageNotFound($message = 'Page not Found', array $headers = [])
22
    {
23 9
        return abort(404, $message, $headers);
24
    }
25
26
    /**
27
     * Throw AccessNotAllowed [403].
28
     *
29
     * @param  string  $message
30
     * @param  array   $headers
31
     */
32
    protected static function accessNotAllowed($message = 'Access denied !', array $headers = [])
33
    {
34
        return abort(403, $message, $headers);
35
    }
36
}
37