mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
38 lines
735 B
PHP
38 lines
735 B
PHP
<?php
|
|
|
|
namespace SilverStripe\View\Tests\SSViewerTest;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
use SilverStripe\ORM\ArrayList;
|
|
use SilverStripe\View\ViewableData;
|
|
|
|
class LevelTestData extends ViewableData implements TestOnly
|
|
{
|
|
protected $depth;
|
|
|
|
public function __construct($depth = 1)
|
|
{
|
|
parent::__construct();
|
|
$this->depth = $depth;
|
|
}
|
|
|
|
public function output($val)
|
|
{
|
|
return "$this->depth-$val";
|
|
}
|
|
|
|
public function forLoop($number)
|
|
{
|
|
$ret = [];
|
|
for ($i = 0; $i < (int)$number; ++$i) {
|
|
$ret[] = new TestObject("!$i");
|
|
}
|
|
return new ArrayList($ret);
|
|
}
|
|
|
|
public function forWith($number)
|
|
{
|
|
return new self($number);
|
|
}
|
|
}
|