NotExistsInTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validate() 0 3 1
A __construct() 0 4 1
1
<?php
2
/**
3
 * This file is part of user_management
4
 * User: Sinan TURGUT <[email protected]>
5
 * Date: 24.06.2019
6
 * php version 7.2
7
 *
8
 * @category Assessment
9
 * @package  UserManagement
10
 * @author   Sinan TURGUT <[email protected]>
11
 * @license  See LICENSE file
12
 * @link     https://dev.sinanturgut.com.tr
13
 */
14
15
namespace UserManagement\Validation\Rules;
16
17
use Respect\Validation\Rules\AbstractRule;
0 ignored issues
show
Bug introduced by
The type Respect\Validation\Rules\AbstractRule was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
19
/**
20
 * Class NotExistsInTable
21
 * @package UserManagement\Validation\Rules
22
 */
23
class NotExistsInTable extends AbstractRule
24
{
25
    /**
26
     * @var
27
     */
28
    private $columns;
29
    /**
30
     * @var
31
     */
32
    private $table;
33
34
    /**
35
     * NotExistsInTable constructor.
36
     * @param $table
37
     * @param $columns
38
     */
39
    public function __construct($table, $columns)
40
    {
41
        $this->table = $table;
42
        $this->columns = $columns;
43
    }
44
45
    /**
46
     * @param $input
47
     * @return mixed
48
     */
49
    public function validate($input)
50
    {
51
        return $this->table->where($this->columns, $input)->exists();
52
    }
53
}