@param array $fields

@return array
7174
private function parseQualityAndParameters(array $fields): array
    {
        $quality     = 1;
        $qParamFound = false;
        $parameters  = null;

        $count = \count($fields);
        for ($idx = 1; $idx < $count; ++$idx) {
            $fieldValue = $fields[$idx];
            if (empty($fieldValue) === true) {
                continue;
            }

            if (\strpos($fieldValue, '=') === false) {
                throw new InvalidArgumentException('mediaType');
            }

            list($key, $value) = \explode('=', $fieldValue, 2);

            $key   = \trim($key);
            $value = \trim($value, ' "');

            // 'q' param separates media parameters from extension parameters

            if ($key === 'q' && $qParamFound === false) {
                $quality     = (float)$value;
                $qParamFound = true;
                continue;
            }

            if ($qParamFound === false) {
                $parameters[$key] = $value;
            }
        }

        return [$parameters, $quality];
    }
733454
public function setFields($fields)
    {
        if (\is_array($fields)) {
            $fields = \implode(',', $fields);
        }

        return $this->setParam('fields', (string) $fields);
    }
408518
public function fields($fields) {

        if ( is_array($fields) ) {
            $this->fields = '`'.implode("`, `", $fields).'`';
        } else if ( is_string($fields) ) {
            $this->fields = $fields;
        } else {
            $this->fields = '*';
        }
        return $this;
    }
1024287
public function setFields($fields = [])
    {
        $existingSchema = $this->get();

        $request = [];
        foreach ($fields as $field) {
            $mode = $this->hasField($field['name'], $existingSchema) ? 'replace-field' : 'add-field';
            $request[$mode][] = $field;
        }

        return $this->request($request);
    }
1197466
public function decodeValues(array $fields)
    {
        $output = [];

        foreach ($fields as $key => $val) {
            $type = array_keys($val)[0];
            $value = current($val);

            $output[$key] = $this->decodeValue($type, $value);
        }

        return $output;
    }
293421
public function prepareSort(array $fields) : array
    {
        $sortFields = [];

        foreach ($fields as $key => $value) {
            if (is_array($value)) {
                $sortFields[$this->prepareFieldName($key)] = $value;
            } else {
                $sortFields[$this->prepareFieldName($key)] = $this->getSortDirection($value);
            }
        }

        return $sortFields;
    }
1275615
public function setFields(array $fields)
    {
        foreach ($fields as $key => $field) {
            $this->setField($key, $field);
        }

        return $this;
    }
233225
public function fields($fields = [])
    {
        $this->builder->select([]);
        $this->casts = [];

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

            return $this;
        }

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

        return $this;
    }
106289
protected static function hash($fields)
    {
        foreach ($fields as $key => $value) {
            if (in_array($key, self::$fields)) {
                $fields[$key] = Hash::make($value);
            }
        }

        return $fields;
    }
484049
public function fields($fields)
    {
        if (is_array($fields) || $fields === null) {
            $this->fields = $fields;
        } else {
            $this->fields = func_get_args();
        }
        return $this;
    }
238893
protected function getFormRules(array $fields)
    {
        $rules = [];

        foreach ($fields as $field) {
            /** @var FieldTypeInterface $field */
            $rules[$field->getName()] = $field->getOption('rules');
        }

        return $rules;
    }
1318081
public function addFields(array $fields)
    {
        $oldFields = $this->_queryBuilder->getFields() ? $this->_queryBuilder->getFields() : array();
        $newFields = array_merge($oldFields, $fields);
        $this->setFields($newFields);
        return $this;
    }
492762
protected function getFormPlaceholders(array $fields)
    {
        $attributes = [];

        foreach ($fields as $field) {
            /** @var FieldTypeInterface $field */
            $attributes[$field->getName()] = $field->getOption('placeholder');
        }

        return $attributes;
    }
649549
public function prepareInsertFields(array $fields)
    {
        if ($this->isSortEnabled()) {
            $fields[$this->sortIndexFieldName] = $this->getMaxSortIndex() + 1;
        }
        
        return $fields;
    }
771491
public function getAllCustomFields(array $fields = [])
    {
        if (!$models = Modules::findFirstByName($this->getSource())) {
            return;
        }

        $conditions = [];
        $fieldsIn = null;

        if (!empty($fields)) {
            $fieldsIn = " and name in ('" . implode("','", $fields) . ')';
        }

        $conditions = 'modules_id = ? ' . $fieldsIn;

        $bind = [$this->getId(), $models->getId()];

        $customFieldsValueTable = $this->getSource() . '_custom_fields';

        $result = $this->getReadConnection()->prepare("SELECT l.{$this->getSource()}_id,
                                               c.id as field_id,
                                               c.name,
                                               l.value ,
                                               c.users_id,
                                               l.created_at,
                                               l.updated_at
                                        FROM {$customFieldsValueTable} l,
                                             custom_fields c
                                        WHERE c.id = l.custom_fields_id
                                          AND l.leads_id = ?
                                          AND c.modules_id = ? ");

        $result->execute($bind);

        // $listOfCustomFields = $result->fetchAll();
        $listOfCustomFields = [];

        while ($row = $result->fetch(\PDO::FETCH_OBJ)) {
            $listOfCustomFields[$row->name] = $row->value;
        }

        return $listOfCustomFields;
    }
251603
public function generateFields(array $fields): array
    {
        $traitFqns = [];
        foreach ($fields as list($fieldFqn, $fieldType)) {
            try {
                $traitFqns[] = $this->fieldGenerator->generateField($fieldFqn, $fieldType);
            } catch (\Exception $e) {
                throw new \RuntimeException(
                    'Failed building field with $fieldFqn: ' . $fieldFqn . ' and $fieldType ' . $fieldType,
                    $e->getCode(),
                    $e
                );
            }
        }

        return $traitFqns;
    }
241477
protected function _getFieldsFromConfig($fields = null) {
		$result = [];
		if (empty($fields)) {
			return $result;
		}

		if (!is_array($fields)) {
			$result = [$fields];
		} else {
			$result = array_keys($fields);
		}

		return $result;
	}