Ejemplo n.º 1
0
 public function testOffsetPositionMovesPointerCorrectly()
 {
     $file = new File('/file');
     $file->setData('data');
     $handler = new FileHandler();
     $handler->setFile($file);
     $handler->offsetPosition(2);
     $this->assertEquals(2, $handler->position());
     $handler->offsetPosition(2);
     $this->assertEquals(4, $handler->position());
 }
Ejemplo n.º 2
0
 /**
  * Sets file pointer to specified position
  *
  * @param int $offset
  * @param int $whence
  *
  * @return bool
  */
 public function stream_seek($offset, $whence = SEEK_SET)
 {
     switch ($whence) {
         case SEEK_SET:
             $this->currently_opened->position($offset);
             break;
         case SEEK_CUR:
             $this->currently_opened->offsetPosition($offset);
             break;
         case SEEK_END:
             $this->currently_opened->seekToEnd();
             $this->currently_opened->offsetPosition($offset);
     }
     return true;
 }