ConfigurationAnnotation.php 574B

12345678910111213141516171819202122
  1. <?php
  2. namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
  3. /**
  4. * Base configuration annotation.
  5. *
  6. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  7. */
  8. abstract class ConfigurationAnnotation implements ConfigurationInterface
  9. {
  10. public function __construct(array $values)
  11. {
  12. foreach ($values as $k => $v) {
  13. if (!method_exists($this, $name = 'set'.$k)) {
  14. throw new \RuntimeException(sprintf('Unknown key "%s" for annotation "@%s".', $k, get_class($this)));
  15. }
  16. $this->$name($v);
  17. }
  18. }
  19. }