fromFile($this->storage->path($this->path)); if ( ! $content) { throw new \Exception('Could not read content.'); } $content = $this->convertToUTF8($content); $this->storeContent($content); } protected function convertToUTF8($content) { array_walk_recursive( $content, function (&$entry) { $entry = mb_convert_encoding( $entry, 'UTF-8' ); } ); return $content; } protected function storeContent($content) { $this->storeMD($content); $this->deleteOriginalDocument(); } protected function storeMD($content) { $convertor = new MDConvertor($content); $this->storage->put("$this->directoryPath/document.md", $convertor->execute()); } }