do not try to delete if file does not exist
[phorkie.git] / src / phorkie / Repositories.php
index dc3387bcc1faad481c6061e67c7b7a90025bbb64..a75f2c23a62d23ca93f6e57ee340592317ce9f2d 100644 (file)
@@ -16,7 +16,12 @@ class Repositories
     {
         chdir($this->gitDir);
         $dirs = glob('*.git', GLOB_ONLYDIR);
-        array_walk($dirs, function ($dir) { return substr($dir, 0, -4); });
+        array_walk(
+            $dirs,
+            function ($dir) {
+                return substr($dir, 0, -4);
+            }
+        );
         sort($dirs, SORT_NUMERIC);
         $n = end($dirs) + 1;
 
@@ -38,7 +43,7 @@ class Repositories
      * @param integer $page    Page number, beginning with 0
      * @param integer $perPage Number of repositories per page
      *
-     * @return array Array of Repositories
+     * @return array Array of Repositories first, number of repositories second
      */
     public function getList($page = 0, $perPage = 10)
     {
@@ -53,7 +58,7 @@ class Repositories
             $r->loadById(substr($oneDir, 0, -4));
             $repos[] = $r;
         }
-        return $repos;
+        return array($repos, count($dirs));
     }
 }