| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | protected function createSigner($algorithm = 'sha256', $type = null) |
||
| 12 | { |
||
| 13 | if (is_null($type)) { |
||
| 14 | $type = class_basename($this); |
||
| 15 | } else { |
||
| 16 | $type = Str::studly($type); |
||
| 17 | } |
||
| 18 | |||
| 19 | $algorithm = Str::studly($algorithm); |
||
| 20 | |||
| 21 | // Check if provided class exists and extends BaseVerifier |
||
| 22 | // to avoid possible code injections |
||
| 23 | if (is_subclass_of($class = Signer::class.'\\'.$type.'\\'.$algorithm, Signer\BaseSigner::class)) { |
||
| 24 | return new $class; |
||
| 25 | } |
||
| 26 | |||
| 27 | throw new InvalidArgumentException('['.$algorithm.'] is not supported in ['.$type.'] verifier.'); |
||
| 28 | } |
||
| 29 | } |
||
| 30 |