Skip to content

Commit 35987bc

Browse files
committed
added Helpers::MAX_DEPTH
1 parent ed4b059 commit 35987bc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/PhpGenerator/Helpers.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
class Helpers
1919
{
2020
const PHP_IDENT = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*';
21+
const MAX_DEPTH = 50;
2122

2223

2324
/**
@@ -67,7 +68,7 @@ private static function _dump(& $var, $level = 0)
6768
if (empty($var)) {
6869
$out = '';
6970

70-
} elseif ($level > 50 || isset($var[$marker])) {
71+
} elseif ($level > self::MAX_DEPTH || isset($var[$marker])) {
7172
throw new Nette\InvalidArgumentException('Nesting level too deep or recursive dependency.');
7273

7374
} else {
@@ -97,7 +98,7 @@ private static function _dump(& $var, $level = 0)
9798
$class = get_class($var);
9899

99100
static $list = array();
100-
if ($level > 50 || in_array($var, $list, TRUE)) {
101+
if ($level > self::MAX_DEPTH || in_array($var, $list, TRUE)) {
101102
throw new Nette\InvalidArgumentException('Nesting level too deep or recursive dependency.');
102103

103104
} else {

0 commit comments

Comments
 (0)