<?php

class Container {

  private $data = [];

  public function add(string $name, int $count) {
    if (isset($this->data[$name])) {
      $this->data[$name] += $count;
    } else {
      $this->data[$name] = $count;
    }
  }

  public function remove(string $name) {
    if (!isset($this->data[$name])) {
      return;
    }
    unset($this->data[$name]);
  }

  public function get($name) {
    return $this->data[$name];
  }

}

class CollectStatistics {

  // TODO: ...

  // Do not hardcore methods from above (add, remove) use magical methods instead.

}

// Do not modify code bellow this line.

// Expected output, utilize var_dump:
// array(2) {
//  ["add"]=>
//  int(3)
//  ["remove"]=>
//  int(1)
// }

$originalInstance = new Container();

// You need to return an array with two items.
// The first item is the wrap.
// The second item contains the statistics.
[ $instance, &$statistics ] = CollectStatistics::wrap($originalInstance);

$instance->add('tomato', 1);
$instance->add('bread', 1);
$instance->add('tomato', 1);
$instance->add('orange', 1);
$instance->remove('bread');

// Print statistics.
var_dump($statistics);

// Check calls.
if ($originalInstance->get('tomato') !== 2) {
  print("Invalid number of tomatoes.\n");
}

if ($originalInstance->get('orange') !== 1) {
  print("Invalid number of oranges.\n");
}