Completed
Push — master ( 59fb2e...bf9165 )
by Manuel
03:41
created

Request::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PiFinder\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
7
abstract class Request extends FormRequest
8
{
9 7
    public function __construct()
10
    {
11 7
        parent::__construct();
12
13 7
        $this->validateMac();
14 7
    }
15
16
    public function validateMac()
17
    {
18 7
        app('validator')->extend('mac', function ($attribute, $value, $parameters) {
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19 7
            return preg_match('/^(([0-9a-fA-F]{2}-){5}|([0-9a-fA-F]{2}:){5})[0-9a-fA-F]{2}$/', $value);
20 7
        });
21 7
    }
22
}
23