/** * @param Asker $asker * * @return string * * @since 1.1.0 * * @author Eddilbert Macharia (http://eddmash.com) <*****@*****.**> */ private static function _getDefault($asker) { $default_val = ''; $msg = 'Please enter the default value now, as valid PHP ' . PHP_EOL; while (true) { $default = $asker->ask(new Question($msg)); if (empty($default)) { $msg = " Please enter some value, or 'exit' (with no quotes) to exit." . PHP_EOL; } elseif ($default == 'exit') { break; } elseif ($default === false) { Console::error(PHP_EOL . ' An error occured while trying to set default value'); break; } else { $default_val = $default; break; } } return $default_val; }
public function input($message = ' ') { return Console::input($message); }
/** * Applies the migration to the database. * * @param ProjectState $state this is the state before the migration is applied * @param Migration $migration the migration to apply * @param bool $fake * * @return mixed * * @since 1.1.0 * * @author Eddilbert Macharia (http://eddmash.com) <*****@*****.**> */ public function applyMigration($state, $migration, $fake = false) { Console::stdout(sprintf(' Applying %s...', $migration->getName())); if (!$fake) { $state = $migration->apply($state, $this->schemaEditor); } $this->recorder->recordApplied(['name' => $migration->getName()]); if ($fake) { $end = Console::ansiFormat('FAKED', [Console::FG_GREEN]); } else { $end = Console::ansiFormat('OK', [Console::FG_GREEN]); } Console::stdout($end . PHP_EOL); return $state; }