Skip to content

Commit

Permalink
[mms] Added Horde_Mail_Rfc822_List#first() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Nov 2, 2014
1 parent 0db6c2e commit 93cc4f1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
6 changes: 6 additions & 0 deletions framework/Mail/doc/Horde/Mail/UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Upgrading to 2.5

Added the 'eai' property.

- Horde_Mail_Rfc822_List

- first()

This method has been added.

- Horde_Mail_Mbox_Parse

Added object to parse mbox format mailbox data.
Expand Down
19 changes: 18 additions & 1 deletion framework/Mail/lib/Horde/Mail/Rfc822/List.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
* @property-read array $raw_addresses The list of all addresses (Address
* objects).
*/
class Horde_Mail_Rfc822_List extends Horde_Mail_Rfc822_Object implements ArrayAccess, Countable, SeekableIterator, Serializable
class Horde_Mail_Rfc822_List
extends Horde_Mail_Rfc822_Object
implements ArrayAccess, Countable, SeekableIterator, Serializable
{
/** Filter masks. */
const HIDE_GROUPS = 1;
Expand Down Expand Up @@ -275,6 +277,21 @@ public function contains($address)
return false;
}

/**
* Convenience method to return the first element in a list.
*
* Useful since it allows chaining; older PHP versions did not allow array
* access dereferencing from the results of a function call.
*
* @since 2.5.0
*
* @return Horde_Mail_Rfc822_Object Rfc822 object, or null if no object.
*/
public function first()
{
return $this[0];
}

/**
* Normalize objects to add to list.
*
Expand Down
2 changes: 2 additions & 0 deletions framework/Mail/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</stability>
<license uri="http://www.horde.org/licenses/bsd">BSD-2-Clause</license>
<notes>
* [mms] Added Horde_Mail_Rfc822_List#first() function.
* [mms] Add property to address object to indicate whether it is an EAI address.
* [mms] Transport driver now indicates whether it handles EAI data.
* [mms] Support validation of EAI addresses (RFC 6532).
Expand Down Expand Up @@ -646,6 +647,7 @@
<date>2014-08-14</date>
<license uri="http://www.horde.org/licenses/bsd">BSD-2-Clause</license>
<notes>
* [mms] Added Horde_Mail_Rfc822_List#first() function.
* [mms] Add property to address object to indicate whether it is an EAI address.
* [mms] Transport driver now indicates whether it handles EAI data.
* [mms] Support validation of EAI addresses (RFC 6532).
Expand Down

0 comments on commit 93cc4f1

Please sign in to comment.