src/WellKnown/DynamicField.php
private static function createField($kind)
    {
        if (!isset(self::$fields[$kind])) {
            switch ($kind) {
                case DynamicFieldKind::STRING_VAL:
                    $type = StringType::create();
                    break;

                case DynamicFieldKind::TEXT_VAL:
                    $type = TextType::create();
                    break;

                case DynamicFieldKind::INT_VAL:
                    $type = IntType::create();
                    break;

                case DynamicFieldKind::BOOL_VAL:
                    $type = BooleanType::create();
                    break;

                case DynamicFieldKind::FLOAT_VAL:
                    $type = FloatType::create();
                    break;

                case DynamicFieldKind::DATE_VAL:
                    $type = DateType::create();
                    break;

                default:
                    throw new InvalidArgumentException(sprintf('DynamicField "%s" is not a valid type.', $kind));
            }

            self::$fields[$kind] = new Field($kind, $type, FieldRule::A_SINGLE_VALUE(), true);
        }

        return self::$fields[$kind];
    }
private static function createField($kind)
    {
        if (!isset(self::$fields[$kind])) {
            switch ($kind) {
                case DynamicFieldKind::STRING_VAL:
                    $type = StringType::create();
                    break;

                case DynamicFieldKind::TEXT_VAL:
                    $type = TextType::create();
                    break;

                case DynamicFieldKind::INT_VAL:
                    $type = IntType::create();
                    break;

                case DynamicFieldKind::BOOL_VAL:
                    $type = BooleanType::create();
                    break;

                case DynamicFieldKind::FLOAT_VAL:
                    $type = FloatType::create();
                    break;

                case DynamicFieldKind::DATE_VAL:
                    $type = DateType::create();
                    break;

                default:
                    throw new InvalidArgumentException(sprintf('DynamicField "%s" is not a valid type.', $kind));
            }

            self::$fields[$kind] = new Field($kind, $type, FieldRule::A_SINGLE_VALUE(), true);
        }

        return self::$fields[$kind];
    }
@param string $kind

@return Field