Example #1
0
 private function processMethodAnnotations(\ReflectionMethod $method, ClassMetadata $classMetadata)
 {
     $class = $method->class;
     $methodAnnotations = $this->getMethodAnnotations($method);
     foreach ($methodAnnotations as $annotation) {
         switch (true) {
             case $annotation instanceof Annotation\PreSerialize:
                 $classMetadata->addPreSerializeMethod(new MethodMetadata($class, $method->name));
                 break;
             case $annotation instanceof Annotation\PostDeserialize:
                 $classMetadata->addPostDeserializeMethod(new MethodMetadata($class, $method->name));
                 break;
             case $annotation instanceof Annotation\PostSerialize:
                 $classMetadata->addPostSerializeMethod(new MethodMetadata($class, $method->name));
                 break;
             case $annotation instanceof Annotation\VirtualProperty:
                 $virtualPropertyMetadata = new VirtualPropertyMetadata($class, $method->name);
                 $this->loadExposedAttribute($virtualPropertyMetadata, $methodAnnotations, $classMetadata);
                 break;
         }
     }
 }