File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 33namespace hiqdev \php \billing \product ;
44
55use hiqdev \php \billing \product \behavior \InvalidBehaviorException ;
6+ use hiqdev \php \billing \product \invoice \InvalidRepresentationException ;
67use hiqdev \php \billing \product \invoice \RepresentationInterface ;
78use hiqdev \php \billing \product \price \PriceTypeDefinition ;
89use hiqdev \php \billing \product \quantity \QuantityFormatterNotFoundException ;
@@ -47,6 +48,10 @@ public function priceTypes(): \Generator
4748 */
4849 public function getRepresentationsByType (string $ representationClass ): array
4950 {
51+ if (!class_exists ($ representationClass )) {
52+ throw new InvalidRepresentationException ("Class ' $ representationClass' does not exist " );
53+ }
54+
5055 $ representations = [];
5156 foreach ($ this ->priceTypes () as $ priceTypeDefinition ) {
5257 foreach ($ priceTypeDefinition ->documentRepresentation () as $ representation ) {
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace hiqdev \php \billing \product \invoice ;
4+
5+ use InvalidArgumentException ;
6+
7+ class InvalidRepresentationException extends InvalidArgumentException
8+ {
9+
10+ }
You can’t perform that action at this time.
0 commit comments