Conditionable.php 708 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * League.Uri (https://uri.thephpleague.com)
  4. *
  5. * (c) Ignace Nyamagana Butera <nyamsprod@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. declare(strict_types=1);
  11. namespace League\Uri\Contracts;
  12. interface Conditionable
  13. {
  14. /**
  15. * Apply the callback if the given "condition" is (or resolves to) true.
  16. *
  17. * @param (callable(static): bool)|bool $condition
  18. * @param callable(static): (static|null) $onSuccess
  19. * @param ?callable(static): (static|null) $onFail
  20. */
  21. public function when(callable|bool $condition, callable $onSuccess, ?callable $onFail = null): static;
  22. }