Overview

Namespaces

  • SellerLabs
    • Snagshout
      • Model
      • Normalizer
      • Resource
      • Utils

Classes

  • SellerLabs\Snagshout\Client
  • SellerLabs\Snagshout\Model\AmazonData
  • SellerLabs\Snagshout\Model\Attribute
  • SellerLabs\Snagshout\Model\BookmarkMetadata
  • SellerLabs\Snagshout\Model\Campaign
  • SellerLabs\Snagshout\Model\Category
  • SellerLabs\Snagshout\Model\Image
  • SellerLabs\Snagshout\Model\ImageMetadata
  • SellerLabs\Snagshout\Model\Links
  • SellerLabs\Snagshout\Model\Product
  • SellerLabs\Snagshout\Model\PromoCode
  • SellerLabs\Snagshout\Model\Promotion
  • SellerLabs\Snagshout\Model\Shipping
  • SellerLabs\Snagshout\Model\V1GetCampaignsResponse
  • SellerLabs\Snagshout\Model\V1GetCategoriesResponse
  • SellerLabs\Snagshout\Model\V1GetStatus
  • SellerLabs\Snagshout\Model\V1GetStatusResponse
  • SellerLabs\Snagshout\Normalizer\AmazonDataNormalizer
  • SellerLabs\Snagshout\Normalizer\AttributeNormalizer
  • SellerLabs\Snagshout\Normalizer\BookmarkMetadataNormalizer
  • SellerLabs\Snagshout\Normalizer\CampaignNormalizer
  • SellerLabs\Snagshout\Normalizer\CategoryNormalizer
  • SellerLabs\Snagshout\Normalizer\ImageMetadataNormalizer
  • SellerLabs\Snagshout\Normalizer\ImageNormalizer
  • SellerLabs\Snagshout\Normalizer\LinksNormalizer
  • SellerLabs\Snagshout\Normalizer\NormalizerFactory
  • SellerLabs\Snagshout\Normalizer\ProductNormalizer
  • SellerLabs\Snagshout\Normalizer\PromoCodeNormalizer
  • SellerLabs\Snagshout\Normalizer\PromotionNormalizer
  • SellerLabs\Snagshout\Normalizer\ShippingNormalizer
  • SellerLabs\Snagshout\Normalizer\V1GetCampaignsResponseNormalizer
  • SellerLabs\Snagshout\Normalizer\V1GetCategoriesResponseNormalizer
  • SellerLabs\Snagshout\Normalizer\V1GetStatusNormalizer
  • SellerLabs\Snagshout\Normalizer\V1GetStatusResponseNormalizer
  • SellerLabs\Snagshout\Resource\CampaignResource
  • SellerLabs\Snagshout\Resource\CategoryResource
  • SellerLabs\Snagshout\Resource\FrontResource
  • SellerLabs\Snagshout\SyndicationClient
  • SellerLabs\Snagshout\Utils\NormalizerFactory
  • SellerLabs\Snagshout\Utils\NullNormalizer
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace SellerLabs\Snagshout\Normalizer;
 4: 
 5: use Joli\Jane\Runtime\Reference;
 6: use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
 7: use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
 8: use Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer;
 9: class CategoryNormalizer extends SerializerAwareNormalizer implements DenormalizerInterface, NormalizerInterface
10: {
11:     public function supportsDenormalization($data, $type, $format = null)
12:     {
13:         if ($type !== 'SellerLabs\\Snagshout\\Model\\Category') {
14:             return false;
15:         }
16:         return true;
17:     }
18:     public function supportsNormalization($data, $format = null)
19:     {
20:         if ($data instanceof \SellerLabs\Snagshout\Model\Category) {
21:             return true;
22:         }
23:         return false;
24:     }
25:     public function denormalize($data, $class, $format = null, array $context = array())
26:     {
27:         $object = new \SellerLabs\Snagshout\Model\Category();
28:         if (property_exists($data, 'id')) {
29:             $object->setId($data->{'id'});
30:         }
31:         if (property_exists($data, 'name')) {
32:             $object->setName($data->{'name'});
33:         }
34:         if (property_exists($data, 'shortName')) {
35:             $object->setShortName($data->{'shortName'});
36:         }
37:         if (property_exists($data, 'imageUrl')) {
38:             $object->setImageUrl($data->{'imageUrl'});
39:         }
40:         if (property_exists($data, 'totalOffers')) {
41:             $object->setTotalOffers($data->{'totalOffers'});
42:         }
43:         return $object;
44:     }
45:     public function normalize($object, $format = null, array $context = array())
46:     {
47:         $data = new \stdClass();
48:         if (null !== $object->getId()) {
49:             $data->{'id'} = $object->getId();
50:         }
51:         if (null !== $object->getName()) {
52:             $data->{'name'} = $object->getName();
53:         }
54:         if (null !== $object->getShortName()) {
55:             $data->{'shortName'} = $object->getShortName();
56:         }
57:         if (null !== $object->getImageUrl()) {
58:             $data->{'imageUrl'} = $object->getImageUrl();
59:         }
60:         if (null !== $object->getTotalOffers()) {
61:             $data->{'totalOffers'} = $object->getTotalOffers();
62:         }
63:         return $data;
64:     }
65: }
API documentation generated by ApiGen