public static function getFileLinesCount($path) { $docbook = FrontController::getInstance(); $wc_cmd = Command::getCommandPath('wc'); $command = $wc_cmd . ' -l ' . $path; list($stdout, $status, $stderr) = $docbook->getTerminal()->run($command, $path); $parts = explode(' ', trim($stdout)); $lines = array_shift($parts); return !empty($lines) ? $lines : 0; }