Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers

Count{}WC 1.0

Count elements in Array.

No Hooks.

Usage

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

Methods

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

Notes

  • Package: Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers

Code of Count{} WC 6.6.1

class Count implements TransformerInterface {
	/**
	 *  Count elements in Array.
	 *
	 * @param array         $value an array to count.
	 * @param stdClass|null $arguments arguments.
	 * @param string|null   $default default value.
	 *
	 * @return number
	 */
	public function transform( $value, stdClass $arguments = null, $default = null ) {
		return count( $value );
	}

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