Ejemplo n.º 1
0
 public function build(BuilderInterface $builder)
 {
     $builder->createVehicle();
     $builder->addDoors();
     $builder->addEngine();
     return $builder->getVehicle();
 }
 /**
  * {@inheritdoc}
  */
 protected function _setDataValues(array $data)
 {
     if (array_key_exists(SearchResults::KEY_SEARCH_CRITERIA, $data)) {
         $data[SearchResults::KEY_SEARCH_CRITERIA] = $this->searchCriteriaBuilder->populateWithArray($data[SearchResults::KEY_SEARCH_CRITERIA])->create();
     }
     if (array_key_exists(SearchResults::KEY_ITEMS, $data)) {
         $items = [];
         foreach ($data[SearchResults::KEY_ITEMS] as $itemArray) {
             $items[] = $this->itemObjectBuilder->populateWithArray($itemArray)->create();
         }
         $data[SearchResults::KEY_ITEMS] = $items;
     }
     return parent::_setDataValues($data);
 }
Ejemplo n.º 3
0
 /**
  * @return string
  */
 public function parse()
 {
     $html = '';
     if (count($this->items) > 0) {
         /** @var ItemInterface $firstChild */
         $firstChild = $this->getFirstChild();
         $html .= $this->builder->createListStartTag($firstChild);
         /** @var ItemInterface $item */
         foreach ($this->items as $item) {
             $html .= $item->parse();
         }
         $html .= $this->builder->createListEndTag($firstChild);
     }
     return $html;
 }
Ejemplo n.º 4
0
 public function build(BuilderInterface $obj)
 {
     $obj->addDoor();
     $obj->addWheel();
     $obj->addEngine();
     $obj->addSeat();
     return $obj;
 }
Ejemplo n.º 5
0
 /**
  * @return string
  */
 protected function parseChildren()
 {
     $html = '';
     if (count($this->getChildren()) > 0) {
         /** @var ItemInterface $firstChild */
         $firstChild = $this->getFirstChild();
         $html .= $this->builder->createListStartTag($firstChild);
         /** @var ItemInterface $child */
         foreach ($this->getChildren() as $child) {
             $html .= $child->parse();
         }
         $html .= $this->builder->createListEndTag($firstChild);
     }
     return $html;
 }
Ejemplo n.º 6
0
 /**
  * Add a builder.
  *
  * @param \TwigGenerator\Builder\BuilderInterface $builder  A builder.
  *
  * @return \TwigGenerator\Builder\BuilderInterface  The builder
  */
 public function addBuilder(BuilderInterface $builder)
 {
     $builder->setGenerator($this);
     $builder->addTwigExtensions($this->twigExtensions);
     $builder->addTwigFilters($this->twigFilters);
     $builder->setTemplateDirs($this->templateDirectories);
     $builder->setMustOverwriteIfExists($this->mustOverwriteIfExists);
     $builder->setVariables(array_merge($this->variables, $builder->getVariables()));
     $this->builders[$builder->getSimpleClassName()] = $builder;
     return $builder;
 }
Ejemplo n.º 7
0
 public function add(BuilderInterface $builder)
 {
     $this->builders[$builder->getName()] = $builder;
     return $this;
 }