当前位置: 首页>>代码示例>>PHP>>正文


PHP QRtools::markTime方法代码示例

本文整理汇总了PHP中QRtools::markTime方法的典型用法代码示例。如果您正苦于以下问题:PHP QRtools::markTime方法的具体用法?PHP QRtools::markTime怎么用?PHP QRtools::markTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QRtools的用法示例。


在下文中一共展示了QRtools::markTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: encodeMask

 public function encodeMask(QRinput $input, $mask)
 {
     if ($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
         throw new Exception('wrong version');
     }
     if ($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
         throw new Exception('wrong level');
     }
     $raw = new QRrawcode($input);
     QRtools::markTime('after_raw');
     $version = $raw->version;
     $width = QRspec::getWidth($version);
     $frame = QRspec::newFrame($version);
     $filler = new FrameFiller($width, $frame);
     if (is_null($filler)) {
         return null;
     }
     // inteleaved data and ecc codes
     for ($i = 0; $i < $raw->dataLength + $raw->eccLength; $i++) {
         $code = $raw->getCode();
         $bit = 0x80;
         for ($j = 0; $j < 8; $j++) {
             $addr = $filler->next();
             $filler->setFrameAt($addr, 0x2 | ($bit & $code) != 0);
             $bit = $bit >> 1;
         }
     }
     QRtools::markTime('after_filler');
     unset($raw);
     // remainder bits
     $j = QRspec::getRemainder($version);
     for ($i = 0; $i < $j; $i++) {
         $addr = $filler->next();
         $filler->setFrameAt($addr, 0x2);
     }
     $frame = $filler->frame;
     unset($filler);
     // masking
     $maskObj = new QRmask();
     if ($mask < 0) {
         if (QR_FIND_BEST_MASK) {
             $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel());
         } else {
             $masked = $maskObj->makeMask($width, $frame, (int) QR_DEFAULT_MASK % 8, $input->getErrorCorrectionLevel());
         }
     } else {
         $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel());
     }
     if ($masked == null) {
         return null;
     }
     QRtools::markTime('after_mask');
     $this->version = $version;
     $this->width = $width;
     $this->data = $masked;
     return $this;
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:57,代码来源:QRcode.php

示例2: buildCache

 public static function buildCache()
 {
     QRtools::markTime('before_build_cache');
     $mask = new QRmask();
     for ($a = 1; $a <= QRSPEC_VERSION_MAX; $a++) {
         $frame = QRspec::newFrame($a);
         if (QR_IMAGE) {
             $fileName = QR_CACHE_DIR . 'frame_' . $a . '.png';
             QRimage::png(self::binarize($frame), $fileName, 1, 0);
         }
         $width = count($frame);
         $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
         for ($maskNo = 0; $maskNo < 8; $maskNo++) {
             $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
         }
     }
     QRtools::markTime('after_build_cache');
 }
开发者ID:norain2050,项目名称:xingkang,代码行数:18,代码来源:qrtools.php

示例3: encode

 public function encode($intext, $outfile = false)
 {
     $code = new QRcode();
     if ($this->eightbit) {
         $code->encodeString8bit($intext, $this->version, $this->level);
     } else {
         $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
     }
     QRtools::markTime('after_encode');
     if ($outfile !== false) {
         file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
     } else {
         return QRtools::binarize($code->data);
     }
 }
开发者ID:nilamdoc,项目名称:KYCGlobal,代码行数:15,代码来源:QRencode.php

示例4: timeBenchmark

        }
        $GLOBALS['qr_time_bench'][$markerId] = $time;
    }
    //----------------------------------------------------------------------
    public static function timeBenchmark()
    {
        self::markTime('finish');
        $lastTime = 0;
        $startTime = 0;
        $p = 0;
        echo '<table cellpadding="3" cellspacing="1">
                    <thead><tr style="border-bottom:1px solid silver"><td colspan="2" style="text-align:center">BENCHMARK</td></tr></thead>
                    <tbody>';
        foreach ($GLOBALS['qr_time_bench'] as $markerId => $thisTime) {
            if ($p > 0) {
                echo '<tr><th style="text-align:right">till ' . $markerId . ': </th><td>' . number_format($thisTime - $lastTime, 6) . 's</td></tr>';
            } else {
                $startTime = $thisTime;
            }
            $p++;
            $lastTime = $thisTime;
        }
        echo '</tbody><tfoot>
                <tr style="border-top:2px solid black"><th style="text-align:right">TOTAL: </th><td>' . number_format($lastTime - $startTime, 6) . 's</td></tr>
            </tfoot>
            </table>';
    }
}
//##########################################################################
QRtools::markTime('start');
开发者ID:ahmedash95,项目名称:Lily,代码行数:30,代码来源:qrtools.php


注:本文中的QRtools::markTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。