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


PHP FileReader::next方法代码示例

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


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

示例1: testReader

 public function testReader()
 {
     $reader = new FileReader(__DIR__ . '/data/error.log');
     $reader->next();
     $this->assertTrue($reader->valid());
     $this->assertEquals('Stack trace:', $reader->consumeLine(10));
 }
开发者ID:bfrohs,项目名称:icanhaslog,代码行数:7,代码来源:FileReader.test.php

示例2: parseSpline

 public function parseSpline(FileReader $iter, $matrix)
 {
     $line = $iter->current();
     echo "New Spline: " . $iter->key() . "\n";
     $d = preg_split('/\\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
     $total = $d[13];
     echo "Parsing {$total} points\n";
     $count = 0;
     $points = array();
     $state = 1;
     // fetch points
     $iter->next();
     // advance to next line
     foreach ($iter as $line) {
         $d = preg_split('/\\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
         //echo implode(",",$d)."\n";
         switch ($state) {
             case 1:
                 $points[] = transformPoint($matrix, (object) array('x' => $d[0], 'y' => $d[1]));
                 ++$count;
                 if ($count == $total) {
                     $state = 2;
                     $count = 0;
                 }
                 break;
             case 2:
                 $count += count($d);
                 if ($count >= $total) {
                     break 2;
                 }
                 break;
         }
     }
     // finished spline
     echo "Ending Spline: " . $iter->key() . "\n";
     return $points;
 }
开发者ID:Anpu,项目名称:INQ-Calculators,代码行数:37,代码来源:zonemap.php

示例3: parseGroup1040and1041

 /**
  * Parses the constant values from GROUP 1040 and 1041
  *
  * @param FileReader $file
  */
 protected function parseGroup1040and1041(FileReader $file)
 {
     $coeffNames = [];
     $coeffValues = [];
     // Seek to start of GROUP 1040, and store the total number of constants
     $file->seek(14);
     $count = (int) trim($file->current());
     // Parse each constant header
     $i = 0;
     while ($i < $count) {
         $file->next();
         foreach ($file->splitCurrent(' ') as $coeff) {
             $coeffNames[] = $coeff;
             $i++;
         }
     }
     // Seek to the begining of GROUP 1041
     $file->seek(18 + ceil($count / 10));
     // Parse each constant value
     $i = 0;
     while ($i < $count) {
         $file->next();
         foreach ($file->splitCurrent(' ') as $value) {
             $coeffValues[] = static::evalNumber($value);
             $i++;
         }
     }
     // Create a new constant instance and store each of the coefficients
     $this->const = new Constant();
     for ($i = 0; $i < count($coeffNames); $i++) {
         $this->const->{$coeffNames[$i]} = $coeffValues[$i];
     }
 }
开发者ID:marando,项目名称:jplephem,代码行数:38,代码来源:Header.php


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