troubleshooting Question

What would this interface look like?

Avatar of Bruce Gust
Bruce GustFlag for United States of America asked on
PHP
4 Comments1 Solution61 ViewsLast Modified:
I've been asked to create a class that "implements this interface."

Not sure what that means or what that would look like.

What do you think?

<?php

namespace App\Data;

/**
 * An immutable collection of values with operators for manipulation or check.
 */
interface RangeFinderInterface extends \IteratorAggregate
{
    public function __construct(iterable $values = []);

    /**
     * Returns values that are between, and including, the passed values. [min, max]
     *
     * For the purpose of this code challenge, all non-numeric values should be dropped.
     *
     * @param int|float|string $min
     * @param int|float|string $max
     *
     * @return static
     */
    public function between($min, $max): self;

    public function after($min): self;

    public function before($max): self;

    /**
     * @param callable|null $by Accepts a single argument and returns a boolean `fn(mixed): bool`
     *
     * @return static
     */
    public function filter(?callable $by): self;

    /**
     * @param callable $by Accepts a single argument and returns a boolean `fn(mixed): bool`
     *
     * @return bool
     */
    public function some(callable $by): bool;

    /**
     * @param callable $by Accepts a single argument and returns a boolean `fn(mixed): bool`
     *
     * @return bool
     */
    public function every(callable $by): bool;

    /**
     * @return array
     */
    public function all(): array;
}
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros