@param string $field
@param array  $values

@return static
11480
public function whereIn($field, $values)
    {
        foreach ($this->queries as $query) {
            $query->whereIn($field, $values);
        }

        return $this;
    }
430740
protected function setField($values)
    {
        foreach ($values as $name => $field) {
            $this->fields[$name] = $field;
        }
    }
654697
public function addIn($field, $values, $whereConcat = 'AND')
    {
        if (!is_array($values)) {
            return $this;
        }

        $field = (0 < count($this->wheres) ? ' ' . $whereConcat . ' ' . $field : $field);

        //~ Bind values (more safety)
        $index  = 1;
        $fields = array();
        foreach ($values as $value) {

            $name = ':value_' . $index;

            $fields[]           = $name;
            $this->binds[$name] = (string) $value;

            $index++;
        }

        $this->wheres[] = $field . ' IN (' . implode(',', $fields) . ')';

        return $this;
    }
852977
protected function access($values, string $field)
    {
        return isset($values[$field]) ? $values[$field] : null;
    }
1353591
public function findWhereIn($field, array $values, $columns = ['*'])
    {
        return parent::findWhereIn(
            $this->getColumnName($field),
            $values,
            $this->getColumnsNames($columns)
        );
    }
110319
public function orderField($field, array $values = [], $order = '')
    {
        if (!empty($values)) {
            $values['sort'] = $order;

            $this->options['order'][$field] = $values;
        }

        return $this;
    }
604479
protected function prepareWhereIn($field, array $values = [], $cacheKey)
    {
        if (is_array($field)) {
            foreach ($field as $name => $values) {
                $this->prepareWhereIn($name, $values, $cacheKey);
            }
        } elseif (count($values)) {

            if ($field === '_id') {
                foreach ($values as $key => $value) {
                    $values[ $key ] = new \MongoDb\BSON\ObjectID($value);
                }
            }

            $this->builderCache->store($cacheKey, [$field => $values]);
        }
    }
299333
public function values($fields = [])
    {
        $this->values = [];

        if (empty($fields)) {
            foreach ($this->model->fields() as $field) {
                $this->assignValue($field);
            }

            return $this;
        }

        foreach ($fields as $field) {
            $this->assignValue($this->model->field($field));
        }

        return $this;
    }
21352
public ZealotKhala in(String field, Object[] values) {
        return this.doIn(ZealotConst.ONE_SPACE, field, values, true, true);
    }
691193
public function includeFields(array $fields)
    {
        foreach ($fields as $fieldName) {
            $this->field($fieldName)->expression(true);
        }

        return $this;
    }
553390
public function fields($fields)
    {
        $fields = is_array($fields) && func_num_args() === 1 ? $fields : func_get_args();
        $this->_parts['fields'] = Set::merge($this->_parts['fields'], $fields);
        return $this;
    }
808419
protected function parseOrXValues($field, $values)
    {
        $exprs = array();
        foreach($values as $value) {
            $exprs[] = $this->parseFieldValue($field, $value);
        }

        return $this->expr()->orX($exprs);
    }
710283
public function values($values)
    {
        if ($values instanceof Collection) {
            $values = $values->toArray();
        }

        $this->values = $values;

        return $this;
    }
8095
protected function buildIn($field, array $values, $isIn)
    {
        $operator = $isIn ? ' IN ' : ' NOT IN ';

        return $field.$operator.$this->parameterizeValues($values);
    }
81458
public static function get_users_by_field($field, $values) {
        global $CFG, $USER, $DB;
        require_once($CFG->dirroot . "/user/lib.php");

        $params = self::validate_parameters(self::get_users_by_field_parameters(),
                array('field' => $field, 'values' => $values));

        // This array will keep all the users that are allowed to be searched,
        // according to the current user's privileges.
        $cleanedvalues = array();

        switch ($field) {
            case 'id':
                $paramtype = core_user::get_property_type('id');
                break;
            case 'idnumber':
                $paramtype = core_user::get_property_type('idnumber');
                break;
            case 'username':
                $paramtype = core_user::get_property_type('username');
                break;
            case 'email':
                $paramtype = core_user::get_property_type('email');
                break;
            default:
                throw new coding_exception('invalid field parameter',
                        'The search field \'' . $field . '\' is not supported, look at the web service documentation');
        }

        // Clean the values.
        foreach ($values as $value) {
            $cleanedvalue = clean_param($value, $paramtype);
            if ( $value != $cleanedvalue) {
                throw new invalid_parameter_exception('The field \'' . $field .
                        '\' value is invalid: ' . $value . '(cleaned value: '.$cleanedvalue.')');
            }
            $cleanedvalues[] = $cleanedvalue;
        }

        // Retrieve the users.
        $users = $DB->get_records_list('user', $field, $cleanedvalues, 'id');

        $context = context_system::instance();
        self::validate_context($context);

        // Finally retrieve each users information.
        $returnedusers = array();
        foreach ($users as $user) {
            $userdetails = user_get_user_details_courses($user);

            // Return the user only if the searched field is returned.
            // Otherwise it means that the $USER was not allowed to search the returned user.
            if (!empty($userdetails) and !empty($userdetails[$field])) {
                $returnedusers[] = $userdetails;
            }
        }

        return $returnedusers;
    }
541487
public function setResults(array $values)
    {
        foreach ($values as $field => $value) {
            if (empty($value)) {
                continue;
            }
            $this->setResult($field, $value);
        }

        return $this;
    }
1236349
public function mset(array $fields, array $values)
    {
        // Those are really temporary tricks.
        // @todo: Rewrite it to use native Predis API
        if(count($fields) !== count($values))
        {
            throw new \InvalidArgumentException(
                "Fields and values array have to be equal!"
            );
        }

        $combined = array_combine($fields, $values);

        foreach ($combined as $field => $value) {
            $this->set($field, $value);
        }
    }