categories = $categories; } public function run(): string { return Html::tag('div', implode(PHP_EOL, array_map(function (PostCategory $category) { $active = $this->active && ($this->active->id == $category->id); return Html::a( Html::encode($category->name), ['/post/category', 'slug' => $category->slug], ['class' => $active ? 'list-group-item active' : 'list-group-item'] ); }, $this->categories->getAll())), [ 'class' => 'list-group', ]); } }