public function minifyCommand()
    {
        $ManaPHPSrcDir = $this->alias->get('@manaphp');
        $ManaPHPDstDir = $ManaPHPSrcDir . '_' . date('ymd');
        $totalClassLines = 0;
        $totalInterfaceLines = 0;
        $totalLines = 0;
        $fileLines = [];
        $sourceFiles = $this->_getSourceFiles($ManaPHPSrcDir);
        foreach ($sourceFiles as $file) {
            $dstFile = str_replace($ManaPHPSrcDir, $ManaPHPDstDir, $file);

            $content = $this->_minify($this->filesystem->fileGet($file));
            $lineCount = substr_count($content, strpos($content, "\r") !== false ? "\r" : "\n");

            if (strpos($file, 'Interface.php')) {
                $totalInterfaceLines += $lineCount;
                $totalLines += $lineCount;
            } else {
                $totalClassLines += $lineCount;
                $totalLines += $lineCount;
            }

            $this->console->writeLn($content);
            $this->filesystem->filePut($dstFile, $content);
            $fileLines[$file] = $lineCount;
        }

        asort($fileLines);

        $i = 1;
        $this->console->writeLn('------------------------------------------------------');

        foreach ($fileLines as $file => $line) {
            $this->console->writeLn(sprintf('%3d %3d %.3f', $i++, $line, $line / $totalLines * 100) . ' ' . substr($file, strpos($file, 'ManaPHP')));
        }

        $this->console->writeLn('------------------------------------------------------');
        $this->console->writeLn('total     lines: ' . $totalLines);
        $this->console->writeLn('class     lines: ' . $totalClassLines);
        $this->console->writeLn('interface lines:  ' . $totalInterfaceLines);

        return 0;
    }
public function minifyCommand()
    {
        $ManaPHPSrcDir = $this->alias->get('@manaphp');
        $ManaPHPDstDir = $ManaPHPSrcDir . '_' . date('ymd');
        $totalClassLines = 0;
        $totalInterfaceLines = 0;
        $totalLines = 0;
        $fileLines = [];
        $sourceFiles = $this->_getSourceFiles($ManaPHPSrcDir);
        foreach ($sourceFiles as $file) {
            $dstFile = str_replace($ManaPHPSrcDir, $ManaPHPDstDir, $file);

            $content = $this->_minify($this->filesystem->fileGet($file));
            $lineCount = substr_count($content, strpos($content, "\r") !== false ? "\r" : "\n");

            if (strpos($file, 'Interface.php')) {
                $totalInterfaceLines += $lineCount;
                $totalLines += $lineCount;
            } else {
                $totalClassLines += $lineCount;
                $totalLines += $lineCount;
            }

            $this->console->writeLn($content);
            $this->filesystem->filePut($dstFile, $content);
            $fileLines[$file] = $lineCount;
        }

        asort($fileLines);

        $i = 1;
        $this->console->writeLn('------------------------------------------------------');

        foreach ($fileLines as $file => $line) {
            $this->console->writeLn(sprintf('%3d %3d %.3f', $i++, $line, $line / $totalLines * 100) . ' ' . substr($file, strpos($file, 'ManaPHP')));
        }

        $this->console->writeLn('------------------------------------------------------');
        $this->console->writeLn('total     lines: ' . $totalLines);
        $this->console->writeLn('class     lines: ' . $totalClassLines);
        $this->console->writeLn('interface lines:  ' . $totalInterfaceLines);

        return 0;
    }
public function minifyCommand ( ) { $ ManaPHPSrcDir = $ this -> alias -> get ( '@manaphp' ) ; $ ManaPHPDstDir = $ ManaPHPSrcDir . '_' . date ( 'ymd' ) ; $ totalClassLines = 0 ; $ totalInterfaceLines = 0 ; $ totalLines = 0 ; $ fileLines = [ ] ; $ sourceFiles = $ this -> _getSourceFiles ( $ ManaPHPSrcDir ) ; foreach ( $ sourceFiles as $ file ) { $ dstFile = str_replace ( $ ManaPHPSrcDir , $ ManaPHPDstDir , $ file ) ; $ content = $ this -> _minify ( $ this -> filesystem -> fileGet ( $ file ) ) ; $ lineCount = substr_count ( $ content , strpos ( $ content , "\r" ) !== false ? "\r" : "\n" ) ; if ( strpos ( $ file , 'Interface.php' ) ) { $ totalInterfaceLines += $ lineCount ; $ totalLines += $ lineCount ; } else { $ totalClassLines += $ lineCount ; $ totalLines += $ lineCount ; } $ this -> console -> writeLn ( $ content ) ; $ this -> filesystem -> filePut ( $ dstFile , $ content ) ; $ fileLines [ $ file ] = $ lineCount ; } asort ( $ fileLines ) ; $ i = 1 ; $ this -> console -> writeLn ( '------------------------------------------------------' ) ; foreach ( $ fileLines as $ file => $ line ) { $ this -> console -> writeLn ( sprintf ( '%3d %3d %.3f' , $ i ++ , $ line , $ line / $ totalLines * 100 ) . ' ' . substr ( $ file , strpos ( $ file , 'ManaPHP' ) ) ) ; } $ this -> console -> writeLn ( '------------------------------------------------------' ) ; $ this -> console -> writeLn ( 'total     lines: ' . $ totalLines ) ; $ this -> console -> writeLn ( 'class     lines: ' . $ totalClassLines ) ; $ this -> console -> writeLn ( 'interface lines:  ' . $ totalInterfaceLines ) ; return 0 ; }
minify framework source code
@return int
minify framework source code