diff --git a/public_html/deployment/classes/config-replacement.class.php b/public_html/deployment/classes/config-replacement.class.php index 93fb09a85b937b4526583168ff42687cdf247b2c..600809472ae42a1b347a9ba65988e95ce38c1e38 100644 --- a/public_html/deployment/classes/config-replacement.class.php +++ b/public_html/deployment/classes/config-replacement.class.php @@ -10,12 +10,14 @@ require_once 'project.class.php'; * reads templatefiles and scans its placeholders for replacements * * @author hahn + * + * 2024-08-23 v1.1 Axel Hahn fix php parser problems */ class configreplacement { /** * project class - * @var type + * @var object */ protected $_oProject = false; protected $_sPhase = false; @@ -23,15 +25,13 @@ class configreplacement { /** - * init + * Constructor * @param string $sProject optional: project id; you can use setProject() too - * @return boolean */ - public function __construct($sProject = false) { + public function __construct($sProject = '') { if ($sProject){ $this->setProject($sProject); } - return true; } @@ -61,13 +61,13 @@ class configreplacement { /** * get an array with all template files (basename) and its replacement fields - * @return array + * @return bool|array */ public function getReplacements(){ if (!$this->_sPhase){ return false; } - $aFiles=$this->getTemplatefiles($this->_sPhase); + $aFiles=$this->getTemplatefiles(); if (!$aFiles){ return false; } @@ -96,8 +96,8 @@ class configreplacement { /** * get replacement definitions from foreman - * @global type $aConfig - * @return boolean + * @global array $aConfig + * @return bool|array */ protected function _getForemanReplacement(){ global $aConfig; @@ -259,9 +259,10 @@ class configreplacement { } /** - * get html code for links to edit each host of the current phase in foreman + * Get html code for links to edit each host of the current phase in foreman + * It returns false if foreman is not activated or there is no phase. * - * @return boolean + * @return bool|string */ public function getForemanlink2Host(){ $sForemanurl=$this->_getForemanBaseUrl(); @@ -288,9 +289,10 @@ class configreplacement { } /** - * get html code for a link to edit hostgroup in foreman + * Get html code for a link to edit hostgroup in foreman + * It returns false if foreman is not activated or there is no hostgroup in the project phase * - * @return boolean + * @return bool|string */ public function getForemanlink2Hostgroup(){ $iEffectiveHostgroup=$this->getForemanHostgroup(); @@ -315,7 +317,7 @@ class configreplacement { /** * get replacements in foreman - * @return type + * @return bool|array */ public function getForemanReplacements(){ return $this->_getForemanReplacement(); @@ -323,7 +325,8 @@ class configreplacement { /** * switch to a project - * @param type $sProject + * @param string $sProject project id + * @param string $sPhase optional: a phase; one of preview|stage|live */ public function setProject($sProject, $sPhase=false){ $this->_oProject = new project($sProject);