<?php

class User {

  public string $name;

  public int $age;

  public function __construct(string $name, int $age) {
    $this->name = $name;
    $this->age = $age;
  }

}

interface Writer {
  public function asString(User $user);
}

class JsonWriter implements Writer {

  // TODO: ...

}

class StringWriter implements Writer {

  // TODO: ...

}

function createWriter($name): Writer {
  // TODO: ...
  // Do not use "if" or "switch" control statements.
}

// Do not modify code bellow this line.

// Expected output:
// JSON:
// {"name":"Ailish","age":22}
// STRING
// Ailish:22

if (!isset($ignoreTest)) {
  print("JSON\n");
  $student = new User("Ailish", "22");
  print(createWriter("json")->asString($student));
  print("\nSTRING\n");
  print(createWriter("string")->asString($student));
  print("\n");
}