Пример #1
0
 /**
  * @param GadgetInterface $gadget
  * @throws \Exception
  */
 public function add(GadgetInterface $gadget)
 {
     if ($this->has($gadget->getName())) {
         throw new \Exception(sprintf('gadget with the name "%s" exists already', $gadget->getName()));
     }
     $this->gadgets[$gadget->getName()] = $gadget;
 }
Пример #2
0
 /**
  * @param GadgetInterface $gadget
  * @param string $title
  */
 public function __construct(GadgetInterface $gadget, $title)
 {
     $this->gadget = $gadget->getName();
     $this->title = $title;
     $this->level = self::LEVEL_NOTICE;
     $this->extraInformation = [];
 }
Пример #3
0
 /**
  * @param GadgetInterface $gadget
  * @param array $config
  * @return array
  */
 protected function resolve(GadgetInterface $gadget, array $config)
 {
     $builder = new TreeBuilder();
     $node = $builder->root($gadget->getName(), 'array', new NodeBuilder());
     $gadget->configure($node);
     $tree = $builder->buildTree();
     $config = $tree->normalize($config);
     return $tree->finalize($config);
 }