From 001884ffe928382db33637a475e257f9b8d835a8 Mon Sep 17 00:00:00 2001 From: Daniele Orlando Date: Sat, 23 Jan 2016 17:37:57 +0100 Subject: [PATCH] Internal cleanup. * [@] cleanup. --- documents/Changelog.txt | 16 ++++++++++++++-- source/FluidXml.php | 15 +++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/documents/Changelog.txt b/documents/Changelog.txt index c545531..1c7dca2 100644 --- a/documents/Changelog.txt +++ b/documents/Changelog.txt @@ -1,13 +1,25 @@ [+]: new [~]: changed [-]: removed [#]: fixed [@]: internal -1.12.2: (2016-01-18) +1.12.4: (2016-01-23) +Internal cleanup. + + * [@] cleanup. + + +1.12.3: +Refactoring improving the code design. + + * [@] refactoring. + + +1.12.2: Internal refactoring and performance regression fix. * [@] refactoring. Performances are normal. -1.12.1: (2016-01-16) +1.12.1: '->times()' and '->each()' are bound to the context. $this behaves as expected. * [@] refactoring. Performances are worst but code is much better. diff --git a/source/FluidXml.php b/source/FluidXml.php index d535d92..8c7b36c 100644 --- a/source/FluidXml.php +++ b/source/FluidXml.php @@ -554,9 +554,10 @@ public function each(callable $fn); * ``` * * @param string|array $child The child/children to add. - * @param string $value The child text content. - * @param bool $switchContext Whether to return the current context - * or the context of the created node. + * @param ...$optionals Accepted values are: + * - a boolean for requesting the context switch + * - a string which is the element text content + * - an array containing the attributes to set on the element. * * @return FluidContext The context associated to the DOMNodeList. */ @@ -760,9 +761,9 @@ protected function handleInsertion($parent, $k, $v, $fn, &$optionals) return $this->insertStringString($parent, $k, $v, $fn, $optionals); } - if ($k_is_string && $k_isnt_special && $v_is_string && $v_is_xml) { + // if ($k_is_string && $k_isnt_special && $v_is_string && $v_is_xml) { // TODO - } + // } ////////////////////////////////////////////// $k_is_special_c = $k_is_special && $k === '@'; @@ -1196,7 +1197,9 @@ public function query(...$xpath) // the xpath, relative (../..) or absolute (//), returns identical // matching results that must be collapsed in an unique result // otherwise a subsequent operation is performed multiple times. - return $this->newContext($this->filterQueryResults($results)); + $results = $this->filterQueryResults($results); + + return $this->newContext($results); } public function times($times, callable $fn = null)