@@ -13,7 +13,6 @@ discard block |
||
| 13 | 13 | * Anydataset files have extension ".anydata.xml" and have many classes to put and get data into anydataset xml file. |
| 14 | 14 | * Anydataset class just read and write files. To search elements you need use AnyIterator |
| 15 | 15 | * and IteratorFilter. Each row have a class Row. |
| 16 | - |
|
| 17 | 16 | * XML Structure |
| 18 | 17 | * <code> |
| 19 | 18 | * <anydataset> |
@@ -28,17 +27,14 @@ discard block |
||
| 28 | 27 | * </row> |
| 29 | 28 | * </anydataset> |
| 30 | 29 | * </code> |
| 31 | - |
|
| 32 | 30 | * How to use: |
| 33 | 31 | * <code> |
| 34 | 32 | * $any = new AnyDataset(); |
| 35 | 33 | * </code> |
| 36 | - |
|
| 37 | 34 | * |
| 38 | 35 | *@see Row |
| 39 | 36 | * @see AnyIterator |
| 40 | 37 | * @see IteratorFilter |
| 41 | - |
|
| 42 | 38 | */ |
| 43 | 39 | class AnyDataset |
| 44 | 40 | { |
@@ -6,64 +6,64 @@ |
||
| 6 | 6 | |
| 7 | 7 | class IteratorFilterXPathFormatter extends IteratorFilterFormatter |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @inheritDoc |
|
| 11 | - */ |
|
| 12 | - public function format($filters, $tableName = null, &$params = [], $returnFields = "*") |
|
| 13 | - { |
|
| 14 | - $param = []; |
|
| 15 | - $xpathFilter = $this->getFilter($filters, $param); |
|
| 9 | + /** |
|
| 10 | + * @inheritDoc |
|
| 11 | + */ |
|
| 12 | + public function format($filters, $tableName = null, &$params = [], $returnFields = "*") |
|
| 13 | + { |
|
| 14 | + $param = []; |
|
| 15 | + $xpathFilter = $this->getFilter($filters, $param); |
|
| 16 | 16 | |
| 17 | - if ($xpathFilter == "") { |
|
| 18 | - return "/anydataset/row"; |
|
| 19 | - } |
|
| 17 | + if ($xpathFilter == "") { |
|
| 18 | + return "/anydataset/row"; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - return "/anydataset/row[" . $xpathFilter . "]"; |
|
| 22 | - } |
|
| 21 | + return "/anydataset/row[" . $xpathFilter . "]"; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @inheritDoc |
|
| 26 | - */ |
|
| 27 | - public function getRelation($name, $relation, $value, &$param) |
|
| 28 | - { |
|
| 29 | - $str = is_numeric($value) ? "" : "'"; |
|
| 30 | - $field = "field[@name='" . $name . "'] "; |
|
| 31 | - $value = " $str$value$str "; |
|
| 24 | + /** |
|
| 25 | + * @inheritDoc |
|
| 26 | + */ |
|
| 27 | + public function getRelation($name, $relation, $value, &$param) |
|
| 28 | + { |
|
| 29 | + $str = is_numeric($value) ? "" : "'"; |
|
| 30 | + $field = "field[@name='" . $name . "'] "; |
|
| 31 | + $value = " $str$value$str "; |
|
| 32 | 32 | |
| 33 | - switch ($relation) { |
|
| 34 | - case Relation::EQUAL: |
|
| 33 | + switch ($relation) { |
|
| 34 | + case Relation::EQUAL: |
|
| 35 | 35 | $return = $field . "=" . $value; |
| 36 | 36 | break; |
| 37 | 37 | |
| 38 | - case Relation::GREATER_THAN: |
|
| 38 | + case Relation::GREATER_THAN: |
|
| 39 | 39 | $return = $field . ">" . $value; |
| 40 | 40 | break; |
| 41 | 41 | |
| 42 | - case Relation::LESS_THAN: |
|
| 42 | + case Relation::LESS_THAN: |
|
| 43 | 43 | $return = $field . "<" . $value; |
| 44 | 44 | break; |
| 45 | 45 | |
| 46 | - case Relation::GREATER_OR_EQUAL_THAN: |
|
| 46 | + case Relation::GREATER_OR_EQUAL_THAN: |
|
| 47 | 47 | $return = $field . ">=" . $value; |
| 48 | 48 | break; |
| 49 | 49 | |
| 50 | - case Relation::LESS_OR_EQUAL_THAN: |
|
| 50 | + case Relation::LESS_OR_EQUAL_THAN: |
|
| 51 | 51 | $return = $field . "<=" . $value; |
| 52 | 52 | break; |
| 53 | 53 | |
| 54 | - case Relation::NOT_EQUAL: |
|
| 54 | + case Relation::NOT_EQUAL: |
|
| 55 | 55 | $return = $field . "!=" . $value; |
| 56 | 56 | break; |
| 57 | 57 | |
| 58 | - case Relation::STARTS_WITH: |
|
| 58 | + case Relation::STARTS_WITH: |
|
| 59 | 59 | $return = " starts-with($field, $value) "; |
| 60 | 60 | break; |
| 61 | 61 | |
| 62 | - default: // Relation::CONTAINS: |
|
| 62 | + default: // Relation::CONTAINS: |
|
| 63 | 63 | $return = " contains($field, $value) "; |
| 64 | 64 | break; |
| 65 | - } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - return $return; |
|
| 68 | - } |
|
| 67 | + return $return; |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -151,11 +151,11 @@ |
||
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * @param array|string $field |
|
| 156 | - * @param string $regEx |
|
| 157 | - * @return RowValidator |
|
| 158 | - */ |
|
| 154 | + /** |
|
| 155 | + * @param array|string $field |
|
| 156 | + * @param string $regEx |
|
| 157 | + * @return RowValidator |
|
| 158 | + */ |
|
| 159 | 159 | public function regexValidation($field, $regEx) |
| 160 | 160 | { |
| 161 | 161 | $this->setProperty($field, self::REGEX, $regEx); |