It would be cool if there was a "getter" for View::blocks array.
Something like
function getBlock($id, $default = '')
{
return isset($this->blocks[$id]) ? $this->blocks[$id] : $default;
}
so one can simply write
<?= $this->getBlock('top') ?>
or
<?= $this->getBlock('top', 'this block has not been set yet, take this defaults') ?>
and forget about it.
As for now, we have to check if corresponding index exists in array, otherwise a notice will be thrown.