Skip to content

Commit

Permalink
Merge branch 'develop' for v1.0.0-beta.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mbtamuli committed Jul 10, 2018
2 parents ef914e3 + b42e188 commit d0f2214
Show file tree
Hide file tree
Showing 16 changed files with 1,665 additions and 150 deletions.
23 changes: 23 additions & 0 deletions AcmePhp/Cli/Exception/AcmeCliActionException.php
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 <galopintitouan@gmail.com>
*
* 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 <galopintitouan@gmail.com>
*/
class AcmeCliActionException extends AcmeCliException
{
public function __construct($actionName, \Exception $previous = null)
{
parent::__construct(sprintf('An exception was thrown during action "%s"', $actionName), $previous);
}
}
23 changes: 23 additions & 0 deletions AcmePhp/Cli/Exception/AcmeCliException.php
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 <galopintitouan@gmail.com>
*
* 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 <galopintitouan@gmail.com>
*/
class AcmeCliException extends \RuntimeException
{
public function __construct($message, \Exception $previous = null)
{
parent::__construct($message, 0, $previous);
}
}
23 changes: 23 additions & 0 deletions AcmePhp/Cli/Exception/AcmeDnsResolutionException.php
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 <galopintitouan@gmail.com>
*
* 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é <jeremy@derusse.com>
*/
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);
}
}
55 changes: 55 additions & 0 deletions AcmePhp/Cli/Exception/CommandFlowException.php
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 <galopintitouan@gmail.com>
*
* 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é <jeremy@derusse.com>
*/
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);
}
}
Loading

0 comments on commit d0f2214

Please sign in to comment.