Re: [PHP] Swiftlet is quite possibly the smallest MVC framework you'll ever use.

2012-02-12 Thread Simon Schick
Hi, Elbert I've looked through the code and found it quite tiny. I like that. Until now I found some things that I'd like to discuss with you: In the class App you're doing all the stuff (routing, calling the constructor aso) in the constructor. Would it not be better to have separate functions

[PHP] Variable number of arguments problem

2012-02-12 Thread Tim Streater
I have a function defined thus: function my_func (&$arg1, $arg2, $arg3, $arg4, $arg5, &$arg6) { // code here } I call this with variously the first three arguments only, or all six, taking care that if I call it with fewer arguments then I don't try to acces $arg4, $arg5, or $a

Re: [PHP] Variable number of arguments problem

2012-02-12 Thread Stuart Dallas
On 12 Feb 2012, at 18:51, Tim Streater wrote: > I have a function defined thus: > > function my_func (&$arg1, $arg2, $arg3, $arg4, $arg5, &$arg6) > { > > // code here > > } > > I call this with variously the first three arguments only, or all six, taking > care that if I call it w

Re: Re: [PHP] Variable number of arguments problem

2012-02-12 Thread Tim Streater
On 12 Feb 2012 at 19:01, Stuart Dallas wrote: > Optional arguments must be given a default value... > > function my_func(&$arg1, $arg2, $arg3, $arg4 = null, $arg5 = null, &$arg6 = > null) > > Note that passing a default value by reference was not supported prior to > PHP5. > > All the relevant d

Re: [PHP] Swiftlet is quite possibly the smallest MVC framework you'll ever use.

2012-02-12 Thread Elbert F
Hi Simon, I think you're right that I may be abusing the constructor a bit. I'm going to follow your suggestion and split it up into smaller functions. I'm also thinking of moving the set_error_handler and spl_autoload_register functions to index.php where Swiftlet is bootstrapped so they can be c

Re: [PHP] Swiftlet is quite possibly the smallest MVC framework you'll ever use.

2012-02-12 Thread Paul M Foster
On Mon, Feb 13, 2012 at 09:24:38AM +1100, Elbert F wrote: > Hi Simon, > > I think you're right that I may be abusing the constructor a bit. I'm going > to follow your suggestion and split it up into smaller functions. I'm also > thinking of moving the set_error_handler and spl_autoload_register >

Re: [PHP] questions about $_SERVER

2012-02-12 Thread Michael Save
On Mon, Feb 13, 2012 at 5:28 PM, Rui Hu wrote: > hi, > > How PHP sets variables in $_SERVER, say, $DOCUMENT_ROOT? What should I know > if I want to modify $_SERVER myself? > > Thanks! > > > -- > Best regards, > > Rui Hu >

[PHP] Re: Swiftlet is quite possibly the smallest MVC framework you'll ever use.

2012-02-12 Thread Elbert F
Hi Paul, Swiftlet implements PSR-0, an unofficial standard that many of the larger frameworks seem to be adopting. It simply maps namespaces to a path, e.g. Foo\Bar\Baz translates to Foo/Bar/Baz.php. The advantage is that you should be able to drop in third-party libraries which are included by th

Re: [PHP] Swiftlet is quite possibly the smallest MVC framework you'll ever use.

2012-02-12 Thread Benjamin Hawkes-Lewis
On Sun, Feb 12, 2012 at 11:36 PM, Paul M Foster wrote: > The more I've thought about it since then, the more I've considered it a > Good Thing(tm). It makes troubleshooting existing code a whole lot > easier. I don't have to wonder what the autoloader is doing or where the > files are, on which th