jwage.com

Personal website of Jonathan H. Wage. Lover of technology and tractors!

<?php

class Me
{
    /** @var bool */
    private $happy = false;

    public function happy()
    {
        $this->happy = true;
    }
}

class Tractor
{
    /** @var bool */
    private $tilling = false;

    public function till() : void
    {
        $this->tilling = true;
    }

    public function isTilling() : bool
    {
        return $this->tilling;
    }
}

$me = new Me();

$tractor = new Tractor();
$tractor->till();

if ($tractor->isTilling()) {
    $me->happy();
}