User::isValid()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
ccs 0
cts 2
cp 0
cc 2
nc 2
nop 1
crap 6
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