/**
  * {@inheritdoc}
  */
 public function transform($object, ContextInterface $context = null)
 {
     if (!$this->supportsClass(get_class($object))) {
         throw UnsupportedClassException::create($object);
     }
     return $object->transformToModel($this->manager, $context);
 }
 /**
  * {@inheritdoc}
  */
 public function transform($object, ContextInterface $context)
 {
     if (!$object instanceof \Traversable) {
         throw UnsupportedClassException::create($object);
     }
     if (!$object instanceof \ArrayAccess) {
         throw new UnsupportedClassException(sprintf('The collection object for transform should implement \\ArrayAccess, %s given.', get_class($object)));
     }
     // Try crete a new collection
     try {
         $transformed = $this->createCollection($object);
     } catch (\Exception $e) {
         throw new UnsupportedClassException(sprintf('Could not create new collection instance with class "%s" (Use constructor).', get_class($object)), 0, $e);
     }
     foreach ($object as $key => $child) {
         $transformed[$key] = $this->manager->transform($child);
     }
     return $transformed;
 }