| Total Complexity | 5 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 13 | class RfCreditorReferenceGenerator implements SelfValidatableInterface |
||
| 14 | { |
||
| 15 | use SelfValidatableTrait; |
||
| 16 | |||
| 17 | /** @var string */ |
||
| 18 | protected $reference; |
||
| 19 | |||
| 20 | public static function generate(string $reference) : string |
||
| 21 | { |
||
| 22 | $generator = new self($reference); |
||
| 23 | |||
| 24 | return $generator->doGenerate(); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function __construct(string $reference) |
||
| 30 | } |
||
| 31 | |||
| 32 | public function doGenerate() : string |
||
| 33 | { |
||
| 34 | if (!$this->isValid()) { |
||
| 35 | throw new InvalidCreditorReferenceException( |
||
| 36 | 'The provided data is not valid to generate a creditor reference.' |
||
| 37 | ); |
||
| 38 | } |
||
| 39 | |||
| 40 | $generator = new phpIso11649(); |
||
| 41 | |||
| 42 | return $generator->generateRfReference($this->reference, false); |
||
|
|
|||
| 43 | } |
||
| 44 | |||
| 45 | public static function loadValidatorMetadata(ClassMetadata $metadata): void |
||
| 57 | ]); |
||
| 58 | } |
||
| 59 | } |
||
| 60 |