Skip to content

This is the SMPL playground, a repository that contains the development efforts and proof of concept for the SMPL framework and suite of components.

License

Notifications You must be signed in to change notification settings

smplphp/playground

Repository files navigation

SMPL

SMPL - Playground

This is the SMPL playground, a repository that contains the development efforts and proof of concept for the SMPL framework and suite of components.

Static Badge GitHub Release GitHub codecov Mutation testing badge Psalm type coverage Psalm level

Components

Logic

The logic component provides a number of utilities for creating functional logic within an application, such as:

Comparators

Comparators are classes that take two values of a given type and compare them to determine their equality, as well as a sorting order. These classes perform an operation analogous to a mathematical sign function, returning a number less than 0 if the A is less than B, 0 if A is equal to B, and a number greater than 0 if A is greater than B. Comparators are of primary use in the sorting of values.

Tip

Comparators are binary operations with the signature <mixed, mixed, int>, so they can be passed where binary operations are accepted.

Consumers

Consumers are classes that take a value of a given type and "consume" it. What this essentially means is that it does something with it, and does not return a value.

Operations

Operations are class representations of encapsulated logic that is performed on a value of a given type, and returns a value of another type.

Binary Operations

Binary operations are an alternative operation that instead takes two arguments and returns a value.

Tip

Binary operations are not normal operations so can't be passed where operations are accepted.

Unary Operations

Unary operations are more specific operations that both takes an argument and returns a value of the same type.

Tip

Unary operations are also normal operations so can be passed where operations are accepted.

Predicates

Predicates are class representations of boolean-value functions, taking a single argument of a given type, and returning true or false dependent on its particular implementation. Predicates are of primary use in the filtering of values.

Tip

Predicates are operations with the signature <mixed, bool>, so they can be passed where operations are accepted.

Suppliers

Suppliers are the opposite of consumers, taking no arguments and returning a value of a given type.

Optional

The Optional class either contains a value or not, with the value sometimes being empty. This class gives you more control over a value, providing a few methods for retrieving a default value if none is present. You'd use an optional instance if you wanted to provide a fluid interface to the presence of a value.

Collections

The collections component provides collections.

Install

Install via composer.

$ composer create-project smplphp/playground

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

About

This is the SMPL playground, a repository that contains the development efforts and proof of concept for the SMPL framework and suite of components.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages