Exemplo n.º 1
0
 /**
  * {@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);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 /**
  * {@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;
 }
Exemplo n.º 4
0
 /**
  * @param string $name
  * @return bool
  */
 public function has($name)
 {
     return $this->loaders->containsKey($name);
 }
Exemplo n.º 5
0
 /**
  * @param string $name
  * @return bool
  */
 public function has($name)
 {
     return $this->fixtures->containsKey($name);
 }