Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Apr 12, 2017
1 parent 675d974 commit 82ad9f1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
30 changes: 13 additions & 17 deletions lib/Autoconfig/AutoconfigGenerator.php
Expand Up @@ -20,7 +20,7 @@
/**
* @codeCoverageIgnore
*
* @property-read Package[] $packages
* @property-read array<string, Package> $packages
*/
class AutoconfigGenerator
{
Expand All @@ -32,7 +32,7 @@ class AutoconfigGenerator
private $packages;

/**
* @return array<string, Package>|\Generator
* @return \Generator
*/
protected function get_packages()
{
Expand All @@ -45,8 +45,6 @@ protected function get_packages()

yield $pathname => $package;
}

return null;
}

/**
Expand Down Expand Up @@ -243,8 +241,6 @@ private function synthesize()

];

$filesystem = $this->filesystem;

$config = [

Autoconfig::CONFIG_CONSTRUCTOR => [],
Expand Down Expand Up @@ -278,7 +274,7 @@ private function synthesize()
{
$config[Autoconfig::CONFIG_PATH][] = [

$filesystem->findShortestPathCode($this->destination, "$path/$v"),
$this->findShortestPathCode("$path/$v"),
$this->weights[$path]

];
Expand All @@ -292,7 +288,7 @@ private function synthesize()

foreach ((array) $value as $v)
{
$config[$key][] = $filesystem->findShortestPathCode($this->destination, "$path/$v");
$config[$key][] = $this->findShortestPathCode("$path/$v");
}

break;
Expand Down Expand Up @@ -331,24 +327,24 @@ public function findShortestPathCode($to)
/**
* Render the synthesized autoconfig into a string.
*
* @param string $synthesized_config
* @param array $config Synthesized config.
*
* @return string
*/
public function render($synthesized_config =null)
public function render($config = [])
{
if (!$synthesized_config)
if (!$config)
{
$synthesized_config = $this->synthesize();
$config = $this->synthesize();
}

$class = __CLASS__;

$config_constructor = $this->render_config_constructor($synthesized_config[Autoconfig::CONFIG_CONSTRUCTOR]);
$config_path = $this->render_config_path($synthesized_config[Autoconfig::CONFIG_PATH]);
$locale_path = implode(",\n\t\t", $synthesized_config[Autoconfig::LOCALE_PATH]);
$filters = $this->render_filters($synthesized_config[Autoconfig::AUTOCONFIG_FILTERS]);
$app_paths = implode(",\n\t\t", $synthesized_config[Autoconfig::APP_PATHS]);
$config_constructor = $this->render_config_constructor($config[Autoconfig::CONFIG_CONSTRUCTOR]);
$config_path = $this->render_config_path($config[Autoconfig::CONFIG_PATH]);
$locale_path = implode(",\n\t\t", $config[Autoconfig::LOCALE_PATH]);
$filters = $this->render_filters($config[Autoconfig::AUTOCONFIG_FILTERS]);
$app_paths = implode(",\n\t\t", $config[Autoconfig::APP_PATHS]);

$extension_render = '';

Expand Down
6 changes: 3 additions & 3 deletions lib/Autoconfig/Schema.php
Expand Up @@ -37,14 +37,14 @@ static public function read_json($pathname)
*
* @var mixed
*/
protected $schema;
private $schema;

/**
* Validator.
*
* @var Validator
*/
protected $validator;
private $validator;

/**
* Initialize the {@link schema} and {@link validator} properties.
Expand Down Expand Up @@ -82,7 +82,7 @@ public function validate($data, $pathname)
$errors .= "\n- " . ($error['property'] ? $error['property'] . ': ' : '') . $error['message'];
}

throw new \Exception("$pathname does not match the expected JSON schema:\n$errors");
throw new \Exception("`$pathname` does not match the expected JSON schema:\n$errors");
}

return true;
Expand Down
4 changes: 0 additions & 4 deletions tests/lib/HelpersTest.php
Expand Up @@ -104,10 +104,6 @@ public function test_get_autoconfig()

],

Autoconfig::MODULE_PATH => [

],

Autoconfig::AUTOCONFIG_FILTERS => [

'ICanBoogie\Autoconfig\Hooks::filter_autoconfig'
Expand Down

0 comments on commit 82ad9f1

Please sign in to comment.