User   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

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

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 1
    public function __construct()
13
    {
14 1
        parent::__construct(['table' => 'user', 'field' => 'id']);
15 1
    }
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