TextType   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 19
rs 10
c 1
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFormOptions() 0 5 2
A getTextRows() 0 6 2
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