protected function _verifyClause(GroupByClause $clause, $fields) { $fields = Arrays::fuse($fields); foreach ($clause->getFields() as $field) { unset($fields[$field->getField()]); } return empty($fields); }
public function testArrayFuse() { $this->assertEquals([], Arrays::fuse([])); $this->assertEquals(['x' => 'x'], Arrays::fuse(['x'])); }
/** * Simplifies a common use of `array_combine()`. Specifically, this: * * COUNTEREXAMPLE: * if ($list) { * $result = array_combine($list, $list); * } else { * // Prior to PHP 5.4, array_combine() failed if given empty arrays. * $result = array(); * } * * ...is equivalent to this: * * $result = array_fuse($list); * * @param $list array List of scalars. * * @return array Dictionary with inputs mapped to themselves. * @group util * * @deprecated */ function array_fuse(array $list) { return \Packaged\Helpers\Arrays::fuse($list); }