Skip to content

Commit

Permalink
Update php config files to return array insetad of setting $config var.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jan 13, 2015
1 parent 1f66598 commit c3962ba
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 13 deletions.
9 changes: 7 additions & 2 deletions src/Core/Configure/Engine/PhpConfig.php
Expand Up @@ -67,10 +67,15 @@ public function read($key)
{
$file = $this->_getFilePath($key, true);

include $file;
$return = include $file;
if (is_array($return)) {
return $return;
}

if (!isset($config)) {
throw new Exception(sprintf('No variable $config found in %s', $file));
throw new Exception(sprintf('Config file "%s" did not return an array', $key . '.php'));
}

return $config;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_app/Plugin/TestPlugin/config/load.php
Expand Up @@ -13,4 +13,4 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/

$config['plugin_load'] = '/test_app/Plugin/TestPlugin/Config/load.php';
return ['plugin_load' => '/test_app/Plugin/TestPlugin/Config/load.php'];
3 changes: 1 addition & 2 deletions tests/test_app/Plugin/TestPlugin/config/more.load.php
Expand Up @@ -12,5 +12,4 @@
* @since 1.3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/

$config['plugin_more_load'] = '/test_app/Plugin/TestPlugin/Config/more.load.php';
return ['plugin_more_load' => '/test_app/Plugin/TestPlugin/Config/more.load.php'];
2 changes: 1 addition & 1 deletion tests/test_app/Plugin/TestPlugin/config/test_templates.php
@@ -1,4 +1,4 @@
<?php
$config = [
return [
'italic' => '<em>{{text}}</em>',
];
2 changes: 1 addition & 1 deletion tests/test_app/Plugin/TestPlugin/config/test_widgets.php
Expand Up @@ -2,6 +2,6 @@
/**
* Widgets list for testing.
*/
$config = [
return [
'text' => ['Cake\View\Widget\LabelWidget'],
];
3 changes: 1 addition & 2 deletions tests/test_app/config/htmlhelper_tags.php
@@ -1,6 +1,5 @@
<?php

$config = [
return [
'formStart' => 'start form',
'formEnd' => 'finish form',
'hiddenBlock' => '<div class="hidden">{{content}}</div>',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_app/config/test_templates.php
Expand Up @@ -2,6 +2,6 @@
/**
* Template strings for testing.
*/
$config = [
return [
'link' => '<a href="{{url}}">{{text}}</a>',
];
2 changes: 1 addition & 1 deletion tests/test_app/config/test_widgets.php
Expand Up @@ -2,6 +2,6 @@
/**
* Widgets list for testing.
*/
$config = [
return [
'text' => ['Cake\View\Widget\LabelWidget'],
];
2 changes: 1 addition & 1 deletion tests/test_app/config/var_test.php
@@ -1,5 +1,5 @@
<?php
$config = [
return [
'Read' => 'value',
'Deep' => [
'Deeper' => [
Expand Down
2 changes: 1 addition & 1 deletion tests/test_app/config/var_test2.php
@@ -1,5 +1,5 @@
<?php
$config = [
return [
'Read' => 'value2',
'Deep' => [
'Second' => [
Expand Down

0 comments on commit c3962ba

Please sign in to comment.