コード例 #1
0
ファイル: Target.php プロジェクト: leoza/entities-bundle
 public function __construct(array $data)
 {
     if (!array_key_exists('name', $data)) {
         throw new \Exception('Name of target is not set');
     }
     $this->name = Standard::normalizeName($data['name']);
     if (!$this->name) {
         throw new \Exception('Empty target name');
     }
     if (!array_key_exists('namespace', $data)) {
         throw new \Exception('Namespace of target is not set');
     }
     $this->namespace = Standard::normalizeNamespace($data['namespace']);
     if (!$this->namespace) {
         throw new \Exception('Empty target namespace');
     }
     $this->withAnnotations = array_key_exists('withAnnotations', $data) && $data['withAnnotations'];
     $this->useClassNotations = array_key_exists('useClassNotations', $data) && $data['useClassNotations'];
     $this->withInitFunction = array_key_exists('withInitFunction', $data) && $data['withInitFunction'];
 }