Skip to content

Commit d0f2214

Browse files
committed
Merge branch 'develop' for v1.0.0-beta.3
2 parents ef914e3 + b42e188 commit d0f2214

16 files changed

+1665
-150
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Acme PHP project.
5+
*
6+
* (c) Titouan Galopin <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace AcmePhp\Cli\Exception;
13+
14+
/**
15+
* @author Titouan Galopin <[email protected]>
16+
*/
17+
class AcmeCliActionException extends AcmeCliException
18+
{
19+
public function __construct($actionName, \Exception $previous = null)
20+
{
21+
parent::__construct(sprintf('An exception was thrown during action "%s"', $actionName), $previous);
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Acme PHP project.
5+
*
6+
* (c) Titouan Galopin <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace AcmePhp\Cli\Exception;
13+
14+
/**
15+
* @author Titouan Galopin <[email protected]>
16+
*/
17+
class AcmeCliException extends \RuntimeException
18+
{
19+
public function __construct($message, \Exception $previous = null)
20+
{
21+
parent::__construct($message, 0, $previous);
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Acme PHP project.
5+
*
6+
* (c) Titouan Galopin <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace AcmePhp\Cli\Exception;
13+
14+
/**
15+
* @author Jérémy Derussé <[email protected]>
16+
*/
17+
class AcmeDnsResolutionException extends AcmeCliException
18+
{
19+
public function __construct($message, \Exception $previous = null)
20+
{
21+
parent::__construct(null === $message ? 'An exception was thrown during resolution of DNS' : $message, $previous);
22+
}
23+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Acme PHP project.
5+
*
6+
* (c) Titouan Galopin <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace AcmePhp\Cli\Exception;
13+
14+
/**
15+
* @author Jérémy Derussé <[email protected]>
16+
*/
17+
class CommandFlowException extends AcmeCliException
18+
{
19+
/**
20+
* @var string
21+
*/
22+
private $missing;
23+
/**
24+
* @var string
25+
*/
26+
private $command;
27+
/**
28+
* @var array
29+
*/
30+
private $arguments;
31+
32+
/**
33+
* @param string $missing Missing requirement to fix the flow
34+
* @param string $command Name of the command to run in order to fix the flow
35+
* @param array $arguments Optional list of missing arguments
36+
* @param \Exception|null $previous
37+
*/
38+
public function __construct($missing, $command, array $arguments = [], \Exception $previous = null)
39+
{
40+
$this->missing = $missing;
41+
$this->command = $command;
42+
$this->arguments = $arguments;
43+
44+
$message = trim(sprintf(
45+
'You have to %s first. Run the command%sphp %s %s %s',
46+
$missing,
47+
PHP_EOL.PHP_EOL,
48+
$_SERVER['PHP_SELF'],
49+
$command,
50+
implode(' ', $arguments)
51+
));
52+
53+
parent::__construct($message, $previous);
54+
}
55+
}

0 commit comments

Comments
 (0)