public function addObject($item) { if ($item instanceof User && $this->type != self::USERS) { GitoliteException::throwWrongTeamType($item->name, self::USERS); } elseif ($item instanceof Repo && $this->type != self::REPO) { GitoliteException::throwWrongTeamType($item->name, self::REPO); } $item->addTeam($this); $this->items[] = $item; }
/** * @param $line * * @return Repo[] * @throws GitoliteException */ protected function parseRepo($line) { $find = []; $arr = preg_split("/[\\s\t]+/", $line); array_shift($arr); foreach ($arr as $name) { if (self::isTeam($name)) { if (!($team = $this->getTeamAsRepo($name))) { GitoliteException::throwUndefinedTeam($name); } $find = array_merge($find, $team->items); } else { $repo = new Repo(); $repo->setName($name); $this->addRepo($repo); $find[] = $repo; } } return $find; }
/** * Add Team * * @param Team $team A team object * * @return Acl */ public function addTeam(Team $team) { if ($team->type != Team::USERS) { GitoliteException::throwWrongTeamType($team, Team::USERS); } foreach ($team->items as $item) { $this->addUser($item); } return $this; }