/**
  * {@inheritdoc}
  */
 public function prepare(array $source, VisitorCollection $visitorCollection)
 {
     // prepare condition collection
     if (!empty($source[self::NODE_CONDITIONS])) {
         try {
             $expr = $this->expressionAssembler->assemble($source[self::NODE_CONDITIONS]);
             if ($expr) {
                 $visitorCollection->append(new ConfigExpressionConditionVisitor($expr));
             }
         } catch (\Exception $e) {
             throw new SyntaxException('invalid conditions. ' . $e->getMessage(), $source[self::NODE_CONDITIONS], self::NODE_CONDITIONS);
         }
     }
 }
Пример #2
0
 public function testAppendShouldValidateParameter()
 {
     $this->setExpectedException('\\Oro\\Component\\Layout\\Exception\\UnexpectedTypeException', 'Expected argument of type "Oro\\Component\\Layout\\Loader\\Visitor\\VisitorInterface",' . ' "stdClass" given.');
     $collection = new VisitorCollection();
     $collection->append(new \stdClass());
 }