public static function toSelectCallable($mixed=null)
    {
        // callable
        if(self::isClosure($mixed) || self::isInstanceCallable($mixed))
        {
            return $mixed;
        }
        // nothing, return full row
        elseif(is_null($mixed) || $mixed==="")
        {
            return function($v) { return $v; };
        }
        // row field from string
        elseif(is_int($mixed) || is_float($mixed) || is_string($mixed))
        {
            return function($v) use($mixed)
            {
                if(is_object($v))
                {
                    if(method_exists($v, $mixed))
                    {
                        return $v->$mixed();
                    }
                    else
                    {
                        return $v->$mixed;
                    }
                }
                else if(is_array($v) || ($v instanceof \ArrayAccess))
                {
                    return $v[$mixed];
                }
            };
        }

        throw new InvalidException("Could not convert expression of type ".gettype($mixed)." into a lambda callable");
    }
public static function toSelectCallable($mixed=null)
    {
        // callable
        if(self::isClosure($mixed) || self::isInstanceCallable($mixed))
        {
            return $mixed;
        }
        // nothing, return full row
        elseif(is_null($mixed) || $mixed==="")
        {
            return function($v) { return $v; };
        }
        // row field from string
        elseif(is_int($mixed) || is_float($mixed) || is_string($mixed))
        {
            return function($v) use($mixed)
            {
                if(is_object($v))
                {
                    if(method_exists($v, $mixed))
                    {
                        return $v->$mixed();
                    }
                    else
                    {
                        return $v->$mixed;
                    }
                }
                else if(is_array($v) || ($v instanceof \ArrayAccess))
                {
                    return $v[$mixed];
                }
            };
        }

        throw new InvalidException("Could not convert expression of type ".gettype($mixed)." into a lambda callable");
    }
public static function toSelectCallable ( $ mixed = null ) { // callable if ( self :: isClosure ( $ mixed ) || self :: isInstanceCallable ( $ mixed ) ) { return $ mixed ; } // nothing, return full row elseif ( is_null ( $ mixed ) || $ mixed === "" ) { return function ( $ v ) { return $ v ; } ; } // row field from string elseif ( is_int ( $ mixed ) || is_float ( $ mixed ) || is_string ( $ mixed ) ) { return function ( $ v ) use ( $ mixed ) { if ( is_object ( $ v ) ) { if ( method_exists ( $ v , $ mixed ) ) { return $ v -> $ mixed ( ) ; } else { return $ v -> $ mixed ; } } else if ( is_array ( $ v ) || ( $ v instanceof \ ArrayAccess ) ) { return $ v [ $ mixed ] ; } } ; } throw new InvalidException ( "Could not convert expression of type " . gettype ( $ mixed ) . " into a lambda callable" ) ; }
Converts strings, empty strings and NULL into a callable
@param string|callable|null $mixed
@return callable
@throws \PerrysLambda\Exception\InvalidException
Converts strings empty strings and NULL into a callable