Changes methods and properties from private to protected (#2308)

The goal of this PR is to offer increased flexibility for integrators and
custom solutions in skeleton modifications.
This commit is contained in:
Daniël Klabbers 2020-09-24 20:30:16 +02:00 committed by GitHub
parent d1cf97df76
commit 6fda1e02db
4 changed files with 19 additions and 19 deletions

View File

@ -70,12 +70,12 @@ class InstalledApp implements AppInterface
return $pipe; return $pipe;
} }
private function inMaintenanceMode(): bool protected function inMaintenanceMode(): bool
{ {
return $this->config['offline'] ?? false; return $this->config['offline'] ?? false;
} }
private function needsUpdate(): bool protected function needsUpdate(): bool
{ {
$settings = $this->container->make(SettingsRepositoryInterface::class); $settings = $this->container->make(SettingsRepositoryInterface::class);
$version = $settings->get('version'); $version = $settings->get('version');
@ -86,7 +86,7 @@ class InstalledApp implements AppInterface
/** /**
* @return \Psr\Http\Server\RequestHandlerInterface * @return \Psr\Http\Server\RequestHandlerInterface
*/ */
private function getUpdaterHandler() protected function getUpdaterHandler()
{ {
$pipe = new MiddlewarePipe; $pipe = new MiddlewarePipe;
$pipe->pipe(new BasePath($this->basePath())); $pipe->pipe(new BasePath($this->basePath()));
@ -97,12 +97,12 @@ class InstalledApp implements AppInterface
return $pipe; return $pipe;
} }
private function basePath(): string protected function basePath(): string
{ {
return parse_url($this->config['url'], PHP_URL_PATH) ?: '/'; return parse_url($this->config['url'], PHP_URL_PATH) ?: '/';
} }
private function subPath($pathName): string protected function subPath($pathName): string
{ {
return '/'.($this->config['paths'][$pathName] ?? $pathName); return '/'.($this->config['paths'][$pathName] ?? $pathName);
} }

View File

@ -52,17 +52,17 @@ class InstalledSite implements SiteInterface
/** /**
* @var Paths * @var Paths
*/ */
private $paths; protected $paths;
/** /**
* @var array * @var array
*/ */
private $config; protected $config;
/** /**
* @var \Flarum\Extend\ExtenderInterface[] * @var \Flarum\Extend\ExtenderInterface[]
*/ */
private $extenders = []; protected $extenders = [];
public function __construct(Paths $paths, array $config) public function __construct(Paths $paths, array $config)
{ {
@ -94,7 +94,7 @@ class InstalledSite implements SiteInterface
return $this; return $this;
} }
private function bootLaravel(): Container protected function bootLaravel(): Container
{ {
$container = new \Illuminate\Container\Container; $container = new \Illuminate\Container\Container;
$laravel = new Application($container, $this->paths); $laravel = new Application($container, $this->paths);
@ -153,7 +153,7 @@ class InstalledSite implements SiteInterface
* @param Application $app * @param Application $app
* @return ConfigRepository * @return ConfigRepository
*/ */
private function getIlluminateConfig(Application $app) protected function getIlluminateConfig(Application $app)
{ {
return new ConfigRepository([ return new ConfigRepository([
'view' => [ 'view' => [
@ -186,7 +186,7 @@ class InstalledSite implements SiteInterface
]); ]);
} }
private function registerLogger(Container $container) protected function registerLogger(Container $container)
{ {
$logPath = $this->paths->storage.'/logs/flarum.log'; $logPath = $this->paths->storage.'/logs/flarum.log';
$handler = new RotatingFileHandler($logPath, Logger::INFO); $handler = new RotatingFileHandler($logPath, Logger::INFO);
@ -196,7 +196,7 @@ class InstalledSite implements SiteInterface
$container->alias('log', LoggerInterface::class); $container->alias('log', LoggerInterface::class);
} }
private function registerCache(Container $container) protected function registerCache(Container $container)
{ {
$container->singleton('cache.store', function ($container) { $container->singleton('cache.store', function ($container) {
return new CacheRepository($container->make('cache.filestore')); return new CacheRepository($container->make('cache.filestore'));

View File

@ -33,12 +33,12 @@ class Site
} }
} }
private static function hasConfigFile($basePath) protected static function hasConfigFile($basePath)
{ {
return file_exists("$basePath/config.php"); return file_exists("$basePath/config.php");
} }
private static function loadConfig($basePath): array protected static function loadConfig($basePath): array
{ {
$config = include "$basePath/config.php"; $config = include "$basePath/config.php";
@ -49,7 +49,7 @@ class Site
return $config; return $config;
} }
private static function loadExtenders($basePath): array protected static function loadExtenders($basePath): array
{ {
$extenderFile = "$basePath/extend.php"; $extenderFile = "$basePath/extend.php";

View File

@ -33,7 +33,7 @@ class UninstalledSite implements SiteInterface
/** /**
* @var Paths * @var Paths
*/ */
private $paths; protected $paths;
public function __construct(Paths $paths) public function __construct(Paths $paths)
{ {
@ -52,7 +52,7 @@ class UninstalledSite implements SiteInterface
); );
} }
private function bootLaravel(): Container protected function bootLaravel(): Container
{ {
$container = new \Illuminate\Container\Container; $container = new \Illuminate\Container\Container;
$laravel = new Application($container, $this->paths); $laravel = new Application($container, $this->paths);
@ -100,7 +100,7 @@ class UninstalledSite implements SiteInterface
/** /**
* @return ConfigRepository * @return ConfigRepository
*/ */
private function getIlluminateConfig() protected function getIlluminateConfig()
{ {
return new ConfigRepository([ return new ConfigRepository([
'session' => [ 'session' => [
@ -114,7 +114,7 @@ class UninstalledSite implements SiteInterface
]); ]);
} }
private function registerLogger(Container $container) protected function registerLogger(Container $container)
{ {
$logPath = $this->paths->storage.'/logs/flarum-installer.log'; $logPath = $this->paths->storage.'/logs/flarum-installer.log';
$handler = new StreamHandler($logPath, Logger::DEBUG); $handler = new StreamHandler($logPath, Logger::DEBUG);