Added warning support to migration script

This commit is contained in:
Marcin Kurczewski 2014-10-17 19:25:45 +02:00
parent 2ffd109c1c
commit 1f993d37b3

View file

@ -55,11 +55,16 @@ function removeRecursively($dir)
abstract class Task
{
private $warnings = [];
public function execute()
{
echo $this->getDescription() . '...';
$this->run();
echo PHP_EOL;
foreach ($this->warnings as $message)
echo 'Warning: ' . $message . PHP_EOL;
}
protected function progress()
@ -67,6 +72,11 @@ abstract class Task
echo '.';
}
protected function warn($message)
{
$this->warnings[] = $message;
}
protected function withProgress($source, $callback, $chunkSize = 666, callable $callbackLoopRunner = null)
{
if ($source instanceof \Traversable)