$this->gitDir = $GLOBALS['phorkie']['cfg']['gitdir'];
}
- /**
- * @return Repository
- */
- public function createNew()
+ public function createNew(): Repository
{
chdir($this->gitDir);
$dirs = glob('*.git', GLOB_ONLYDIR);
- array_walk(
- $dirs,
- function ($dir) {
- return substr($dir, 0, -4);
- }
- );
+ foreach ($dirs as $key => $dir) {
+ $dirs[$key] = substr($dir, 0, -4);
+ }
sort($dirs, SORT_NUMERIC);
+
if ($GLOBALS['phorkie']['cfg']['randomIds']) {
$n = end($dirs) + mt_rand(65536, 16777216);
} else {
*
* @return array Array of Repositories first, number of repositories second
*/
- public function getList($page = 0, $perPage = 10)
+ public function getList($page = 0, $perPage = 10): array
{
chdir($this->gitDir);
$dirs = glob('*.git', GLOB_ONLYDIR);