function __construct(array $expansion, Map $tags, Map $scope) { $this->expansion = $this->compile($expansion, $scope); if ($tags->contains('·unsafe')) { $this->unsafe = false; } $this->recursive = $tags->contains('·recursion'); }
/** * Checks an relation to the indicated user. * * @param integer $userid * * @return boolean True if a relation exists, false if not */ protected function getPlayerRelation($userid) { if (!$userid || !$this->userid) { return false; } $this->loadPlayerRelations(); if ($this->players->size() > 0 && $this->players->contains($userid)) { return true; } return false; }
/** * {@inheritdoc} */ public function groupBy(callable $discriminator) : MapInterface { if ($this->size() === 0) { throw new GroupEmptySequenceException(); } $map = null; foreach ($this->values as $value) { $key = $discriminator($value); if ($map === null) { $type = gettype($key); $map = new Map($type === 'object' ? get_class($key) : $type, SequenceInterface::class); } if ($map->contains($key)) { $map = $map->put($key, $map->get($key)->add($value)); } else { $map = $map->put($key, new self($value)); } } return $map; }