@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | function isIgnorable() |
75 | 75 | { |
76 | - if(isset($this->default_value) || isset($this->notnull)) |
|
76 | + if (isset($this->default_value) || isset($this->notnull)) |
|
77 | 77 | { |
78 | 78 | return FALSE; |
79 | 79 | } |
@@ -83,47 +83,47 @@ discard block |
||
83 | 83 | function toString() |
84 | 84 | { |
85 | 85 | $validator = ''; |
86 | - if($this->filter) |
|
86 | + if ($this->filter) |
|
87 | 87 | { |
88 | - $validator .= sprintf('${\'%s_argument\'}->checkFilter(\'%s\');' . "\n" |
|
88 | + $validator .= sprintf('${\'%s_argument\'}->checkFilter(\'%s\');'."\n" |
|
89 | 89 | , $this->argument_name |
90 | 90 | , $this->filter |
91 | 91 | ); |
92 | 92 | } |
93 | - if($this->min_length) |
|
93 | + if ($this->min_length) |
|
94 | 94 | { |
95 | - $validator .= sprintf('${\'%s_argument\'}->checkMinLength(%s);' . "\n" |
|
95 | + $validator .= sprintf('${\'%s_argument\'}->checkMinLength(%s);'."\n" |
|
96 | 96 | , $this->argument_name |
97 | 97 | , $this->min_length |
98 | 98 | ); |
99 | 99 | } |
100 | - if($this->max_length) |
|
100 | + if ($this->max_length) |
|
101 | 101 | { |
102 | - $validator .= sprintf('${\'%s_argument\'}->checkMaxLength(%s);' . "\n" |
|
102 | + $validator .= sprintf('${\'%s_argument\'}->checkMaxLength(%s);'."\n" |
|
103 | 103 | , $this->argument_name |
104 | 104 | , $this->max_length |
105 | 105 | ); |
106 | 106 | } |
107 | - if(isset($this->default_value)) |
|
107 | + if (isset($this->default_value)) |
|
108 | 108 | { |
109 | 109 | $this->default_value = new DefaultValue($this->argument_name, $this->default_value); |
110 | - if($this->default_value->isSequence()) |
|
110 | + if ($this->default_value->isSequence()) |
|
111 | 111 | $validator .= '$db = DB::getInstance(); $sequence = $db->getNextSequence(); '; |
112 | - if($this->default_value->isOperation()) |
|
112 | + if ($this->default_value->isOperation()) |
|
113 | 113 | { |
114 | - $validator .= sprintf('${\'%s_argument\'}->setColumnOperation(\'%s\');' . "\n" |
|
114 | + $validator .= sprintf('${\'%s_argument\'}->setColumnOperation(\'%s\');'."\n" |
|
115 | 115 | , $this->argument_name |
116 | 116 | , $this->default_value->getOperation() |
117 | 117 | ); |
118 | 118 | } |
119 | - $validator .= sprintf('${\'%s_argument\'}->ensureDefaultValue(%s);' . "\n" |
|
119 | + $validator .= sprintf('${\'%s_argument\'}->ensureDefaultValue(%s);'."\n" |
|
120 | 120 | , $this->argument_name |
121 | 121 | , $this->default_value->toString() |
122 | 122 | ); |
123 | 123 | } |
124 | - if($this->notnull) |
|
124 | + if ($this->notnull) |
|
125 | 125 | { |
126 | - $validator .= sprintf('${\'%s_argument\'}->checkNotNull();' . "\n" |
|
126 | + $validator .= sprintf('${\'%s_argument\'}->checkNotNull();'."\n" |
|
127 | 127 | , $this->argument_name |
128 | 128 | ); |
129 | 129 | } |
@@ -107,8 +107,9 @@ |
||
107 | 107 | if(isset($this->default_value)) |
108 | 108 | { |
109 | 109 | $this->default_value = new DefaultValue($this->argument_name, $this->default_value); |
110 | - if($this->default_value->isSequence()) |
|
111 | - $validator .= '$db = DB::getInstance(); $sequence = $db->getNextSequence(); '; |
|
110 | + if($this->default_value->isSequence()) { |
|
111 | + $validator .= '$db = DB::getInstance(); $sequence = $db->getNextSequence(); '; |
|
112 | + } |
|
112 | 113 | if($this->default_value->isOperation()) |
113 | 114 | { |
114 | 115 | $validator .= sprintf('${\'%s_argument\'}->setColumnOperation(\'%s\');' . "\n" |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | return $this->_is_string; |
72 | 72 | $str_pos = strpos($this->value, '('); |
73 | - if($str_pos === false) |
|
73 | + if ($str_pos === false) |
|
74 | 74 | { |
75 | 75 | return TRUE; |
76 | 76 | } |
@@ -99,31 +99,31 @@ discard block |
||
99 | 99 | |
100 | 100 | function _setValue() |
101 | 101 | { |
102 | - if(!isset($this->value)) |
|
102 | + if (!isset($this->value)) |
|
103 | 103 | { |
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | 107 | // If value contains comma separated values and does not contain paranthesis |
108 | 108 | // -> default value is an array |
109 | - if(strpos($this->value, ',') !== FALSE && strpos($this->value, '(') === FALSE) |
|
109 | + if (strpos($this->value, ',') !== FALSE && strpos($this->value, '(') === FALSE) |
|
110 | 110 | { |
111 | 111 | return sprintf('array(%s)', $this->value); |
112 | 112 | } |
113 | 113 | |
114 | 114 | $str_pos = strpos($this->value, '('); |
115 | 115 | // // TODO Replace this with parseExpression |
116 | - if($str_pos === FALSE) |
|
116 | + if ($str_pos === FALSE) |
|
117 | 117 | { |
118 | 118 | $this->_is_string = TRUE; |
119 | - return '\'' . $this->value . '\''; |
|
119 | + return '\''.$this->value.'\''; |
|
120 | 120 | } |
121 | 121 | //if($str_pos===false) return $this->value; |
122 | 122 | |
123 | 123 | $func_name = substr($this->value, 0, $str_pos); |
124 | 124 | $args = substr($this->value, $str_pos + 1, -1); |
125 | 125 | |
126 | - switch($func_name) |
|
126 | + switch ($func_name) |
|
127 | 127 | { |
128 | 128 | case 'ipaddress' : |
129 | 129 | $val = '$_SERVER[\'REMOTE_ADDR\']'; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $val = sprintf('%d', $args); |
160 | 160 | break; |
161 | 161 | default : |
162 | - $val = '\'' . $this->value . '\''; |
|
162 | + $val = '\''.$this->value.'\''; |
|
163 | 163 | //$val = $this->value; |
164 | 164 | } |
165 | 165 |
@@ -26,19 +26,19 @@ discard block |
||
26 | 26 | { |
27 | 27 | $this->groups = array(); |
28 | 28 | |
29 | - if($xml_groups) |
|
29 | + if ($xml_groups) |
|
30 | 30 | { |
31 | - if(!is_array($xml_groups)) |
|
31 | + if (!is_array($xml_groups)) |
|
32 | 32 | { |
33 | 33 | $xml_groups = array($xml_groups); |
34 | 34 | } |
35 | 35 | |
36 | 36 | $dbParser = &DB::getParser(); |
37 | - for($i = 0; $i < count($xml_groups); $i++) |
|
37 | + for ($i = 0; $i < count($xml_groups); $i++) |
|
38 | 38 | { |
39 | 39 | $group = $xml_groups[$i]; |
40 | 40 | $column = trim($group->attrs->column); |
41 | - if(!$column) |
|
41 | + if (!$column) |
|
42 | 42 | { |
43 | 43 | continue; |
44 | 44 | } |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | |
52 | 52 | function toString() |
53 | 53 | { |
54 | - $output = 'array(' . PHP_EOL; |
|
55 | - foreach($this->groups as $group) |
|
54 | + $output = 'array('.PHP_EOL; |
|
55 | + foreach ($this->groups as $group) |
|
56 | 56 | { |
57 | - $output .= "'" . $group . "' ,"; |
|
57 | + $output .= "'".$group."' ,"; |
|
58 | 58 | } |
59 | 59 | $output = substr($output, 0, -1); |
60 | 60 | $output .= ')'; |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | { |
34 | 34 | $this->pipe = $pipe; |
35 | 35 | |
36 | - if(!is_array($conditions)) |
|
36 | + if (!is_array($conditions)) |
|
37 | 37 | { |
38 | 38 | $conditions = array($conditions); |
39 | 39 | } |
40 | 40 | |
41 | - foreach($conditions as $condition) |
|
41 | + foreach ($conditions as $condition) |
|
42 | 42 | { |
43 | 43 | //if($condition->node_name === 'query') $this->conditions[] = new QueryTag($condition, true); |
44 | 44 | $this->conditions[] = new ConditionTag($condition); |
@@ -56,21 +56,21 @@ discard block |
||
56 | 56 | */ |
57 | 57 | function getConditionGroupString() |
58 | 58 | { |
59 | - $conditions_string = 'array(' . PHP_EOL; |
|
60 | - foreach($this->conditions as $condition) |
|
59 | + $conditions_string = 'array('.PHP_EOL; |
|
60 | + foreach ($this->conditions as $condition) |
|
61 | 61 | { |
62 | - $conditions_string .= $condition->getConditionString() . PHP_EOL . ','; |
|
62 | + $conditions_string .= $condition->getConditionString().PHP_EOL.','; |
|
63 | 63 | } |
64 | 64 | $conditions_string = substr($conditions_string, 0, -2); //remove ',' |
65 | 65 | $conditions_string .= ')'; |
66 | 66 | |
67 | - return sprintf("new ConditionGroup(%s%s)", $conditions_string, $this->pipe ? ',\'' . $this->pipe . '\'' : ''); |
|
67 | + return sprintf("new ConditionGroup(%s%s)", $conditions_string, $this->pipe ? ',\''.$this->pipe.'\'' : ''); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | function getArguments() |
71 | 71 | { |
72 | 72 | $arguments = array(); |
73 | - foreach($this->conditions as $condition) |
|
73 | + foreach ($this->conditions as $condition) |
|
74 | 74 | { |
75 | 75 | $arguments = array_merge($arguments, $condition->getArguments()); |
76 | 76 | } |
@@ -67,38 +67,38 @@ discard block |
||
67 | 67 | $this->column_name = $dbParser->parseExpression($condition->attrs->column); |
68 | 68 | |
69 | 69 | // If default value is column name, it should be escaped |
70 | - if($isColumnName = (strpos($condition->attrs->default, '.') !== FALSE |
|
70 | + if ($isColumnName = (strpos($condition->attrs->default, '.') !== FALSE |
|
71 | 71 | && strpos($condition->attrs->default, '.') !== 0 |
72 | - && strpos($condition->attrs->default, '%') === FALSE )) |
|
72 | + && strpos($condition->attrs->default, '%') === FALSE)) |
|
73 | 73 | { |
74 | 74 | $condition->attrs->default = $dbParser->parseExpression($condition->attrs->default); |
75 | 75 | } |
76 | 76 | |
77 | - if($condition->node_name == 'query') |
|
77 | + if ($condition->node_name == 'query') |
|
78 | 78 | { |
79 | 79 | $this->query = new QueryTag($condition, TRUE); |
80 | 80 | $this->default_column = $this->query->toString(); |
81 | 81 | } |
82 | - else if($condition->attrs->var && !strpos($condition->attrs->var, '.')) |
|
82 | + else if ($condition->attrs->var && !strpos($condition->attrs->var, '.')) |
|
83 | 83 | { |
84 | 84 | $this->argument = new QueryArgument($condition); |
85 | 85 | $this->argument_name = $this->argument->getArgumentName(); |
86 | 86 | } |
87 | 87 | else |
88 | 88 | { |
89 | - if(isset($condition->attrs->default)) |
|
89 | + if (isset($condition->attrs->default)) |
|
90 | 90 | { |
91 | 91 | $operationList = array('in' => 1, 'between' => 1, 'notin' => 1, 'not_in' => 1); |
92 | - if(isset($operationList[$this->operation])) |
|
92 | + if (isset($operationList[$this->operation])) |
|
93 | 93 | { |
94 | 94 | $default_value = $condition->attrs->default; |
95 | - if(strpos($default_value, "'") !== FALSE) |
|
95 | + if (strpos($default_value, "'") !== FALSE) |
|
96 | 96 | { |
97 | - $default_value = "\"" . $default_value . "\""; |
|
97 | + $default_value = "\"".$default_value."\""; |
|
98 | 98 | } |
99 | 99 | else |
100 | 100 | { |
101 | - $default_value = "'" . $default_value . "'"; |
|
101 | + $default_value = "'".$default_value."'"; |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | else |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | $default_value_object = new DefaultValue($this->column_name, $condition->attrs->default); |
107 | 107 | $default_value = $default_value_object->toString(); |
108 | 108 | |
109 | - if($default_value_object->isStringFromFunction()) |
|
109 | + if ($default_value_object->isStringFromFunction()) |
|
110 | 110 | { |
111 | - $default_value = '"\'".' . $default_value . '."\'"'; |
|
111 | + $default_value = '"\'".'.$default_value.'."\'"'; |
|
112 | 112 | } |
113 | 113 | |
114 | - if($default_value_object->isString() && !$isColumnName && !is_numeric($condition->attrs->default)) |
|
114 | + if ($default_value_object->isString() && !$isColumnName && !is_numeric($condition->attrs->default)) |
|
115 | 115 | { |
116 | - if(strpos($default_value, "'") !== FALSE) |
|
116 | + if (strpos($default_value, "'") !== FALSE) |
|
117 | 117 | { |
118 | - $default_value = "\"" . $default_value . "\""; |
|
118 | + $default_value = "\"".$default_value."\""; |
|
119 | 119 | } |
120 | 120 | else |
121 | 121 | { |
122 | - $default_value = "'" . $default_value . "'"; |
|
122 | + $default_value = "'".$default_value."'"; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | else |
129 | 129 | { |
130 | - $this->default_column = "'" . $dbParser->parseColumnName($condition->attrs->var) . "'"; |
|
130 | + $this->default_column = "'".$dbParser->parseColumnName($condition->attrs->var)."'"; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | function getArguments() |
141 | 141 | { |
142 | 142 | $arguments = array(); |
143 | - if($this->query) |
|
143 | + if ($this->query) |
|
144 | 144 | { |
145 | 145 | $arguments = array_merge($arguments, $this->query->getArguments()); |
146 | 146 | } |
147 | - if($this->argument) |
|
147 | + if ($this->argument) |
|
148 | 148 | { |
149 | 149 | $arguments[] = $this->argument; |
150 | 150 | } |
@@ -153,31 +153,31 @@ discard block |
||
153 | 153 | |
154 | 154 | function getConditionString() |
155 | 155 | { |
156 | - if($this->query) |
|
156 | + if ($this->query) |
|
157 | 157 | { |
158 | 158 | return sprintf("new ConditionSubquery('%s',%s,%s%s)" |
159 | 159 | , $this->column_name |
160 | 160 | , $this->default_column |
161 | - , '"' . $this->operation . '"' |
|
162 | - , $this->pipe ? ", '" . $this->pipe . "'" : '' |
|
161 | + , '"'.$this->operation.'"' |
|
162 | + , $this->pipe ? ", '".$this->pipe."'" : '' |
|
163 | 163 | ); |
164 | 164 | } |
165 | - else if(isset($this->default_column)) |
|
165 | + else if (isset($this->default_column)) |
|
166 | 166 | { |
167 | 167 | return sprintf("new ConditionWithoutArgument('%s',%s,%s%s)" |
168 | 168 | , $this->column_name |
169 | 169 | , $this->default_column |
170 | - , '"' . $this->operation . '"' |
|
171 | - , $this->pipe ? ", '" . $this->pipe . "'" : '' |
|
170 | + , '"'.$this->operation.'"' |
|
171 | + , $this->pipe ? ", '".$this->pipe."'" : '' |
|
172 | 172 | ); |
173 | 173 | } |
174 | 174 | else |
175 | 175 | { |
176 | 176 | return sprintf("new ConditionWithArgument('%s',%s,%s%s)" |
177 | 177 | , $this->column_name |
178 | - , '$' . $this->argument_name . '_argument' |
|
179 | - , '"' . $this->operation . '"' |
|
180 | - , $this->pipe ? ", '" . $this->pipe . "'" : '' |
|
178 | + , '$'.$this->argument_name.'_argument' |
|
179 | + , '"'.$this->operation.'"' |
|
180 | + , $this->pipe ? ", '".$this->pipe."'" : '' |
|
181 | 181 | ); |
182 | 182 | } |
183 | 183 | } |
@@ -78,13 +78,11 @@ discard block |
||
78 | 78 | { |
79 | 79 | $this->query = new QueryTag($condition, TRUE); |
80 | 80 | $this->default_column = $this->query->toString(); |
81 | - } |
|
82 | - else if($condition->attrs->var && !strpos($condition->attrs->var, '.')) |
|
81 | + } else if($condition->attrs->var && !strpos($condition->attrs->var, '.')) |
|
83 | 82 | { |
84 | 83 | $this->argument = new QueryArgument($condition); |
85 | 84 | $this->argument_name = $this->argument->getArgumentName(); |
86 | - } |
|
87 | - else |
|
85 | + } else |
|
88 | 86 | { |
89 | 87 | if(isset($condition->attrs->default)) |
90 | 88 | { |
@@ -95,13 +93,11 @@ discard block |
||
95 | 93 | if(strpos($default_value, "'") !== FALSE) |
96 | 94 | { |
97 | 95 | $default_value = "\"" . $default_value . "\""; |
98 | - } |
|
99 | - else |
|
96 | + } else |
|
100 | 97 | { |
101 | 98 | $default_value = "'" . $default_value . "'"; |
102 | 99 | } |
103 | - } |
|
104 | - else |
|
100 | + } else |
|
105 | 101 | { |
106 | 102 | $default_value_object = new DefaultValue($this->column_name, $condition->attrs->default); |
107 | 103 | $default_value = $default_value_object->toString(); |
@@ -116,16 +112,14 @@ discard block |
||
116 | 112 | if(strpos($default_value, "'") !== FALSE) |
117 | 113 | { |
118 | 114 | $default_value = "\"" . $default_value . "\""; |
119 | - } |
|
120 | - else |
|
115 | + } else |
|
121 | 116 | { |
122 | 117 | $default_value = "'" . $default_value . "'"; |
123 | 118 | } |
124 | 119 | } |
125 | 120 | } |
126 | 121 | $this->default_column = $default_value; |
127 | - } |
|
128 | - else |
|
122 | + } else |
|
129 | 123 | { |
130 | 124 | $this->default_column = "'" . $dbParser->parseColumnName($condition->attrs->var) . "'"; |
131 | 125 | } |
@@ -161,8 +155,7 @@ discard block |
||
161 | 155 | , '"' . $this->operation . '"' |
162 | 156 | , $this->pipe ? ", '" . $this->pipe . "'" : '' |
163 | 157 | ); |
164 | - } |
|
165 | - else if(isset($this->default_column)) |
|
158 | + } else if(isset($this->default_column)) |
|
166 | 159 | { |
167 | 160 | return sprintf("new ConditionWithoutArgument('%s',%s,%s%s)" |
168 | 161 | , $this->column_name |
@@ -170,8 +163,7 @@ discard block |
||
170 | 163 | , '"' . $this->operation . '"' |
171 | 164 | , $this->pipe ? ", '" . $this->pipe . "'" : '' |
172 | 165 | ); |
173 | - } |
|
174 | - else |
|
166 | + } else |
|
175 | 167 | { |
176 | 168 | return sprintf("new ConditionWithArgument('%s',%s,%s%s)" |
177 | 169 | , $this->column_name |
@@ -25,42 +25,42 @@ discard block |
||
25 | 25 | function __construct($xml_conditions) |
26 | 26 | { |
27 | 27 | $this->condition_groups = array(); |
28 | - if(!$xml_conditions) |
|
28 | + if (!$xml_conditions) |
|
29 | 29 | { |
30 | 30 | return; |
31 | 31 | } |
32 | 32 | |
33 | 33 | $xml_condition_list = array(); |
34 | - if($xml_conditions->condition) |
|
34 | + if ($xml_conditions->condition) |
|
35 | 35 | { |
36 | 36 | $xml_condition_list = $xml_conditions->condition; |
37 | 37 | } |
38 | 38 | |
39 | - if($xml_conditions->query) |
|
39 | + if ($xml_conditions->query) |
|
40 | 40 | { |
41 | - if(!is_array($xml_condition_list)) |
|
41 | + if (!is_array($xml_condition_list)) |
|
42 | 42 | { |
43 | 43 | $xml_condition_list = array($xml_condition_list); |
44 | 44 | } |
45 | - if(!is_array($xml_conditions->query)) |
|
45 | + if (!is_array($xml_conditions->query)) |
|
46 | 46 | { |
47 | 47 | $xml_conditions->query = array($xml_conditions->query); |
48 | 48 | } |
49 | 49 | $xml_condition_list = array_merge($xml_condition_list, $xml_conditions->query); |
50 | 50 | } |
51 | - if($xml_condition_list) |
|
51 | + if ($xml_condition_list) |
|
52 | 52 | { |
53 | 53 | $this->condition_groups[] = new ConditionGroupTag($xml_condition_list); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $xml_groups = $xml_conditions->group; |
57 | - if($xml_groups) |
|
57 | + if ($xml_groups) |
|
58 | 58 | { |
59 | - if(!is_array($xml_groups)) |
|
59 | + if (!is_array($xml_groups)) |
|
60 | 60 | { |
61 | 61 | $xml_groups = array($xml_groups); |
62 | 62 | } |
63 | - foreach($xml_groups as $group) |
|
63 | + foreach ($xml_groups as $group) |
|
64 | 64 | { |
65 | 65 | $this->condition_groups[] = new ConditionGroupTag($group->condition, $group->attrs->pipe); |
66 | 66 | } |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | */ |
74 | 74 | function toString() |
75 | 75 | { |
76 | - $output_conditions = 'array(' . PHP_EOL; |
|
77 | - foreach($this->condition_groups as $condition) |
|
76 | + $output_conditions = 'array('.PHP_EOL; |
|
77 | + foreach ($this->condition_groups as $condition) |
|
78 | 78 | { |
79 | - $output_conditions .= $condition->getConditionGroupString() . PHP_EOL . ','; |
|
79 | + $output_conditions .= $condition->getConditionGroupString().PHP_EOL.','; |
|
80 | 80 | } |
81 | 81 | $output_conditions = substr($output_conditions, 0, -1); |
82 | 82 | $output_conditions .= ')'; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | function getArguments() |
87 | 87 | { |
88 | 88 | $arguments = array(); |
89 | - foreach($this->condition_groups as $condition) |
|
89 | + foreach ($this->condition_groups as $condition) |
|
90 | 90 | { |
91 | 91 | $arguments = array_merge($arguments, $condition->getArguments()); |
92 | 92 | } |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | // Sort order - asc / desc |
60 | 60 | $this->sort_order = $index->attrs->order; |
61 | 61 | $sortList = array('asc' => 1, 'desc' => 1); |
62 | - if(!isset($sortList[$this->sort_order])) |
|
62 | + if (!isset($sortList[$this->sort_order])) |
|
63 | 63 | { |
64 | 64 | $arg = new Xml_Node_(); |
65 | 65 | $arg->attrs = new Xml_Node_(); |
66 | 66 | $arg->attrs->var = $this->sort_order; |
67 | 67 | $arg->attrs->default = 'asc'; |
68 | 68 | $this->sort_order_argument = new SortQueryArgument($arg); |
69 | - $this->sort_order = '$' . $this->sort_order_argument->getArgumentName() . '_argument'; |
|
69 | + $this->sort_order = '$'.$this->sort_order_argument->getArgumentName().'_argument'; |
|
70 | 70 | } |
71 | 71 | else |
72 | 72 | { |
73 | - $this->sort_order = '"' . $this->sort_order . '"'; |
|
73 | + $this->sort_order = '"'.$this->sort_order.'"'; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $arguments = array(); |
85 | 85 | $arguments[] = $this->argument; |
86 | - if($this->sort_order_argument) |
|
86 | + if ($this->sort_order_argument) |
|
87 | 87 | { |
88 | 88 | $arguments[] = $this->sort_order_argument; |
89 | 89 | } |
@@ -67,8 +67,7 @@ |
||
67 | 67 | $arg->attrs->default = 'asc'; |
68 | 68 | $this->sort_order_argument = new SortQueryArgument($arg); |
69 | 69 | $this->sort_order = '$' . $this->sort_order_argument->getArgumentName() . '_argument'; |
70 | - } |
|
71 | - else |
|
70 | + } else |
|
72 | 71 | { |
73 | 72 | $this->sort_order = '"' . $this->sort_order . '"'; |
74 | 73 | } |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | */ |
49 | 49 | function __construct($index) |
50 | 50 | { |
51 | - if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs) |
|
51 | + if ($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs) |
|
52 | 52 | { |
53 | - if(!isset($index->page->attrs->default)) |
|
53 | + if (!isset($index->page->attrs->default)) |
|
54 | 54 | $index->page->attrs->default = 1; |
55 | - if(!isset($index->page_count->attrs->default)) |
|
55 | + if (!isset($index->page_count->attrs->default)) |
|
56 | 56 | $index->page_count->attrs->default = 10; |
57 | 57 | $this->page = new QueryArgument($index->page); |
58 | 58 | $this->page_count = new QueryArgument($index->page_count); |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $this->arguments[] = $this->page_count; |
61 | 61 | } |
62 | 62 | |
63 | - if(!isset($index->list_count->attrs->default)) |
|
63 | + if (!isset($index->list_count->attrs->default)) |
|
64 | 64 | $index->list_count->attrs->default = 0; |
65 | 65 | $this->list_count = new QueryArgument($index->list_count); |
66 | 66 | $this->arguments[] = $this->list_count; |
67 | 67 | |
68 | - if(isset($index->offset) && isset($index->offset->attrs)) |
|
68 | + if (isset($index->offset) && isset($index->offset->attrs)) |
|
69 | 69 | { |
70 | 70 | $this->offset = new QueryArgument($index->offset); |
71 | 71 | $this->arguments[] = $this->offset; |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | |
75 | 75 | function toString() |
76 | 76 | { |
77 | - if($this->page) |
|
77 | + if ($this->page) |
|
78 | 78 | { |
79 | 79 | return sprintf('new Limit(${\'%s_argument\'}, ${\'%s_argument\'}, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->page->getArgumentName(), $this->page_count->getArgumentName()); |
80 | 80 | } |
81 | - elseif($this->offset) |
|
81 | + elseif ($this->offset) |
|
82 | 82 | { |
83 | 83 | return sprintf('new Limit(${\'%s_argument\'}, NULL, NULL, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->offset->getArgumentName()); |
84 | 84 | } |
@@ -50,18 +50,21 @@ discard block |
||
50 | 50 | { |
51 | 51 | if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs) |
52 | 52 | { |
53 | - if(!isset($index->page->attrs->default)) |
|
54 | - $index->page->attrs->default = 1; |
|
55 | - if(!isset($index->page_count->attrs->default)) |
|
56 | - $index->page_count->attrs->default = 10; |
|
53 | + if(!isset($index->page->attrs->default)) { |
|
54 | + $index->page->attrs->default = 1; |
|
55 | + } |
|
56 | + if(!isset($index->page_count->attrs->default)) { |
|
57 | + $index->page_count->attrs->default = 10; |
|
58 | + } |
|
57 | 59 | $this->page = new QueryArgument($index->page); |
58 | 60 | $this->page_count = new QueryArgument($index->page_count); |
59 | 61 | $this->arguments[] = $this->page; |
60 | 62 | $this->arguments[] = $this->page_count; |
61 | 63 | } |
62 | 64 | |
63 | - if(!isset($index->list_count->attrs->default)) |
|
64 | - $index->list_count->attrs->default = 0; |
|
65 | + if(!isset($index->list_count->attrs->default)) { |
|
66 | + $index->list_count->attrs->default = 0; |
|
67 | + } |
|
65 | 68 | $this->list_count = new QueryArgument($index->list_count); |
66 | 69 | $this->arguments[] = $this->list_count; |
67 | 70 | |
@@ -77,12 +80,10 @@ discard block |
||
77 | 80 | if($this->page) |
78 | 81 | { |
79 | 82 | return sprintf('new Limit(${\'%s_argument\'}, ${\'%s_argument\'}, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->page->getArgumentName(), $this->page_count->getArgumentName()); |
80 | - } |
|
81 | - elseif($this->offset) |
|
83 | + } elseif($this->offset) |
|
82 | 84 | { |
83 | 85 | return sprintf('new Limit(${\'%s_argument\'}, NULL, NULL, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->offset->getArgumentName()); |
84 | - } |
|
85 | - else |
|
86 | + } else |
|
86 | 87 | { |
87 | 88 | return sprintf('new Limit(${\'%s_argument\'})', $this->list_count->getArgumentName()); |
88 | 89 | } |
@@ -49,36 +49,36 @@ discard block |
||
49 | 49 | function __construct($xml_navigation) |
50 | 50 | { |
51 | 51 | $this->order = array(); |
52 | - if($xml_navigation) |
|
52 | + if ($xml_navigation) |
|
53 | 53 | { |
54 | 54 | $order = $xml_navigation->index; |
55 | - if($order) |
|
55 | + if ($order) |
|
56 | 56 | { |
57 | - if(!is_array($order)) |
|
57 | + if (!is_array($order)) |
|
58 | 58 | { |
59 | 59 | $order = array($order); |
60 | 60 | } |
61 | - foreach($order as $order_info) |
|
61 | + foreach ($order as $order_info) |
|
62 | 62 | { |
63 | 63 | $this->order[] = new IndexTag($order_info); |
64 | 64 | } |
65 | 65 | |
66 | - if($xml_navigation->page && $xml_navigation->page->attrs || $xml_navigation->list_count && $xml_navigation->list_count->attrs) |
|
66 | + if ($xml_navigation->page && $xml_navigation->page->attrs || $xml_navigation->list_count && $xml_navigation->list_count->attrs) |
|
67 | 67 | { |
68 | 68 | $this->limit = new LimitTag($xml_navigation); |
69 | 69 | } |
70 | 70 | |
71 | - if($xml_navigation->list_count) |
|
71 | + if ($xml_navigation->list_count) |
|
72 | 72 | { |
73 | 73 | $this->list_count = $xml_navigation->list_count->attrs; |
74 | 74 | } |
75 | 75 | |
76 | - if($xml_navigation->page_count) |
|
76 | + if ($xml_navigation->page_count) |
|
77 | 77 | { |
78 | 78 | $this->page_count = $xml_navigation->page_count->attrs; |
79 | 79 | } |
80 | 80 | |
81 | - if($xml_navigation->page) |
|
81 | + if ($xml_navigation->page) |
|
82 | 82 | { |
83 | 83 | $this->page = $xml_navigation->page->attrs; |
84 | 84 | } |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | */ |
93 | 93 | function getOrderByString() |
94 | 94 | { |
95 | - $output = 'array(' . PHP_EOL; |
|
96 | - foreach($this->order as $order) |
|
95 | + $output = 'array('.PHP_EOL; |
|
96 | + foreach ($this->order as $order) |
|
97 | 97 | { |
98 | - $output .= $order->toString() . PHP_EOL . ','; |
|
98 | + $output .= $order->toString().PHP_EOL.','; |
|
99 | 99 | } |
100 | 100 | $output = substr($output, 0, -1); |
101 | 101 | $output .= ')'; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | function getLimitString() |
110 | 110 | { |
111 | - if($this->limit) |
|
111 | + if ($this->limit) |
|
112 | 112 | { |
113 | 113 | return $this->limit->toString(); |
114 | 114 | } |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | function getArguments() |
122 | 122 | { |
123 | 123 | $arguments = array(); |
124 | - foreach($this->order as $order) |
|
124 | + foreach ($this->order as $order) |
|
125 | 125 | { |
126 | 126 | $arguments = array_merge($order->getArguments(), $arguments); |
127 | 127 | } |
128 | - if($this->limit) |
|
128 | + if ($this->limit) |
|
129 | 129 | { |
130 | 130 | $arguments = array_merge($this->limit->getArguments(), $arguments); |
131 | 131 | } |
@@ -111,8 +111,7 @@ |
||
111 | 111 | if($this->limit) |
112 | 112 | { |
113 | 113 | return $this->limit->toString(); |
114 | - } |
|
115 | - else |
|
114 | + } else |
|
116 | 115 | { |
117 | 116 | return ""; |
118 | 117 | } |