Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers

ArrayKeys{}WC 1.0

Search array value by one of its key.

Хуков нет.

Использование

$ArrayKeys = new ArrayKeys();
// use class methods

Методы

  1. public transform( $value, stdClass $arguments = null, $default = array() )
  2. public validate( stdClass $arguments = null )

Заметки

  • Пакет: Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers

Код ArrayKeys{} WC 8.7.0

class ArrayKeys implements TransformerInterface {
	/**
	 * Search array value by one of its key.
	 *
	 * @param mixed         $value a value to transform.
	 * @param stdClass|null $arguments arguments.
	 * @param string|null   $default default value.
	 *
	 * @return mixed
	 */
	public function transform( $value, stdClass $arguments = null, $default = array() ) {
		if ( ! is_array( $value ) ) {
			return $default;
		}

		return array_keys( $value );
	}

	/**
	 * Validate Transformer arguments.
	 *
	 * @param stdClass|null $arguments arguments to validate.
	 *
	 * @return mixed
	 */
	public function validate( stdClass $arguments = null ) {
		return true;
	}
}