DebugKit\Shell\WhitespaceShell::main PHP Method

main() public method

Will check files for whitespace and notify you of any files containing leading or trailing whitespace.
public main ( ) : void
return void
    public function main()
    {
        $path = APP;
        if (!empty($this->params['path']) && strpos($this->params['path'], '/') === 0) {
            $path = $this->params['path'];
        } elseif (!empty($this->params['path'])) {
            $path .= $this->params['path'];
        }
        $folder = new Folder($path);
        $r = $folder->findRecursive('.*\\.php');
        $this->out("Checking *.php in " . $path);
        foreach ($r as $file) {
            $c = file_get_contents($file);
            if (preg_match('/^[\\n\\r|\\n\\r|\\n|\\r|\\s]+\\<\\?php/', $c)) {
                $this->out('!!!contains leading whitespaces: ' . $this->shortPath($file));
            }
            if (preg_match('/\\?\\>[\\n\\r|\\n\\r|\\n|\\r|\\s]+$/', $c)) {
                $this->out('!!!contains trailing whitespaces: ' . $this->shortPath($file));
            }
        }
    }