create() публичный Метод

Create a new file or overwrite existing one.
public create ( string $path, string $contents )
$path string
$contents string
Пример #1
0
 /**
  * Copy temporary process allocation data to persistent storage.
  *
  * @param string[] $with
  * @throws ReadException
  */
 private function updateStorage($with = [])
 {
     $data = [];
     foreach ($this->processes as $processAlias => $process) {
         $data[$processAlias] = $process;
     }
     $data = array_merge($data, $with);
     $this->fs->create($this->fsPath, json_encode($data));
 }
Пример #2
0
 /**
  *
  */
 public function testApiCreate_ThrowsException_WhenLegueWriteThrowsException()
 {
     $path = 'path';
     $contents = 'contents';
     $expected = new Exception();
     $ex = null;
     $this->expect('put', [$path, $contents])->willThrow($expected);
     try {
         $this->fs->create($path, $contents);
     } catch (Exception $ex) {
     }
     $this->assertInstanceOf(WriteException::class, $ex);
     $this->assertSame($expected, $ex->getPrevious());
 }
Пример #3
0
 /**
  * Copy temporary project data to persistent storage.
  *
  * @param string[] $with
  * @throws ReadException
  */
 private function updateStorage($with = [])
 {
     $data = array_merge($this->data, $with);
     $this->fs->create($this->fsPath, json_encode($data));
 }