/** * Serializes \CC15\MQ\VO\Import to object * * @param Import $object * @param string $group * * @throws \InvalidArgumentException * * @return object */ public static function toObject($object, $group = NULL) { if ($object === null) { return null; } if (!isset(self::$groups[$group])) { throw new \InvalidArgumentException('Group \'' . $group . '\' not supported for ' . 'CC15\\MQ\\VO\\Import' . '.'); } else { $id = self::$groups[$group]; } if (!$object instanceof Import) { throw new \InvalidArgumentException('You have to pass object of class CC15\\MQ\\VO\\Import.'); } $output = array(); if (($id & 1) > 0) { $output['eshop'] = EshopMeta::toObject($object->eshop, $group); } if (($id & 2) > 0 && isset($object->eshop)) { $output['eshop'] = EshopMeta::toObject($object->eshop, $group); } if (($id & 1) > 0) { $output['feed'] = FeedMeta::toObject($object->feed, $group); } if (($id & 2) > 0 && isset($object->feed)) { $output['feed'] = FeedMeta::toObject($object->feed, $group); } if (($id & 1) > 0) { $output['tmpFileName'] = $object->tmpFileName; } if (($id & 2) > 0 && isset($object->tmpFileName)) { $output['tmpFileName'] = $object->tmpFileName; } return (object) $output; }
/** * Serializes \CC15\Entity\Eshop to object * * @param Eshop $object * @param string $group * * @throws \InvalidArgumentException * * @return object */ public static function toObject($object, $group = NULL) { if ($object === null) { return null; } if (!isset(self::$groups[$group])) { throw new \InvalidArgumentException('Group \'' . $group . '\' not supported for ' . 'CC15\\Entity\\Eshop' . '.'); } else { $id = self::$groups[$group]; } if (!$object instanceof Eshop) { throw new \InvalidArgumentException('You have to pass object of class CC15\\Entity\\Eshop.'); } $output = array(); if (($id & 1) > 0 && isset($object->id)) { $output['_id'] = $object->id; } if (($id & 2) > 0 && isset($object->id)) { $output['id'] = (string) $object->id; } if (($id & 1) > 0) { $output['name'] = $object->name; } if (($id & 2) > 0 && isset($object->name)) { $output['name'] = $object->name; } if (($id & 1) > 0) { $output['slug'] = $object->slug; } if (($id & 2) > 0 && isset($object->slug)) { $output['slug'] = $object->slug; } if (($id & 1) > 0) { $output['url'] = $object->url; } if (($id & 2) > 0 && isset($object->url)) { $output['url'] = $object->url; } if (($id & 1) > 0) { if (!(isset($output['feeds']) && is_array($output['feeds']))) { $output['feeds'] = array(); } foreach ((array) $object->feeds as $k0 => $v0) { $output['feeds'][$k0] = FeedMeta::toObject($v0, $group); } } if (($id & 2) > 0 && isset($object->feeds)) { if (!(isset($output['feeds']) && is_array($output['feeds']))) { $output['feeds'] = array(); } foreach ((array) $object->feeds as $k0 => $v0) { $output['feeds'][$k0] = FeedMeta::toObject($v0, $group); } } return (object) $output; }