nayleen/finder

Yet another class finder implementation.

1.0 2024-01-08 23:56 UTC

This package is auto-updated.

Last update: 2024-04-30 11:21:25 UTC


README

Yet another class finder implementation.

Installation

composer require nayleen/finder

Usage

The finder comes with two different sets of classes: Engines and Expectations.

Engines

Currently supported Engine implementations:

Engines provide iterators over class strings which can then be filtered using Expectations.

Expectations

Expectations filter the class strings according to certain criteria. They're chainable, composable and negatable. You can (and should) write your own Expectations depending on your requirements in class filtering.

Building blocks (located in Nayleen\Finder\Expectation sub-namespaces):

  • Combinator\Composed - chains two expectation (like boolean ANDs)
  • Combinator\Not - negates a wrapped expectation

Concrete implementations:

  • Any
  • CallableExpectation - wraps a callable with signature: callable(class-string): bool
  • ExtendsClass
  • HasAttribute
  • ImplementsInterface
  • IsInstantiable