2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\View\Tests\SSViewerTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\ORM\ArrayList;
|
|
|
|
use SilverStripe\View\ViewableData;
|
|
|
|
|
|
|
|
class LevelTestData extends ViewableData implements TestOnly
|
|
|
|
{
|
2016-12-16 05:34:21 +01:00
|
|
|
protected $depth;
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function __construct($depth = 1)
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->depth = $depth;
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function output($val)
|
|
|
|
{
|
|
|
|
return "$this->depth-$val";
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function forLoop($number)
|
|
|
|
{
|
|
|
|
$ret = array();
|
|
|
|
for ($i = 0; $i < (int)$number; ++$i) {
|
|
|
|
$ret[] = new TestObject("!$i");
|
|
|
|
}
|
|
|
|
return new ArrayList($ret);
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function forWith($number)
|
|
|
|
{
|
|
|
|
return new self($number);
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|