public function obtainLocations(Index $index) { // If the end user desires to see all scaffolds, instead // of having to select a vendor and package first, then // we simply return all locations from the index if ($this->input->getOption('show-all') == true) { return $index->all(); } // Select a vendor $vendor = $this->output->choice('Please select a vendor', $index->getVendors()); // Select a package $package = $this->output->choice('Please select a package', $index->getPackagesFor($vendor)); // Fetch the available locations for vendor and package return $index->getLocationsFor($vendor, $package); }
/** * Persists the index into a file * * Previous index file will be removed before new * index file is saved to the disk * * @param Index $index */ protected function buildIndexFile(Index $index) { // Clear any eventual previous index file $this->deleteIndexFile(); // Write the index file $this->getFile()->append($this->getPathToIndexFile(), $index->toJson(JSON_PRETTY_PRINT)); }