Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 686 Bytes

do_if.md

File metadata and controls

27 lines (18 loc) · 686 Bytes

do_if

Description

Returns a function that will call the given function if the result of applying the callable arguments to the predicates is true for all of them If the result of applying the callable arguments to the predicates is false for any of them, the given function will not be executed (returning null).

Parameters

fn
Function to call if all predicates are valid.
predicates
Predicates to be validated.

Examples

<?php

use function Lambdish\Phunctional\do_if;
use function Lambdish\Phunctional\apply;

apply(do_if($this->sendBirthdayGift(), [$this->isBirthday(), $this->isAdult()]), [$user]);