Skip to content

Instantly share code, notes, and snippets.

View nullthoughts's full-sized avatar

Jani Gyllenberg nullthoughts

View GitHub Profile
@calebporzio
calebporzio / chain_helper.php
Last active July 23, 2023 04:27
Handy "chain()" helper method for making non-fluent classes/objects fluent.
<?php
function chain($object)
{
return new class ($object) {
protected $lastReturn = null;
public function __construct($object)
{
$this->wrapped = $object;