Lines Matching defs:path

28     function exists(Path $path): bool
30 return file_exists($path->toAbsolutePath()->toAbsoluteId());
34 * @param $path
38 public function getContent($path): string
44 $mime = FileSystems::getMime($path);
46 LogUtility::error("This mime content ($mime) is not text based (for the path $path). We can't return a text.");
50 LogUtility::error("The mime is unknown for the path ($path). Trying to returning the content as text.");
52 $content = @file_get_contents($path->toAbsolutePath()->toAbsoluteId());
55 throw new ExceptionNotFound("The file ($path) does not exists");
61 * @param LocalPath $path
65 public function getModifiedTime($path): DateTime
67 if (!self::exists($path)) {
68 throw new ExceptionNotFound("Local File System Modified Time: The file ($path) does not exist");
70 $timestamp = filemtime($path->toCanonicalAbsolutePath()->toAbsoluteId());
77 public function getCreationTime(Path $path)
79 if (!$this->exists($path)) {
80 throw new ExceptionNotFound("The path ($path) does not exists, no creation time");
82 $filePath = $path->toAbsolutePath()->toAbsoluteId();
90 public function delete(Path $path)
92 $absolutePath = $path->toAbsolutePath()->toAbsoluteId();
101 * @var LocalPath $path
103 public function getSize(Path $path)
105 return filesize($path->toAbsolutePath()->toAbsoluteId());
115 throw new ExceptionCompile("Unable to create the directory path ($dirPath)");
120 public function isDirectory(Path $path): bool
122 return is_dir($path->toAbsolutePath());
126 * @param LocalPath $path
130 public function getChildren(Path $path, string $type = null): array
137 $directoryHandle = @opendir($path->toAbsolutePath());
145 $childPath = $path->resolve($fileName);
181 * @param LocalPath $path
186 public function closest(Path $path, string $lastFullName): Path
188 if (FileSystems::isDirectory($path)) {
189 $closest = $path->resolve($lastFullName);
194 $parent = $path;
206 throw new ExceptionNotFound("No closest was found for the file name ($lastFullName) from the path ($path)");
210 * @param LocalPath $path
213 public function createRegularFile(Path $path)
215 touch($path->toAbsoluteId());
218 public function setContent(Path $path, string $content)
221 $file = $path->toAbsoluteId();
224 * expects the path to be with unix separator