예제 #1
0
 /**
  * @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
 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.');
     }
 }