EnvValidator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A validate() 0 6 2
1
<?php
2
3
namespace Melihovv\LaravelEnvValidator;
4
5
use Illuminate\Validation\Validator;
6
7
class EnvValidator
8
{
9
    /**
10
     * @var Validator
11
     */
12
    private $validator;
13
14
    public function __construct(Validator $validator)
15
    {
16
        $this->validator = $validator;
17
    }
18
19
    public function validate()
20
    {
21
        if ($this->validator->fails()) {
22
            $messages = array_values($this->validator->messages()->all());
23
24
            throw EnvValidationFailed::fromMessages($messages);
25
        }
26
    }
27
}
28