| @@ -113,9 +113,9 @@ | ||
| 113 | 113 | } | 
| 114 | 114 | |
| 115 | 115 | /** | 
| 116 | - * @param array $data rules configuration | |
| 117 | - * @return string the WHERE clause | |
| 118 | - */ | |
| 116 | + * @param array $data rules configuration | |
| 117 | + * @return string the WHERE clause | |
| 118 | + */ | |
| 119 | 119 | protected function buildWhere($data) | 
| 120 | 120 |      { | 
| 121 | 121 |          if (!isset($data['rules']) || !$data['rules']) { | 
| @@ -59,19 +59,19 @@ discard block | ||
| 59 | 59 | $this->_operators = [ | 
| 60 | 60 | 'equal' => '= ?', | 
| 61 | 61 | 'not_equal' => '<> ?', | 
| 62 | - 'in' => ['op' => 'IN (?)', 'list' => true, 'sep' => ', ' ], | |
| 62 | + 'in' => ['op' => 'IN (?)', 'list' => true, 'sep' => ', '], | |
| 63 | 63 | 'not_in' => ['op' => 'NOT IN (?)', 'list' => true, 'sep' => ', '], | 
| 64 | 64 | 'less' => '< ?', | 
| 65 | 65 | 'less_or_equal' => '<= ?', | 
| 66 | 66 | 'greater' => '> ?', | 
| 67 | 67 | 'greater_or_equal' => '>= ?', | 
| 68 | - 'between' => ['op' => 'BETWEEN ?', 'list' => true, 'sep' => ' AND '], | |
| 69 | -            'begins_with' =>      ['op' => 'LIKE ?',     'fn' => function($value){ return "$value%"; } ], | |
| 70 | -            'not_begins_with' =>  ['op' => 'NOT LIKE ?', 'fn' => function($value){ return "$value%"; } ], | |
| 71 | -            'contains' =>         ['op' => 'LIKE ?',     'fn' => function($value){ return "%$value%"; } ], | |
| 72 | -            'not_contains' =>     ['op' => 'NOT LIKE ?', 'fn' => function($value){ return "%$value%"; } ], | |
| 73 | -            'ends_with' =>        ['op' => 'LIKE ?',     'fn' => function($value){ return "%$value"; } ], | |
| 74 | -            'not_ends_with' =>    ['op' => 'NOT LIKE ?', 'fn' => function($value){ return "%$value"; } ], | |
| 68 | + 'between' => ['op' => 'BETWEEN ?', 'list' => true, 'sep' => ' AND '], | |
| 69 | +            'begins_with' =>      ['op' => 'LIKE ?', 'fn' => function($value) { return "$value%"; }], | |
| 70 | +            'not_begins_with' =>  ['op' => 'NOT LIKE ?', 'fn' => function($value) { return "$value%"; }], | |
| 71 | +            'contains' =>         ['op' => 'LIKE ?', 'fn' => function($value) { return "%$value%"; }], | |
| 72 | +            'not_contains' =>     ['op' => 'NOT LIKE ?', 'fn' => function($value) { return "%$value%"; }], | |
| 73 | +            'ends_with' =>        ['op' => 'LIKE ?', 'fn' => function($value) { return "%$value"; }], | |
| 74 | +            'not_ends_with' =>    ['op' => 'NOT LIKE ?', 'fn' => function($value) { return "%$value"; }], | |
| 75 | 75 | 'is_empty' => '= ""', | 
| 76 | 76 | 'is_not_empty' => '<> ""', | 
| 77 | 77 | 'is_null' => 'IS NULL', | 
| @@ -97,7 +97,7 @@ discard block | ||
| 97 | 97 |          } else { | 
| 98 | 98 | $op = ArrayHelper::getValue($pattern, 'op'); | 
| 99 | 99 | $list = ArrayHelper::getValue($pattern, 'list'); | 
| 100 | -            if ($list){ | |
| 100 | +            if ($list) { | |
| 101 | 101 | $sep = ArrayHelper::getValue($pattern, 'sep'); | 
| 102 | 102 | $replacement = implode($sep, $keys); | 
| 103 | 103 |              } else { | 
| @@ -109,7 +109,7 @@ discard block | ||
| 109 | 109 | } | 
| 110 | 110 | |
| 111 | 111 | $this->_params = array_merge($this->_params, $params); | 
| 112 | -        return $field . " " . ($replacement ? str_replace("?", $replacement, $pattern) : $pattern); | |
| 112 | +        return $field." ".($replacement ? str_replace("?", $replacement, $pattern) : $pattern); | |
| 113 | 113 | } | 
| 114 | 114 | |
| 115 | 115 | /** | 
| @@ -123,7 +123,7 @@ discard block | ||
| 123 | 123 | } | 
| 124 | 124 | |
| 125 | 125 | $where = []; | 
| 126 | - $condition = " " . $data['condition'] . " "; | |
| 126 | + $condition = " ".$data['condition']." "; | |
| 127 | 127 | |
| 128 | 128 |          foreach ($data['rules'] as $rule) { | 
| 129 | 129 |              if (isset($rule['condition'])) { | 
| @@ -151,7 +151,7 @@ discard block | ||
| 151 | 151 | } | 
| 152 | 152 | } | 
| 153 | 153 | |
| 154 | -        return  !empty($where) ? "(" . implode($condition, $where) . ")" :  ''; | |
| 154 | +        return  !empty($where) ? "(".implode($condition, $where).")" : ''; | |
| 155 | 155 | } | 
| 156 | 156 | |
| 157 | 157 | /** |