Skip to content

Commit c1a5c3b

Browse files
committed
refactor: Rename profiler configuration key for environment exclusion
1 parent 674b1df commit c1a5c3b

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

config/config.default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
),
3333
'profiler.options' => array(),
3434
'profiler.exclude-env' => array(),
35-
'profiler.is-exclude-all-env' => false,
35+
'profiler.exclude-all-env' => false,
3636
'profiler.simple_url' => function ($url) {
3737
return preg_replace('/=\d+/', '', $url);
3838
},

src/ProfilingData.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ final class ProfilingData
1414
/** @var callable|null */
1515
private $replaceUrl;
1616
/** @var bool */
17-
private $isExcludeAllEnv;
17+
private $excludeAllEnv;
1818

1919
public function __construct(Config $config)
2020
{
2121
$this->excludeEnv = isset($config['profiler.exclude-env']) ? (array)$config['profiler.exclude-env'] : array();
22-
$this->isExcludeAllEnv = isset($config['profiler.is-exclude-all-env']) ? $config['profiler.is-exclude-all-env'] : false;
22+
$this->excludeAllEnv = isset($config['profiler.exclude-all-env']) ? $config['profiler.exclude-all-env'] : false;
2323
$this->simpleUrl = isset($config['profiler.simple_url']) ? $config['profiler.simple_url'] : null;
2424
$this->replaceUrl = isset($config['profiler.replace_url']) ? $config['profiler.replace_url'] : null;
2525
}
@@ -82,7 +82,7 @@ public function getProfilingData(array $profile)
8282
*/
8383
private function getEnvironment(array $env)
8484
{
85-
if($this->isExcludeAllEnv) {
85+
if ($this->excludeAllEnv) {
8686
return array();
8787
}
8888

tests/ProfilingDataTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ public function testExcludeAllEnv()
1212
$_ENV['TEST_EXCLUDE_ENV'] = 'TEST';
1313

1414
$config = new Config([
15-
'profiler.is-exclude-all-env' => true,
15+
'profiler.exclude-all-env' => true,
1616
]);
1717
$profilingData = new ProfilingData($config);
1818

1919
$profile = ['example' => 'data'];
2020
$result = $profilingData->getProfilingData($profile);
2121

22-
2322
$this->assertEmpty($result['meta']['env']);
2423
}
2524

@@ -28,7 +27,7 @@ public function testNotExcludeAllEnv()
2827
$_ENV['TEST_EXCLUDE_ENV'] = 'TEST';
2928

3029
$config = new Config([
31-
'profiler.is-exclude-all-env' => false,
30+
'profiler.exclude-all-env' => false,
3231
]);
3332
$profilingData = new ProfilingData($config);
3433

@@ -37,6 +36,4 @@ public function testNotExcludeAllEnv()
3736

3837
$this->assertEquals('TEST', $result['meta']['env']['TEST_EXCLUDE_ENV']);
3938
}
40-
41-
4239
}

0 commit comments

Comments
 (0)