Пример #1
0
 /**
  * @return array
  */
 protected function encode()
 {
     parent::init(4, 8);
     $i = 0;
     while ($i < $this->getDataLength()) {
         $this->setDataValue($this->getASCIIFromOneSegment($i));
         $this->setDataBits(8);
         $this->incrementDataCounter();
         $i++;
     }
 }
Пример #2
0
 /**
  * @return array
  */
 protected function encode()
 {
     parent::init(2, 9);
     $i = 0;
     while ($i < $this->getDataLength()) {
         if ($i % 2 == 0) {
             $this->setDataValue($this->getHashedCharacter($i));
             $this->setDataBits(6);
         } else {
             $this->setDataValue($this->getDataValue() * 45 + $this->getHashedCharacter($i));
             $this->setDataBits(11);
             $this->incrementDataCounter();
         }
         $i++;
     }
 }
Пример #3
0
 /**
  * @return array
  */
 protected function encode()
 {
     parent::init(1, 10);
     $i = 0;
     while ($i < $this->getDataLength()) {
         if ($i % 3 == 0) {
             $this->setDataValue($this->getOneSegmentFromText($i));
             $this->setDataBits(4);
         } else {
             $this->setDataValue($this->getDataValue() * 10 + $this->getOneSegmentFromText($i));
             if ($i % 3 == 1) {
                 $this->setDataBits(7);
             } else {
                 $this->setDataBits(10);
                 $this->incrementDataCounter();
             }
         }
         $i++;
     }
 }