MiniAsset\Output\AssetWriter::setTimestamp PHP Method

setTimestamp() public method

Set the timestamp for a build file.
public setTimestamp ( AssetTarget $build, integer $time ) : void
$build MiniAsset\AssetTarget The name of the build to set a timestamp for.
$time integer The timestamp.
return void
    public function setTimestamp(AssetTarget $build, $time)
    {
        $ext = $build->ext();
        if (empty($this->timestamp[$ext])) {
            return;
        }
        $data = $this->_readTimestamp();
        $name = $this->buildCacheName($build);
        $data[$name] = $time;
        $this->_writeTimestamp($data);
    }

Usage Example

 public function testGetSetTimestamp()
 {
     $writer = new AssetWriter(['js' => true, 'css' => false], TMP);
     $time = time();
     $writer->setTimestamp($this->target, $time);
     $result = $writer->getTimestamp($this->target);
     $this->assertEquals($time, $result);
 }