public static function build() { $encoders = [new JsonEncoder(new JsonEncode(), new JsonDecode(false)), new RawEncoder()]; $normalizers = NormalizerFactory::create(); $serializer = new Serializer($normalizers, $encoders); $clientGenerator = GeneratorFactory::build(); $prettyPrinter = new \PhpParser\PrettyPrinter\Standard(); $naming = new Naming(); $modelGenerator = new ModelGenerator($naming); $normGenerator = new NormalizerGenerator($naming); return new self($serializer, GuesserFactory::create($serializer), $modelGenerator, $normGenerator, $clientGenerator, $prettyPrinter); }
public static function build(array $options = []) { $encoders = [new JsonEncoder(new JsonEncode(), new JsonDecode(false)), new YamlEncoder(new YamlEncode(), new YamlDecode(false, true, true, true)), new RawEncoder()]; $normalizers = NormalizerFactory::create(); $serializer = new Serializer($normalizers, $encoders); $schemaParser = new SchemaParser($serializer); $clientGenerator = GeneratorFactory::build(); $prettyPrinter = new StandardPrettyPrinter(); $naming = new Naming(); $modelGenerator = new ModelGenerator($naming); $normGenerator = new NormalizerGenerator($naming, isset($options['reference']) ? $options['reference'] : false); return new self($schemaParser, GuesserFactory::create($serializer), $modelGenerator, $normGenerator, $clientGenerator, $prettyPrinter); }