lib/console/controllers/PhpDocController.php
public function actionFix($root = null)
    {
        $files = $this->findFiles($root);

        $nFilesTotal = 0;
        $nFilesUpdated = 0;
        foreach ($files as $file) {
            $contents = file_get_contents($file);
            $sha = sha1($contents);

            // fix line endings
            $lines = preg_split('/(\r\n|\n|\r)/', $contents);

            $this->fixFileDoc($lines, $file);

            $newContent = implode("\n", $lines);
            if ($sha !== sha1($newContent)) {
                $nFilesUpdated++;
            }
            file_put_contents($file, $newContent);
            $nFilesTotal++;
        }

        $this->stdout("\nParsed $nFilesTotal files.\n");
        $this->stdout("Updated $nFilesUpdated files.\n");
    }
public function actionFix($root = null)
    {
        $files = $this->findFiles($root);

        $nFilesTotal = 0;
        $nFilesUpdated = 0;
        foreach ($files as $file) {
            $contents = file_get_contents($file);
            $sha = sha1($contents);

            // fix line endings
            $lines = preg_split('/(\r\n|\n|\r)/', $contents);

            $this->fixFileDoc($lines, $file);

            $newContent = implode("\n", $lines);
            if ($sha !== sha1($newContent)) {
                $nFilesUpdated++;
            }
            file_put_contents($file, $newContent);
            $nFilesTotal++;
        }

        $this->stdout("\nParsed $nFilesTotal files.\n");
        $this->stdout("Updated $nFilesUpdated files.\n");
    }
public function actionFix ( $ root = null ) { $ files = $ this -> findFiles ( $ root ) ; $ nFilesTotal = 0 ; $ nFilesUpdated = 0 ; foreach ( $ files as $ file ) { $ contents = file_get_contents ( $ file ) ; $ sha = sha1 ( $ contents ) ; // fix line endings $ lines = preg_split ( '/(\r\n|\n|\r)/' , $ contents ) ; $ this -> fixFileDoc ( $ lines , $ file ) ; $ newContent = implode ( "\n" , $ lines ) ; if ( $ sha !== sha1 ( $ newContent ) ) { $ nFilesUpdated ++ ; } file_put_contents ( $ file , $ newContent ) ; $ nFilesTotal ++ ; } $ this -> stdout ( "\nParsed $nFilesTotal files.\n" ) ; $ this -> stdout ( "Updated $nFilesUpdated files.\n" ) ; }
Fix some issues with PHPdoc in files.

@param string $root the directory to parse files from. Defaults to YII_PATH.
Fix some issues with PHPdoc in files .