debug option to print curl requests
[shpub.git] / src / shpub / Config.php
index 352ab99da68b8194b865e841fa2486a338762e70..c9ebb4d783655e1d1544286be2b86f47a5b612fd 100644 (file)
@@ -12,6 +12,8 @@ class Config
      */
     public $host;
 
+    public $debug = false;
+
     protected function getConfigFilePath()
     {
         if (!isset($_SERVER['HOME'])) {
@@ -65,7 +67,8 @@ class Config
                 if ($hostVal == '') {
                     continue;
                 }
-                $str .= $hostProp . '=' . $hostVal . "\n";
+                $str .= $hostProp
+                    . '=' . static::quoteIniValue($hostVal) . "\n";
             }
         }
         $cfgFilePath = $this->getConfigFilePath();
@@ -105,5 +108,18 @@ class Config
         }
         return null;
     }
+
+    public static function quoteIniValue($val)
+    {
+        if (strpos($val, '=') === false) {
+            return $val;
+        }
+        return '"' . $val . '"';
+    }
+
+    public function setDebug($debug)
+    {
+        $this->debug = $debug;
+    }
 }
 ?>