-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clarify exception types and move formatting logic out of Loader
- Loading branch information
1 parent
e7e1103
commit 70b0df2
Showing
7 changed files
with
78 additions
and
26 deletions.
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,14 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Cjm\Behat\Psr7Extension\AppFile; | ||
|
||
use Cjm\Behat\Psr7Extension\Psr7LoaderException; | ||
|
||
final class FileNotFound extends Psr7LoaderException | ||
{ | ||
public function __construct(string $path) | ||
{ | ||
parent::__construct('File not found at ' . $path); | ||
} | ||
} |
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,14 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Cjm\Behat\Psr7Extension\AppFile; | ||
|
||
use Cjm\Behat\Psr7Extension\Psr7LoaderException; | ||
|
||
final class InvalidFile extends Psr7LoaderException | ||
{ | ||
public function __construct(string $path) | ||
{ | ||
parent::__construct('File at ' . $path . ' did not return an application'); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,26 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Cjm\Behat\Psr7Extension\AppFile; | ||
|
||
use Cjm\Behat\Psr7Extension\Psr7LoaderException; | ||
|
||
final class UnknownType extends Psr7LoaderException | ||
{ | ||
public function __construct($type) | ||
{ | ||
parent::__construct('Do not know how to create an app from ' . $this->printableType($type)); | ||
} | ||
|
||
private function printableType($type) : string | ||
{ | ||
$str = gettype($type); | ||
|
||
if ($str == 'object') { | ||
$str = 'object:' . get_class($type); | ||
} | ||
|
||
return $str; | ||
} | ||
|
||
} |
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,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Cjm\Behat\Psr7Extension; | ||
|
||
abstract class Psr7LoaderException extends \InvalidArgumentException | ||
{ | ||
} |
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