Print chapter body
@param $file (string) name of the file containing the chapter body
@param $mode (boolean) if true the chapter body is in HTML, otherwise in simple text.
@public
174025
public function ChapterBody($file, $mode=false) {
		$this->selectColumn();
		// get esternal file content
		$content = file_get_contents($file, false);
		// set font
		$this->SetFont('times', '', 9);
		$this->SetTextColor(50, 50, 50);
		// print content
		if ($mode) {
			// ------ HTML MODE ------
			$this->writeHTML($content, true, false, true, false, 'J');
		} else {
			// ------ TEXT MODE ------
			$this->Write(0, $content, '', 0, 'J', true, 0, false, true, 0);
		}
		$this->Ln();
	}
754384
public function write($file = "")
    {
        $envString = $this->generateEnvString($this->lines);
        file_put_contents($file ? $file : $this->filePath, $envString);
    }
1301513
public function setLayout($file)
    {
        if (strstr($file, '::')) {
            $file = explode('::', $file);
            $package = $file[0];
            $file = $file[1];
        } else {
            $package = $this->package;
        }

        $this->assignDeclaredLayout($package, $file);
    }
985035
public function read($file)
    {
        $this->lines = [];

        $section = '';

        foreach (file($file) as $line) {
            if (preg_match('/^\s*(;.*)?$/', $line)) {
                // comment or whitespace
                $this->lines[] = [
                    'type' => 'comment',
                    'data' => $line,
                    'section' => $section
                ];
            } elseif (preg_match('/^\s?\[(.*)\]/', $line, $match)) {
                // section
                $section = $match[1];
                $this->lines[] = [
                    'type' => 'section',
                    'data' => $line,
                    'section' => $section
                ];
            } elseif (preg_match('/^\s*(.*?)\s*=\s*(.*?)\s*$/', $line, $match)) {
                // entry
                $this->lines[] = [
                    'type' => 'entry',
                    'data' => $line,
                    'section' => $section,
                    'key' => $match[1],
                    'value' => $match[2]
                ];
            }
        }
    }
519496
public static function chmod($file, $mode)
    {
        if (!@chmod($file, $mode)) {
            throw new IOException(sprintf("Cannot chmod %s to %s", $file, $mode));
        }
    }
833729
private function _output( \Throwable $e, string $title, string $file, int $line ) : string
    {
        $html  = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
        $html .= '<html lang="ja">';
        $html .= '<head>';
        $html .= $this->makeHtmlHead( $title );
        $html .= '</head>';
        $html .= '<body>' . PHP_EOL;
        $html .= $this->makeHtmlBody( $e, $title, $file, $line );
        $html .= '</body>' . PHP_EOL;
        $html .= '</html>' . PHP_EOL;

        return $html;
    }
356781
public function open($file, $mode)
    {
        if (!empty(trim($file)) && !empty(trim($mode))) {
            $this->resource = fopen($file, $this->modes[$mode]);
            $this->file = $file;

            return $this;
        }

        return false;
    }
5114
public function read(string $file): string
    {
        $destFile = tempnam(sys_get_temp_dir(), 'pdf_to_text_');

        $command = sprintf(
            'pdftotext -layout %s %s',
            escapeshellarg(realpath($file)),
            escapeshellarg($destFile)
        );

        $return = 0;
        $output = system($command, $return);

        $content = file_get_contents($destFile);
        unlink($destFile);

        switch ($return) {
            case 0:
                return $content;

            default:
                throw new \Exception($command . PHP_EOL . $output, $return);
        }
    }
939969
public function write($file = '') {
        if ($file == '') {
            $file = $this->outSourceFile;
        }

        file_put_contents($file, $this->generate());
    }
548555
public function withTag($file, $inline = false)
    {
        $versionedFile = $this->version($file);
        $extension = pathinfo($file, PATHINFO_EXTENSION);

        if ($inline) {
            $versionedFile = strtok($versionedFile, '?');
            $absoluteFile = implode('/', array_filter([
                $this->rootPath,
                $this->publicPath,
                ltrim($versionedFile, '/')
            ]));
            if (file_exists($absoluteFile)) {
                $content = file_get_contents($absoluteFile);

                if ($extension === 'js') {
                    return '<script>' . $content . '</script>';
                }

                return '<style>' . $content . '</style>';
            }
        }

        if ($extension === 'js') {
            return '<script src="' . $versionedFile . '"></script>';
        }

        return '<link rel="stylesheet" href="' . $versionedFile . '">';
    }
227691
private function process($mode, $class)
    {
        switch ($mode) {
            case self::OPTION_DOCUMENT:
                $class !== null ? $this->sm->deleteDocumentTableFor($class) : $this->sm->deleteAllDocumentTables();
                break;
            case self::OPTION_GENERATOR:
                $class !== null ? $this->sm->deleteGeneratorTablesFor($class) : $this->sm->deleteAllGeneratorTables();
                break;
        }
    }
1215234
private function parse_mode( &$mode, $buffer )
	{
		if ( substr( trim( $buffer ), 0, 6 ) === '# --->' )
		{
			$mode = trim( substr( $buffer, 6 ) );
		}
	}
993947
public static function truncate(String $file, Int $limit = 0, String $mode = 'r+')
    {
        $file = Info::rpath($file);

        if( ! is_file($file) )
        {
            throw new Exception\FileNotFoundException(NULL, $file);
        }

        $fileOpen  = fopen($file, $mode);
        $fileWrite = ftruncate($fileOpen, $limit);

        fclose($fileOpen);
    }
1320878
private final function setReadableWritable(string $mode)
   {
      if (self::MODE_R === $mode) {
          $this->meta["readable"] = true;
          $this->meta["writable"] = false;
      } else if (self::MODE_W === $mode
              || self::MODE_A === $mode
              || self::MODE_C === $mode
              || self::MODE_X === $mode) {
          $this->meta["readable"] = false;
          $this->meta["writable"] = true;
      } else if (self::MODE_R_MORE === $mode
              || self::MODE_W_MORE === $mode    
              || self::MODE_A_MORE === $mode
              || self::MODE_C_MORE === $mode
              || self::MODE_X_MORE === $mode) {
          $this->meta["readable"] = true;
          $this->meta["writable"] = true;
       }
   }
137589
public function mode($mode)
    {
        if ($mode !== false) {
            $this->staging = true;
        } else {
            $this->staging = false;
        }
    }
271308
protected function openFile(string $file, string $mode)
    {
        $fp = @fopen($file, $mode);
        if (false === $fp) {
            throw new StreamException(
                    'Can not open file ' . $file . ' with mode ' . $mode . ': '
                    .
                    str_replace('fopen(' . $file . '): ', '', lastErrorMessage())
            );
        }

        return $fp;
    }
379771
public static function write($filename, $content, $mode = 0666)
    {
        self::ensureFileSystem()->dumpFile($filename, $content, $mode);
    }