Cake\Upgrade\Shell\Task\AppUsesTask::_orderUses PHP Метод

_orderUses() защищенный Метод

For code standards, use statements should be alphabetical but in addition, this Moves all use statements to the top of the class
protected _orderUses ( string $contents ) : string
$contents string
Результат string
    protected function _orderUses($contents)
    {
        preg_match_all('/[\\t ]*\\buse .+;[\\n]/', $contents, $matches);
        $contents = str_replace($matches[0], '', $contents);
        array_walk($matches[0], create_function('&$val', '$val = ltrim($val);'));
        $matches[0] = array_unique($matches[0]);
        sort($matches[0]);
        return preg_replace('/(namespace [\\S+]+;[\\n]{2})/', '\\1' . implode('', $matches[0]), $contents);
    }