1 | <?php |
||
5 | class StringHelper { |
||
6 | |||
7 | /** |
||
8 | * Turn a list of machine names into a camel-cased string. |
||
9 | * |
||
10 | * @return string |
||
11 | * A camel-cased concatenation of the input components. |
||
12 | * |
||
13 | * @throws \InvalidArgumentException |
||
14 | * If the provided input does can't be converted to a specification compliant |
||
15 | * string representation for field or type names. |
||
16 | */ |
||
17 | public static function camelCase() { |
||
29 | |||
30 | /** |
||
31 | * Turn a list of machine names into a property-cased string. |
||
32 | * |
||
33 | * @return string |
||
34 | * A camel-cased concatenation of the input components. |
||
35 | */ |
||
36 | public static function propCase() { |
||
40 | |||
41 | /** |
||
42 | * Wraps a type string in brackets declaring it as a list. |
||
43 | * |
||
44 | * @param string $type |
||
45 | * The type to declare as a list. |
||
46 | * |
||
47 | * @return string |
||
48 | * The decorated type string. |
||
49 | */ |
||
50 | public static function listType($type) { |
||
53 | |||
54 | /** |
||
55 | * Appends an exclamation mark to a type string declaring it as non-null. |
||
56 | * |
||
57 | * @param string $type |
||
58 | * The type to declare as non-null. |
||
59 | * |
||
60 | * @return string |
||
61 | * The decorated type string. |
||
62 | */ |
||
63 | public static function nonNullType($type) { |
||
66 | |||
67 | /** |
||
68 | * Decorates a type as non-null and/or as a list. |
||
69 | * |
||
70 | * @param string $type |
||
71 | * The type to declare as non-null. |
||
72 | * @param bool $list |
||
73 | * Whether to mark the type as a list. |
||
74 | * @param bool $required |
||
75 | * Whether to mark the type as required. |
||
76 | * |
||
77 | * @return string |
||
78 | * The decorated type. |
||
79 | */ |
||
80 | public static function decorateType($type, $list = FALSE, $required = FALSE) { |
||
91 | |||
92 | /** |
||
93 | * Parses a type definition from a string and properly decorates it. |
||
94 | * |
||
95 | * Converts type strings (e.g. [Foo!]) to their object representations. |
||
96 | * |
||
97 | * @param string $type |
||
98 | * The type string to parse. |
||
99 | * |
||
100 | * @return array |
||
101 | * The extracted type with the type decorators. |
||
102 | */ |
||
103 | public static function parseType($type) { |
||
126 | |||
127 | } |