No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ArticleFilter.php
ArticleGrouper.php
ArticleSorter.php
ItemList.php
ItemStrategyInterface.php
ItemStrategyPipe.php
README.md

README.md

pattern

          $sorter = new ArticleSorter();
             if ($request->get('sort') === 'desc') {
                 $sorter->sortDesc(); // sort desc if the user requested it 
             }
          $articleSortChain = new ItemStrategyPipe();
          $articleSortChain->add($sorter) // ad logic
              ->add(new ArticleFilter()) // add more logic
              ->add(new ArticleGrouper());  // add more logic
        
          $itemList = new ItemList($articles); // create a new list of articels (this can eg. be loaded from a db)
          $itemList = $articleSortChain->process($itemList); // process the pipe