Exemplo n.º 1
0
 public function encode(Interchange $interchange)
 {
     $out = $this->annotationPrinter->prepareString($interchange);
     foreach ($interchange->getMessages() as $message) {
         $out .= $this->annotationPrinter->prepareString($message);
         $identifier = $message->getIdentifier();
         $this->segmentPrinter->setSegmentMappings($this->mappingLoader->loadSegments($identifier['version'], $identifier['release']));
         foreach ($message->getSegments() as $segment) {
             $out .= $this->segmentPrinter->prepareString($segment);
         }
         $out .= $this->annotationPrinter->prepareString($message->createTrailer());
     }
     $out .= $this->annotationPrinter->prepareString($interchange->createTrailer());
     return $out;
 }
Exemplo n.º 2
0
 /**
  * @test
  * @expectedException \EDI\Exception\AnnotationMissing
  */
 public function should_except_when_annotation_missing()
 {
     $printer = new AnnotationPrinter(new AnnotationReader());
     $printer->prepareString(new Incorrect());
 }