Skip to content

Commit

Permalink
Filter non action classes in route:list output (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuench committed Dec 16, 2023
1 parent 297ca07 commit 1377cc5
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/N98/Magento/Command/Route/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace N98\Magento\Command\Route;

use Magento\Framework\App\ActionInterface;
use Magento\Framework\App\AreaList;
use Magento\Framework\App\Route\Config;
use Magento\Framework\Module\Dir\Reader;
Expand All @@ -15,22 +16,22 @@
class ListCommand extends AbstractMagentoCommand
{
/**
* @var \Magento\Framework\Module\Dir\Reader
* @var Reader
*/
private $reader;

/**
* @var \Magento\Framework\App\Route\Config
* @var Config
*/
private $config;

/**
* @var \Magento\Framework\App\AreaList
* @var AreaList
*/
private $areaList;

/**
* @var \Magento\Framework\App\Route\Config\Reader
* @var Config\Reader
*/
private $configReader;

Expand Down Expand Up @@ -65,10 +66,10 @@ protected function configure()
* @return void
*/
public function inject(
\Magento\Framework\Module\Dir\Reader $reader,
\Magento\Framework\App\Route\Config $config,
\Magento\Framework\App\AreaList $areaList,
\Magento\Framework\App\Route\Config\Reader $configReader
Reader $reader,
Config $config,
AreaList $areaList,
Config\Reader $configReader
) {
$this->reader = $reader;
$this->config = $config;
Expand All @@ -89,6 +90,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$actionPaths = $this->reader->getActionFiles();

foreach ($actionPaths as $fullActionPath) {
/**
* Filter abstract classes and non action classes
* @link https://github.com/netz98/n98-magerun2/issues/1304
*/
if (!is_a($fullActionPath, ActionInterface::class, true)) {
continue;
}

$area = 'frontend';

$actionPath = explode('\\', $fullActionPath);
Expand Down

0 comments on commit 1377cc5

Please sign in to comment.