Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\Transformers

Count::transform()publicWC 1.0

Count elements in Array or Countable object.

@param array|Countable $value an array to count. @param stdClass|null $arguments arguments. @param string|null $default_value default value.

@return number

Method of the class: Count{}

No Hooks.

Return

null. Nothing (null).

Usage

$Count = new Count();
$Count->transform( $value, ?stdClass $arguments, $default_value );
$value (required)
-
?stdClass $arguments **
-
Default: null
$default_value **
-
Default: null

Count::transform() code WC 9.7.1

public function transform( $value, ?stdClass $arguments = null, $default_value = null ) {
	if ( ! is_array( $value ) && ! $value instanceof \Countable ) {
		return $default_value;
	}

	return count( $value );
}