@@ -56,15 +56,15 @@ public function validate(string $subject, array $parameters): void {
5656 throw new InvalidObjectExeption ('Parameter is malformed ' );
5757 }
5858
59- $ this ->validateParameter ($ parameter );
59+ $ this ->validateParameter ($ placeholder , $ parameter );
6060 }
6161 }
6262
6363 /**
6464 * @param array $parameter
6565 * @throws InvalidObjectExeption
6666 */
67- protected function validateParameter (array $ parameter ): void {
67+ protected function validateParameter (string $ placeholder , array $ parameter ): void {
6868 if (!isset ($ parameter ['type ' ])) {
6969 throw new InvalidObjectExeption ('Object type is undefined ' );
7070 }
@@ -74,15 +74,15 @@ protected function validateParameter(array $parameter): void {
7474
7575 $ missingKeys = array_diff ($ requiredParameters , array_keys ($ parameter ));
7676 if (!empty ($ missingKeys )) {
77- throw new InvalidObjectExeption ('Object is invalid, missing keys: ' . json_encode ($ missingKeys ));
77+ throw new InvalidObjectExeption ('Object for placeholder ' . $ placeholder . ' is invalid, missing keys: ' . json_encode ($ missingKeys ));
7878 }
7979
8080 foreach ($ parameter as $ key => $ value ) {
8181 if (!is_string ($ key )) {
82- throw new InvalidObjectExeption ('Object is invalid, key ' . $ key . ' is not a string ' );
82+ throw new InvalidObjectExeption ('Object for placeholder ' . $ placeholder . ' is invalid, key ' . $ key . ' is not a string ' );
8383 }
8484 if (!is_string ($ value )) {
85- throw new InvalidObjectExeption ('Object is invalid, value ' . $ value . ' is not a string ' );
85+ throw new InvalidObjectExeption ('Object for placeholder ' . $ placeholder . ' is invalid, value ' . $ value . ' for key ' . $ key . ' is not a string ' );
8686 }
8787 }
8888 }
0 commit comments