示例#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;
 }
 /**
  * @test
  * @expectedException \EDI\Exception\AnnotationMissing
  */
 public function should_except_when_annotation_missing()
 {
     $printer = new AnnotationPrinter(new AnnotationReader());
     $printer->prepareString(new Incorrect());
 }