Author: as
Date: Tue Oct  9 17:38:03 2007
New Revision: 6404

Log:
- Added more doc blocks to modules.

Modified:
    trunk/Feed/src/interfaces/module.php
    trunk/Feed/src/modules/content.php
    trunk/Feed/src/modules/dublin_core.php

Modified: trunk/Feed/src/interfaces/module.php
==============================================================================
--- trunk/Feed/src/interfaces/module.php [iso-8859-1] (original)
+++ trunk/Feed/src/interfaces/module.php [iso-8859-1] Tue Oct  9 17:38:03 2007
@@ -10,17 +10,102 @@
  */
 
 /**
+ * Interface for feed modules.
+ *
+ * Currently implemented for these feed modules:
+ *  - Content ([EMAIL PROTECTED] ezcFeedModuleContent})
+ *  - DublinCore ([EMAIL PROTECTED] ezcFeedModuleDublinCore})
+ *
  * @package Feed
  * @version //autogentag//
  */
 interface ezcFeedModule
 {
+    /**
+     * Returns the module name (eg. 'DublinCore').
+     *
+     * @return string
+     */
     public static function getModuleName();
+
+    /**
+     * Returns the namespace for this module (eg. 
'http://purl.org/dc/elements/1.1/').
+     *
+     * @return string
+     */
     public static function getNamespace();
+
+    /**
+     * Returns the namespace prefix for this module (eg. 'dc').
+     *
+     * @return string
+     */
     public static function getNamespacePrefix();
-    public function feedMetaSetHook( &$element, &$value );
-    public function feedItemSetHook( &$element, &$value );
+
+    /**
+     * Returns true if the name $element is allowed as a channel element.
+     *
+     * @param string $element The name of the element
+     * @return bool
+     */
     public function isChannelElementAllowed( $element );
+
+    /**
+     * Returns true if the name $element is allowed as an item element.
+     *
+     * @param string $element The name of the element
+     * @return bool
+     */
     public function isItemElementAllowed( $element );
+
+    /**
+     * Return true if setting the item $element to $value is allowed, false
+     * otherwise.
+     *
+     * It is a hook called before setting the feed $element to $value.
+     *
+     * @param string $element The name of the feed element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedMetaSetHook( $element, $value );
+
+    /**
+     * Return true if setting the item $element to $value is allowed with the
+     * module data $moduleData, false otherwise.
+     *
+     * It is a hook called before setting the feed $element to $value.
+     *
+     * @param array(string=>mixed) The module data
+     * @param string $element The name of the feed element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedMetaGenerateHook( $moduleData, $element, $value );
+
+    /**
+     * Return true if setting the item $element to $value is allowed, false
+     * otherwise.
+     *
+     * It is a hook called before setting the item $element to $value.
+     *
+     * @param string $element The name of the item element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedItemSetHook( $element, $value );
+
+    /**
+     * Return true if setting the item $element to $value is allowed with the
+     * item module data $moduleData, false otherwise.
+     *
+     * It is a hook called before setting the feed $element to $value.
+     *
+     * @param array(string=>mixed) The item module data
+     * @param string $element The name of the feed element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedItemGenerateHook( $moduleData, $element, $value );
 }
 ?>

Modified: trunk/Feed/src/modules/content.php
==============================================================================
--- trunk/Feed/src/modules/content.php [iso-8859-1] (original)
+++ trunk/Feed/src/modules/content.php [iso-8859-1] Tue Oct  9 17:38:03 2007
@@ -10,42 +10,149 @@
  */
 
 /**
+ * Class for handling a Content feed module.
+ *
  * @package Feed
  * @version //autogentag//
  */
 class ezcFeedModuleContent implements ezcFeedModule
 {
+    /**
+     * Holds the feed type of this module (eg. 'rss2').
+     *
+     * @var string
+     */
     protected $feedType;
+
+    /**
+     * Holds the supported elements for this module.
+     *
+     * @var array(string)
+     */
     protected $supportedItemElements = array( 'encoded' );
 
+    /**
+     * Creates a new Content module with the feed type as $feedType.
+     *
+     * @param string $feedType The feed type of the new module
+     */
     public function __construct( $feedType )
     {
         $this->feedType = $feedType;
     }
 
+    /**
+     * Returns the module name ('Content').
+     *
+     * @return string
+     */
     public static function getModuleName()
     {
         return 'Content';
     }
 
+    /**
+     * Returns the namespace for this module 
('http://purl.org/rss/1.0/modules/content/').
+     *
+     * @return string
+     */
     public static function getNamespace()
     {
         return 'http://purl.org/rss/1.0/modules/content/';
     }
 
+    /**
+     * Returns the namespace prefix for this module ('content').
+     *
+     * @return string
+     */
     public static function getNamespacePrefix()
     {
         return 'content';
     }
 
+    /**
+     * Returns true if the name $element is allowed as a channel element.
+     *
+     * @param string $element The name of the element
+     * @return bool
+     */
     public function isChannelElementAllowed( $element )
     {
         return false;
     }
 
+    /**
+     * Returns true if the name $element is allowed as an item element.
+     *
+     * @param string $element The name of the element
+     * @return bool
+     */
     public function isItemElementAllowed( $element )
     {
         return in_array( $element, $this->supportedItemElements );
+    }
+
+    /**
+     * Return true if setting the item $element to $value is allowed, false
+     * otherwise.
+     *
+     * It is a hook called before setting the feed $element to $value.
+     *
+     * @param string $element The name of the feed element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedMetaSetHook( $element, $value )
+    {
+        return null;
+    }
+
+    /**
+     * Return true if setting the item $element to $value is allowed with the
+     * module data $moduleData, false otherwise.
+     *
+     * It is a hook called before setting the feed $element to $value.
+     *
+     * @param array(string=>mixed) The module data
+     * @param string $element The name of the feed element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedMetaGenerateHook( $moduleData, $element, $value )
+    {
+        return true;
+    }
+
+    /**
+     * Return true if setting the item $element to $value is allowed, false
+     * otherwise.
+     *
+     * It is a hook called before setting the item $element to $value.
+     *
+     * @param string $element The name of the item element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedItemSetHook( $element, $value )
+    {
+        return null;
+    }
+
+    /**
+     * Return true if setting the item $element to $value is allowed with the
+     * item module data $moduleData, false otherwise.
+     *
+     * It is a hook called before setting the feed $element to $value.
+     *
+     * @param array(string=>mixed) The item module data
+     * @param string $element The name of the feed element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedItemGenerateHook( $moduleData, $element, $value )
+    {
+        return true;
     }
 
     public function generateMetaData( $feedProcessor, $element, $value )
@@ -75,25 +182,5 @@
     {
         return $value;
     }
-
-    public function feedMetaSetHook( &$element, &$value )
-    {
-        return null;
-    }
-
-    public function feedMetaGenerateHook( $moduleData, &$element, &$value )
-    {
-        return true;
-    }
-
-    public function feedItemSetHook( &$element, &$value )
-    {
-        return null;
-    }
-
-    public function feedItemGenerateHook( $moduleData, &$element, &$value )
-    {
-        return true;
-    }
 }
 ?>

Modified: trunk/Feed/src/modules/dublin_core.php
==============================================================================
--- trunk/Feed/src/modules/dublin_core.php [iso-8859-1] (original)
+++ trunk/Feed/src/modules/dublin_core.php [iso-8859-1] Tue Oct  9 17:38:03 2007
@@ -10,102 +10,104 @@
  */
 
 /**
+ * Class for handling a DublinCore feed module.
+ *
  * @package Feed
  * @version //autogentag//
  */
 class ezcFeedModuleDublinCore implements ezcFeedModule
 {
+    /**
+     * Holds the feed type of this module (eg. 'rss2').
+     *
+     * @var string
+     */
     protected $feedType;
+
+    /**
+     * Holds the supported elements for this module.
+     *
+     * @var array(string)
+     */
     protected $supportedElements = array(
         'title', 'creator', 'subject', 'description', 'publisher',
         'contributor', 'date', 'type', 'format', 'identifier',
         'source', 'language', 'relation', 'coverage', 'rights'
     );
 
+    /**
+     * Creates a new DublinCore module with the feed type as $feedType.
+     *
+     * @param string $feedType The feed type of the new module
+     */
     public function __construct( $feedType )
     {
         $this->feedType = $feedType;
     }
 
+    /**
+     * Returns the module name ('DublinCore').
+     *
+     * @return string
+     */
     public static function getModuleName()
     {
         return 'DublinCore';
     }
 
+    /**
+     * Returns the namespace for this module 
('http://purl.org/dc/elements/1.1/').
+     *
+     * @return string
+     */
     public static function getNamespace()
     {
         return 'http://purl.org/dc/elements/1.1/';
     }
 
+    /**
+     * Returns the namespace prefix for this module ('dc').
+     *
+     * @return string
+     */
     public static function getNamespacePrefix()
     {
         return 'dc';
     }
 
+    /**
+     * Returns true if the name $element is allowed as a channel element.
+     *
+     * @param string $element The name of the element
+     * @return bool
+     */
     public function isChannelElementAllowed( $element )
     {
         return in_array( $element, $this->supportedElements );
     }
 
+    /**
+     * Returns true if the name $element is allowed as an item element.
+     *
+     * @param string $element The name of the element
+     * @return bool
+     */
     public function isItemElementAllowed( $element )
     {
         return in_array( $element, $this->supportedElements );
     }
 
-    public function prepareDate( $date )
-    {
-        if ( is_int( $date ) || is_numeric( $date ) )
-        {
-            return $date;
-        }
-        $ts = strtotime( $date );
-        if ( $ts !== false )
-        {
-            return $ts;
-        }
-        return time();
-    }
-
-    public function generateMetaData( $feedProcessor, $element, $value )
-    {
-        $prefix = $this->getNamespacePrefix();
-        switch ( $element )
-        {
-            case 'date':
-                $feedProcessor->generateMetaData( "$prefix:$element", date( 
DATE_W3C, $value ) );
-                break;
-            default:
-                $feedProcessor->generateMetaData( "$prefix:$element", $value );
-                break;
-        }
-    }
-
-    public function generateItemData( $itemTag, $feedProcessor, $element, 
$value )
-    {
-        $prefix = $this->getNamespacePrefix();
-        switch ( $element )
-        {
-            case 'date':
-                $feedProcessor->generateItemData( $itemTag, 
"$prefix:$element", date( DATE_W3C, $value ) );
-                break;
-            default:
-                $feedProcessor->generateItemData( $itemTag, 
"$prefix:$element", $value );
-                break;
-        }
-    }
-    
-    public function prepareMetaData( $element, $value )
-    {
-        switch ( $element )
-        {
-            case 'date':
-                $value = $this->prepareDate( $value );
-                break;
-        }
-        return $value;
-    }
-
-    public function feedMetaSetHook( &$element, &$value )
+    /**
+     * Return true if setting the item $element to $value is allowed, false
+     * otherwise.
+     *
+     * It is a hook called before setting the feed $element to $value.
+     *
+     * @param string $element The name of the feed element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedMetaSetHook( $element, $value )
     {
         if ( in_array( $this->feedType, array( 'rss1' ) ) )
         {
@@ -118,7 +120,18 @@
         return null;
     }
 
-    public function feedMetaGenerateHook( $moduleData, &$element, &$value )
+    /**
+     * Return true if setting the item $element to $value is allowed with the
+     * module data $moduleData, false otherwise.
+     *
+     * It is a hook called before setting the feed $element to $value.
+     *
+     * @param array(string=>mixed) $moduleData The module data
+     * @param string $element The name of the feed element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedMetaGenerateHook( $moduleData, $element, $value )
     {
         if ( 
             ( isset( $moduleData['creator'] ) && $element === 'author' ) ||
@@ -130,7 +143,17 @@
         return true;
     }
 
-    public function feedItemSetHook( &$element, &$value )
+    /**
+     * Return true if setting the item $element to $value is allowed, false
+     * otherwise.
+     *
+     * It is a hook called before setting the item $element to $value.
+     *
+     * @param string $element The name of the item element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedItemSetHook( $element, $value )
     {
         if ( in_array( $this->feedType, array( 'rss1' ) ) )
         {
@@ -143,13 +166,79 @@
         return null;
     }
 
-    public function feedItemGenerateHook( $moduleData, &$element, &$value )
+    /**
+     * Return true if setting the item $element to $value is allowed with the
+     * item module data $moduleData, false otherwise.
+     *
+     * It is a hook called before setting the feed $element to $value.
+     *
+     * @param array(string=>mixed) $moduleData The item module data
+     * @param string $element The name of the feed element
+     * @param mixed $value The new value for $element
+     * @return bool
+     */
+    public function feedItemGenerateHook( $moduleData, $element, $value )
     {
         if ( isset( $moduleData['date'] ) && $element === 'published' )
         {
             return false;
         }
         return true;
+    }
+
+    public function prepareDate( $date )
+    {
+        if ( is_int( $date ) || is_numeric( $date ) )
+        {
+            return $date;
+        }
+        $ts = strtotime( $date );
+        if ( $ts !== false )
+        {
+            return $ts;
+        }
+        return time();
+    }
+
+    public function generateMetaData( $feedProcessor, $element, $value )
+    {
+        $prefix = $this->getNamespacePrefix();
+        switch ( $element )
+        {
+            case 'date':
+                $feedProcessor->generateMetaData( "$prefix:$element", date( 
DATE_W3C, $value ) );
+                break;
+
+            default:
+                $feedProcessor->generateMetaData( "$prefix:$element", $value );
+                break;
+        }
+    }
+
+    public function generateItemData( $itemTag, $feedProcessor, $element, 
$value )
+    {
+        $prefix = $this->getNamespacePrefix();
+        switch ( $element )
+        {
+            case 'date':
+                $feedProcessor->generateItemData( $itemTag, 
"$prefix:$element", date( DATE_W3C, $value ) );
+                break;
+
+            default:
+                $feedProcessor->generateItemData( $itemTag, 
"$prefix:$element", $value );
+                break;
+        }
+    }
+    
+    public function prepareMetaData( $element, $value )
+    {
+        switch ( $element )
+        {
+            case 'date':
+                $value = $this->prepareDate( $value );
+                break;
+        }
+        return $value;
     }
 }
 ?>


-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to