title

text

EOT, c::to_string($static)); $static = [ [v::DIV, [ "before", "class" => "div", [v::SPAN, "spanned"], "disabled" => false, "checked" => true, "after", ]], ]; self::assertSame(<<beforespannedafter EOT, c::to_string($static)); } function testDynamic() { $dynamic = [ v::h1("title"), v::p("text"), ]; self::assertSame(<<title

text

EOT, c::to_string($dynamic)); $dynamic = [ v::div([ "before", "class" => "div", v::span("spanned"), "disabled" => false, "checked" => true, "after", ]), ]; self::assertSame(<<beforespannedafter EOT, c::to_string($dynamic)); } function testDynamic2() { $rows = [ ["a" => 1, "b" => 2, "c" => 3], ["a" => "un", "b" => "deux", "c" => "trois"], ["a" => "one", "b" => "two", "c" => "three"], ]; $dynamic = v::table([ v::thead(v::tr(function() use ($rows) { $headers = array_keys(cl::first($rows)); foreach ($headers as $header) { yield v::th($header); } })), v::tbody(function() use ($rows) { foreach ($rows as $row) { yield v::tr(function () use ($row) { foreach ($row as $col) { yield v::td($col); } }); } }), ]); self::assertSame(<< abc 123 undeuxtrois onetwothree EOT, c::to_string($dynamic)); } }