TextType::getTextRows()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Prateekkarki\Laragen\Models\Types\General;
3
use Prateekkarki\Laragen\Models\Types\GeneralType;
4
5
class TextType extends GeneralType
6
{
7
    protected $dataType = 'text';
8
    protected $formType = 'text';
9
    protected $validationRule = 'string';
10
11
    public function getFormOptions() {
12
        $options = "";
13
        $options .= $this->isRequired() ? 'required="required" ' : ''; 
0 ignored issues
show
Bug introduced by
The method isRequired() does not exist on Prateekkarki\Laragen\Models\Types\General\TextType. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

13
        $options .= $this->/** @scrutinizer ignore-call */ isRequired() ? 'required="required" ' : ''; 
Loading history...
14
        $options .= 'rows="'.$this->getTextRows().'" '; 
15
        return $options;
16
    }
17
18
    public function getTextRows() {
19
        if (!$this->size) {
20
                    return 4;
21
        }
22
        
23
        return floor($this->getsize() / 120);
24
    }
25
}
26