@@ -67,10 +67,10 @@ |
||
67 | 67 | * the model layer. |
68 | 68 | */ |
69 | 69 | foreach ($keys as $key) { |
70 | - if (isset($result[ $key ])) { |
|
71 | - $loadedItems[ $key ] = $result[ $key ]; |
|
70 | + if (isset($result[$key])) { |
|
71 | + $loadedItems[$key] = $result[$key]; |
|
72 | 72 | } else { |
73 | - $loadedItems[ $key ] = null; |
|
73 | + $loadedItems[$key] = null; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | return $loadedItems; |
@@ -15,65 +15,65 @@ |
||
15 | 15 | */ |
16 | 16 | abstract class AbstractLoader extends AbstractDataLoader |
17 | 17 | { |
18 | - protected $primaryKey; |
|
18 | + protected $primaryKey; |
|
19 | 19 | |
20 | - /** |
|
21 | - * @return EEM_Base |
|
22 | - * @throws EE_Error |
|
23 | - * @throws InvalidArgumentException |
|
24 | - * @throws InvalidDataTypeException |
|
25 | - * @throws InvalidInterfaceException |
|
26 | - */ |
|
27 | - abstract protected function getQuery(): EEM_Base; |
|
20 | + /** |
|
21 | + * @return EEM_Base |
|
22 | + * @throws EE_Error |
|
23 | + * @throws InvalidArgumentException |
|
24 | + * @throws InvalidDataTypeException |
|
25 | + * @throws InvalidInterfaceException |
|
26 | + */ |
|
27 | + abstract protected function getQuery(): EEM_Base; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @param array $keys |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - abstract protected function getWhereParams(array $keys): array; |
|
29 | + /** |
|
30 | + * @param array $keys |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + abstract protected function getWhereParams(array $keys): array; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Given array of keys, loads and returns a map consisting of keys from `keys` array and loaded |
|
37 | - * values |
|
38 | - * |
|
39 | - * Note that order of returned values must match exactly the order of keys. |
|
40 | - * If some entry is not available for given key - it must include null for the missing key. |
|
41 | - * |
|
42 | - * For example: |
|
43 | - * loadKeys(['a', 'b', 'c']) -> ['a' => 'value1, 'b' => null, 'c' => 'value3'] |
|
44 | - * |
|
45 | - * @param array $keys |
|
46 | - * |
|
47 | - * @return array |
|
48 | - * @throws Exception |
|
49 | - */ |
|
50 | - public function loadKeys(array $keys): array |
|
51 | - { |
|
52 | - if (empty($keys)) { |
|
53 | - return $keys; |
|
54 | - } |
|
35 | + /** |
|
36 | + * Given array of keys, loads and returns a map consisting of keys from `keys` array and loaded |
|
37 | + * values |
|
38 | + * |
|
39 | + * Note that order of returned values must match exactly the order of keys. |
|
40 | + * If some entry is not available for given key - it must include null for the missing key. |
|
41 | + * |
|
42 | + * For example: |
|
43 | + * loadKeys(['a', 'b', 'c']) -> ['a' => 'value1, 'b' => null, 'c' => 'value3'] |
|
44 | + * |
|
45 | + * @param array $keys |
|
46 | + * |
|
47 | + * @return array |
|
48 | + * @throws Exception |
|
49 | + */ |
|
50 | + public function loadKeys(array $keys): array |
|
51 | + { |
|
52 | + if (empty($keys)) { |
|
53 | + return $keys; |
|
54 | + } |
|
55 | 55 | |
56 | - $args = [ |
|
57 | - $this->getWhereParams($keys), |
|
58 | - ]; |
|
56 | + $args = [ |
|
57 | + $this->getWhereParams($keys), |
|
58 | + ]; |
|
59 | 59 | |
60 | - $query = $this->getQuery(); |
|
61 | - $result = $query->get_all($args); |
|
60 | + $query = $this->getQuery(); |
|
61 | + $result = $query->get_all($args); |
|
62 | 62 | |
63 | - $loadedItems = []; |
|
63 | + $loadedItems = []; |
|
64 | 64 | |
65 | - /** |
|
66 | - * Loop over the items and return an array of loaded items, |
|
67 | - * where the key is the ID and the value is the Object passed through |
|
68 | - * the model layer. |
|
69 | - */ |
|
70 | - foreach ($keys as $key) { |
|
71 | - if (isset($result[ $key ])) { |
|
72 | - $loadedItems[ $key ] = $result[ $key ]; |
|
73 | - } else { |
|
74 | - $loadedItems[ $key ] = null; |
|
75 | - } |
|
76 | - } |
|
77 | - return $loadedItems; |
|
78 | - } |
|
65 | + /** |
|
66 | + * Loop over the items and return an array of loaded items, |
|
67 | + * where the key is the ID and the value is the Object passed through |
|
68 | + * the model layer. |
|
69 | + */ |
|
70 | + foreach ($keys as $key) { |
|
71 | + if (isset($result[ $key ])) { |
|
72 | + $loadedItems[ $key ] = $result[ $key ]; |
|
73 | + } else { |
|
74 | + $loadedItems[ $key ] = null; |
|
75 | + } |
|
76 | + } |
|
77 | + return $loadedItems; |
|
78 | + } |
|
79 | 79 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function __construct() |
24 | 24 | { |
25 | - $this->setName($this->namespace . 'ModelNameEnum'); |
|
25 | + $this->setName($this->namespace.'ModelNameEnum'); |
|
26 | 26 | $this->setDescription(esc_html__('Entity model name', 'event_espresso')); |
27 | 27 | parent::__construct(); |
28 | 28 | } |
@@ -19,34 +19,34 @@ |
||
19 | 19 | */ |
20 | 20 | class ModelNameEnum extends EnumBase |
21 | 21 | { |
22 | - /** |
|
23 | - * ModelNameEnum constructor. |
|
24 | - */ |
|
25 | - public function __construct() |
|
26 | - { |
|
27 | - $this->setName($this->namespace . 'ModelNameEnum'); |
|
28 | - $this->setDescription(esc_html__('Entity model name', 'event_espresso')); |
|
29 | - parent::__construct(); |
|
30 | - } |
|
22 | + /** |
|
23 | + * ModelNameEnum constructor. |
|
24 | + */ |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + $this->setName($this->namespace . 'ModelNameEnum'); |
|
28 | + $this->setDescription(esc_html__('Entity model name', 'event_espresso')); |
|
29 | + parent::__construct(); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @return array |
|
35 | - * @throws EE_Error |
|
36 | - * @throws ReflectionException |
|
37 | - */ |
|
38 | - protected function getValues(): array |
|
39 | - { |
|
40 | - return [ |
|
41 | - 'DATETIME' => [ |
|
42 | - 'value' => EEM_Datetime::instance()->item_name(), |
|
43 | - ], |
|
44 | - 'TICKET' => [ |
|
45 | - 'value' => EEM_Ticket::instance()->item_name(), |
|
46 | - ], |
|
47 | - 'PRICE' => [ |
|
48 | - 'value' => EEM_Price::instance()->item_name(), |
|
49 | - ], |
|
50 | - ]; |
|
51 | - } |
|
33 | + /** |
|
34 | + * @return array |
|
35 | + * @throws EE_Error |
|
36 | + * @throws ReflectionException |
|
37 | + */ |
|
38 | + protected function getValues(): array |
|
39 | + { |
|
40 | + return [ |
|
41 | + 'DATETIME' => [ |
|
42 | + 'value' => EEM_Datetime::instance()->item_name(), |
|
43 | + ], |
|
44 | + 'TICKET' => [ |
|
45 | + 'value' => EEM_Ticket::instance()->item_name(), |
|
46 | + ], |
|
47 | + 'PRICE' => [ |
|
48 | + 'value' => EEM_Price::instance()->item_name(), |
|
49 | + ], |
|
50 | + ]; |
|
51 | + } |
|
52 | 52 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | if (is_int($key) && $this->validateAttribute($value)) { |
111 | 111 | $this->attributes[] = $value; |
112 | 112 | } else if ($this->validateAttribute($key)) { |
113 | - $this->attributes[ $key ] = $value; |
|
113 | + $this->attributes[$key] = $value; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | */ |
125 | 125 | private function validateAttribute($attribute) |
126 | 126 | { |
127 | - $allowed = BrowserAsset::$allowed_attributes[ $this->type() ]; |
|
128 | - if (! in_array($attribute, $allowed, true)) { |
|
127 | + $allowed = BrowserAsset::$allowed_attributes[$this->type()]; |
|
128 | + if ( ! in_array($attribute, $allowed, true)) { |
|
129 | 129 | throw new DomainException( |
130 | 130 | sprintf( |
131 | 131 | esc_html__('Invalid attribute! The only allowed attributes are: "%1$s"', 'event_espresso'), |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | private function setSource($source) |
182 | 182 | { |
183 | - if (! is_string($source)) { |
|
183 | + if ( ! is_string($source)) { |
|
184 | 184 | throw new InvalidDataTypeException( |
185 | 185 | '$source', |
186 | 186 | $source, |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if (empty($version) && ! $this->isBuiltDistributionSource()) { |
217 | 217 | $version = $this->domain->version(); |
218 | 218 | } |
219 | - if (! is_string($version)) { |
|
219 | + if ( ! is_string($version)) { |
|
220 | 220 | throw new InvalidDataTypeException( |
221 | 221 | '$version', |
222 | 222 | $version, |
@@ -17,234 +17,234 @@ |
||
17 | 17 | abstract class BrowserAsset extends Asset |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var array $attributes |
|
22 | - */ |
|
23 | - private $attributes = []; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var array $allowed_attributes |
|
27 | - */ |
|
28 | - private static $allowed_attributes = [ |
|
29 | - Asset::TYPE_CSS => [ |
|
30 | - 'crossorigin', |
|
31 | - 'media', |
|
32 | - 'referrerpolicy', |
|
33 | - 'sizes', |
|
34 | - 'type', |
|
35 | - ], |
|
36 | - Asset::TYPE_JS => [ |
|
37 | - 'async', |
|
38 | - 'charset', |
|
39 | - 'crossorigin', |
|
40 | - 'defer', |
|
41 | - 'type', |
|
42 | - ] |
|
43 | - ]; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var array $dependencies |
|
47 | - */ |
|
48 | - private $dependencies; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var string $source |
|
52 | - */ |
|
53 | - private $source; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var string $version |
|
57 | - */ |
|
58 | - private $version; |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * Asset constructor. |
|
63 | - * |
|
64 | - * @param string $type |
|
65 | - * @param string $handle |
|
66 | - * @param string $source |
|
67 | - * @param array $dependencies |
|
68 | - * @param DomainInterface $domain |
|
69 | - * @param string $version |
|
70 | - * @throws DomainException |
|
71 | - * @throws InvalidDataTypeException |
|
72 | - */ |
|
73 | - public function __construct($type, $handle, $source, array $dependencies, DomainInterface $domain, $version = '') |
|
74 | - { |
|
75 | - parent::__construct($type, $handle, $domain); |
|
76 | - $this->setSource($source); |
|
77 | - $this->setDependencies($dependencies); |
|
78 | - $this->setVersion($version, false); |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * @since 4.9.62.p |
|
84 | - */ |
|
85 | - abstract public function enqueueAsset(); |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * @return array |
|
90 | - */ |
|
91 | - public function getAttributes() |
|
92 | - { |
|
93 | - return $this->attributes; |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param array $attributes |
|
99 | - * @throws DomainException |
|
100 | - * @since 5.0.0.p |
|
101 | - */ |
|
102 | - public function addAttributes(array $attributes) |
|
103 | - { |
|
104 | - if (empty($attributes)) { |
|
105 | - throw new DomainException( |
|
106 | - esc_html__('The attributes array needs at least one value.', 'event_espresso') |
|
107 | - ); |
|
108 | - } |
|
109 | - foreach ($attributes as $key => $value) { |
|
110 | - if (is_int($key) && $this->validateAttribute($value)) { |
|
111 | - $this->attributes[] = $value; |
|
112 | - } else if ($this->validateAttribute($key)) { |
|
113 | - $this->attributes[ $key ] = $value; |
|
114 | - } |
|
115 | - } |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @param string $attribute |
|
121 | - * @return bool |
|
122 | - * @throws DomainException |
|
123 | - * @since 5.0.0.p |
|
124 | - */ |
|
125 | - private function validateAttribute($attribute) |
|
126 | - { |
|
127 | - $allowed = BrowserAsset::$allowed_attributes[ $this->type() ]; |
|
128 | - if (! in_array($attribute, $allowed, true)) { |
|
129 | - throw new DomainException( |
|
130 | - sprintf( |
|
131 | - esc_html__('Invalid attribute! The only allowed attributes are: "%1$s"', 'event_espresso'), |
|
132 | - implode('", "', $allowed) |
|
133 | - ) |
|
134 | - ); |
|
135 | - } |
|
136 | - return true; |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - /** |
|
141 | - * @return array |
|
142 | - */ |
|
143 | - public function dependencies() |
|
144 | - { |
|
145 | - return $this->dependencies; |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * @param array $dependencies |
|
151 | - */ |
|
152 | - public function addDependencies(array $dependencies) |
|
153 | - { |
|
154 | - $this->dependencies = array_merge($this->dependencies, $dependencies); |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * @param array $dependencies |
|
160 | - */ |
|
161 | - protected function setDependencies(array $dependencies) |
|
162 | - { |
|
163 | - $this->dependencies = $dependencies; |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - /** |
|
168 | - * @since 4.9.62.p |
|
169 | - * @return bool |
|
170 | - */ |
|
171 | - public function hasDependencies() |
|
172 | - { |
|
173 | - return count($this->dependencies) > 0; |
|
174 | - } |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * @return string |
|
179 | - */ |
|
180 | - public function source() |
|
181 | - { |
|
182 | - return $this->source; |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** |
|
187 | - * @param string $source |
|
188 | - * @throws InvalidDataTypeException |
|
189 | - */ |
|
190 | - private function setSource($source) |
|
191 | - { |
|
192 | - if (! is_string($source)) { |
|
193 | - throw new InvalidDataTypeException( |
|
194 | - '$source', |
|
195 | - $source, |
|
196 | - 'string' |
|
197 | - ); |
|
198 | - } |
|
199 | - $this->source = $source; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - /** |
|
204 | - * @return string |
|
205 | - * @throws InvalidDataTypeException |
|
206 | - * @throws DomainException |
|
207 | - */ |
|
208 | - public function version() |
|
209 | - { |
|
210 | - return $this->version; |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * @param string $version |
|
216 | - * @param bool $fluent |
|
217 | - * @return BrowserAsset|null |
|
218 | - * @throws DomainException |
|
219 | - * @throws InvalidDataTypeException |
|
220 | - */ |
|
221 | - public function setVersion($version, $fluent = true) |
|
222 | - { |
|
223 | - // if version is NOT set and this asset was NOT built for distribution, |
|
224 | - // then set the version equal to the EE core plugin version |
|
225 | - if (empty($version) && ! $this->isBuiltDistributionSource()) { |
|
226 | - $version = $this->domain->version(); |
|
227 | - } |
|
228 | - if (! is_string($version)) { |
|
229 | - throw new InvalidDataTypeException( |
|
230 | - '$version', |
|
231 | - $version, |
|
232 | - 'string' |
|
233 | - ); |
|
234 | - } |
|
235 | - $this->version = $version; |
|
236 | - if ($fluent) { |
|
237 | - return $this; |
|
238 | - } |
|
239 | - return null; |
|
240 | - } |
|
241 | - |
|
242 | - |
|
243 | - /** |
|
244 | - * @return bool |
|
245 | - */ |
|
246 | - public function isBuiltDistributionSource() { |
|
247 | - return substr($this->source, -8) === Asset::FILE_EXTENSION_DISTRIBUTION_JS |
|
248 | - || substr($this->source, -9) === Asset::FILE_EXTENSION_DISTRIBUTION_CSS; |
|
249 | - } |
|
20 | + /** |
|
21 | + * @var array $attributes |
|
22 | + */ |
|
23 | + private $attributes = []; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var array $allowed_attributes |
|
27 | + */ |
|
28 | + private static $allowed_attributes = [ |
|
29 | + Asset::TYPE_CSS => [ |
|
30 | + 'crossorigin', |
|
31 | + 'media', |
|
32 | + 'referrerpolicy', |
|
33 | + 'sizes', |
|
34 | + 'type', |
|
35 | + ], |
|
36 | + Asset::TYPE_JS => [ |
|
37 | + 'async', |
|
38 | + 'charset', |
|
39 | + 'crossorigin', |
|
40 | + 'defer', |
|
41 | + 'type', |
|
42 | + ] |
|
43 | + ]; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var array $dependencies |
|
47 | + */ |
|
48 | + private $dependencies; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var string $source |
|
52 | + */ |
|
53 | + private $source; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var string $version |
|
57 | + */ |
|
58 | + private $version; |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * Asset constructor. |
|
63 | + * |
|
64 | + * @param string $type |
|
65 | + * @param string $handle |
|
66 | + * @param string $source |
|
67 | + * @param array $dependencies |
|
68 | + * @param DomainInterface $domain |
|
69 | + * @param string $version |
|
70 | + * @throws DomainException |
|
71 | + * @throws InvalidDataTypeException |
|
72 | + */ |
|
73 | + public function __construct($type, $handle, $source, array $dependencies, DomainInterface $domain, $version = '') |
|
74 | + { |
|
75 | + parent::__construct($type, $handle, $domain); |
|
76 | + $this->setSource($source); |
|
77 | + $this->setDependencies($dependencies); |
|
78 | + $this->setVersion($version, false); |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * @since 4.9.62.p |
|
84 | + */ |
|
85 | + abstract public function enqueueAsset(); |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * @return array |
|
90 | + */ |
|
91 | + public function getAttributes() |
|
92 | + { |
|
93 | + return $this->attributes; |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param array $attributes |
|
99 | + * @throws DomainException |
|
100 | + * @since 5.0.0.p |
|
101 | + */ |
|
102 | + public function addAttributes(array $attributes) |
|
103 | + { |
|
104 | + if (empty($attributes)) { |
|
105 | + throw new DomainException( |
|
106 | + esc_html__('The attributes array needs at least one value.', 'event_espresso') |
|
107 | + ); |
|
108 | + } |
|
109 | + foreach ($attributes as $key => $value) { |
|
110 | + if (is_int($key) && $this->validateAttribute($value)) { |
|
111 | + $this->attributes[] = $value; |
|
112 | + } else if ($this->validateAttribute($key)) { |
|
113 | + $this->attributes[ $key ] = $value; |
|
114 | + } |
|
115 | + } |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @param string $attribute |
|
121 | + * @return bool |
|
122 | + * @throws DomainException |
|
123 | + * @since 5.0.0.p |
|
124 | + */ |
|
125 | + private function validateAttribute($attribute) |
|
126 | + { |
|
127 | + $allowed = BrowserAsset::$allowed_attributes[ $this->type() ]; |
|
128 | + if (! in_array($attribute, $allowed, true)) { |
|
129 | + throw new DomainException( |
|
130 | + sprintf( |
|
131 | + esc_html__('Invalid attribute! The only allowed attributes are: "%1$s"', 'event_espresso'), |
|
132 | + implode('", "', $allowed) |
|
133 | + ) |
|
134 | + ); |
|
135 | + } |
|
136 | + return true; |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + /** |
|
141 | + * @return array |
|
142 | + */ |
|
143 | + public function dependencies() |
|
144 | + { |
|
145 | + return $this->dependencies; |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * @param array $dependencies |
|
151 | + */ |
|
152 | + public function addDependencies(array $dependencies) |
|
153 | + { |
|
154 | + $this->dependencies = array_merge($this->dependencies, $dependencies); |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * @param array $dependencies |
|
160 | + */ |
|
161 | + protected function setDependencies(array $dependencies) |
|
162 | + { |
|
163 | + $this->dependencies = $dependencies; |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + /** |
|
168 | + * @since 4.9.62.p |
|
169 | + * @return bool |
|
170 | + */ |
|
171 | + public function hasDependencies() |
|
172 | + { |
|
173 | + return count($this->dependencies) > 0; |
|
174 | + } |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * @return string |
|
179 | + */ |
|
180 | + public function source() |
|
181 | + { |
|
182 | + return $this->source; |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** |
|
187 | + * @param string $source |
|
188 | + * @throws InvalidDataTypeException |
|
189 | + */ |
|
190 | + private function setSource($source) |
|
191 | + { |
|
192 | + if (! is_string($source)) { |
|
193 | + throw new InvalidDataTypeException( |
|
194 | + '$source', |
|
195 | + $source, |
|
196 | + 'string' |
|
197 | + ); |
|
198 | + } |
|
199 | + $this->source = $source; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + /** |
|
204 | + * @return string |
|
205 | + * @throws InvalidDataTypeException |
|
206 | + * @throws DomainException |
|
207 | + */ |
|
208 | + public function version() |
|
209 | + { |
|
210 | + return $this->version; |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + /** |
|
215 | + * @param string $version |
|
216 | + * @param bool $fluent |
|
217 | + * @return BrowserAsset|null |
|
218 | + * @throws DomainException |
|
219 | + * @throws InvalidDataTypeException |
|
220 | + */ |
|
221 | + public function setVersion($version, $fluent = true) |
|
222 | + { |
|
223 | + // if version is NOT set and this asset was NOT built for distribution, |
|
224 | + // then set the version equal to the EE core plugin version |
|
225 | + if (empty($version) && ! $this->isBuiltDistributionSource()) { |
|
226 | + $version = $this->domain->version(); |
|
227 | + } |
|
228 | + if (! is_string($version)) { |
|
229 | + throw new InvalidDataTypeException( |
|
230 | + '$version', |
|
231 | + $version, |
|
232 | + 'string' |
|
233 | + ); |
|
234 | + } |
|
235 | + $this->version = $version; |
|
236 | + if ($fluent) { |
|
237 | + return $this; |
|
238 | + } |
|
239 | + return null; |
|
240 | + } |
|
241 | + |
|
242 | + |
|
243 | + /** |
|
244 | + * @return bool |
|
245 | + */ |
|
246 | + public function isBuiltDistributionSource() { |
|
247 | + return substr($this->source, -8) === Asset::FILE_EXTENSION_DISTRIBUTION_JS |
|
248 | + || substr($this->source, -9) === Asset::FILE_EXTENSION_DISTRIBUTION_CSS; |
|
249 | + } |
|
250 | 250 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct() |
22 | 22 | { |
23 | - $this->setName($this->namespace . 'AttendeesConnectionOrderbyEnum'); |
|
23 | + $this->setName($this->namespace.'AttendeesConnectionOrderbyEnum'); |
|
24 | 24 | $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
25 | 25 | parent::__construct(); |
26 | 26 | } |
@@ -14,35 +14,35 @@ |
||
14 | 14 | */ |
15 | 15 | class AttendeesConnectionOrderbyEnum extends EnumBase |
16 | 16 | { |
17 | - /** |
|
18 | - * AttendeesConnectionOrderbyEnum constructor. |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - $this->setName($this->namespace . 'AttendeesConnectionOrderbyEnum'); |
|
23 | - $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
24 | - parent::__construct(); |
|
25 | - } |
|
17 | + /** |
|
18 | + * AttendeesConnectionOrderbyEnum constructor. |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + $this->setName($this->namespace . 'AttendeesConnectionOrderbyEnum'); |
|
23 | + $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @return array |
|
30 | - */ |
|
31 | - protected function getValues(): array |
|
32 | - { |
|
33 | - return [ |
|
34 | - 'ID' => [ |
|
35 | - 'value' => 'ATT_ID', |
|
36 | - 'description' => esc_html__('Order by ID', 'event_espresso'), |
|
37 | - ], |
|
38 | - 'LAST_NAME' => [ |
|
39 | - 'value' => 'ATT_lname', |
|
40 | - 'description' => esc_html__('Order by last name', 'event_espresso'), |
|
41 | - ], |
|
42 | - 'FIRST_NAME' => [ |
|
43 | - 'value' => 'ATT_fname', |
|
44 | - 'description' => esc_html__('Order by first name', 'event_espresso'), |
|
45 | - ], |
|
46 | - ]; |
|
47 | - } |
|
28 | + /** |
|
29 | + * @return array |
|
30 | + */ |
|
31 | + protected function getValues(): array |
|
32 | + { |
|
33 | + return [ |
|
34 | + 'ID' => [ |
|
35 | + 'value' => 'ATT_ID', |
|
36 | + 'description' => esc_html__('Order by ID', 'event_espresso'), |
|
37 | + ], |
|
38 | + 'LAST_NAME' => [ |
|
39 | + 'value' => 'ATT_lname', |
|
40 | + 'description' => esc_html__('Order by last name', 'event_espresso'), |
|
41 | + ], |
|
42 | + 'FIRST_NAME' => [ |
|
43 | + 'value' => 'ATT_fname', |
|
44 | + 'description' => esc_html__('Order by first name', 'event_espresso'), |
|
45 | + ], |
|
46 | + ]; |
|
47 | + } |
|
48 | 48 | } |
@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'Attendee', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'Attendees', |
|
41 | + 'toType' => $this->namespace.'Attendee', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace).'Attendees', |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryAttendeesConnection", |
44 | 44 | 'connectionArgs' => self::get_connection_args(), |
45 | 45 | 'resolve' => [$this, 'resolveConnection'], |
@@ -18,128 +18,128 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryAttendeesConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * AttendeeConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Attendee $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Attendee $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * AttendeeConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Attendee $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Attendee $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'Attendee', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace) . 'Attendees', |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryAttendeesConnection", |
|
42 | - 'connectionArgs' => self::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'Attendee', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace) . 'Attendees', |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryAttendeesConnection", |
|
42 | + 'connectionArgs' => self::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return AttendeeConnectionResolver |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | - { |
|
58 | - return new AttendeeConnectionResolver($entity, $args, $context, $info); |
|
59 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return AttendeeConnectionResolver |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | + { |
|
58 | + return new AttendeeConnectionResolver($entity, $args, $context, $info); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Given an optional array of args, this returns the args to be used in the connection |
|
63 | - * |
|
64 | - * @param array $args The args to modify the defaults |
|
65 | - * @return array |
|
66 | - */ |
|
67 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | - public static function get_connection_args(array $args = []): array |
|
69 | - { |
|
70 | - $newArgs = [ |
|
71 | - 'datetime' => [ |
|
72 | - 'type' => 'ID', |
|
73 | - 'description' => esc_html__( |
|
74 | - 'Globally unique datetime ID to get the attendees for.', |
|
75 | - 'event_espresso' |
|
76 | - ), |
|
77 | - ], |
|
78 | - 'datetimeIn' => [ |
|
79 | - 'type' => ['list_of' => 'ID'], |
|
80 | - 'description' => esc_html__( |
|
81 | - 'Globally unique datetime IDs to get the attendees for.', |
|
82 | - 'event_espresso' |
|
83 | - ), |
|
84 | - ], |
|
85 | - 'event' => [ |
|
86 | - 'type' => 'ID', |
|
87 | - 'description' => esc_html__( |
|
88 | - 'Globally unique event ID to get the attendees for.', |
|
89 | - 'event_espresso' |
|
90 | - ), |
|
91 | - ], |
|
92 | - 'eventIn' => [ |
|
93 | - 'type' => ['list_of' => 'ID'], |
|
94 | - 'description' => esc_html__( |
|
95 | - 'Globally unique event IDs to get the attendees for.', |
|
96 | - 'event_espresso' |
|
97 | - ), |
|
98 | - ], |
|
99 | - 'orderby' => [ |
|
100 | - 'type' => ['list_of' => 'EspressoAttendeesConnectionOrderbyInput'], |
|
101 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
102 | - ], |
|
103 | - 'regTicket' => [ |
|
104 | - 'type' => 'ID', |
|
105 | - 'description' => esc_html__( |
|
106 | - 'Globally unique registration ticket ID to get the attendees for.', |
|
107 | - 'event_espresso' |
|
108 | - ), |
|
109 | - ], |
|
110 | - 'regTicketIn' => [ |
|
111 | - 'type' => ['list_of' => 'ID'], |
|
112 | - 'description' => esc_html__( |
|
113 | - 'Globally unique registration ticket IDs to get the attendees for.', |
|
114 | - 'event_espresso' |
|
115 | - ), |
|
116 | - ], |
|
117 | - 'regTicketId' => [ |
|
118 | - 'type' => 'Int', |
|
119 | - 'description' => esc_html__('Registration ticket ID to get the attendees for.', 'event_espresso'), |
|
120 | - ], |
|
121 | - 'regTicketIdIn' => [ |
|
122 | - 'type' => ['list_of' => 'Int'], |
|
123 | - 'description' => esc_html__('Registration ticket IDs to get the attendees for.', 'event_espresso'), |
|
124 | - ], |
|
125 | - 'regStatus' => [ |
|
126 | - 'type' => 'EspressoRegistrationStatusEnum', |
|
127 | - 'description' => esc_html__('Limit attendees to registration status.', 'event_espresso'), |
|
128 | - ], |
|
129 | - 'search' => [ |
|
130 | - 'type' => 'String', |
|
131 | - 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
132 | - ], |
|
133 | - ]; |
|
61 | + /** |
|
62 | + * Given an optional array of args, this returns the args to be used in the connection |
|
63 | + * |
|
64 | + * @param array $args The args to modify the defaults |
|
65 | + * @return array |
|
66 | + */ |
|
67 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | + public static function get_connection_args(array $args = []): array |
|
69 | + { |
|
70 | + $newArgs = [ |
|
71 | + 'datetime' => [ |
|
72 | + 'type' => 'ID', |
|
73 | + 'description' => esc_html__( |
|
74 | + 'Globally unique datetime ID to get the attendees for.', |
|
75 | + 'event_espresso' |
|
76 | + ), |
|
77 | + ], |
|
78 | + 'datetimeIn' => [ |
|
79 | + 'type' => ['list_of' => 'ID'], |
|
80 | + 'description' => esc_html__( |
|
81 | + 'Globally unique datetime IDs to get the attendees for.', |
|
82 | + 'event_espresso' |
|
83 | + ), |
|
84 | + ], |
|
85 | + 'event' => [ |
|
86 | + 'type' => 'ID', |
|
87 | + 'description' => esc_html__( |
|
88 | + 'Globally unique event ID to get the attendees for.', |
|
89 | + 'event_espresso' |
|
90 | + ), |
|
91 | + ], |
|
92 | + 'eventIn' => [ |
|
93 | + 'type' => ['list_of' => 'ID'], |
|
94 | + 'description' => esc_html__( |
|
95 | + 'Globally unique event IDs to get the attendees for.', |
|
96 | + 'event_espresso' |
|
97 | + ), |
|
98 | + ], |
|
99 | + 'orderby' => [ |
|
100 | + 'type' => ['list_of' => 'EspressoAttendeesConnectionOrderbyInput'], |
|
101 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
102 | + ], |
|
103 | + 'regTicket' => [ |
|
104 | + 'type' => 'ID', |
|
105 | + 'description' => esc_html__( |
|
106 | + 'Globally unique registration ticket ID to get the attendees for.', |
|
107 | + 'event_espresso' |
|
108 | + ), |
|
109 | + ], |
|
110 | + 'regTicketIn' => [ |
|
111 | + 'type' => ['list_of' => 'ID'], |
|
112 | + 'description' => esc_html__( |
|
113 | + 'Globally unique registration ticket IDs to get the attendees for.', |
|
114 | + 'event_espresso' |
|
115 | + ), |
|
116 | + ], |
|
117 | + 'regTicketId' => [ |
|
118 | + 'type' => 'Int', |
|
119 | + 'description' => esc_html__('Registration ticket ID to get the attendees for.', 'event_espresso'), |
|
120 | + ], |
|
121 | + 'regTicketIdIn' => [ |
|
122 | + 'type' => ['list_of' => 'Int'], |
|
123 | + 'description' => esc_html__('Registration ticket IDs to get the attendees for.', 'event_espresso'), |
|
124 | + ], |
|
125 | + 'regStatus' => [ |
|
126 | + 'type' => 'EspressoRegistrationStatusEnum', |
|
127 | + 'description' => esc_html__('Limit attendees to registration status.', 'event_espresso'), |
|
128 | + ], |
|
129 | + 'search' => [ |
|
130 | + 'type' => 'String', |
|
131 | + 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
132 | + ], |
|
133 | + ]; |
|
134 | 134 | |
135 | - $newArgs = apply_filters( |
|
136 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__attendee_args', |
|
137 | - $newArgs, |
|
138 | - $args |
|
139 | - ); |
|
140 | - return array_merge( |
|
141 | - $newArgs, |
|
142 | - $args |
|
143 | - ); |
|
144 | - } |
|
135 | + $newArgs = apply_filters( |
|
136 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__attendee_args', |
|
137 | + $newArgs, |
|
138 | + $args |
|
139 | + ); |
|
140 | + return array_merge( |
|
141 | + $newArgs, |
|
142 | + $args |
|
143 | + ); |
|
144 | + } |
|
145 | 145 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() |
26 | 26 | { |
27 | - $this->setName($this->namespace . 'AttendeesConnectionOrderbyInput'); |
|
27 | + $this->setName($this->namespace.'AttendeesConnectionOrderbyInput'); |
|
28 | 28 | $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
29 | 29 | parent::__construct(); |
30 | 30 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | return [ |
40 | 40 | new GraphQLField( |
41 | 41 | 'field', |
42 | - ['non_null' => $this->namespace . 'AttendeesConnectionOrderbyEnum'] |
|
42 | + ['non_null' => $this->namespace.'AttendeesConnectionOrderbyEnum'] |
|
43 | 43 | ), |
44 | 44 | new GraphQLField( |
45 | 45 | 'order', |
@@ -16,31 +16,31 @@ |
||
16 | 16 | */ |
17 | 17 | class AttendeesConnectionOrderbyInput extends InputBase |
18 | 18 | { |
19 | - /** |
|
20 | - * AttendeesConnectionOrderbyInput constructor. |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - $this->setName($this->namespace . 'AttendeesConnectionOrderbyInput'); |
|
25 | - $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | - parent::__construct(); |
|
27 | - } |
|
19 | + /** |
|
20 | + * AttendeesConnectionOrderbyInput constructor. |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + $this->setName($this->namespace . 'AttendeesConnectionOrderbyInput'); |
|
25 | + $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @return GraphQLFieldInterface[] |
|
32 | - */ |
|
33 | - protected function getFields(): array |
|
34 | - { |
|
35 | - return [ |
|
36 | - new GraphQLField( |
|
37 | - 'field', |
|
38 | - ['non_null' => $this->namespace . 'AttendeesConnectionOrderbyEnum'] |
|
39 | - ), |
|
40 | - new GraphQLField( |
|
41 | - 'order', |
|
42 | - 'OrderEnum' |
|
43 | - ), |
|
44 | - ]; |
|
45 | - } |
|
30 | + /** |
|
31 | + * @return GraphQLFieldInterface[] |
|
32 | + */ |
|
33 | + protected function getFields(): array |
|
34 | + { |
|
35 | + return [ |
|
36 | + new GraphQLField( |
|
37 | + 'field', |
|
38 | + ['non_null' => $this->namespace . 'AttendeesConnectionOrderbyEnum'] |
|
39 | + ), |
|
40 | + new GraphQLField( |
|
41 | + 'order', |
|
42 | + 'OrderEnum' |
|
43 | + ), |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function getData(array $where_params = []) |
22 | 22 | { |
23 | - $field_key = lcfirst($this->namespace) . 'Prices'; |
|
23 | + $field_key = lcfirst($this->namespace).'Prices'; |
|
24 | 24 | $query = <<<QUERY |
25 | 25 | query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs, \$first: Int, \$last: Int ) { |
26 | 26 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class Prices extends GraphQLData |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $where_params |
|
17 | - * @return array|null |
|
18 | - * @since 5.0.0.p |
|
19 | - */ |
|
20 | - public function getData(array $where_params = []) |
|
21 | - { |
|
22 | - $field_key = lcfirst($this->namespace) . 'Prices'; |
|
23 | - $query = <<<QUERY |
|
15 | + /** |
|
16 | + * @param array $where_params |
|
17 | + * @return array|null |
|
18 | + * @since 5.0.0.p |
|
19 | + */ |
|
20 | + public function getData(array $where_params = []) |
|
21 | + { |
|
22 | + $field_key = lcfirst($this->namespace) . 'Prices'; |
|
23 | + $query = <<<QUERY |
|
24 | 24 | query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs, \$first: Int, \$last: Int ) { |
25 | 25 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
26 | 26 | nodes { |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | } |
45 | 45 | } |
46 | 46 | QUERY; |
47 | - $this->setParams([ |
|
48 | - 'operation_name' => 'GET_PRICES', |
|
49 | - 'variables' => [ |
|
50 | - 'first' => 100, |
|
51 | - ], |
|
52 | - 'query' => $query, |
|
53 | - ]); |
|
47 | + $this->setParams([ |
|
48 | + 'operation_name' => 'GET_PRICES', |
|
49 | + 'variables' => [ |
|
50 | + 'first' => 100, |
|
51 | + ], |
|
52 | + 'query' => $query, |
|
53 | + ]); |
|
54 | 54 | |
55 | - return $this->getQueryResponse($field_key, $where_params); |
|
56 | - } |
|
55 | + return $this->getQueryResponse($field_key, $where_params); |
|
56 | + } |
|
57 | 57 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function getData(array $where_params = []) |
22 | 22 | { |
23 | - $field_key = lcfirst($this->namespace) . 'Tickets'; |
|
23 | + $field_key = lcfirst($this->namespace).'Tickets'; |
|
24 | 24 | $query = <<<QUERY |
25 | 25 | query GET_TICKETS(\$where: {$this->namespace}RootQueryTicketsConnectionWhereArgs, \$first: Int, \$last: Int ) { |
26 | 26 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class Tickets extends GraphQLData |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $where_params |
|
17 | - * @return array|null |
|
18 | - * @since 5.0.0.p |
|
19 | - */ |
|
20 | - public function getData(array $where_params = []) |
|
21 | - { |
|
22 | - $field_key = lcfirst($this->namespace) . 'Tickets'; |
|
23 | - $query = <<<QUERY |
|
15 | + /** |
|
16 | + * @param array $where_params |
|
17 | + * @return array|null |
|
18 | + * @since 5.0.0.p |
|
19 | + */ |
|
20 | + public function getData(array $where_params = []) |
|
21 | + { |
|
22 | + $field_key = lcfirst($this->namespace) . 'Tickets'; |
|
23 | + $query = <<<QUERY |
|
24 | 24 | query GET_TICKETS(\$where: {$this->namespace}RootQueryTicketsConnectionWhereArgs, \$first: Int, \$last: Int ) { |
25 | 25 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
26 | 26 | nodes { |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | QUERY; |
60 | - $this->setParams([ |
|
61 | - 'operation_name' => 'GET_TICKETS', |
|
62 | - 'variables' => [ |
|
63 | - 'first' => 100, |
|
64 | - ], |
|
65 | - 'query' => $query, |
|
66 | - ]); |
|
60 | + $this->setParams([ |
|
61 | + 'operation_name' => 'GET_TICKETS', |
|
62 | + 'variables' => [ |
|
63 | + 'first' => 100, |
|
64 | + ], |
|
65 | + 'query' => $query, |
|
66 | + ]); |
|
67 | 67 | |
68 | - return $this->getQueryResponse($field_key, $where_params); |
|
69 | - } |
|
68 | + return $this->getQueryResponse($field_key, $where_params); |
|
69 | + } |
|
70 | 70 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function getData(array $where_params = []) |
22 | 22 | { |
23 | - $field_key = lcfirst($this->namespace) . 'PriceTypes'; |
|
23 | + $field_key = lcfirst($this->namespace).'PriceTypes'; |
|
24 | 24 | $query = <<<QUERY |
25 | 25 | query GET_PRICE_TYPES(\$first: Int, \$last: Int ) { |
26 | 26 | {$field_key}(first: \$first, last: \$last) { |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class PriceTypes extends GraphQLData |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $where_params |
|
17 | - * @return array|null |
|
18 | - * @since 5.0.0.p |
|
19 | - */ |
|
20 | - public function getData(array $where_params = []) |
|
21 | - { |
|
22 | - $field_key = lcfirst($this->namespace) . 'PriceTypes'; |
|
23 | - $query = <<<QUERY |
|
15 | + /** |
|
16 | + * @param array $where_params |
|
17 | + * @return array|null |
|
18 | + * @since 5.0.0.p |
|
19 | + */ |
|
20 | + public function getData(array $where_params = []) |
|
21 | + { |
|
22 | + $field_key = lcfirst($this->namespace) . 'PriceTypes'; |
|
23 | + $query = <<<QUERY |
|
24 | 24 | query GET_PRICE_TYPES(\$first: Int, \$last: Int ) { |
25 | 25 | {$field_key}(first: \$first, last: \$last) { |
26 | 26 | nodes { |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | QUERY; |
44 | - $this->setParams([ |
|
45 | - 'operation_name' => 'GET_PRICE_TYPES', |
|
46 | - 'variables' => [ |
|
47 | - 'first' => 100, |
|
48 | - ], |
|
49 | - 'query' => $query, |
|
50 | - ]); |
|
44 | + $this->setParams([ |
|
45 | + 'operation_name' => 'GET_PRICE_TYPES', |
|
46 | + 'variables' => [ |
|
47 | + 'first' => 100, |
|
48 | + ], |
|
49 | + 'query' => $query, |
|
50 | + ]); |
|
51 | 51 | |
52 | - return $this->getQueryResponse($field_key, $where_params); |
|
53 | - } |
|
52 | + return $this->getQueryResponse($field_key, $where_params); |
|
53 | + } |
|
54 | 54 | } |