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