StringField::isValid()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * A String field
5
 */
6
namespace Rocket\Entities\Fields;
7
8
use Rocket\Entities\Field;
9
10
/**
11
 * String Field
12
 *
13
 * @property string $value The field's value
14
 */
15
class StringField extends Field
16
{
17
    /**
18
     * @var string The table associated with the model.
19
     */
20
    public $table = 'field_string';
21
22
    /**
23
     * Checks if a field is valid
24
     *
25
     * @param mixed $value The value to validate
26
     * @return bool
27
     */
28 141
    protected function isValid($value)
29
    {
30 141
        return is_string($value) && strlen($value) <= 255;
31
    }
32
}
33