summaryrefslogtreecommitdiffstats
path: root/src/Components/OptionsArray.php
diff options
context:
space:
mode:
authorDan Ungureanu <udan1107@gmail.com>2015-08-18 02:24:42 +0300
committerDan Ungureanu <udan1107@gmail.com>2015-08-18 02:24:42 +0300
commit14c54da98c3b4f18c78ff44c22fbdd20e8ef6e18 (patch)
treea4604f6b1d1095790e313b71bf226e4291788ca8 /src/Components/OptionsArray.php
parent1568adba1af7bf061354a30afd169e29fa43f133 (diff)
downloadsql-parser-14c54da98c3b4f18c78ff44c22fbdd20e8ef6e18.zip
sql-parser-14c54da98c3b4f18c78ff44c22fbdd20e8ef6e18.tar.gz
sql-parser-14c54da98c3b4f18c78ff44c22fbdd20e8ef6e18.tar.bz2
Replaced explicit calls to Component::build() with implicit calls to Component::__toString().
Fixed bugs that caused field names like '0', '0.0', etc. to be considered invalid. Refactoring.
Diffstat (limited to 'src/Components/OptionsArray.php')
-rw-r--r--src/Components/OptionsArray.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Components/OptionsArray.php b/src/Components/OptionsArray.php
index 6b43844..a496273 100644
--- a/src/Components/OptionsArray.php
+++ b/src/Components/OptionsArray.php
@@ -256,9 +256,10 @@ class OptionsArray extends Component
*/
public static function build($component)
{
- if ((empty($component)) || (!is_array($component->options))) {
+ if (empty($component->options)) {
return '';
}
+
$options = array();
foreach ($component->options as $option) {
if (!is_array($option)) {
@@ -266,9 +267,7 @@ class OptionsArray extends Component
} else {
$options[] = $option['name']
. (!empty($option['equals']) ? '=' : ' ')
- . (!empty($option['expr']) ? ((string) $option['expr']) : $option['value']);
- // If `$option['expr']` happens to be a component, the magic
- // method will build it automatically.
+ . (!empty($option['expr']) ? $option['expr'] : $option['value']);
}
}
return implode(' ', $options);