Skip to content

Commit

Permalink
Increase cyclomatic complexity limit
Browse files Browse the repository at this point in the history
getDirect() is necessarily complex
  • Loading branch information
mpetrovich committed Jun 9, 2021
1 parent d9e514f commit 3ddd8ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="6"/>
<property name="complexity" value="7"/>
<property name="absoluteComplexity" value="10"/>
</properties>
</rule>
Expand Down
6 changes: 2 additions & 4 deletions src/getDirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
function getDirect($input, $key, $default = null)
{
if (!is_string($key) && !is_numeric($key) && !is_null($key)) {
return $default;
}

if (is_null($input)) {
$value = $default;
} elseif (is_null($input)) {
$value = $default;
} elseif ($input instanceof \ArrayAccess && $input->offsetExists($key)) {
$value = $input[$key];
Expand Down

0 comments on commit 3ddd8ef

Please sign in to comment.