Pantheon\Terminus\Collections\Workflows::lastCreatedAt PHP Method

lastCreatedAt() public method

Get timestamp of most recently created Workflow
public lastCreatedAt ( ) : integer | null
return integer | null Timestamp
    public function lastCreatedAt()
    {
        $workflows = $this->all();
        usort($workflows, function ($a, $b) {
            $a_created_after_b = $a->get('created_at') >= $b->get('created_at');
            if ($a_created_after_b) {
                $cmp = -1;
            } else {
                $cmp = 1;
            }
            return $cmp;
        });
        if (count($workflows) > 0) {
            $timestamp = $workflows[0]->get('created_at');
        } else {
            $timestamp = null;
        }
        return $timestamp;
    }