| Total Complexity | 10 |
| Total Lines | 87 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | final class SubmitButton implements ButtonInterface |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | private $name; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | private $value; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var array |
||
| 27 | */ |
||
| 28 | private $groups; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var bool |
||
| 32 | */ |
||
| 33 | private $clicked = false; |
||
| 34 | |||
| 35 | |||
| 36 | /** |
||
| 37 | * SubmitButton constructor. |
||
| 38 | * |
||
| 39 | * @param string $name |
||
| 40 | * @param string $value |
||
| 41 | * @param string[] $groups |
||
| 42 | */ |
||
| 43 | 15 | public function __construct(string $name, string $value = 'ok', array $groups = []) |
|
| 44 | { |
||
| 45 | 15 | $this->name = $name; |
|
| 46 | 15 | $this->value = $value; |
|
| 47 | 15 | $this->groups = $groups; |
|
| 48 | 15 | } |
|
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | 7 | public function name(): string |
|
| 54 | { |
||
| 55 | 7 | return $this->name; |
|
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * {@inheritdoc} |
||
| 60 | */ |
||
| 61 | 7 | public function clicked(): bool |
|
| 62 | { |
||
| 63 | 7 | return $this->clicked; |
|
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * {@inheritdoc} |
||
| 68 | */ |
||
| 69 | 5 | public function constraintGroups(): array |
|
| 70 | { |
||
| 71 | 5 | return $this->groups; |
|
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * {@inheritdoc} |
||
| 76 | */ |
||
| 77 | 10 | public function submit($data): bool |
|
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * {@inheritdoc} |
||
| 84 | */ |
||
| 85 | 2 | public function toHttp(): array |
|
| 92 | } |
||
| 93 | |||
| 94 | /** |
||
| 95 | * {@inheritdoc} |
||
| 96 | */ |
||
| 97 | 3 | public function view(?HttpFieldPath $parent = null): ButtonViewInterface |
|
| 102 |