download progress, cleanups
[pharext/pharext] / src / pharext / Cli / Command.php
index 0ec52fffea07b06b829ee4e3ccffd68a651c8a98..e19ce93a444ffd3d4d87a2be90ed589f897e86a8 100644 (file)
@@ -30,6 +30,16 @@ trait Command
                        \pharext\VERSION);
        }
        
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::debug()
+        */
+       public function debug($fmt) {
+               if ($this->args->verbose) {
+                       vprintf($fmt, array_slice(func_get_args(), 1));
+               }
+       }
+       
        /**
         * @inheritdoc
         * @see \pharext\Command::info()
@@ -117,34 +127,6 @@ trait Command
                printf("\n");
        }
        
-       /**
-        * Create temporary file/directory name
-        * @param string $prefix
-        * @param string $suffix
-        */
-       private function tempname($prefix, $suffix = null) {
-               if (!isset($suffix)) {
-                       $suffix = uniqid();
-               }
-               return sprintf("%s/%s.%s", sys_get_temp_dir(), $prefix, $suffix);
-       }
-
-       /**
-        * Create a new temp directory
-        * @param string $prefix
-        * @return string
-        */
-       private function newtemp($prefix) {
-               $temp = $this->tempname($prefix);
-               if (!is_dir($temp)) {
-                       if (!mkdir($temp, 0700, true)) {
-                               $this->error(null);
-                               exit(3);
-                       }
-               }
-               return $temp;
-       }
-
        /**
         * rm -r
         * @param string $dir