TextField   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 3
b 0
f 0
dl 0
loc 13
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A validate() 0 3 2
1
<?php
2
namespace Lepton\Boson\DataTypes;
3
4
#[\Attribute]
5
class TextField extends Field{
6
7
8
9
  public function __construct(private $max_length = 128, ...$options ){
10
     parent::__construct(...$options);
0 ignored issues
show
Bug introduced by
$options is expanded, but the parameter $null of Lepton\Boson\DataTypes\Field::__construct() does not expect variable arguments. ( Ignorable by Annotation )

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

10
     parent::__construct(/** @scrutinizer ignore-type */ ...$options);
Loading history...
11
12
  }
13
14
  public function validate($value){
15
    if(strlen($value) > $this->max_length) return false;
16
    return parent::validate($value);
17
  }
18
}