Passed
Push — master ( afdc6b...e39cc4 )
by Adrien
03:24
created

User   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 3
c 0
b 0
f 0
dl 0
loc 19
ccs 0
cts 7
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A isValid() 0 3 2
1
<?php
2
3
namespace mQueue\Form\Validate;
4
5
use Zend_Validate_Db_RecordExists;
6
7
/**
8
 * Validator for User ID.
9
 */
10
class User extends Zend_Validate_Db_RecordExists
11
{
12
    public function __construct()
13
    {
14
        parent::__construct(['table' => 'user', 'field' => 'id']);
15
    }
16
17
    /**
18
     * Defined by Zend_Validate_Interface
19
     *
20
     * Returns true if and only if $value contains a valid User ID
21
     *
22
     * @param int $value
23
     *
24
     * @return bool
25
     */
26
    public function isValid($value)
27
    {
28
        return ($value === 0) || parent::isValid($value);
29
    }
30
}
31