本文整理汇总了PHP中FileReader::current方法的典型用法代码示例。如果您正苦于以下问题:PHP FileReader::current方法的具体用法?PHP FileReader::current怎么用?PHP FileReader::current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileReader
的用法示例。
在下文中一共展示了FileReader::current方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: parseGroup1050
/**
* Parses the coefficient properties of GROUP 1050
*
* @param FileReader $file
*/
protected function parseGroup1050(FileReader $file)
{
$coeffStart = [];
$coeffCount = [];
$coeffSets = [];
$nameLen = ceil($this->const->count() / 10);
$valueLen = ceil($this->const->count() / 3);
// Seek to GROUP 1050 line 1
$file->seek(22 + $nameLen + $valueLen);
foreach (explode(' ', $file->current()) as $i) {
if ($i != '') {
$coeffStart[] = (int) $i;
}
}
// Seek to GROUP 1050 line 2
$file->seek(23 + $nameLen + $valueLen);
foreach (explode(' ', $file->current()) as $i) {
if ($i != '') {
$coeffCount[] = (int) $i;
}
}
// Seek to GROUP 1050 line 3
$file->seek(24 + $nameLen + $valueLen);
foreach (explode(' ', $file->current()) as $i) {
if ($i != '') {
$coeffSets[] = (int) $i;
}
}
// Save coefficient values to properties
$this->coeffStart = $coeffStart;
$this->coeffCount = $coeffCount;
$this->coeffSets = $coeffSets;
}