aboutsummaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-06-30 15:24:38 -0300
committerSilvio <silvio@devlet.com.br>2010-06-30 15:24:38 -0300
commitc8766ec967255af09c88f2b212c0c870ea7954b5 (patch)
tree1cc540d26ff4a58ef5397dd8777bcbb32e896680 /classes
parent4d018fa255659a7c922b37500448a4a258bccbdc (diff)
downloadcinisis-c8766ec967255af09c88f2b212c0c870ea7954b5.tar.gz
cinisis-c8766ec967255af09c88f2b212c0c870ea7954b5.tar.bz2
Adding IsisConnector::filterBrackets()
Diffstat (limited to 'classes')
-rw-r--r--classes/IsisConnector.php26
1 files changed, 21 insertions, 5 deletions
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php
index db5ac9d..eeedeb7 100644
--- a/classes/IsisConnector.php
+++ b/classes/IsisConnector.php
@@ -282,12 +282,26 @@ class IsisConnector {
*/
public function explodeBrackets($subject) {
preg_match_all('/<[^<>]*>/', $subject, $values);
+ return $this->filterBrackets($values[0]);
+ }
- // Why this doesn't work?
- //$values = preg_replace(array('/</', '/>/'), '', $values);
-
- foreach ($values[0] as $key => $value) {
- $values[$key] = preg_replace(array('/</', '/>/'), '', $value);
+ /**
+ * Filter out brackets from strings.
+ *
+ * @param $values
+ * String (or array filled with strings) to be filtered.
+ *
+ * @result
+ * Filtered string or array.
+ */
+ public function filterBrackets($values) {
+ if (is_array($values)) {
+ foreach ($values as $key => $value) {
+ $values[$key] = $this->filterBrackets($value);
+ }
+ }
+ else {
+ $values = preg_replace(array('/</', '/>/'), '', $values);
}
return $values;
@@ -298,6 +312,7 @@ class IsisConnector {
*
* @param $value
* String to be compared.
+ *
* @return
* True if string has brackets, false otherwise.
*/
@@ -316,6 +331,7 @@ class IsisConnector {
*
* @param $value
* String with values.
+ *
* @return
* Array with values.
*/