Merge pull request #92 from AwardWallet/master

added configurable maximum recursion depth
This commit is contained in:
Justin Rainbow
2014-03-05 08:03:52 -07:00

View File

@ -29,6 +29,12 @@ class RefResolver
*/ */
protected static $depth = 0; protected static $depth = 0;
/**
* maximum references depth
* @var integer
*/
public static $maxDepth = 7;
/** /**
* @var UriRetrieverInterface * @var UriRetrieverInterface
*/ */
@ -89,7 +95,7 @@ class RefResolver
*/ */
public function resolve($schema, $sourceUri = null) public function resolve($schema, $sourceUri = null)
{ {
if (self::$depth > 7) { if (self::$depth > self::$maxDepth) {
return; return;
} }
++self::$depth; ++self::$depth;