コード例 #1
0
ファイル: Run.php プロジェクト: natedrake/fast-forward
 /**
  * @param Bookmark[] $bookmarks
  *
  * @return mixed|null
  */
 private function selectMatch($bookmarks)
 {
     if (count($bookmarks) === 0) {
         return null;
     }
     Bookmark::table($this->out, $bookmarks);
     $answer = $this->out->ask('Enter # of command to run');
     if ($answer !== null && ctype_digit($answer) && $answer >= 0 && $answer < count($bookmarks)) {
         return $bookmarks[$answer];
     }
     return null;
 }
コード例 #2
0
ファイル: Import.php プロジェクト: natedrake/fast-forward
 private function showResults()
 {
     if (count($this->failed) > 0) {
         $this->out->note('Bookmarks that failed to import: ' . count($this->failed));
         Bookmark::table($this->out, $this->failed, array('Error'));
     }
     if (count($this->skipped) > 0) {
         $this->out->note('Bookmarks skipped because of identical shortcuts: ' . count($this->skipped));
         Bookmark::table($this->out, $this->skipped, array('Existing command'));
     }
     if (count($this->imported) > 0) {
         $this->out->success('Bookmarks successfully imported: ' . count($this->imported));
         Bookmark::table($this->out, $this->imported);
     } else {
         $this->out->note('No bookmarks were imported.');
     }
 }