PersonSecretWithVariables.php 567 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace JMS\Serializer\Tests\Fixtures;
  3. use JMS\Serializer\Annotation as Serializer;
  4. use JMS\Serializer\Context;
  5. use JMS\Serializer\Metadata\PropertyMetadata;
  6. /**
  7. */
  8. class PersonSecretWithVariables
  9. {
  10. /**
  11. * @Serializer\Type("string")
  12. */
  13. public $name;
  14. /**
  15. * @Serializer\Type("string")
  16. * @Serializer\Expose(if="context.getDirection()==2 || object.test(property_metadata, context)")
  17. */
  18. public $gender;
  19. public function test(PropertyMetadata $propertyMetadata, Context $context)
  20. {
  21. return true;
  22. }
  23. }