for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Hyde\Foundation\Services;
use Hyde\Hyde;
use Illuminate\Support\Facades\Config;
use LaravelZero\Framework\Application;
use Symfony\Component\Yaml\Yaml;
use function array_merge;
use function file_exists;
use function file_get_contents;
use function is_array;
/**
* @internal
*
* @see \Hyde\Framework\Testing\Feature\YamlConfigurationServiceTest
*/
class LoadYamlConfiguration
{
* Performs a core task that needs to be performed on
* early stages of the framework.
public function bootstrap(Application $app): void
$app
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function bootstrap(/** @scrutinizer ignore-unused */ Application $app): void
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
if ($this->hasYamlConfigFile()) {
$this->mergeParsedConfiguration();
}
protected function hasYamlConfigFile(): bool
return file_exists(Hyde::path('hyde.yml'))
|| file_exists(Hyde::path('hyde.yaml'));
protected function mergeParsedConfiguration(): void
Config::set('site', array_merge(
Config::get('site', []),
$this->getYaml()
));
protected function getYaml(): array
$yaml = Yaml::parse(file_get_contents($this->getFile()));
return is_array($yaml) ? $yaml : [];
protected function getFile(): string
? Hyde::path('hyde.yml')
: Hyde::path('hyde.yaml');
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.