Welcome Guest, Not a member yet? Register   Sign In
__get in libraries
#3

If you look at /core/Model.php, you'll see very similar code:

PHP Code:
public function __get($key)
{
    return 
get_instance()->$key;


Of course, whether this is a good idea for your library really depends on what you are doing in your library and how you expect it to be used. If you look through CI's libraries, you'll find that it, or something like it, is used in some libraries, but not others. In many cases, there are additional checks within the method to ensure different things occur based on what is being requested.
Reply


Messages In This Thread
__get in libraries - by kylevorster - 12-11-2014, 02:21 AM
RE: __get in libraries - by Rufnex - 12-11-2014, 09:28 AM
RE: __get in libraries - by mwhitney - 12-15-2014, 10:11 AM
RE: __get in libraries - by Narf - 12-16-2014, 12:22 PM
RE: __get in libraries - by Hobbes - 12-20-2014, 05:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB