<?php
namespace App\Bsp\Parser\FileFormats; class FileFormats { protected $formats = []; public function append(\App\Bsp\Parser\FileFormats\FileFormat $format) { $this->formats[] = $format; } public function getAll() { $formats = $this->formats; usort($formats, function ($a, $b) { $ret = 0; if (!$ret) { return $ret = $a->priority - $b->priority; } if (!$ret) { return $ret = strcasecmp($b->label, $a->label); } return $ret; }); return $formats; } } 