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


PHP Reader::next方法代码示例

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


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

示例1: next

 function next()
 {
     if (($this->_entity = fgets($this->_file_handler)) == false) {
         throw new \Exception("Error: product failed on read");
     }
     if (($this->_entity = json_decode($this->_entity, true)) === null) {
         throw new \Exception("Error: unrecognized type");
     }
     parent::next();
 }
开发者ID:litmanovitziv,项目名称:struct-reader,代码行数:10,代码来源:JSONReader.php

示例2: testGetClarkNoNS

    function testGetClarkNoNS()
    {
        $input = <<<BLA
<?xml version="1.0"?>
<root />
BLA;
        $reader = new Reader();
        $reader->xml($input);
        $reader->next();
        $this->assertEquals('{}root', $reader->getClark());
    }
开发者ID:kalmas,项目名称:sabre-xml,代码行数:11,代码来源:ReaderTest.php

示例3: next

 function next()
 {
     if (($this->_entity = fgetcsv($this->_file_handler, 0, $this->_delimiter)) == false) {
         throw new \Exception("Error: product failed on read");
     }
     // Handling blamk row
     if (empty(implode($this->_entity))) {
         throw new \Exception("Error: Record is empty");
     }
     $this->_entity = array_combine($this->_header, $this->_entity);
     parent::next();
 }
开发者ID:litmanovitziv,项目名称:struct-reader,代码行数:12,代码来源:CSVReader.php

示例4: testParseInnerTree

    /**
     * @depends testMappedElement
     */
    function testParseInnerTree()
    {
        $input = <<<BLA
<?xml version="1.0"?>
<root xmlns="http://sabredav.org/ns">
  <elem1>
     <elem1 />
  </elem1>
</root>
BLA;
        $reader = new Reader();
        $reader->elementMap = ['{http://sabredav.org/ns}elem1' => function (Reader $reader) {
            $innerTree = $reader->parseInnerTree(['{http://sabredav.org/ns}elem1' => function (Reader $reader) {
                $reader->next();
                return "foobar";
            }]);
            return $innerTree;
        }];
        $reader->xml($input);
        $output = $reader->parse();
        $expected = ['name' => '{http://sabredav.org/ns}root', 'value' => [['name' => '{http://sabredav.org/ns}elem1', 'value' => [['name' => '{http://sabredav.org/ns}elem1', 'value' => 'foobar', 'attributes' => []]], 'attributes' => []]], 'attributes' => []];
        $this->assertEquals($expected, $output);
    }
开发者ID:russellgalpin,项目名称:sabre-xml,代码行数:26,代码来源:ReaderTest.php

示例5: read

 public function read()
 {
     static $seeked = 0;
     static $currently_reading = false;
     static $currently_skipping = false;
     static $arrayPartial = array();
     static $arraySkip = array();
     $ignore = false;
     while ($ret = parent::read()) {
         $id = $this->getAttributeNs("id", self::XMLNS_XML);
         $currentPartial = end($arrayPartial);
         $currentSkip = end($arraySkip);
         if (isset($this->partial[$id])) {
             if ($currentPartial == $id) {
                 v("%s done", $id, VERBOSE_PARTIAL_READING);
                 unset($this->partial[$id]);
                 --$seeked;
                 $currently_reading = false;
                 array_pop($arrayPartial);
             } else {
                 v("Starting %s...", $id, VERBOSE_PARTIAL_READING);
                 $currently_reading = $id;
                 ++$seeked;
                 $arrayPartial[] = $id;
             }
             return $ret;
         } elseif (isset($this->skip[$id])) {
             if ($currentSkip == $id) {
                 v("%s done", $id, VERBOSE_PARTIAL_READING);
                 unset($this->skip[$id]);
                 $currently_skipping = false;
                 $ignore = false;
                 array_pop($arraySkip);
             } else {
                 v("Skipping %s...", $id, VERBOSE_PARTIAL_READING);
                 $currently_skipping = $id;
                 $ignore = true;
                 $arraySkip[] = $id;
             }
         } elseif ($currently_skipping && $this->skip[$currently_skipping]) {
             if ($currentSkip == $id) {
                 v("Skipping child of %s, %s", $currently_reading, $id, VERBOSE_PARTIAL_CHILD_READING);
             } else {
                 v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING);
             }
             $ignore = true;
         } elseif ($currently_reading && $this->partial[$currently_reading]) {
             if ($currentPartial == $id) {
                 v("Rendering child of %s, %s", $currently_reading, $id, VERBOSE_PARTIAL_CHILD_READING);
             } else {
                 v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING);
             }
             return $ret;
         } elseif (empty($this->partial)) {
             return false;
         } else {
             // If we are used by the indexer then we have no clue about the
             // parents :)
             if ($id && $this->parents) {
                 // If this id isn't one of our ancestors we can jump
                 // completely over it
                 if (!in_array($id, $this->parents)) {
                     parent::next();
                 }
             }
             $ignore = true;
         }
     }
     return $ret;
 }
开发者ID:TazeTSchnitzel,项目名称:phd,代码行数:70,代码来源:Partial.php

示例6: initialize

 /**
  * Realiza la revision del archivo
  *
  * @param string $fileName
  */
 protected function initialize(Reader $reader)
 {
     $this->checkCsvFile($reader->getFilename());
     if (count($this->rules) === 0) {
         throw new Exception(' No se puede revistar el documento sin antes haber definido reglas @ ' . __LINE__);
     }
     $index = $reader->getHeaders();
     if (count($this->index) > 0) {
         $faltan = array_diff($this->index, $index);
         if (count($faltan)) {
             $this->addError('Se detectaron columnas faltantes en el archivo, se necesitan ' . implode(', ', $this->index) . ' y se encontraron ' . implode(', ', $index) . ' Faltando ' . implode(', ', $faltan) . '');
         }
     }
     $reader->rewind();
     while ($reader->valid()) {
         $this->applyRules($reader->current(), $reader->getLineNumber());
         $reader->next();
     }
 }
开发者ID:Eximagen,项目名称:sochi,代码行数:24,代码来源:Checker.php


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