count = $this->count ? $this->count : 5; } public function run(): string { if ($this->filter == self::FILTER_POPULAR) { $posts = Post::find()->byType( $this->type )->popular()->limit($this->count)->all(); } else { $posts = Post::find()->byType( $this->type )->last()->limit($this->count)->all(); } return $this->render($this->view, [ 'posts' => $posts, 'view' => $this->view, 'url' => Url::canonical(), ]); } }