本文整理匯總了PHP中League\Fractal\Manager::setRecursionLimit方法的典型用法代碼示例。如果您正苦於以下問題:PHP Manager::setRecursionLimit方法的具體用法?PHP Manager::setRecursionLimit怎麽用?PHP Manager::setRecursionLimit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類League\Fractal\Manager
的用法示例。
在下文中一共展示了Manager::setRecursionLimit方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testRecursionLimiting
public function testRecursionLimiting()
{
$manager = new Manager();
// Should limit to 10 by default
$manager->parseIncludes('a.b.c.d.e.f.g.h.i.j.NEVER');
$this->assertEquals(array('a', 'a.b', 'a.b.c', 'a.b.c.d', 'a.b.c.d.e', 'a.b.c.d.e.f', 'a.b.c.d.e.f.g', 'a.b.c.d.e.f.g.h', 'a.b.c.d.e.f.g.h.i', 'a.b.c.d.e.f.g.h.i.j'), $manager->getRequestedIncludes());
// Try setting to 3 and see what happens
$manager->setRecursionLimit(3);
$manager->parseIncludes('a.b.c.NEVER');
$this->assertEquals(array('a', 'a.b', 'a.b.c'), $manager->getRequestedIncludes());
}
示例2: getFractalManager
/**
* Getter for FractalManager instance.
*
* @return Manager
*/
public function getFractalManager()
{
if (!$this->_fractalManager) {
$manager = new Manager();
$serializer = $this->config('serializer');
$manager->setSerializer(new $serializer($this->config('baseUrl') ?: Router::fullBaseUrl()));
$manager->parseIncludes((array) $this->request->query('include'));
$manager->setRecursionLimit($this->config('recursionLimit'));
$this->_fractalManager = $manager;
}
return $this->_fractalManager;
}
示例3: setRecursionLimit
/**
* set data transformation recursion limit
* @param $limit
* @return $this
*/
public function setRecursionLimit($limit)
{
$this->manager->setRecursionLimit($limit);
return $this;
}