code/Report.php
public static function get_reports()
    {
        $reports = ClassInfo::subclassesFor(get_called_class());

        $reportsArray = [];
        if ($reports && count($reports) > 0) {
            $excludedReports = static::get_excluded_reports();
            // Collect reports into array with an attribute for 'sort'
            foreach ($reports as $report) {
                // Don't use the Report superclass, or any excluded report classes
                if (in_array($report, $excludedReports)) {
                    continue;
                }
                $reflectionClass = new ReflectionClass($report);
                // Don't use abstract classes
                if ($reflectionClass->isAbstract()) {
                    continue;
                }

                /** @var Report $reportObj */
                $reportObj = $report::create();
                if ($reportObj->hasMethod('sort')) {
                    // Use the sort method to specify the sort field
                    $reportObj->sort = $reportObj->sort();
                }
                $reportsArray[$report] = $reportObj;
            }
        }

        uasort($reportsArray, function ($a, $b) {
            if ($a->sort == $b->sort) {
                return 0;
            } else {
                return ($a->sort < $b->sort) ? -1 : 1;
            }
        });

        return $reportsArray;
    }
public static function get_reports()
    {
        $reports = ClassInfo::subclassesFor(get_called_class());

        $reportsArray = [];
        if ($reports && count($reports) > 0) {
            $excludedReports = static::get_excluded_reports();
            // Collect reports into array with an attribute for 'sort'
            foreach ($reports as $report) {
                // Don't use the Report superclass, or any excluded report classes
                if (in_array($report, $excludedReports)) {
                    continue;
                }
                $reflectionClass = new ReflectionClass($report);
                // Don't use abstract classes
                if ($reflectionClass->isAbstract()) {
                    continue;
                }

                /** @var Report $reportObj */
                $reportObj = $report::create();
                if ($reportObj->hasMethod('sort')) {
                    // Use the sort method to specify the sort field
                    $reportObj->sort = $reportObj->sort();
                }
                $reportsArray[$report] = $reportObj;
            }
        }

        uasort($reportsArray, function ($a, $b) {
            if ($a->sort == $b->sort) {
                return 0;
            } else {
                return ($a->sort < $b->sort) ? -1 : 1;
            }
        });

        return $reportsArray;
    }
public static function get_reports ( ) { $ reports = ClassInfo :: subclassesFor ( get_called_class ( ) ) ; $ reportsArray = [ ] ; if ( $ reports && count ( $ reports ) > 0 ) { $ excludedReports = static :: get_excluded_reports ( ) ; // Collect reports into array with an attribute for 'sort' foreach ( $ reports as $ report ) { // Don't use the Report superclass, or any excluded report classes if ( in_array ( $ report , $ excludedReports ) ) { continue ; } $ reflectionClass = new ReflectionClass ( $ report ) ; // Don't use abstract classes if ( $ reflectionClass -> isAbstract ( ) ) { continue ; } /** @var Report $reportObj */ $ reportObj = $ report :: create ( ) ; if ( $ reportObj -> hasMethod ( 'sort' ) ) { // Use the sort method to specify the sort field $ reportObj -> sort = $ reportObj -> sort ( ) ; } $ reportsArray [ $ report ] = $ reportObj ; } } uasort ( $ reportsArray , function ( $ a , $ b ) { if ( $ a -> sort == $ b -> sort ) { return 0 ; } else { return ( $ a -> sort < $ b -> sort ) ? - 1 : 1 ; } } ) ; return $ reportsArray ; }
Return the SS_Report objects making up the given list.

@return Report[] Array of Report objects
Return the SS_Report objects making up the given list .