Codebase list reactphp-dns / 80247a9 src / Query / RecordBag.php
80247a9

Tree @80247a9 (Download .tar.gz)

RecordBag.php @80247a9raw · history · blame

<?php

namespace React\Dns\Query;

use React\Dns\Model\Record;

class RecordBag
{
    private $records = array();

    public function set($currentTime, Record $record)
    {
        $this->records[] = array($currentTime + $record->ttl, $record);
    }

    public function all()
    {
        return array_values(array_map(
            function ($value) {
                list($expiresAt, $record) = $value;
                return $record;
            },
            $this->records
        ));
    }
}