Your IP : 216.73.216.85


Current Path : /home/smartconb/www/armencom33/libraries/smartslider3/src/Framework/Pattern/
Upload File :
Current File : /home/smartconb/www/armencom33/libraries/smartslider3/src/Framework/Pattern/OrderableTrait.php

<?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();
    }
}