Skip to main content
Glama
ProjectContext.php1.56 kB
<?php declare(strict_types=1); namespace GoldenPathDigital\LaravelAscend\Analyzers; use GoldenPathDigital\LaravelAscend\Documentation\DocumentationException; final class ProjectContext { private string $rootPath; /** * @var array<string, bool> */ private array $excludedDirectories; /** * @param array<int, string> $excludedDirectories */ public function __construct(string $rootPath, array $excludedDirectories = ['vendor', 'node_modules', 'storage', '.git']) { $resolved = realpath($rootPath); if ($resolved === false || !is_dir($resolved)) { throw DocumentationException::becauseBasePathIsInvalid($rootPath); } $this->rootPath = $resolved; $this->excludedDirectories = array_fill_keys($excludedDirectories, true); } public function getRootPath(): string { return $this->rootPath; } public function isExcluded(string $relativePath): bool { $segments = explode(DIRECTORY_SEPARATOR, $relativePath); $segments = array_filter($segments); foreach ($segments as $segment) { if (isset($this->excludedDirectories[$segment])) { return true; } } return false; } public function resolvePath(string $relativePath): string { $relative = ltrim(str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $relativePath), DIRECTORY_SEPARATOR); $candidate = $this->rootPath . DIRECTORY_SEPARATOR . $relative; return $candidate; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aarongrtech/laravel-ascend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server