コード例 #1
0
ファイル: findhooks.php プロジェクト: ruizrube/spdef
 * @param $arr An array
 * @param $sort Boolean : wheter to sort the array (Default: true)
 */
function printArray($msg, $arr, $sort = true)
{
    if ($sort) {
        asort($arr);
    }
    foreach ($arr as $v) {
        echo "{$msg}: {$v}\n";
    }
}
# MAIN
$documented = getHooksFromDoc($doc);
$potential = array();
$bad = array();
foreach ($pathinc as $dir) {
    $potential = array_merge($potential, getHooksFromPath($dir));
    $bad = array_merge($bad, getBadHooksFromPath($dir));
}
$potential = array_unique($potential);
$bad = array_unique($bad);
$todo = array_diff($potential, $documented);
$deprecated = array_diff($documented, $potential);
// let's show the results:
printArray('undocumented', $todo);
printArray('not found', $deprecated);
printArray('unclear hook calls', $bad);
if (count($todo) == 0 && count($deprecated) == 0 && count($bad) == 0) {
    echo "Looks good!\n";
}
コード例 #2
0
ファイル: findhooks.php プロジェクト: puring0815/OpenKore
            if (filetype($path . $file) == 'file') {
                $hooks = array_merge($hooks, getHooksFromFile($path . $file));
            }
        }
        closedir($dh);
    }
    return $hooks;
}
/**
 * Nicely output the array
 * @param $msg A message to show before the value
 * @param $arr An array
 * @param $sort Boolean : wheter to sort the array (Default: true)
 */
function printArray($msg, $arr, $sort = true)
{
    if ($sort) {
        asort($arr);
    }
    foreach ($arr as $v) {
        print "{$msg}: {$v}\n";
    }
}
# MAIN
$documented = getHooksFromDoc($doc);
$potential = getHooksFromPath($pathinc);
$todo = array_diff($potential, $documented);
$deprecated = array_diff($documented, $potential);
// let's show the results:
printArray('undocumented', $todo);
printArray('not found', $deprecated);