-<?php namespace BookStack\Entities\Tools;
+<?php
+
+namespace BookStack\Entities\Tools;
use BookStack\Entities\EntityProvider;
use BookStack\Entities\Models\Book;
class SiblingFetcher
{
-
/**
* Search among the siblings of the entity of given type and id.
*/
public function fetch(string $entityType, int $entityId): Collection
{
- $entity = (new EntityProvider)->get($entityType)->visible()->findOrFail($entityId);
+ $entity = (new EntityProvider())->get($entityType)->visible()->findOrFail($entityId);
$entities = [];
// Page in chapter
// Book
// Gets just the books in a shelf if shelf is in context
if ($entity->isA('book')) {
- $contextShelf = (new ShelfContext)->getContextualShelfForBook($entity);
+ $contextShelf = (new ShelfContext())->getContextualShelfForBook($entity);
if ($contextShelf) {
$entities = $contextShelf->visibleBooks()->get();
} else {