Created
April 18, 2011 18:48
-
-
Save johnwards/925912 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace WhiteOctober\FormBuilderBundle\Normalizer; | |
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; | |
/** | |
* This handles unknown objects gracefully | |
*/ | |
class noopNormalizer extends AbstractNormalizer | |
{ | |
private $className = ''; | |
/** | |
* {@inheritdoc} | |
*/ | |
public function normalize($object, $format, $properties = null) | |
{ | |
return array("Can not normalize ".$this->className); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function denormalize($data, $class, $format = null) | |
{ | |
return "Can not denormalize ".$this->className; | |
} | |
/** | |
* Returns true all the time...this is just a rapid object to handle this | |
* | |
* @param string $format The format being (de-)serialized from or into. | |
* @return Boolean Whether the class has any getters. | |
*/ | |
public function supports(\ReflectionClass $class, $format = null) | |
{ | |
$this->className = $class->getName(); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment