for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Astrotomic\Stancy\Factories;
use Astrotomic\Stancy\Exceptions\SheetCollectionNotFoundException;
use Astrotomic\Stancy\Exceptions\SheetNotFoundException;
use Astrotomic\Stancy\Models\Page;
use RuntimeException;
use Spatie\Sheets\Facades\Sheets;
class PageFactory
{
public function make(array $data = [], ?string $page = null): Page
return app(Page::class, [
'data' => $data,
'page' => $page,
]);
}
public function makeFromSheet(string $collection, string $name, ?string $page = null): Page
try {
$sheet = Sheets::collection($collection)->get($name);
} catch (RuntimeException $exception) {
throw SheetCollectionNotFoundException::make($collection, $exception);
if ($sheet === null) {
throw SheetNotFoundException::make($collection, $name);
return static::make($sheet->toArray(), $page);
Astrotomic\Stancy\Factories\PageFactory::make()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
return static::/** @scrutinizer ignore-call */ make($sheet->toArray(), $page);