| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | 334 | private static function getClass(string $name): AttributeInterface |
|
| 45 | { |
||
| 46 | /** @var class-string<AttributeInterface> $classString */ |
||
| 47 | 334 | $classString = sprintf('\Enjoys\Forms\Attributes\%sAttribute', ucfirst(strtolower($name))); |
|
| 48 | 334 | if (class_exists($classString)) { |
|
| 49 | 326 | $attributeClass = new $classString(); |
|
| 50 | } else { |
||
| 51 | 301 | $attributeClass = (new Base())->withName($name); |
|
| 52 | } |
||
| 53 | 334 | return $attributeClass; |
|
| 54 | } |
||
| 56 |