/** * {@inheritDoc} */ public function checksum($key) { return Checksum::fromFile($this->computePath($key)); }
/** * {@inheritDoc} */ public function write($key, $content) { $this->files[$key]['content'] = $content; $this->files[$key]['mtime'] = time(); $this->files[$key]['checksum'] = Checksum::fromContent($content); }
public function testChecksumIsUpdatedOnWrite() { $adapter = new InMemory(array('foobar' => array('content' => 'Some content', 'checksum' => 'abcd'))); $adapter->write('foobar', 'Changed content'); $this->assertEquals(Checksum::fromContent('Changed content'), $adapter->checksum('foobar')); }
/** * Returns the checksum of the file * * @param string $key * * @return string */ public function checksum($key) { return Checksum::fromContent($this->read($key)); }