private function createStylesheetConstraint($attibutes, $tag, $class)
 {
     $constraint = new StylesheetConstraint($attibutes);
     $constraint->setTag($tag);
     $constraint->addClass($class);
     return $constraint;
 }
Exemplo n.º 2
0
 /**
  * @return StylesheetConstraint
  */
 private function getConstraint(StylesheetConstraint $constraint, $tag, array $classes = array())
 {
     foreach ($constraint->getConstraints() as $child) {
         $childClasses = $child->getClasses();
         if ($child->getTag() == $tag && count(array_intersect($childClasses, $classes)) == count($childClasses)) {
             return $child;
         }
     }
     return false;
 }
 public static function merge(array $containers)
 {
     $resultContainer = parent::merge($containers);
     $resultMap = array();
     foreach ($containers as $container) {
         foreach ($container->resultMap as $tag => $bag) {
             if (!isset($resultMap[$tag])) {
                 $resultMap[$tag] = array();
             }
             $resultMap[$tag][] = $bag;
         }
     }
     foreach ($resultMap as $tag => $bags) {
         $resultMap[$tag] = BagContainer::merge($bags);
     }
     $resultContainer->resultMap = $resultMap;
     return $resultContainer;
 }
 private function assertStylesheetConstraintEquals(StylesheetConstraint $expected, StylesheetConstraint $actual)
 {
     $this->assertEquals($expected->getTag(), $actual->getTag());
     $this->assertEquals($expected->getWeight(), $actual->getWeight());
     $this->assertEquals($expected->getAll(), $actual->getAll());
     $this->assertEquals($expected->getClasses(), $actual->getClasses());
     $actualConstraintChildren = $actual->getConstraints();
     foreach ($expected->getConstraints() as $name => $constraint) {
         $this->assertStylesheetConstraintEquals($constraint, $actualConstraintChildren[$name]);
     }
 }
Exemplo n.º 5
0
 /**
  * Adds constraints with given tag
  * 
  * @param string Constraint tag
  * @param StylesheetConstraint Constraint to add
  */
 public function addConstraint($tag, StylesheetConstraint $constraint)
 {
     $tag = (string) $tag;
     $constraint->setTag($tag);
     $this->constraints[] = $constraint;
 }
Exemplo n.º 6
0
 private function updateStylesheetConstraintCacheIfNecessary(StylesheetConstraint $constraint = null)
 {
     if ($constraint && $this->useCacheForStylesheetConstraint && $constraint->isResultMapModified()) {
         $this->cache->save($constraint, $constraint->getCacheId());
     }
 }