コード例 #1
0
 /**
  * @param $text
  * @param bool $outfile
  * @param bool $raw
  *
  * @return array|int
  */
 public function encode($text, $outfile = false, $raw = false)
 {
     $code = new Code();
     if ($this->eightBit) {
         $code->encodeString8bit($text, $this->version, $this->level);
     } else {
         $code->encodeString($text, $this->version, $this->level, $this->hint, $this->caseSensitive);
     }
     Tools::markTime('after_encode');
     return $outfile !== false ? file_put_contents($outfile, join("\n", Tools::binarize($code->data))) : ($raw ? $code->data : Tools::binarize($code->data));
 }