public function addMethodMetadata(MethodMetadata $metadata) { if ($this->reflection->isFinal()) { throw new RuntimeException(sprintf('Class "%s" is declared final, and cannot be secured.', $reflection->name)); } if ($metadata->reflection->isStatic()) { throw new RuntimeException(sprintf('Method "%s::%s" is declared static and cannot be secured.', $metadata->reflection->class, $metadata->reflection->name)); } if ($metadata->reflection->isFinal()) { throw new RuntimeException(sprintf('Method "%s::%s" is declared final and cannot be secured.', $metadata->reflection->class, $metadata->reflection->name)); } parent::addMethodMetadata($metadata); }
/** * {@inheritdoc} */ public function loadMetadataForClass(\ReflectionClass $class) { $classMetadata = new MergeableClassMetadata($class->getName()); foreach ($class->getMethods() as $method) { $annotation = $this->reader->getMethodAnnotation($method, static::ANNOTATION_CLASS); if ($annotation instanceof LoggerAware) { $this->checkParameters($method, $annotation->getParameter()); $propertyMetadata = new MethodMetadata($class->getName(), $method->getName()); $propertyMetadata->setArgument($annotation->getParameter()); $classMetadata->addMethodMetadata($propertyMetadata); } } return $classMetadata; }
/** * @inheritdoc */ public function loadMetadataForClass(\ReflectionClass $class) { $classMetadata = new MergeableClassMetadata($class->getName()); foreach ($class->getMethods() as $method) { $annotations = $this->reader->getMethodAnnotations($method); foreach ($annotations as $annotation) { if ($annotation instanceof Transactional) { $propertyMetadata = new MethodMetadata($class->getName(), $method->getName()); $propertyMetadata->setEm($annotation->getEmName())->setOnError($annotation->getOnError())->setOnSuccess($annotation->getOnSuccess()); $classMetadata->addMethodMetadata($propertyMetadata); } } } return $classMetadata; }
/** * {@inheritdoc} */ public function loadMetadataForClass(\ReflectionClass $class) { $classMetadata = new MergeableClassMetadata($class->getName()); foreach ($class->getMethods() as $method) { $annotation = $this->reader->getMethodAnnotation($method, static::ANNOTATION_CLASS); if ($annotation instanceof SemLock) { $propertyMetadata = new MethodMetadata($class->getName(), $method->getName()); if (!$annotation->getKey()) { throw new \Exception('Lock key not specified'); } $propertyMetadata->setKey($annotation->getKey()); $propertyMetadata->setWaitTimeout($annotation->getWaitTimeout()); $classMetadata->addMethodMetadata($propertyMetadata); } } return $classMetadata; }