| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace PhpZip\Mapper;
- /**
- * Adds a offset value to the given position.
- *
- * @author Ne-Lexa alexey@nelexa.ru
- * @license MIT
- */
- class OffsetPositionMapper extends PositionMapper
- {
- /**
- * @var int
- */
- private $offset;
- /**
- * @param int $offset
- */
- public function __construct($offset)
- {
- $this->offset = $offset;
- }
- /**
- * @param int $position
- * @return int
- */
- public function map($position)
- {
- return parent::map($position) + $this->offset;
- }
- /**
- * @param int $position
- * @return int
- */
- public function unmap($position)
- {
- return parent::unmap($position) - $this->offset;
- }
- }
|