Skip to content

Commit aaa08ea

Browse files
author
Tim Helfensdörfer
authored
Added method to destroy repositories and fixed typo
1 parent 87fd223 commit aaa08ea

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

src/Config.php

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Config
2828
*
2929
* @var array
3030
*/
31-
private $_repostitories = [];
31+
private $_repositories = [];
3232

3333
/**
3434
* List of all groups.
@@ -149,13 +149,28 @@ protected function createOrFindUser($name)
149149
* @param string $name
150150
* @return Repository
151151
*/
152-
protected function createOrFindRepository($name)
152+
public function createOrFindRepository($name)
153153
{
154-
if (isset($this->_repostitories[$name]))
155-
return $this->_repostitories[$name];
154+
if (isset($this->_repositories[$name]))
155+
return $this->_repositories[$name];
156156

157-
$this->_repostitories[$name] = new Repository($name);
158-
return $this->_repostitories[$name];
157+
$this->_repositories[$name] = new Repository($name);
158+
return $this->_repositories[$name];
159+
}
160+
161+
/**
162+
* Delete repository.
163+
*
164+
* @param string $name
165+
* @return bool
166+
*/
167+
public function deleteRepository($name)
168+
{
169+
if (!isset($this->_repositories[$name]))
170+
return false;
171+
172+
unset($this->_repositories[$name]);
173+
return true;
159174
}
160175

161176
/**
@@ -364,7 +379,7 @@ protected function generateConfig()
364379
if (count($this->_groups))
365380
$config .= "\n";
366381

367-
foreach ($this->_repostitories as $name => $repository) {
382+
foreach ($this->_repositories as $name => $repository) {
368383
$config .= 'repo ' . $name . "\n";
369384
$permissions = $repository->getPermissions();
370385
foreach ($permissions as $permission) {
@@ -436,7 +451,7 @@ public function &getGroups()
436451
*/
437452
public function &getRepositories()
438453
{
439-
return $this->_repostitories;
454+
return $this->_repositories;
440455
}
441456

442457
/**
@@ -539,7 +554,7 @@ public function __toString()
539554
}
540555

541556
$out .= PHP_EOL . '## REPOSITORIES' . PHP_EOL . PHP_EOL;
542-
foreach ($this->_repostitories as $repository) {
557+
foreach ($this->_repositories as $repository) {
543558
$out .= (string) $repository . PHP_EOL;
544559
}
545560

0 commit comments

Comments
 (0)