Webiny\Component\Storage\Storage::setContents PHP Method

setContents() public method

Writes the given contents into the file
public setContents ( string $key, string $contents, boolean $append = false ) : boolean | integer
$key string
$contents string
$append boolean
return boolean | integer The number of bytes that were written into the file
    public function setContents($key, $contents, $append = false)
    {
        return $this->driver->setContents($key, $contents, $append);
    }

Usage Example

Esempio n. 1
0
 /**
  * @dataProvider driverSet
  */
 public function testSave(Storage $storage)
 {
     $storage->setContents($this->key, 'Test contents');
     $this->assertSame('Test contents', $storage->getContents($this->key));
     $storage->setContents($this->key, 'Appended contents', true);
     $contents = $storage->getContents($this->key);
     $this->assertTrue(strpos($contents, 'Test contents') === 0);
     $this->assertTrue(strpos($contents, 'Appended contents') > 0);
 }
All Usage Examples Of Webiny\Component\Storage\Storage::setContents