/** * @depends testWhetherConfigObjectsCanBeConvertedToArrays */ public function testWhetherItIsPossibleToMergeConfigObjects() { $config = new ConfigObject(array('a' => 'b')); $config->merge(array('a' => 'bb', 'c' => 'd', 'e' => array('f' => 'g'))); $this->assertEquals(array('a' => 'bb', 'c' => 'd', 'e' => array('f' => 'g')), $config->toArray(), 'ConfigObjects cannot be extended with arrays'); $config->merge(new ConfigObject(array('c' => array('d' => 'ee'), 'e' => array('h' => 'i')))); $this->assertEquals(array('a' => 'bb', 'c' => array('d' => 'ee'), 'e' => array('f' => 'g', 'h' => 'i')), $config->toArray(), 'ConfigObjects cannot be extended with other ConfigObjects'); }
/** * Create a @see Dashlet instance from the given Zend config, using the provided title * * @param $title The title for this dashlet * @param ConfigObject $config The configuration defining url, parameters, height, width, etc. * @param Pane $pane The pane this dashlet belongs to * * @return Dashlet A newly created Dashlet for use in the Dashboard */ public static function fromIni($title, ConfigObject $config, Pane $pane) { $height = null; $width = null; $url = $config->get('url'); $parameters = $config->toArray(); unset($parameters['url']); // otherwise there's an url = parameter in the Url $cmp = new Dashlet($title, Url::fromPath($url, $parameters), $pane); return $cmp; }
/** * Return this config's data as associative array * * @return array */ public function toArray() { return $this->config->toArray(); }
/** * Before-update trigger (per row) * * @param ConfigObject $old The original data as currently stored * @param ConfigObject $new The original data to update * * @return ConfigObject The eventually modified data to update */ protected function onUpdateAnnouncement(ConfigObject $old, ConfigObject $new) { if ($new->message !== $old->message) { $announcement = new Announcement($new->toArray()); $new->hash = $announcement->getHash(); } return $new; }