aboutsummaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-06-28 11:36:29 -0300
committerSilvio <silvio@devlet.com.br>2010-06-28 11:36:29 -0300
commitfefb118c589af3028518c63af0130963d4e0a9e9 (patch)
tree2092a08b35bbb90473b61220e9ffa75983d356d3 /classes
parent93ce15dd6a512f5d29fa230fba69bf796ccb4ff6 (diff)
downloadcinisis-fefb118c589af3028518c63af0130963d4e0a9e9.tar.gz
cinisis-fefb118c589af3028518c63af0130963d4e0a9e9.tar.bz2
Adding useful methods for bracket handling at IsisConnector
Diffstat (limited to 'classes')
-rw-r--r--classes/IsisConnector.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php
index 6467959..4e53535 100644
--- a/classes/IsisConnector.php
+++ b/classes/IsisConnector.php
@@ -243,4 +243,43 @@ class IsisConnector {
return $keys[$subfield];
}
}
+
+ /**
+ * Remove brackets from strings whithin an array.
+ *
+ * @param &$values
+ * Array with bracketed strings.
+ */
+ public function removeBrackets($value) {
+ $value = str_replace('<', '', $value);
+ $value = str_replace('>', '', $value);
+ return $value;
+ }
+
+ /**
+ * Remove brackets from strings whithin an array.
+ *
+ * @param &$values
+ * Array with bracketed strings.
+ */
+ public function removeBracketsFromArray(&$values) {
+ foreach ($values as $key => $value) {
+ $values[$key] = $this->removeBrackets($value);
+ }
+ }
+
+ /**
+ * Explode a bracketed string into values. Just strings
+ * inside brackets are returned.
+ *
+ * @param $subject
+ * Strings containing brackets.
+ *
+ * @return
+ * Array of matched strings.
+ */
+ public function explodeBrackets($subject) {
+ $values = preg_split('/[<\s>]+/', $subject, -1, PREG_SPLIT_NO_EMPTY);
+ return $values;
+ }
}