-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtensionPathProblem.php
More file actions
39 lines (30 loc) · 1023 Bytes
/
ExtensionPathProblem.php
File metadata and controls
39 lines (30 loc) · 1023 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
namespace Php\Pie\Platform\TargetPhp\Exception;
use Php\Pie\Platform\TargetPhp\PhpBinaryPath;
use RuntimeException;
use function file_exists;
use function is_dir;
class ExtensionPathProblem extends RuntimeException
{
public static function new(PhpBinaryPath $php, string|null $extensionPath): self
{
$message = 'Could not determine extension path for ' . $php->phpBinaryPath;
if ($extensionPath === null) {
$message .= '; extension_dir => not set';
} else {
$message .= '; extension_dir => ' . $extensionPath;
if (file_exists($extensionPath)) {
$message .= '; exists';
if (is_dir($extensionPath)) {
$message .= ', is a directory';
} else {
$message .= ', not a directory';
}
} else {
$message .= '; does not exist';
}
}
return new self($message);
}
}