Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Jan 16, 2025
1 parent de4af90 commit a828a18
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions config/di-console.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Yiisoft\Definitions\DynamicReference;
use Yiisoft\Definitions\ReferencesArray;
use Yiisoft\Yii\Debug\Debugger;
use Yiisoft\Yii\Debug\StartupPolicy\Condition\CommandCondition;
use Yiisoft\Yii\Debug\StartupPolicy\Condition\CommandNameCondition;
use Yiisoft\Yii\Debug\StartupPolicy\Condition\EnvironmentVariableCondition;
use Yiisoft\Yii\Debug\StartupPolicy\StartupPolicy;

Expand All @@ -25,7 +25,7 @@
'startupPolicy' => DynamicReference::to(
static fn () => new StartupPolicy(
new EnvironmentVariableCondition('YII_DEBUG_IGNORE'),
new CommandCondition($params['yiisoft/yii-debug']['ignoredCommands'])
new CommandNameCondition($params['yiisoft/yii-debug']['ignoredCommands'])
),
),
'excludedClasses' => $params['yiisoft/yii-debug']['excludedClasses'],
Expand Down
4 changes: 2 additions & 2 deletions config/di-web.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Yiisoft\Yii\Debug\Debugger;
use Yiisoft\Yii\Debug\StartupPolicy\Condition\EnvironmentVariableCondition;
use Yiisoft\Yii\Debug\StartupPolicy\Condition\HeaderCondition;
use Yiisoft\Yii\Debug\StartupPolicy\Condition\RequestCondition;
use Yiisoft\Yii\Debug\StartupPolicy\Condition\UriPathsCondition;
use Yiisoft\Yii\Debug\StartupPolicy\StartupPolicy;

if (!(bool)($params['yiisoft/yii-debug']['enabled'] ?? false)) {
Expand All @@ -27,7 +27,7 @@
static fn () => new StartupPolicy(
new EnvironmentVariableCondition('YII_DEBUG_IGNORE'),
new HeaderCondition('X-Debug-Ignore'),
new RequestCondition($params['yiisoft/yii-debug']['ignoredRequests'])
new UriPathsCondition($params['yiisoft/yii-debug']['ignoredRequests'])
),
),
'excludedClasses' => $params['yiisoft/yii-debug']['excludedClasses'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use Yiisoft\Strings\WildcardPattern;
use Yiisoft\Yii\Console\Event\ApplicationStartup;

final class CommandCondition implements ConditionInterface
final class CommandNameCondition implements ConditionInterface
{
public function __construct(
/**
* @var string[]
* @psalm-var list<string>
*/
private readonly array $commands,
private readonly array $names,
) {
}

Expand All @@ -24,10 +24,10 @@ public function match(object $event): bool
return false;
}

$command = (string) $event->commandName;
$name = (string) $event->commandName;

foreach ($this->commands as $pattern) {
if ((new WildcardPattern($pattern))->match($command)) {
foreach ($this->names as $pattern) {
if ((new WildcardPattern($pattern))->match($name)) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use Yiisoft\Strings\WildcardPattern;
use Yiisoft\Yii\Http\Event\BeforeRequest;

final class RequestCondition implements ConditionInterface
final class UriPathsCondition implements ConditionInterface
{
public function __construct(
/**
* @var string[]
* @psalm-var list<string>
*/
private readonly array $uriPaths,
private readonly array $paths,
) {
}

Expand All @@ -26,7 +26,7 @@ public function match(object $event): bool

$path = $event->getRequest()->getUri()->getPath();

foreach ($this->uriPaths as $pattern) {
foreach ($this->paths as $pattern) {
if ((new WildcardPattern($pattern))->match($path)) {
return true;
}
Expand Down

0 comments on commit a828a18

Please sign in to comment.