Returner helper class
add_filter('the_title', Returner::v("Test")); |
class Returner { | |
private static $returned = array(); | |
private $value; | |
public function __construct( $value ) { | |
$this->value = $value; | |
} | |
public function result( $arg ) { | |
return $this->value; | |
} | |
public static function v( $value ) { | |
if ( isset( Returner::$returned[$value] ) ) { | |
return Returner::$returned[$value]; | |
} | |
$sc = new Returner( $value ); | |
$returnCallable = array( $sc, 'result' ); | |
Returner::$returned[$value] = $returnCallable; | |
return $returnCallable; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment