Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
s/$array/$arraySyntax/g for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmoussa committed Oct 12, 2013
1 parent fcfd2ce commit 35589ef
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions library/Zend/Config/Writer/PhpArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ class PhpArray extends AbstractWriter
*/
public function processConfig(array $config)
{
$array = array(
$arraySyntax = array(
'open' => $this->useBracketArraySyntax ? '[' : 'array(',
'close' => $this->useBracketArraySyntax ? ']' : ')'
);

return "<?php\n\n" .
"return " . $array['open'] . "\n" . $this->processIndented($config, $array) . $array['close'] . ";\n";
"return " . $arraySyntax['open'] . "\n" . $this->processIndented($config, $arraySyntax) .
$arraySyntax['close'] . ";\n";
}

/**
Expand All @@ -52,11 +53,11 @@ public function setUseBracketArraySyntax($value)
* Recursively processes a PHP config array structure into a readable format.
*
* @param array $config
* @param array $array
* @param array $arraySyntax
* @param int $indentLevel
* @return string
*/
protected function processIndented(array $config, array $array, &$indentLevel = 1)
protected function processIndented(array $config, array $arraySyntax, &$indentLevel = 1)
{
$arrayString = "";

Expand All @@ -66,12 +67,12 @@ protected function processIndented(array $config, array $array, &$indentLevel =

if (is_array($value)) {
if ($value === array()) {
$arrayString .= $array['open'] . $array['close'] . ",\n";
$arrayString .= $arraySyntax['open'] . $arraySyntax['close'] . ",\n";
} else {
$indentLevel++;
$arrayString .= $array['open'] . "\n"
. $this->processIndented($value, $array, $indentLevel)
. str_repeat(self::INDENT_STRING, --$indentLevel) . $array['close'] . ",\n";
$arrayString .= $arraySyntax['open'] . "\n"
. $this->processIndented($value, $arraySyntax, $indentLevel)
. str_repeat(self::INDENT_STRING, --$indentLevel) . $arraySyntax['close'] . ",\n";
}
} elseif (is_object($value)) {
$arrayString .= var_export($value, true) . ",\n";
Expand Down

0 comments on commit 35589ef

Please sign in to comment.