Skip to content

Commit

Permalink
added Helpers::MAX_DEPTH
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 10, 2015
1 parent ed4b059 commit 35987bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/PhpGenerator/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class Helpers
{
const PHP_IDENT = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*';
const MAX_DEPTH = 50;


/**
Expand Down Expand Up @@ -67,7 +68,7 @@ private static function _dump(& $var, $level = 0)
if (empty($var)) {
$out = '';

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

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

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

} else {
Expand Down

0 comments on commit 35987bc

Please sign in to comment.