Passed
Push — master ( b3147e...c49c81 )
by Ferry
03:13
created

Text::maxLength()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: User
5
 * Date: 1/26/2019
6
 * Time: 6:00 PM
7
 */
8
9
namespace crocodicstudio\crudbooster\types;
10
11
use crocodicstudio\crudbooster\controllers\scaffolding\traits\DefaultOption;
12
use crocodicstudio\crudbooster\controllers\scaffolding\traits\Join;
13
use crocodicstudio\crudbooster\types\text\TextModel;
14
15
class Text
16
{
17
    use DefaultOption, Join;
18
19
    public function strLimit($length = 100) {
20
        $data = columnSingleton()->getColumn($this->index);
21
        /** @var WysiwygModel $data */
22
        $data->setLimit($length);
23
24
        columnSingleton()->setColumn($this->index, $data);
25
26
        return $this;
27
    }
28
29
    public function maxLength($length) {
30
        $model = columnSingleton()->getColumn($this->index);
31
        /**
32
         * @var TextModel $model
33
         */
34
        $model->setMaxLength($length);
35
        columnSingleton()->setColumn($this->index, $model);
36
    }
37
38
    public function minLength($length) {
39
        $model = columnSingleton()->getColumn($this->index);
40
        /**
41
         * @var TextModel $model
42
         */
43
        $model->setMinLength($length);
44
        columnSingleton()->setColumn($this->index, $model);
45
    }
46
}