wp_back/wp-content/plugins/smart-slider-3/Nextend/Framework/Pattern/OrderableTrait.php

31 lines
597 B
PHP
Raw Normal View History

2024-05-20 15:37:46 +03:00
<?php
namespace Nextend\Framework\Pattern;
trait OrderableTrait {
public function getOrdering() {
return isset($this->ordering) ? $this->ordering : 1000000;
}
/**
* @param OrderableTrait[] $items
*/
public static function uasort(&$items) {
uasort($items, array(
OrderableTrait::class,
'compare'
));
}
/**
* @param OrderableTrait $a
* @param OrderableTrait $b
*
* @return int
*/
public static function compare($a, $b) {
return $a->getOrdering() - $b->getOrdering();
}
}