supportsNormalization() public method

Checks whether the given class is supported for normalization by this normalizer
public supportsNormalization ( mixed $data, string $format = null ) : boolean
$data mixed Data to normalize.
$format string The format being (de-)serialized from or into.
return boolean
コード例 #1
0
 public function testNormalizationWithType()
 {
     $dummy = $this->getDummy();
     $this->normalizer->addType('dummy', TypehintNormalizerClassDummy::class);
     $this->normalizer->addType('subdummy', TypehintNormalizerSubclassDummy::class);
     $expected = array('@type' => 'dummy', 'x' => array('@class' => RecursiveNormalizerSubclassDummy::class, 'a' => 'xa', 'b' => 'xb'), 'y' => array('@type' => 'subdummy', 'a' => 'ya', 'b' => 'yb'));
     $this->assertTrue($this->normalizer->supportsNormalization($dummy));
     $actual = $this->normalizer->normalize($dummy, null);
     $this->assertEquals($expected, $actual);
 }