/** * Writes a content in a local path and returns written length * * @param string $path * @param \MarkdownExtended\API\ContentInterface $content * * @return int */ protected function writeOutputFile($path, ContentInterface $content) { // construct output file name $name = $content->getMetadata('file_name'); $path = Helper::fillPlaceholders($path, !empty($name) ? pathinfo($name, PATHINFO_FILENAME) : Helper::header2Label($content->getTitle())); // make a backup if `option[force]!==true` $backup = (bool) $this->getKernel()->getConfig('force') !== true; // write output Helper::writeFile($path, (string) $content, $backup); // return created path return $path; }