[Xapian-discuss] Another PHP 5 wrapper...

Daniel Ménard Daniel.Menard at Bdsp.tm.fr
Thu Apr 6 16:00:52 BST 2006


Paul Dixon a écrit :

>However, there's no reason why Daniel could not incorporate my base
>class into his classes to get the best of both worlds, with
>pre-defined and documented methods, but falling back to __call when a
>method is not found. It would just need a few tweaks to support method
>names using lowerCamelCase.
>  
>
Paul, this is another brilliant idea, but if swig is able in a near 
future to generate the php wrapper directly, I'm not sure it's worth 
spending time on improving the wrapper.
I also guess that it will be hard to include phpdoc in the generated 
wrapper, so my point about having documentation goes away, no ?

>class XapianWritableDatabase extends XapianBase {
>
>  function addDoc(XapianDocument $doc) {
>
>	//turn object pointers into resources
>	$args=func_get_args();
>	array_walk_recursive($args, array($this, 'coerce_param'));
>			
>	//call real function		
>	$rvalue=call_user_func_array('writabledatabase_adddoc', $args);
>	
>	return $this->wrap_resource($rvalue);
>  }
>
>}
>  
>
It should work very well. Ideally, such construct would be generated 
only if arguments or return type is an object.

>>But what's the issue with PHP 5.0 here?  I'm assuming there's something
>>useful which was added in 5.1,
>>    
>>
>
>Daniel can answer that, I don't *think* I used anything 5.1 specific.
>v5.1 did include a lot of bug fixes and some enhancements to the
>Standard PHP Library (SPL) which Daniel might have used?
>  
>
Only because I used the Countable interface, which is not very important.

Best regards,

-- 

Daniel Ménard

Banque de Données Santé Publique
Avenue du Professeur Léon Bernard
35043 Rennes Cédex

Tél. (+33) 2.99.02.29.42
Fax (+33) 2.99.02.26.28
E-mail Daniel.Menard at Bdsp.tm.fr
http://www.bdsp.tm.fr




More information about the Xapian-discuss mailing list