Skip to content

Commit 875a34b

Browse files
committed
Align with changes in plaisio/console.
1 parent 783b53b commit 875a34b

File tree

4 files changed

+7
-40
lines changed

4 files changed

+7
-40
lines changed

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"ext-dom": "*",
1212
"ext-libxml": "*",
1313
"composer/composer": "^1.0",
14-
"plaisio/console": "^0.2.15",
14+
"plaisio/console": "^1.0",
1515
"plaisio/exception": "^1.1",
1616
"plaisio/exception-handler": "^1.1",
1717
"plaisio/kernel": "^1.1",
@@ -23,8 +23,7 @@
2323
},
2424
"require-dev": {
2525
"phing/phing": "^2.0",
26-
"phpunit/phpunit": "^9.0",
27-
"plaisio/console": "^0.2.3"
26+
"phpunit/phpunit": "^9.0"
2827
},
2928
"autoload": {
3029
"psr-4": {

src/Command/GenerateExceptionHandlerCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
3838
$handlers = $metadataExtractor->extractExceptionAgents();
3939

4040
$xmlHelper = new PlaisioXmlHelper();
41-
[$class, $path] = $xmlHelper->extractExceptionHandlerClass();
41+
[$class, $path] = $xmlHelper->queryExceptionHandlerClass();
4242

4343
$generator = new ExceptionHandlerCodeGenerator();
4444
$code = $generator->generateCode($class, $handlers);

src/Helper/PlaisioXmlHelper.php

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,13 @@
33

44
namespace Plaisio\ExceptionHandler\Helper;
55

6-
use Plaisio\Console\Helper\PlaisioXmlHelper as ConsolePlaisioXmlHelper;
7-
use SetBased\Exception\RuntimeException;
6+
use Plaisio\Console\Helper\PlaisioXmlHelper as BasePlaisioXmlHelper;
87

98
/**
109
* Helper class for retrieving information about plaisio.xml files.
1110
*/
12-
class PlaisioXmlHelper
11+
class PlaisioXmlHelper extends BasePlaisioXmlHelper
1312
{
14-
//--------------------------------------------------------------------------------------------------------------------
15-
/**
16-
* The path to the plaisio.xml file.
17-
*
18-
* @var string
19-
*/
20-
private $path;
21-
22-
/**
23-
* The XML of the plaisio.xml.
24-
*
25-
* @var \DOMDocument
26-
*/
27-
private $xml;
28-
29-
//--------------------------------------------------------------------------------------------------------------------
30-
/**
31-
* PlaisioXmlHelper constructor.
32-
*/
33-
public function __construct()
34-
{
35-
$this->path = ConsolePlaisioXmlHelper::plaisioXmlPath();
36-
37-
$this->xml = new \DOMDocument();
38-
$success = $this->xml->load($this->path, LIBXML_NOWARNING);
39-
if (!$success)
40-
{
41-
throw new RuntimeException('Unable to parse XML file "%s".', $this->path);
42-
}
43-
}
44-
4513
//--------------------------------------------------------------------------------------------------------------------
4614
/**
4715
* Returns the exception agents found in the plaisio.xml file.
@@ -68,7 +36,7 @@ public function extractExceptionAgents(): array
6836
*
6937
* @return string[]
7038
*/
71-
public function extractExceptionHandlerClass(): array
39+
public function queryExceptionHandlerClass(): array
7240
{
7341
$xpath = new \DOMXpath($this->xml);
7442

test/Command/GenerateExceptionHandlerCoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class GenerateExceptionHandlerCoreTest extends TestCase
1515
//--------------------------------------------------------------------------------------------------------------------
1616
public function testExecute(): void
1717
{
18-
$_ENV['PLAISIO_CONFIG'] = __DIR__.'/plaisio.xml';
18+
putenv(sprintf('%s=%s', 'PLAISIO_CONFIG', __DIR__.'/plaisio.xml'));
1919

2020
$application = new PlaisioApplication();
2121
$application->setAutoExit(false);

0 commit comments

Comments
 (0)