We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4cc5a4 commit 91dfa12Copy full SHA for 91dfa12
src/ErrorHandling/ErrorTextHelper.php
@@ -0,0 +1,28 @@
1
+<?php
2
+
3
+namespace WikibaseSolutions\CypherDSL\ErrorHandling;
4
5
+class ErrorTextHelper {
6
+ public static function getTypeErrorObjectArrayText(
7
+ string $varName,
8
+ $typeNames,
9
+ $userInput
10
+ ) {
11
+ $userInputInfo = self::getUserInputInfo($userInput);
12
13
+ if (is_array($typeNames)) {
14
+ $typeNames = implode( ' or ', $typeNames );
15
+ }
16
17
+ return "\$$varName should consist of only $typeNames objects, $userInputInfo given.";
18
19
20
+ public static function getUserInputInfo($userInput) : string {
21
+ $info = gettype( $userInput );
22
+ if ( $info === 'object' ) {
23
+ $info = get_class( $userInput );
24
+ } else {
25
+ $givenType .= ' "' . (string) $userInput . '"';
26
27
28
+}
0 commit comments