CodeIgniter Forums
Making Helpers more Helpful - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Making Helpers more Helpful (/showthread.php?tid=29447)



Making Helpers more Helpful - El Forum - 04-09-2010

[eluser]Unknown[/eluser]
Wouldn't it be better if Helpers were abstract classes with static methods, rather than php scripts with random floating methods?

Once you loaded a helper, like so:
Code:
$this->load->helper('my_helper')

It could then be accessed like so:
Code:
my_helper::function_name(args)

It would make code more readable, and further CI's commitment to OO PHP.

(Yes I know this wouldn't run on PHP4).


Making Helpers more Helpful - El Forum - 04-10-2010

[eluser]adamp1[/eluser]
I suppose then it turns into what CI defines as a library. One reason I would like this is so I can better Unit Test my code, as you may/may not know functions which have already been loaded are impossible to mock.