public function builder($fieldName = null) { if ($fieldName === null) { return $this; } else { if (isset($this->map[$fieldName])) { return $this->map[$fieldName]; } } return ScalarFields::getInstance(); }
/** * Convert given array into fields. * * @param array $input * @return FieldsBuilderInterface */ public static function fromArray($input = []) { $fields = ScalarFields::getInstance(); foreach ($input as $k => $v) { if (is_array($v)) { $fields = $fields->appendFields($k, self::fromArray($v)); } elseif (!!$v) { $fields = $fields->appendField($k); } } return $fields; }