blob: 8db6975c31979d68d61916933f35d1491ee7a942 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?php
namespace PHPIAC\Modules\Support;
use PHPIAC\Connection;
trait HandlesFiles
{
/**
* @param string $path
*
* @return bool
*/
public function fileExists(string $path): bool
{
Connection::enablePty();
Connection::exec("ls $path");
$ls = Connection::read();
$state = ! str_contains($ls, 'No such file or directory');
Connection::disablePty();
return $state;
}
}
|