Skip to content

Instantly share code, notes, and snippets.

Avatar

Jani Gyllenberg nullthoughts

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