/**
  * Process the beginning of this element.
  *
  * @param  array      $attributes The attribute list of this element
  * @throws \Exception
  */
 public function begin(array $attributes)
 {
     try {
         $instance = $this->creationFactory->createObject($attributes);
         $logger = $this->digester->getLogger();
         $indentLogger = $this->digester->getIndentLogger();
         $match = $this->digester->getMatch();
         if (!empty($logger)) {
             $loggerdebug($indentLogger . "  [FactoryCreateRule]{" . $match . "} New " . get_class($instance));
         }
         $this->digester->push($instance);
     } catch (\Exception $exception) {
         throw $exception;
     }
 }
Beispiel #2
0
 /**
  * Add a "factory create" rule for the specified parameters.
  *
  * @param string                           $pattern         Element matching pattern
  * @param \Phigester\ObjectCreationFactory $creationFactory Previously
  *                                                          instantiated \Phigester\ObjectCreationFactory to be utilized
  */
 public function addFactoryCreate($pattern, \Phigester\ObjectCreationFactory $creationFactory)
 {
     $creationFactory->setDigester($this);
     $this->addRule($pattern, new \Phigester\FactoryCreateRule($creationFactory));
 }