-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
3,112 additions
and
303 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
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,23 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Acme PHP project. | ||
* | ||
* (c) Titouan Galopin <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace AcmePhp\Cli\Exception; | ||
|
||
/** | ||
* @author Titouan Galopin <[email protected]> | ||
*/ | ||
class AcmeCliActionException extends AcmeCliException | ||
{ | ||
public function __construct($actionName, \Exception $previous = null) | ||
{ | ||
parent::__construct(sprintf('An exception was thrown during action "%s"', $actionName), $previous); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Acme PHP project. | ||
* | ||
* (c) Titouan Galopin <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace AcmePhp\Cli\Exception; | ||
|
||
/** | ||
* @author Titouan Galopin <[email protected]> | ||
*/ | ||
class AcmeCliException extends \RuntimeException | ||
{ | ||
public function __construct($message, \Exception $previous = null) | ||
{ | ||
parent::__construct($message, 0, $previous); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Acme PHP project. | ||
* | ||
* (c) Titouan Galopin <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace AcmePhp\Cli\Exception; | ||
|
||
/** | ||
* @author Jérémy Derussé <[email protected]> | ||
*/ | ||
class AcmeDnsResolutionException extends AcmeCliException | ||
{ | ||
public function __construct($message, \Exception $previous = null) | ||
{ | ||
parent::__construct(null === $message ? 'An exception was thrown during resolution of DNS' : $message, $previous); | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Acme PHP project. | ||
* | ||
* (c) Titouan Galopin <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace AcmePhp\Cli\Exception; | ||
|
||
/** | ||
* @author Jérémy Derussé <[email protected]> | ||
*/ | ||
class CommandFlowException extends AcmeCliException | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $missing; | ||
/** | ||
* @var string | ||
*/ | ||
private $command; | ||
/** | ||
* @var array | ||
*/ | ||
private $arguments; | ||
|
||
/** | ||
* @param string $missing Missing requirement to fix the flow | ||
* @param string $command Name of the command to run in order to fix the flow | ||
* @param array $arguments Optional list of missing arguments | ||
* @param \Exception|null $previous | ||
*/ | ||
public function __construct($missing, $command, array $arguments = [], \Exception $previous = null) | ||
{ | ||
$this->missing = $missing; | ||
$this->command = $command; | ||
$this->arguments = $arguments; | ||
|
||
$message = trim(sprintf( | ||
'You have to %s first. Run the command%sphp %s %s %s', | ||
$missing, | ||
PHP_EOL.PHP_EOL, | ||
$_SERVER['PHP_SELF'], | ||
$command, | ||
implode(' ', $arguments) | ||
)); | ||
|
||
parent::__construct($message, $previous); | ||
} | ||
} |
Oops, something went wrong.