From c8d5c8442fe6ce54f7f65d1d0eb4203b06c09583 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 10 Feb 2010 21:21:42 -0800 Subject: Added some boilerplate class comments, etc. --- lib/atom10entry.php | 48 +++++++++++++++++++++++++++++++++++++++++ lib/atom10feed.php | 58 ++++++++++++++++++++++++++++++++++++++++++++------ lib/atomnoticefeed.php | 55 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 154 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/atom10entry.php b/lib/atom10entry.php index 1b79ce7ad..5710c80fc 100644 --- a/lib/atom10entry.php +++ b/lib/atom10entry.php @@ -1,9 +1,51 @@ . + * + * @category Feed + * @package StatusNet + * @author Zach Copley + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') +{ + exit(1); +} class Atom10EntryException extends Exception { } +/** + * Class for manipulating an Atom entry in memory. Get the entry as an XML + * string with Atom10Entry::getString(). + * + * @category Feed + * @package StatusNet + * @author Zach Copley + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ class Atom10Entry extends XMLStringer { private $namespaces; @@ -39,6 +81,12 @@ class Atom10Entry extends XMLStringer } + /** + * Check that all required elements have been set, etc. + * Throws an Atom10EntryException if something's missing. + * + * @return void + */ function validate { diff --git a/lib/atom10feed.php b/lib/atom10feed.php index 01fc69072..a37f6521a 100644 --- a/lib/atom10feed.php +++ b/lib/atom10feed.php @@ -1,9 +1,51 @@ . + * + * @category Feed + * @package StatusNet + * @author Zach Copley + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') +{ + exit(1); +} class Atom10FeedException extends Exception { } +/** + * Class for building an Atom feed in memory. Get the finished doc + * as a string with Atom10Feed::getString(). + * + * @category Feed + * @package StatusNet + * @author Zach Copley + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ class Atom10Feed extends XMLStringer { public $xw; @@ -23,12 +65,11 @@ class Atom10Feed extends XMLStringer private $entries; /** - * undocumented function + * Constructor * - * @param array $entries an array of FeedItems + * @param boolean $indent flag to turn indenting on or off * * @return void - * */ function __construct($indent = true) { parent::__construct($indent); @@ -38,6 +79,14 @@ class Atom10Feed extends XMLStringer $this->addNamespace('xmlns', 'http://www.w3.org/2005/Atom'); } + /** + * Add another namespace to the feed + * + * @param string $namespace the namespace + * @param string $uri namspace uri + * + * @return void + */ function addNamespace($namespace, $uri) { $ns = array($namespace => $uri); @@ -172,6 +221,3 @@ class Atom10Feed extends XMLStringer } } - - - diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php index ce87ec9e6..a626ab549 100644 --- a/lib/atomnoticefeed.php +++ b/lib/atomnoticefeed.php @@ -1,5 +1,47 @@ . + * + * @category Feed + * @package StatusNet + * @author Zach Copley + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ +if (!defined('STATUSNET') +{ + exit(1); +} + +/** + * Class for creating a feed that represents a collection of notices. Builds the + * feed in memory. Get the feed as a string with AtomNoticeFeed::getString(). + * + * @category Feed + * @package StatusNet + * @author Zach Copley + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ class AtomNoticeFeed extends Atom10Feed { function __construct($indent = true) { @@ -29,6 +71,12 @@ class AtomNoticeFeed extends Atom10Feed ); } + /** + * Add more than one Notice to the feed + * + * @param mixed $notices an array of Notice objects or handle + * + */ function addEntryFromNotices($notices) { if (is_array($notices)) { @@ -42,9 +90,14 @@ class AtomNoticeFeed extends Atom10Feed } } + /** + * Add a single Notice to the feed + * + * @param Notice $notice a Notice to add + */ function addEntryFromNotice($notice) { $this->addEntryRaw($notice->asAtomEntry()); } -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf