| Total Complexity | 4 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class Text extends AGraphical |
||
| 16 | { |
||
| 17 | 4 | public function set(string $alias, ArrayAccess &$session, string $errorMessage, string $font = '/usr/share/fonts/truetype/freefont/FreeMono.ttf'): self |
|
| 18 | { |
||
| 19 | 4 | $this->font = $font; |
|
| 20 | 4 | $text = strtoupper($this->generateRandomString(8)); |
|
| 21 | |||
| 22 | 4 | $this->setEntry($alias, null, $text); |
|
| 23 | 4 | $this->fillSession($alias, $session, $text); |
|
| 24 | 4 | $this->setAttribute('id', $this->getKey()); |
|
| 25 | 4 | parent::addRule(IRules::SATISFIES_CALLBACK, $errorMessage, [$this, 'checkFillCaptcha']); |
|
| 26 | 4 | return $this; |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | public function addRule(/** @scrutinizer ignore-unused */ string $ruleName, /** @scrutinizer ignore-unused */ string $errorText, /** @scrutinizer ignore-unused */ ...$args): void |
|
| 30 | { |
||
| 31 | // no additional rules applicable |
||
| 32 | 1 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * @param mixed $value |
||
| 36 | * @return bool |
||
| 37 | */ |
||
| 38 | 1 | public function checkFillCaptcha($value): bool |
|
| 42 | } |
||
| 43 | } |
||
| 44 |