Automattic\WooCommerce\Admin\API\Reports

Segmenter::segment_cmp()privateWC 1.0

Compares two report data objects by pre-defined object property and ASC/DESC ordering.

Method of the class: Segmenter{}

No Hooks.

Return

String.

Usage

// private - for code of main (parent) class only
$result = $this->segment_cmp( $a, $b );
$a(stdClass) (required)
Object a.
$b(stdClass) (required)
Object b.

Segmenter::segment_cmp() code WC 9.4.2

private function segment_cmp( $a, $b ) {
	if ( $a['segment_id'] === $b['segment_id'] ) {
		return 0;
	} elseif ( $a['segment_id'] > $b['segment_id'] ) {
		return 1;
	} elseif ( $a['segment_id'] < $b['segment_id'] ) {
		return - 1;
	}
}