Skip to content

Commit aa0f16b

Browse files
committed
refactor(engine): improve code formatting for readability in chapter handling
1 parent aae5530 commit aa0f16b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

classes/sync/engine.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,10 @@ private function parse_tree(array $tree): array {
226226
}
227227

228228
// Chapter files: sections/NN-name/NN-bookname/NN-chapter.html.
229-
if (preg_match('#^sections/([^/]+)/([^/]+)/([^/]+\.html)$#', $path, $matches)
230-
&& $item['type'] === 'blob') {
229+
if (
230+
preg_match('#^sections/([^/]+)/([^/]+)/([^/]+\.html)$#', $path, $matches)
231+
&& $item['type'] === 'blob'
232+
) {
231233
$dirname = $matches[1];
232234
$bookdir = $matches[2];
233235
$chapterfile = $matches[3];
@@ -602,8 +604,10 @@ private function update_existing_book(
602604

603605
if ($chaptermapping && $chaptermapping->content_hash === $contenthash) {
604606
// Content unchanged — but still update pagenum in case ordering changed.
605-
$existingchapter = $DB->get_record('book_chapters',
606-
['bookid' => $bookid, 'importsrc' => $chapterpath]);
607+
$existingchapter = $DB->get_record(
608+
'book_chapters',
609+
['bookid' => $bookid, 'importsrc' => $chapterpath]
610+
);
607611
if ($existingchapter && (int) $existingchapter->pagenum !== $pagenum) {
608612
$existingchapter->pagenum = $pagenum;
609613
$existingchapter->timemodified = time();

0 commit comments

Comments
 (0)