Reflect 3.1.0 has just been released.

News:

  • Ability to filter results of each analyser with a closure (on all SAPI).

Example 1: display a restricted view of structure analyser to classes info.

Writes filter rules (into, e.g: YourFilters.php)
<?php

$closure = function ($data) {
    $filterOnKeys = array(
        'classes', 'abstractClasses', 'concreteClasses',
    );

    foreach ($data as $title => &$keys) {
        if (strpos($title, 'StructureAnalyser') === false) {
            continue;
        }
        // looking into Structure Analyser metrics only
        foreach ($keys as $key => $val) {
            if (!in_array($key, $filterOnKeys)) {
                $keys[$key] = false;  // "removed" partially unsolicited values
                continue;
            }
        }
    }
    return $data;
};

return $closure;
The filter’s file that host the $closure, must be resolvable through the include_path.
Be carefull, with filter source code, or unwanted results may occured.
You have ability to remove definitively (unset), or remove partially (false), values in response through the filter.
Only one filter is allowed at same run, but you can combine one or more analyser rules.

On CLI, you have to invoke the analyser:run command with the --filter option. E.g :

$ phpreflect analyser:run --filter=YourFilters.php src

On Reflect source code, that will display such output:

Data Source Analysed

Directories                                         20
Files                                               72

Structure
  Classes                                           64
    Abstract Classes                                 6 (9.38%)
    Concrete Classes                                58 (90.62%)

Download :

Published by Laurent Laville on 2015-05-11