/** * {@inheritdoc} */ public function load($path, array $arguments = []) { if ($this->caches->containsKey($path) === false) { $content = $this->loader->load($path, $arguments); $value = new Pair($path, $content); $this->caches->add($value); } return $this->caches->get($path); }
public function testSetter() { $map = new Map(["a" => 1, "b" => 2, "c" => 3]); $map["d"] = 4; $map->c = 5; $map->set("a", 6); $this->assertEquals(4, $map->count()); $this->assertEquals(4, $map->get("d")); $this->assertEquals(5, $map->get("c")); $this->assertEquals(6, $map->get("a")); }
public function save(StreamName $streamName, DomainMessage $event) { $id = (string) $event->getId(); $name = (string) $streamName; $events = $this->events->get($name); if (null === $events) { $events = new Map(); $this->events->add(new Pair($name, $events)); } if (!$events->containsKey($id)) { $events->add(new Pair($id, new Vector())); } $events->get($id)->add($event); }
/** * {@inheritDoc} * @return $this */ public function groupBy($callback) { $group = new Map(); foreach ($this as $value) { $key = $callback($value); if (!$group->containsKey($key)) { $element = $this instanceof VectorInterface ? new static([$value]) : new Vector([$value]); $group->add(new Pair($key, $element)); } else { $value = $group->get($key)->add($value); $group->set($key, $value); } } return $group; }
/** * Get the loader of fixture * * @param string $name * @return \holyshared\fixture\FixtureLoader */ public function get($name) { return $this->loaders->get($name); }
/** * Get the path of fixture file * * @param string $name * @return string */ public function get($name) { return $this->fixtures->get($name); }