CodeIgniter's pattern is a singleton. The phpUri uses static calls. There is a great difference between them that I suggest you to familiarize with.
The point here is that phpUri
uses the static call parse
which is requested from the class, not the object itself and as CodeIgniter is a singleton, it's an object with sub-objects (said that for simplicity, read more about that). With that being said, the reason why this doesn't work is that phpUri
does not behave like an object and only produces(returns) objects after the static call:
$href = phpUri::parse($target_url)->join($href);
can be simplified to:
$parsed = phpUri::parse($target_url);
$href = $parsed->join($href);
the first line is the static call which returns an object to $parsed
variable and then you can play with that.
In singleton, you can't make a 'classes parent' by defining a class as an objects attribute. That's why to use this library, you should rewrite all the static calls first.
But it is much easier to write an abstraction layer library in CodeIgniter that uses static calls in it's object's non-static methods:
class MyPhpUri {
function parse($target_url) {
return phpUri::parse($target_url);
}
}
Then in your library
$CI =& get_instance();
$CI->load->library('MyPhpUri');
$href = $CI->myphpuri->parse($target_url)->join($var);
That is what an abstract class is - the one that gives you an interface.