GenericValidation   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 24
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isRequired() 0 6 3
A isNotNull() 0 4 2
1
<?php
2
/**
3
 * Author: Nil Portugués Calderó <[email protected]>
4
 * Date: 9/20/14
5
 * Time: 11:46 AM
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace NilPortugues\Validator\Validation;
12
13
/**
14
 * Class GenericAttribute
15
 * @package Tests\NilPortugues\Validator\Validation
16
 */
17
class GenericValidation
18
{
19
    /**
20
     * @param string|null $value
21
     *
22
     * @return bool
23
     */
24
    public static function isRequired($value)
25
    {
26
        return isset($value) === true
27
        && \is_null($value) === false
28
        && empty($value) === false;
29
    }
30
31
    /**
32
     * @param string|null $value
33
     *
34
     * @return bool
35
     */
36
    public static function isNotNull($value)
37
    {
38
        return $value !== null && $value !== '';
39
    }
40
}
41