Exemple #1
0
 public function __construct(Linha $linha, $nome, $format, $pos_start, $pos_end, $options)
 {
     if (!Picture::validarFormato($format)) {
         throw new \InvalidArgumentException("'{$format}' is not a valid format on {$nome}");
     }
     $this->options = $options;
     $this->nome = $nome;
     $this->cnabLinha = $linha;
     $this->format = $format;
     $this->pos_start = $pos_start;
     $this->pos_end = $pos_end;
     $this->length = $pos_end + 1 - $pos_start;
     $p_length = Picture::getLength($this->format);
     if ($p_length > $this->length) {
         throw new \Exception("Picture length of '{$this->nome}' need more positions than  {$pos_start} : {$pos_end}");
     } else {
         if ($p_length < $this->length) {
             throw new \Exception("Picture length of '{$this->nome}' need less positions than  {$pos_start} : {$pos_end}");
         }
     }
 }