-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from asgrim/check-if-given-php-binary-is-valid
Check if a given PHP Binary is actually valid
- Loading branch information
Showing
4 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Php\Pie\Platform\TargetPhp\Exception; | ||
|
||
use RuntimeException; | ||
|
||
use function sprintf; | ||
|
||
class InvalidPhpBinaryPath extends RuntimeException | ||
{ | ||
public static function fromNonExistentPhpBinary(string $phpBinaryPath): self | ||
{ | ||
return new self(sprintf( | ||
'The php binary at "%s" does not exist', | ||
$phpBinaryPath, | ||
)); | ||
} | ||
|
||
public static function fromNonExecutablePhpBinary(string $phpBinaryPath): self | ||
{ | ||
return new self(sprintf( | ||
'The php binary at "%s" is not executable', | ||
$phpBinaryPath, | ||
)); | ||
} | ||
|
||
public static function fromInvalidPhpBinary(string $phpBinaryPath): self | ||
{ | ||
return new self(sprintf( | ||
'The php binary at "%s" does not appear to be a PHP binary', | ||
$phpBinaryPath, | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Hah! I am not really PHP."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters