Skip navigation

Previous Post is here.

Made quite a few changes to the interface since the last time I posted. It was becoming far too complex for something that needed to be so simple. The end result has the removal of the independent parser class and segment classes.

The parsing is all handled though the single class along with the segments. However, complex types like the path and query string segments are set into there own classes to be referenced from there.

That is all I have to report right now, steadily working on simplifying the interfaces for this project as I write it up. Oh right another thing, I’m avoid a lot of the built in PHP functions like parse_url, parse_str, and http_build_query because I wouldn’t learn anything that way.

In the previous post the example given is now invalid. How it should be:

   1:  // __load.php contains the autoloading which is required!
   2:  // Without it this library will not function correctly.
   3:  require_once '/path/lfUri/library/__load.php';
   4:  
   5:  $url = 'http://example.com:8080/path/to/no/where.ext';
   6:  $url = new lfUriLocator( $url );
   7:  
   8:  var_dump( $url->getScheme() );
   9:  var_dump( $url->setScheme( 'ftp' )->getScheme() );
  10:  
  11:  // Only for the development stages will the parser object contain
  12:  // a means to construct a URL from parts. Debugging use only.
  13:  print $url; # $url->__toString();

The project source files can be found at Google Code
http://code.google.com/p/lfuri/
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: