~thirdplace/feed-finder

5fc787d9f10423dd64a809f11d371f00ede68ea2 — Dag 5 months ago 5fbca0e
feat: add sorting to finders
4 files changed, 10 insertions(+), 0 deletions(-)

M src/FeedFinder.php
M src/Finder.php
M src/finders/Feeds.php
M src/finders/Html.php
M src/FeedFinder.php => src/FeedFinder.php +1 -0
@@ 90,6 90,7 @@ final class FeedFinder
                    $finders[] = new $className();
            }
        }
        usort($finders, fn($a, $b) => $a::INDEX <=> $b::INDEX);
        return $finders;
    }


M src/Finder.php => src/Finder.php +5 -0
@@ 5,6 5,11 @@ namespace Thirdplace;

abstract class Finder
{
    /**
     * This const is used for ordering (sorting)
     */
    public const INDEX = 50;

    public const NAME = 'Generic name';
    public const DESCRIPTION = 'Generic description';


M src/finders/Feeds.php => src/finders/Feeds.php +2 -0
@@ 5,6 5,8 @@ namespace Thirdplace;

final class Feeds extends Finder
{
    public const INDEX = 90;

    private array $feeds;

    public function __construct(array $feeds)

M src/finders/Html.php => src/finders/Html.php +2 -0
@@ 8,6 8,8 @@ namespace Thirdplace;
 */
final class Html extends Finder
{
    public const INDEX = 90;

    const NAME = 'RSS auto-discovery';
    const DESCRIPTION = 'This feed was found parsing the html.';