/** * @param $filter * @return array */ protected function compileFilter($filter) { list($type, $condition) = $filter; if (is_string($condition) || $filter instanceof Raw) { return [$type, $condition]; } elseif (is_array($condition)) { $result = []; foreach ($condition as $k => $v) { if (is_numeric($k)) { $result[] = $v; } else { $result[] = ConnectionManager::bind($k, $v); } } return [$type, implode(' AND ', $result)]; } $subFilter = new static(); $subFilter->type = ''; call_user_func($condition, $subFilter); return [$type, $subFilter->toString()]; }
/** * @dataProvider dataProviderTestBind */ public function testBind($expected, $expr, $params) { $this->assertSame($expected, ConnectionManager::bind($expr, $params)); }