$dir]); } elseif ($base = @$this->realpath($dir)) { $out = "$base/$file"; if (file_exists($out)) { if (!is_readable($out) && !is_writable($out)) { throw new Exception("pidUnusable", ['pidfile' => $out]); } elseif (!is_readable($out)) { throw new Exception("pidunreadable", ['pidfile' => $out]); } elseif (!is_writable($out)) { throw new Exception("pidUnwritable", ['pidfile' => $out]); } elseif (!is_file($out)) { throw new Exception("pidNotFile", ['pidfile' => $out]); } } elseif (!is_writable($base)) { throw new Exception("pidUncreatable", ['pidfile' => $out]); } } else { throw new Exception("pidDirNotFound", ['piddir' => $dir]); } return $out; } protected function realpath(string $path) { return @realpath($path); } }