public function testGetOrDefault() { $object = new \DateTime(); $this->assertSame('foobar', Archive::getOrDefault($object, 'field1', 'foobar')); Archive::set($object, 'field2', 'ups'); $this->assertSame('ups', Archive::getOrDefault($object, 'field2', 'foobar')); }
/** * Returns the root and path of the embedded document. * * @return array An array with the root and path (root and path keys) or null if they do not exist. * * @api */ public function getRootAndPath() { return Archive::getOrDefault($this, 'root_and_path', null); }
/** * Returns the query hashes. * * @return array The query hashes. */ public function getQueryHashes() { return Archive::getOrDefault($this, 'query_hashes', array()); }
/** * Returns the saved data. * * @return array|null The saved data or null if it does not exist. */ public function getSavedData() { return Archive::getOrDefault($this, 'saved_data', null); }
/** * Returns the remove queue of the group. * * @api */ public function getRemove() { return Archive::getOrDefault($this, 'remove', array()); }