Send messages to multiple passed recipients or a default recipient
protected function sendMessages (array $recipients = []) {

    // if no recipients are passed get email from current object (default)
    if ( ! $recipients) {
        array_push($recipients, 'email' =&gt; $this-&gt;author-&gt;email);
    }

    foreach ($recipients as $recipient) {
        //some logic.
    }
}


Assuming you can change the default value, an empty array evaluates as false: https://3v4l.org/Onpcv (alternatively if you don’t like using it like that, do a check on the count, or empty etc)