Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | protected static function fieldCompare(Document $a, Document $b) { |
||
41 | $field = self::$orderByField; |
||
42 | if (property_exists('\CloudControl\Cms\storage\entities\Document', $field)) { |
||
43 | return strcasecmp($a->{$field}, $b->{$field}); |
||
44 | } |
||
45 | |||
46 | if (!isset($a->fields->{$field}[0])) { |
||
47 | return -3; |
||
48 | } |
||
49 | |||
50 | if (!isset($b->fields->{$field}[0])) { |
||
51 | return 3; |
||
52 | } |
||
53 | |||
54 | return strcasecmp($a->fields->{$field}[0], $b->fields->{$field}[0]); |
||
55 | } |
||
56 | } |