framework/base/ArrayableTrait.php
protected function extractRootFields(array $fields)
    {
        $result = [];

        foreach ($fields as $field) {
            $result[] = current(explode('.', $field, 2));
        }

        if (in_array('*', $result, true)) {
            $result = [];
        }

        return array_unique($result);
    }
protected function extractRootFields(array $fields)
    {
        $result = [];

        foreach ($fields as $field) {
            $result[] = current(explode('.', $field, 2));
        }

        if (in_array('*', $result, true)) {
            $result = [];
        }

        return array_unique($result);
    }
Extracts the root field names from nested fields.
Nested fields are separated with dots (.). e.g: "item.id"
The previous example would extract "item".

@param array $fields The fields requested for extraction
@return array root fields extracted from the given nested fields
@since 2.0.14