| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | namespace App\Blog\Archive; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use App\Blog\Tag\TagRepository; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Psr\Http\Message\ResponseInterface as Response; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Yiisoft\Data\Paginator\OffsetPaginator; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Yiisoft\Router\HydratorAttribute\RouteArgument; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Yiisoft\Yii\View\Renderer\ViewRenderer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  | final class ArchiveController | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |     private const POSTS_PER_PAGE = 3; | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |     private const POPULAR_TAGS_COUNT = 10; | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |     private ViewRenderer $viewRenderer; | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     public function __construct(ViewRenderer $viewRenderer) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 21 |  |  |         $this->viewRenderer = $viewRenderer->withControllerName('blog/archive'); | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     public function index(ArchiveRepository $archiveRepo): Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 26 |  |  |         return $this->viewRenderer->render('index', ['archive' => $archiveRepo->getFullArchive()]); | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     public function monthlyArchive( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         TagRepository $tagRepository, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         ArchiveRepository $archiveRepo, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         #[RouteArgument('page')] int $pageNum = 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         #[RouteArgument('year')] int $year = 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         #[RouteArgument('month')] int $month = 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     ): Response { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         $dataReader = $archiveRepo->getMonthlyArchive($year, $month); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         $paginator = (new OffsetPaginator($dataReader)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             ->withPageSize(self::POSTS_PER_PAGE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |             ->withCurrentPage($pageNum); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $data = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |             'year' => $year, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |             'month' => $month, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             'paginator' => $paginator, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             'archive' => $archiveRepo | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |                 ->getFullArchive() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |                 ->withLimit(12), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |             'tags' => $tagRepository->getTagMentions(self::POPULAR_TAGS_COUNT), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 51 |  |  |         return $this->viewRenderer->render('monthly-archive', $data); | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     public function yearlyArchive(ArchiveRepository $archiveRepo, #[RouteArgument('year')] int $year = 0): Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         $data = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             'year' => $year, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |             'items' => $archiveRepo->getYearlyArchive($year), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 61 |  |  |         return $this->viewRenderer->render('yearly-archive', $data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 63 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 64 |  |  |  | 
            
                        
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths