4 {{ foo is empty ? 'ok' : 'ko' }}
5 {{ bar is empty ? 'ok' : 'ko' }}
6 {{ foobar is empty ? 'ok' : 'ko' }}
7 {{ array is empty ? 'ok' : 'ko' }}
8 {{ zero is empty ? 'ok' : 'ko' }}
9 {{ string is empty ? 'ok' : 'ko' }}
10 {{ countable_empty is empty ? 'ok' : 'ko' }}
11 {{ countable_not_empty is empty ? 'ok' : 'ko' }}
12 {{ markup_empty is empty ? 'ok' : 'ko' }}
13 {{ markup_not_empty is empty ? 'ok' : 'ko' }}
16 class CountableStub implements Countable
20 public function __construct(array $items)
22 $this->items = $items;
25 public function count()
27 return count($this->items);
31 'foo' => '', 'bar' => null, 'foobar' => false, 'array' => array(), 'zero' => 0, 'string' => '0',
32 'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)),
33 'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'),