Check 'present' methods in isset() implementation by BenConstable · Pull Request #25 · robclancy/presenter

Thanks very much for taking a look at this.

I understand that calling methods in isset() may provide unexpected overhead, but I can't really see that that would cause issues. Laravel's Eloquent models do just that internally in order to check the result of mutators. Also, as presenters are intended to be lightweight objects that interact with an already-loaded underlying model, there shouldn't be any heavy logic or database interactions in them (although I again understand your point about devs doing this - if they do do that though they're not really using the library correctly).

If you really don't want this behaviour however, then I don't think just using method_exists is a useful alternative, better just to forget this functionality. Otherwise it could be confusing and cause unexpected behaviour. For example (sorry it's a bit contrived):

<?php

class MyPresenter extends \Robbo\Presenter\Presenter {

    public function presentFullName()
    {
        if ($this->first_name && $this->last_name) {
            return $this->first_name . ' ' . $this->last_name;
        }

        return null;
    }
}

$p = new Presenter($object);

// This would be true, which would be confusing

if (isset($p->full_name)) {
    echo $p->full_name;
} else {
    echo $p->first_name;
}

Sorry about the incorrect base branch - couldn't find any contribution notes so just went for master by default! If you do want this functionality I'll remake the pull against develop.