Пример #1
0
 /**
  * @test
  */
 public function unserializedBagIsCopyOfSerializedBag()
 {
     $container = new BagContainer();
     $container->add('someName1', 'someValue1');
     $container->add('someName2', array('someKey' => 'someValue'));
     $unserializedContainer = unserialize(serialize($container));
     $expectedAttributes = array('someName1' => 'someValue1', 'someName2' => array('someKey' => 'someValue'));
     $this->assertEquals($expectedAttributes, $unserializedContainer->getAll());
 }
 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;
 }
Пример #3
0
 private function setNodeStylesheet(Node $node, BagContainer $bagContainer)
 {
     $bagContainer->apply($node);
 }
Пример #4
0
 public function addConstraintsFromAttributes(BagContainer $constraint, \XMLReader $reader, array $ignoredAttributes = array(self::ATTRIBUTE_CLASS))
 {
     while ($reader->moveToNextAttribute()) {
         $attributes = $this->getAttributesFromXmlAttribute($reader);
         foreach ($attributes as $name => $value) {
             if (!in_array($name, $ignoredAttributes)) {
                 if ($complexAttributeName = $this->getComplexAttributeName($name)) {
                     $propertyName = substr($name, strlen($complexAttributeName) + 1);
                     $constraint->add($complexAttributeName, array('name' => $complexAttributeName, $propertyName => $value));
                 } else {
                     $constraint->add($name, $value);
                 }
             }
         }
     }
 }
Пример #5
0
 public static function merge(array $containers)
 {
     $internalConstraints = array();
     foreach ($containers as $constraint) {
         $internalConstraints = array_merge($internalConstraints, $constraint->constraints);
     }
     $constraint = parent::merge($containers);
     $constraint->constraints = $internalConstraints;
     return $constraint;
 }