本文整理汇总了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;
}