[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [phoenix-dev] ProjectInfoAPI Documenation
|
Thanks Karl, I've updated the code on Phoenix.eclipse.org to this latest
version.
Nathan Gervais - nathan@xxxxxxxxxxx
Web Developer
The Eclipse Foundation
-----Original Message-----
From: phoenix-dev-bounces@xxxxxxxxxxx
[mailto:phoenix-dev-bounces@xxxxxxxxxxx] On Behalf Of Karl Matthias
Sent: Thursday, September 13, 2007 5:21 PM
To: karl.matthias@xxxxxxxxxxx; For developers on the new Eclipse.org website
project.
Subject: Re: [phoenix-dev] ProjectInfoAPI Documenation
I discovered a bit of a limitation in the class in that things which are
usually arrays like newsgroups or mailinglists return non-array data
when only one entry is present. That requires that your code check
every time it gets something back to see if it's an array or not. So
Bjorn came up with the idea of allowing you to request the key as a
plural word and always get back an array even if there is only 1
element. I implemented this in the attached file. So for example, say
the ECF project has only 1 mailing list. If I said:
$x = $projectinfo->mailinglist
if(count($x) > 1) {
...
}
I get a fatal error on count() unless I check is_array() every time
first. Then I have to have two paths everywhere in my code where I use
the data. Instead with the attached version (incorporating Nathan's
fix) I can say:
$x = $projectinfo->mailinglists <--------- note the 's'
if(count($x) > 1) {
...
}
And get no error. And I don't have to check is_array() every time I use
the data nor maintain multiple paths through my code.
Also, I implemented Countable on each of the two classes allowing you to
say count($projectinfo) to see how many keys you got back. Or
count($projectinfovalues) to see how many fields you have for a mainkey.
Cheers,
Karl
Karl Matthias wrote:
> +1 Looks great to me.
>
> Karl
>
> Bjorn Freeman-Benson wrote:
>
>> Nathan,
>> Thanks for the code review and fix.
>> +1
>>
>> - Bjorn
>>
>> Nathan Gervais wrote:
>>
>>> Can we get some more +1's to move this forward?
>>>
>>>
>>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> phoenix-dev mailing list
>> phoenix-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/phoenix-dev
>>
> _______________________________________________
> phoenix-dev mailing list
> phoenix-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/phoenix-dev
>