Passed
Pull Request — master (#23)
by Prateek
07:40
created

TextType   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 18
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTextRows() 0 5 2
A getFormOptions() 0 5 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" ' : ''; 
14
        $options .='rows="'.$this->getTextRows().'" '; 
15
        return $options;
16
    }
17
18
    public function getTextRows() {
19
        if (!$this->size)
20
            return 4;
21
        
22
        return floor($this->getsize() / 120);
0 ignored issues
show
Bug introduced by
The method getsize() 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

22
        return floor($this->/** @scrutinizer ignore-call */ getsize() / 120);
Loading history...
23
    }
24
}
25