diff --git a/src/wdm/debian/control/StandardFile.php b/src/wdm/debian/control/StandardFile.php index 71dcf8c..89767e2 100644 --- a/src/wdm/debian/control/StandardFile.php +++ b/src/wdm/debian/control/StandardFile.php @@ -1,12 +1,12 @@ - '', + 'Package' => false, 'Version' => '0.1', "Section" => "web", "Priority" => "optional", "Architecture" => "all", "Essential" => "no", - "Depends" => "", - "Pre-Depends" => "", - "Recommends" => "", - "Suggests" => "", + "Depends" => false, + "Pre-Depends" => false, + "Recommends" => false, + "Suggests" => false, "Installed-Size" => 1024, "Maintainer" => "name [email]", - "Conflicts" => "", - "Replaces" => "", + "Conflicts" => false, + "Replaces" => false, "Provides" => "your-company", "Description" => "Your description" ); - + public function setPackageName($name) { return $this->_setProperty("Package", $name); } - + public function setVersion($version) { return $this->_setProperty("Version", $version); } - + public function setSection($section) { return $this->_setProperty("Section", $section); } - + public function setPriority($priority) { return $this->_setProperty($this["Priority"], $priority); } - + public function setArchitecture($arch) { return $this->_setProperty("Architecture", $arch); } - + public function setEssential($essential) { return $this->_setProperty("Essential", $essential); } - + public function setDepends($depends) { return $this->_setProperty("Depends", $this->_transformList($depends)); } - + public function setPreDepends($depends) { return $this->_setProperty("Pre-Depends", $this->_transformList($depends)); @@ -95,43 +95,43 @@ class StandardFile { return $this->_setProperty("Reccommends", $depends); } - + public function setSuggests($depends) { return $this->_setProperty("Suggests", $this->_transformList($depends)); } - + public function setInstalledSize($size) { return $this->_setProperty("Installed-Size", $size); } - + public function setMaintainer($maintainer, $email = false) { $email = ($email) ? $email : "---"; return $this->_setProperty("Maintainer", $maintainer . "[{$email}]"); } - + public function setConflicts($conflicts) { return $this->_setProperty("Conflicts", $this->_transformList($conflicts)); } - + public function setReplaces($replaces) { return $this->_setProperty("Conflicts", $this->_transformList($replaces)); } - + public function setProvides($provides) { return $this->_setProperty("Provides", $provides); } - + public function setDescription($description) { return $this->_setProperty("Description", $description); } - + private function _transformList($depends) { if (is_array($depends)) { @@ -139,16 +139,16 @@ class StandardFile } else { $depends = $depends; } - + return $depends; } - + private function _setProperty($key, $value) { $this[$key] = $value; return $this; } - + public function offsetExists ($offset) { return array_key_exists($offset, $this->_keys); } @@ -173,19 +173,21 @@ class StandardFile unset($this->_keys[$offset]); } } - + /** * Control file string representation. - * + * * @return string The control file */ public function __toString() { $control = ''; foreach ($this->_keys as $key => $value) { - $control .= "{$key}: {$value}" . PHP_EOL; + if($value){ + $control .= "{$key}: {$value}" . PHP_EOL; + } } - + return $control; } -} \ No newline at end of file +}