From ac3600bf373df370ee2a8ff4805e1d20a54081ac Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 27 Dec 2021 11:58:19 +0100 Subject: [PATCH] Tweak the feature that links to Symfony repository URLs --- src/BuildConfig.php | 6 +++--- src/KernelFactory.php | 6 +++--- src/Reference/ClassReference.php | 8 ++++---- src/Reference/MethodReference.php | 8 ++++---- src/Reference/NamespaceReference.php | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/BuildConfig.php b/src/BuildConfig.php index 3e05eb5..b7281c3 100644 --- a/src/BuildConfig.php +++ b/src/BuildConfig.php @@ -16,7 +16,7 @@ class BuildConfig { private const PHP_DOC_URL = 'https://secure.php.net/manual/en'; - private const GITHUB_URL = 'https://github.com/symfony/symfony/blob/{symfonyVersion}/src'; + private const SYMFONY_REPOSITORY_URL = 'https://github.com/symfony/symfony/blob/{symfonyVersion}/src'; private const SYMFONY_DOC_URL = 'https://symfony.com/doc/{symfonyVersion}'; private $useBuildCache; @@ -78,9 +78,9 @@ public function getPhpDocUrl(): string return self::PHP_DOC_URL; } - public function getGithubUrl(): string + public function getSymfonyRepositoryUrl(): string { - return str_replace('{symfonyVersion}', $this->getSymfonyVersion(), self::GITHUB_URL); + return str_replace('{symfonyVersion}', $this->getSymfonyVersion(), self::SYMFONY_REPOSITORY_URL); } public function getSymfonyDocUrl(): string diff --git a/src/KernelFactory.php b/src/KernelFactory.php index 3a17b47..ffbee0c 100644 --- a/src/KernelFactory.php +++ b/src/KernelFactory.php @@ -101,9 +101,9 @@ private static function getDirectives(): array private static function getReferences(BuildConfig $buildConfig): array { return [ - new SymfonyReferences\ClassReference($buildConfig->getGithubUrl()), - new SymfonyReferences\MethodReference($buildConfig->getGithubUrl()), - new SymfonyReferences\NamespaceReference($buildConfig->getGithubUrl()), + new SymfonyReferences\ClassReference($buildConfig->getSymfonyRepositoryUrl()), + new SymfonyReferences\MethodReference($buildConfig->getSymfonyRepositoryUrl()), + new SymfonyReferences\NamespaceReference($buildConfig->getSymfonyRepositoryUrl()), new SymfonyReferences\PhpFunctionReference($buildConfig->getPhpDocUrl()), new SymfonyReferences\PhpMethodReference($buildConfig->getPhpDocUrl()), new SymfonyReferences\PhpClassReference($buildConfig->getPhpDocUrl()), diff --git a/src/Reference/ClassReference.php b/src/Reference/ClassReference.php index 362d1ba..56cd375 100644 --- a/src/Reference/ClassReference.php +++ b/src/Reference/ClassReference.php @@ -16,11 +16,11 @@ class ClassReference extends Reference { - private $githubUrl; + private $symfonyRepositoryUrl; - public function __construct(string $githubUrl) + public function __construct(string $symfonyRepositoryUrl) { - $this->githubUrl = $githubUrl; + $this->symfonyRepositoryUrl = $symfonyRepositoryUrl; } public function getName(): string @@ -35,7 +35,7 @@ public function resolve(Environment $environment, string $data): ResolvedReferen return new ResolvedReference( $environment->getCurrentFileName(), $className->afterLast('\\'), - sprintf('%s/%s.php', $this->githubUrl, $className->replace('\\', '/')), + sprintf('%s/%s.php', $this->symfonyRepositoryUrl, $className->replace('\\', '/')), [], [ 'title' => $className, diff --git a/src/Reference/MethodReference.php b/src/Reference/MethodReference.php index d552fcc..baacc46 100644 --- a/src/Reference/MethodReference.php +++ b/src/Reference/MethodReference.php @@ -16,11 +16,11 @@ class MethodReference extends Reference { - private $githubUrl; + private $symfonyRepositoryUrl; - public function __construct(string $githubUrl) + public function __construct(string $symfonyRepositoryUrl) { - $this->githubUrl = $githubUrl; + $this->symfonyRepositoryUrl = $symfonyRepositoryUrl; } public function getName(): string @@ -42,7 +42,7 @@ public function resolve(Environment $environment, string $data): ResolvedReferen return new ResolvedReference( $environment->getCurrentFileName(), $methodName.'()', - sprintf('%s/%s.php#method_%s', $this->githubUrl, str_replace('\\', '/', $className), $methodName), + sprintf('%s/%s.php#method_%s', $this->symfonyRepositoryUrl, str_replace('\\', '/', $className), $methodName), [], [ 'title' => sprintf('%s::%s()', $className, $methodName), diff --git a/src/Reference/NamespaceReference.php b/src/Reference/NamespaceReference.php index c825f85..96eaff9 100644 --- a/src/Reference/NamespaceReference.php +++ b/src/Reference/NamespaceReference.php @@ -16,11 +16,11 @@ class NamespaceReference extends Reference { - private $githubUrl; + private $symfonyRepositoryUrl; - public function __construct(string $githubUrl) + public function __construct(string $symfonyRepositoryUrl) { - $this->githubUrl = $githubUrl; + $this->symfonyRepositoryUrl = $symfonyRepositoryUrl; } public function getName(): string @@ -35,7 +35,7 @@ public function resolve(Environment $environment, string $data): ResolvedReferen return new ResolvedReference( $environment->getCurrentFileName(), $className->afterLast('\\'), - sprintf('%s/%s', $this->githubUrl, $className->replace('\\', '/')), + sprintf('%s/%s', $this->symfonyRepositoryUrl, $className->replace('\\', '/')), [], [ 'title' => $className,