PluginProbe
WooCommerce / 11.1.0
WooCommerce v11.1.0
11.1.0 11.1.0-rc.2 11.1.0-rc.1 11.1.0-beta.2 11.1.0-beta.1 11.0.1 11.0.0 11.0.0-rc.3 11.0.0-rc.2 11.0.0-rc.1 11.0.0-beta.2 11.0.0-beta.1 10.9.4 10.9.3 10.9.2 10.9.1 10.9.0 10.9.0-rc.1 10.9.0-beta.2 10.9.0-beta.1 10.8.1 10.8.0 10.8.0-rc.1 10.8.0-beta.2 10.8.0-beta.1 All 648 releases
woocommerce / src / Admin / RemoteSpecs / RuleProcessors / Transformers / ArrayKeys.php
ArrayKeys.php
42 lines 1017 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\Transformers;
4
5 use Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\Transformers\TransformerInterface;
6 use stdClass;
7
8 /**
9 * Search array value by one of its key.
10 *
11 * @package Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\Transformers
12 */
13 class ArrayKeys implements TransformerInterface {
14 /**
15 * Search array value by one of its key.
16 *
17 * @param mixed $value a value to transform.
18 * @param stdClass|null $arguments arguments.
19 * @param string|null $default_value default value.
20 *
21 * @return mixed
22 */
23 public function transform( $value, ?stdClass $arguments = null, $default_value = array() ) {
24 if ( ! is_array( $value ) ) {
25 return $default_value;
26 }
27
28 return array_keys( $value );
29 }
30
31 /**
32 * Validate Transformer arguments.
33 *
34 * @param stdClass|null $arguments arguments to validate.
35 *
36 * @return mixed
37 */
38 public function validate( ?stdClass $arguments = null ) {
39 return true;
40 }
41 }
42