array * @method static callable|Collection|null toCollection( string ...$str ) Curried :: json->null | Collection */ class Json { use Macroable; /** * @return void */ public static function init() { self::macro( 'toArray', curryN( 1, function ( $str ) { return json_decode( $str, true ); } ) ); self::macro( 'toCollection', curryN( 1, function ( $str ) { return Maybe::of( $str ) ->map( 'stripslashes' ) ->map( self::toArray() ) ->map( 'wpml_collect' ) ->getOrElse( null ); } ) ); } } Json::init();