src/util/DocumentSorter.php
protected static function fieldCompare(Document $a, Document $b) {
        $field = self::$orderByField;
        if (property_exists('\CloudControl\Cms\storage\entities\Document', $field)) {
            return strcasecmp($a->{$field}, $b->{$field});
        }

        if (!isset($a->fields->{$field}[0])) {
            return -3;
        }

        if (!isset($b->fields->{$field}[0])) {
            return 3;
        }

        return strcasecmp($a->fields->{$field}[0], $b->fields->{$field}[0]);
    }
protected static function fieldCompare(Document $a, Document $b) {
        $field = self::$orderByField;
        if (property_exists('\CloudControl\Cms\storage\entities\Document', $field)) {
            return strcasecmp($a->{$field}, $b->{$field});
        }

        if (!isset($a->fields->{$field}[0])) {
            return -3;
        }

        if (!isset($b->fields->{$field}[0])) {
            return 3;
        }

        return strcasecmp($a->fields->{$field}[0], $b->fields->{$field}[0]);
    }
protected static function fieldCompare ( Document $ a , Document $ b ) { $ field = self :: $ orderByField ; if ( property_exists ( '\CloudControl\Cms\storage\entities\Document' , $ field ) ) { return strcasecmp ( $ a -> { $ field } , $ b -> { $ field } ) ; } if ( ! isset ( $ a -> fields -> { $ field } [ 0 ] ) ) { return - 3 ; } if ( ! isset ( $ b -> fields -> { $ field } [ 0 ] ) ) { return 3 ; } return strcasecmp ( $ a -> fields -> { $ field } [ 0 ] , $ b -> fields -> { $ field } [ 0 ] ) ; }
Compares two documents
@param Document $a
@param Document $b
@return int
Compares two documents