public function __construct(Torrent $torrent, $dir) { $this->torrent = $torrent; $this->dir = $dir; $this->pieceSize = $torrent->getPieceSize(); $this->pieceCount = $torrent->getPieceCount(); $this->maxPieces = self::calculateMaxPieces($this->pieceSize); $this->openFiles = array(); $this->pieces = array(); $this->dirty = array(); $this->pieceSequences = array_fill(0, $this->pieceCount, 0); }