exists() public method

Check whether a file or directory exist.
public exists ( string $path ) : boolean
$path string
return boolean
Exemplo n.º 1
0
 /**
  * Copy data from persistent storage to temporary one.
  *
  * @return mixed
  * @throws ReadException
  */
 private function selectFromStorage()
 {
     if (!$this->fs->exists($this->fsPath)) {
         return $this->getEmptyStorage();
     }
     $data = json_decode($this->fs->read($this->fsPath), true);
     if (!isset($data['pid']) || !$this->system->existsPid($data['pid'])) {
         return $this->getEmptyStorage();
     }
     return $data;
 }
Exemplo n.º 2
0
 /**
  * Copy data from persistent storage to temporary one.
  *
  * @return string[][]
  * @throws ReadException
  */
 private function selectFromStorage()
 {
     if (!$this->fs->exists($this->fsPath)) {
         return [];
     }
     $processes = [];
     $data = json_decode($this->fs->read($this->fsPath), true);
     foreach ($data as $alias => $record) {
         if ($this->system->existsPid($record['pid'])) {
             $processes[$alias] = ['pid' => $record['pid'], 'name' => $record['name'], 'verified' => false];
         }
     }
     return $processes;
 }
Exemplo n.º 3
0
 /**
  *
  */
 public function testApiExists_ThrowsException_WhenModelHasThrowsException()
 {
     $this->setExpectedException(ReadException::class);
     $this->expect('has', ['path'])->willThrow(new Exception());
     $this->fs->exists('path');
 }