src/MVC/MVC.php
public static function share($callable)
    {
        if (!is_object($callable) || !method_exists($callable, '__invoke')) {
            throw new InvalidArgumentException('Callable is not a Closure or invokable object.');
        }
        
        return function ($c) use ($callable) {
            static $object;

            if (null === $object) {
                $object = $callable($c);
            }

            return $object;
        };
    }
public static function share($callable)
    {
        if (!is_object($callable) || !method_exists($callable, '__invoke')) {
            throw new InvalidArgumentException('Callable is not a Closure or invokable object.');
        }
        
        return function ($c) use ($callable) {
            static $object;

            if (null === $object) {
                $object = $callable($c);
            }

            return $object;
        };
    }
public static function share ( $ callable ) { if ( ! is_object ( $ callable ) || ! method_exists ( $ callable , '__invoke' ) ) { throw new InvalidArgumentException ( 'Callable is not a Closure or invokable object.' ) ; } return function ( $ c ) use ( $ callable ) { static $ object ; if ( null === $ object ) { $ object = $ callable ( $ c ) ; } return $ object ; } ; }
Share a clousure object or callback object

@access public
@param $callable
@return callable
@throws InvalidArgumentException
Share a clousure object or callback object