Db/IcingaObject: formatting & style

This commit is contained in:
Thomas Gelf 2016-10-05 18:05:59 +00:00
parent 70b8a9ea02
commit 749f035971
2 changed files with 18 additions and 4 deletions

View File

@ -752,6 +752,7 @@ abstract class DbObject
if ($e instanceof IE) { if ($e instanceof IE) {
throw $e; throw $e;
} }
throw new IE( throw new IE(
'Storing %s[%s] failed: %s {%s}', 'Storing %s[%s] failed: %s {%s}',
$this->table, $this->table,
@ -760,6 +761,7 @@ abstract class DbObject
var_export($this->getProperties(), 1) // TODO: Remove properties var_export($this->getProperties(), 1) // TODO: Remove properties
); );
} }
$this->modifiedProperties = array(); $this->modifiedProperties = array();
$this->hasBeenModified = false; $this->hasBeenModified = false;
$this->loadedProperties = $this->properties; $this->loadedProperties = $this->properties;

View File

@ -1399,13 +1399,19 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
protected function renderLegacyBooleanProperty($property, $legacyKey) protected function renderLegacyBooleanProperty($property, $legacyKey)
{ {
return c1::renderKeyValue($legacyKey, c1::renderBoolean($this->$property)); return c1::renderKeyValue(
$legacyKey,
c1::renderBoolean($this->$property)
);
} }
protected function renderProperties() protected function renderProperties()
{ {
$out = ''; $out = '';
$blacklist = array_merge($this->propertiesNotForRendering, $this->prioritizedProperties); $blacklist = array_merge(
$this->propertiesNotForRendering,
$this->prioritizedProperties
);
foreach ($this->properties as $key => $value) { foreach ($this->properties as $key => $value) {
if (in_array($key, $blacklist)) { if (in_array($key, $blacklist)) {
@ -1691,9 +1697,15 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
$type = strtolower($this->getType()); $type = strtolower($this->getType());
if ($this->isTemplate()) { if ($this->isTemplate()) {
$name = c1::renderKeyValue('name', c1::renderString($this->getObjectName())); $name = c1::renderKeyValue(
'name',
c1::renderString($this->getObjectName())
);
} else { } else {
$name = c1::renderKeyValue($type . '_name', c1::renderString($this->getObjectName())); $name = c1::renderKeyValue(
$type . '_name',
c1::renderString($this->getObjectName())
);
} }
$str = sprintf( $str = sprintf(