X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fpharext%2FCli%2FCommand.php;h=6ad2c806b4a4ccabe3602f1b5ed8c836e5ca6423;hb=e990b6dabecbdaf98b8d8b2173b0d697f9b2b754;hp=0cc0bb40f2b8649cc06de21d577c7b76728f2a44;hpb=4acccbbedeb300e70cc06d9253e95bafeb7a2859;p=pharext%2Fpharext diff --git a/src/pharext/Cli/Command.php b/src/pharext/Cli/Command.php index 0cc0bb4..6ad2c80 100644 --- a/src/pharext/Cli/Command.php +++ b/src/pharext/Cli/Command.php @@ -110,15 +110,13 @@ trait Command * @see \pharext\Command::error() */ public function error($fmt) { - if (!$this->args->quiet) { - if (!isset($fmt)) { - $fmt = "%s\n"; - $arg = error_get_last()["message"]; - } else { - $arg = array_slice(func_get_args(), 1); - } - vfprintf(STDERR, "ERROR: $fmt", $arg); + if (!isset($fmt)) { + $fmt = "%s\n"; + $arg = error_get_last()["message"]; + } else { + $arg = array_slice(func_get_args(), 1); } + vfprintf(STDERR, "ERROR: $fmt", $arg); } /** @@ -183,21 +181,16 @@ trait Command } /** - * rm -r - * @param string $dir + * Verbosity + * @return boolean */ - private function rm($dir) { - foreach (scandir($dir) as $entry) { - if ($entry === "." || $entry === "..") { - continue; - } elseif (is_dir("$dir/$entry")) { - $this->rm("$dir/$entry"); - } elseif (!unlink("$dir/$entry")) { - $this->warn(null); - } - } - if (!rmdir($dir)) { - $this->warn(null); + public function verbosity() { + if ($this->args->verbose) { + return true; + } elseif ($this->args->quiet) { + return false; + } else { + return null; } } }