Changeset View
Changeset View
Standalone View
Standalone View
plugins/libkolab/lib/kolab_format_configuration.php
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | public function set(&$object) | ||||
} | } | ||||
$this->obj = new Configuration($driver); | $this->obj = new Configuration($driver); | ||||
break; | break; | ||||
case 'relation': | case 'relation': | ||||
$relation = new Relation(strval($object['name']), strval($object['category'])); | $relation = new Relation(strval($object['name']), strval($object['category'])); | ||||
if ($object['color']) { | if ($object['color'] ?? false) { | ||||
$relation->setColor($object['color']); | $relation->setColor($object['color']); | ||||
} | } | ||||
if ($object['parent']) { | if ($object['parent'] ?? false) { | ||||
$relation->setParent($object['parent']); | $relation->setParent($object['parent']); | ||||
} | } | ||||
if ($object['iconName']) { | if ($object['iconName'] ?? false) { | ||||
$relation->setIconName($object['iconName']); | $relation->setIconName($object['iconName']); | ||||
} | } | ||||
if ($object['priority'] > 0) { | if (($object['priority'] ?? 0) > 0) { | ||||
$relation->setPriority((int) $object['priority']); | $relation->setPriority((int) $object['priority']); | ||||
} | } | ||||
if (!empty($object['members'])) { | if (!empty($object['members'] ?? null)) { | ||||
$relation->setMembers(self::array2vector($object['members'])); | $relation->setMembers(self::array2vector($object['members'])); | ||||
} | } | ||||
$this->obj = new Configuration($relation); | $this->obj = new Configuration($relation); | ||||
break; | break; | ||||
case 'snippet': | case 'snippet': | ||||
$collection = new SnippetCollection($object['name']); | $collection = new SnippetCollection($object['name']); | ||||
$snippets = new vectorsnippets; | $snippets = new vectorsnippets; | ||||
foreach ((array) $object['snippets'] as $item) { | foreach ((array)($object['snippets'] ?? []) as $item) { | ||||
$snippet = new snippet($item['name'], $item['text']); | $snippet = new snippet($item['name'], $item['text']); | ||||
$snippet->setTextType(strtolower($item['type']) == 'html' ? Snippet::HTML : Snippet::Plain); | $snippet->setTextType(strtolower($item['type']) == 'html' ? Snippet::HTML : Snippet::Plain); | ||||
if ($item['shortcut']) { | if ($item['shortcut'] ?? false) { | ||||
$snippet->setShortCut($item['shortcut']); | $snippet->setShortCut($item['shortcut']); | ||||
} | } | ||||
$snippets->push($snippet); | $snippets->push($snippet); | ||||
} | } | ||||
$collection->setSnippets($snippets); | $collection->setSnippets($snippets); | ||||
▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines |