Skip to content

Commit 92d442e

Browse files
Updated access modifiers from private to protected across multiple files (#249)
Co-authored-by: Ashley Hindle <ashleyhindle@users.noreply.github.com>
1 parent 1f95db8 commit 92d442e

11 files changed

+44
-44
lines changed

src/BoostServiceProvider.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function boot(Router $router): void
7676
}
7777
}
7878

79-
private function registerPublishing(): void
79+
protected function registerPublishing(): void
8080
{
8181
if ($this->app->runningInConsole()) {
8282
$this->publishes([
@@ -85,7 +85,7 @@ private function registerPublishing(): void
8585
}
8686
}
8787

88-
private function registerCommands(): void
88+
protected function registerCommands(): void
8989
{
9090
if ($this->app->runningInConsole()) {
9191
$this->commands([
@@ -96,7 +96,7 @@ private function registerCommands(): void
9696
}
9797
}
9898

99-
private function registerRoutes(): void
99+
protected function registerRoutes(): void
100100
{
101101
Route::post('/_boost/browser-logs', function (Request $request) {
102102
$logs = $request->input('logs', []);
@@ -156,7 +156,7 @@ private static function buildLogMessageFromData(array $data): string
156156
return implode(' ', $messages);
157157
}
158158

159-
private function registerBrowserLogger(): void
159+
protected function registerBrowserLogger(): void
160160
{
161161
config([
162162
'logging.channels.browser' => [
@@ -168,19 +168,19 @@ private function registerBrowserLogger(): void
168168
]);
169169
}
170170

171-
private function registerBladeDirectives(BladeCompiler $bladeCompiler): void
171+
protected function registerBladeDirectives(BladeCompiler $bladeCompiler): void
172172
{
173173
$bladeCompiler->directive('boostJs', fn (): string => '<?php echo '.\Laravel\Boost\Services\BrowserLogger::class.'::getScript(); ?>');
174174
}
175175

176-
private function hookIntoResponses(Router $router): void
176+
protected function hookIntoResponses(Router $router): void
177177
{
178178
$this->app->booted(function () use ($router): void {
179179
$router->pushMiddlewareToGroup('web', InjectBoost::class);
180180
});
181181
}
182182

183-
private function shouldRun(): bool
183+
protected function shouldRun(): bool
184184
{
185185
if (! config('boost.enabled', true)) {
186186
return false;

src/Concerns/ReadsLogs.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ trait ReadsLogs
1212
* Regular expression fragments and default chunk-window sizes used when
1313
* scanning log files. Declaring them once keeps every consumer in sync.
1414
*/
15-
private function getTimestampRegex(): string
15+
protected function getTimestampRegex(): string
1616
{
1717
return '\\[\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\]';
1818
}
1919

20-
private function getEntrySplitRegex(): string
20+
protected function getEntrySplitRegex(): string
2121
{
2222
return '/(?='.$this->getTimestampRegex().')/';
2323
}
2424

25-
private function getErrorEntryRegex(): string
25+
protected function getErrorEntryRegex(): string
2626
{
2727
return '/^'.$this->getTimestampRegex().'.*\\.ERROR:/';
2828
}
2929

30-
private function getChunkSizeStart(): int
30+
protected function getChunkSizeStart(): int
3131
{
3232
return 64 * 1024; // 64 kB
3333
}
3434

35-
private function getChunkSizeMax(): int
35+
protected function getChunkSizeMax(): int
3636
{
3737
return 1024 * 1024; // 1 MB
3838
}
@@ -114,7 +114,7 @@ protected function readLastErrorEntry(string $logFile): ?string
114114
*
115115
* @return string[]
116116
*/
117-
private function scanLogChunkForEntries(string $logFile, int $chunkSize): array
117+
protected function scanLogChunkForEntries(string $logFile, int $chunkSize): array
118118
{
119119
$fileSize = filesize($logFile);
120120
if ($fileSize === false) {

src/Console/InstallCommand.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function handle(CodeEnvironmentsDetector $codeEnvironmentsDetector, Herd
7676
$this->outro();
7777
}
7878

79-
private function bootstrap(CodeEnvironmentsDetector $codeEnvironmentsDetector, Herd $herd, Terminal $terminal): void
79+
protected function bootstrap(CodeEnvironmentsDetector $codeEnvironmentsDetector, Herd $herd, Terminal $terminal): void
8080
{
8181
$this->codeEnvironmentsDetector = $codeEnvironmentsDetector;
8282
$this->herd = $herd;
@@ -93,14 +93,14 @@ private function bootstrap(CodeEnvironmentsDetector $codeEnvironmentsDetector, H
9393
$this->projectName = config('app.name');
9494
}
9595

96-
private function displayBoostHeader(): void
96+
protected function displayBoostHeader(): void
9797
{
9898
note($this->boostLogo());
9999
intro('✦ Laravel Boost :: Install :: We Must Ship ✦');
100100
note("Let's give {$this->bgYellow($this->black($this->bold($this->projectName)))} a Boost");
101101
}
102102

103-
private function boostLogo(): string
103+
protected function boostLogo(): string
104104
{
105105
return
106106
<<<'HEADER'
@@ -113,21 +113,21 @@ private function boostLogo(): string
113113
HEADER;
114114
}
115115

116-
private function discoverEnvironment(): void
116+
protected function discoverEnvironment(): void
117117
{
118118
$this->systemInstalledCodeEnvironments = $this->codeEnvironmentsDetector->discoverSystemInstalledCodeEnvironments();
119119
$this->projectInstalledCodeEnvironments = $this->codeEnvironmentsDetector->discoverProjectInstalledCodeEnvironments(base_path());
120120
}
121121

122-
private function collectInstallationPreferences(): void
122+
protected function collectInstallationPreferences(): void
123123
{
124124
$this->selectedBoostFeatures = $this->selectBoostFeatures();
125125
$this->selectedTargetMcpClient = $this->selectTargetMcpClients();
126126
$this->selectedTargetAgents = $this->selectTargetAgents();
127127
$this->enforceTests = $this->determineTestEnforcement(ask: false);
128128
}
129129

130-
private function performInstallation(): void
130+
protected function performInstallation(): void
131131
{
132132
$this->installGuidelines();
133133

@@ -138,7 +138,7 @@ private function performInstallation(): void
138138
}
139139
}
140140

141-
private function discoverTools(): array
141+
protected function discoverTools(): array
142142
{
143143
$tools = [];
144144
$toolDir = implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'Mcp', 'Tools']);
@@ -159,7 +159,7 @@ private function discoverTools(): array
159159
return $tools;
160160
}
161161

162-
private function outro(): void
162+
protected function outro(): void
163163
{
164164
$label = 'https://boost.laravel.com/installed';
165165

@@ -189,7 +189,7 @@ private function outro(): void
189189
echo $this->black($this->bold($text.$link)).$this->reset(PHP_EOL).$this->reset(PHP_EOL);
190190
}
191191

192-
private function hyperlink(string $label, string $url): string
192+
protected function hyperlink(string $label, string $url): string
193193
{
194194
return "\033]8;;{$url}\007{$label}\033]8;;\033\\";
195195
}
@@ -230,7 +230,7 @@ protected function determineTestEnforcement(bool $ask = true): bool
230230
/**
231231
* @return Collection<int, string>
232232
*/
233-
private function selectBoostFeatures(): Collection
233+
protected function selectBoostFeatures(): Collection
234234
{
235235
$defaultInstallOptions = ['mcp_server', 'ai_guidelines'];
236236
$installOptions = [
@@ -272,7 +272,7 @@ protected function boostToolsToDisable(): array
272272
/**
273273
* @return Collection<int, CodeEnvironment>
274274
*/
275-
private function selectTargetMcpClients(): Collection
275+
protected function selectTargetMcpClients(): Collection
276276
{
277277
if (! $this->shouldInstallMcp() && ! $this->shouldInstallHerdMcp()) {
278278
return collect();
@@ -287,7 +287,7 @@ private function selectTargetMcpClients(): Collection
287287
/**
288288
* @return Collection<int, CodeEnvironment>
289289
*/
290-
private function selectTargetAgents(): Collection
290+
protected function selectTargetAgents(): Collection
291291
{
292292
if (! $this->shouldInstallAiGuidelines()) {
293293
return collect();
@@ -304,7 +304,7 @@ private function selectTargetAgents(): Collection
304304
*
305305
* @return array{scroll: int, required: bool, displayMethod: string}
306306
*/
307-
private function getSelectionConfig(string $contractClass): array
307+
protected function getSelectionConfig(string $contractClass): array
308308
{
309309
return match ($contractClass) {
310310
Agent::class => ['scroll' => 5, 'required' => false, 'displayMethod' => 'agentName'],
@@ -316,7 +316,7 @@ private function getSelectionConfig(string $contractClass): array
316316
/**
317317
* @return Collection<int, CodeEnvironment>
318318
*/
319-
private function selectCodeEnvironments(string $contractClass, string $label): Collection
319+
protected function selectCodeEnvironments(string $contractClass, string $label): Collection
320320
{
321321
$allEnvironments = $this->codeEnvironmentsDetector->getCodeEnvironments();
322322
$config = $this->getSelectionConfig($contractClass);
@@ -366,7 +366,7 @@ private function selectCodeEnvironments(string $contractClass, string $label): C
366366
return $selectedClasses->map(fn ($className) => $availableEnvironments->first(fn ($env): bool => $env::class === $className));
367367
}
368368

369-
private function installGuidelines(): void
369+
protected function installGuidelines(): void
370370
{
371371
if (! $this->shouldInstallAiGuidelines()) {
372372
return;
@@ -434,27 +434,27 @@ private function installGuidelines(): void
434434
}
435435
}
436436

437-
private function shouldInstallAiGuidelines(): bool
437+
protected function shouldInstallAiGuidelines(): bool
438438
{
439439
return $this->selectedBoostFeatures->contains('ai_guidelines');
440440
}
441441

442-
private function shouldInstallStyleGuidelines(): bool
442+
protected function shouldInstallStyleGuidelines(): bool
443443
{
444444
return false;
445445
}
446446

447-
private function shouldInstallMcp(): bool
447+
protected function shouldInstallMcp(): bool
448448
{
449449
return $this->selectedBoostFeatures->contains('mcp_server');
450450
}
451451

452-
private function shouldInstallHerdMcp(): bool
452+
protected function shouldInstallHerdMcp(): bool
453453
{
454454
return $this->selectedBoostFeatures->contains('herd_mcp');
455455
}
456456

457-
private function installMcpServerConfig(): void
457+
protected function installMcpServerConfig(): void
458458
{
459459
if (! $this->shouldInstallMcp() && ! $this->shouldInstallHerdMcp()) {
460460
return;
@@ -556,7 +556,7 @@ private function installMcpServerConfig(): void
556556
/**
557557
* Is the project actually using localization for their new features?
558558
*/
559-
private function detectLocalization(): bool
559+
protected function detectLocalization(): bool
560560
{
561561
$actuallyUsing = false;
562562

src/Install/Detection/DetectionStrategyFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function makeFromConfig(array $config): DetectionStrategy
4141
return $this->make($type, $config);
4242
}
4343

44-
private function inferTypeFromConfig(array $config): string|array
44+
protected function inferTypeFromConfig(array $config): string|array
4545
{
4646
$typeMap = [
4747
'files' => self::TYPE_FILE,

src/Install/Detection/DirectoryDetectionStrategy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function detect(array $config, ?Platform $platform = null): bool
3838
return false;
3939
}
4040

41-
private function expandPath(string $path, ?Platform $platform = null): string
41+
protected function expandPath(string $path, ?Platform $platform = null): string
4242
{
4343
if ($platform === Platform::Windows) {
4444
return preg_replace_callback('/%([^%]+)%/', fn (array $matches) => getenv($matches[1]) ?: $matches[0], $path);
@@ -54,7 +54,7 @@ private function expandPath(string $path, ?Platform $platform = null): string
5454
return $path;
5555
}
5656

57-
private function isAbsolutePath(string $path): bool
57+
protected function isAbsolutePath(string $path): bool
5858
{
5959
return str_starts_with($path, '/') ||
6060
str_starts_with($path, '\\') ||

src/Install/GuidelineAssist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function enums(): array
5959
*
6060
* @return array<string, string>
6161
*/
62-
private function discover(callable $cb): array
62+
protected function discover(callable $cb): array
6363
{
6464
$classes = [];
6565
$appPath = app_path();

src/Install/GuidelineComposer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ protected function guideline(string $path): array
247247

248248
private array $storedSnippets = [];
249249

250-
private function processBoostSnippets(string $content): string
250+
protected function processBoostSnippets(string $content): string
251251
{
252252
return preg_replace_callback('/(?<!@)@boostsnippet\(\s*(?P<nameQuote>[\'"])(?P<name>[^\1]*?)\1(?:\s*,\s*(?P<langQuote>[\'"])(?P<lang>[^\3]*?)\3)?\s*\)(?P<content>.*?)@endboostsnippet/s', function ($matches): string {
253253
$name = $matches['name'];

src/Install/GuidelineWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function write(string $guidelines): int
8484
return $replaced ? self::REPLACED : self::NEW;
8585
}
8686

87-
private function acquireLockWithRetry(mixed $handle, string $filePath, int $maxRetries = 3): void
87+
protected function acquireLockWithRetry(mixed $handle, string $filePath, int $maxRetries = 3): void
8888
{
8989
$attempts = 0;
9090
$delay = 100000; // Start with 100ms in microseconds

src/Mcp/Tools/ListAvailableConfigKeys.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function handle(Request $request): Response
3636
* @param array<int|string, string|array<int|string, string>> $array
3737
* @return array<int|string, int|string>
3838
*/
39-
private function flattenToDotNotation(array $array, string $prefix = ''): array
39+
protected function flattenToDotNotation(array $array, string $prefix = ''): array
4040
{
4141
$results = [];
4242

src/Mcp/Tools/ListRoutes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function handle(Request $request): Response
8989
/**
9090
* @param array<string|bool> $options
9191
*/
92-
private function artisan(string $command, array $options = []): string
92+
protected function artisan(string $command, array $options = []): string
9393
{
9494
$output = new BufferedOutput;
9595
$response = Artisan::call($command, $options, $output);

0 commit comments

Comments
 (0)