*/ public function validatePath(string $path): array { $theme = $this->loader->fromPath($path); return $this->validate($theme); } /** @return array */ public function validate(Theme $theme): array { $issues = []; $entryView = 'views/'.str_replace('.', '/', $theme->entryView()).'.blade.php'; if (! $theme->has($entryView)) { $issues[] = [ 'severity' => 'error', 'message' => "Entry view [{$theme->entryView()}] was not found.", 'file' => $entryView, ]; } foreach (['stylesheet' => $theme->stylesheet(), 'script' => $theme->script()] as $label => $relativePath) { if ($relativePath !== '' && ! $theme->has($relativePath)) { $issues[] = [ 'severity' => 'error', 'message' => ucfirst($label)." file [{$relativePath}] was not found.", 'file' => $relativePath, ]; } } $preview = $theme->preview(); if ($preview !== null && ! $theme->has($preview)) { $issues[] = [ 'severity' => 'warning', 'message' => "Preview file [{$preview}] was not found.", 'file' => $preview, ]; } foreach ((array) ($theme->meta()['assets'] ?? []) as $asset) { if (! is_string($asset) || $asset === '') { continue; } if (! $theme->has($asset)) { $issues[] = [ 'severity' => 'warning', 'message' => "Declared asset [{$asset}] was not found.", 'file' => $asset, ]; } } return array_merge($issues, $this->accessibility->validate($theme)); } }