web/Zend/Gdata/App/FeedEntryParent.php
changeset 0 4eba9c11703f
equal deleted inserted replaced
-1:000000000000 0:4eba9c11703f
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * Zend Framework
       
     5  *
       
     6  * LICENSE
       
     7  *
       
     8  * This source file is subject to the new BSD license that is bundled
       
     9  * with this package in the file LICENSE.txt.
       
    10  * It is also available through the world-wide-web at this URL:
       
    11  * http://framework.zend.com/license/new-bsd
       
    12  * If you did not receive a copy of the license and are unable to
       
    13  * obtain it through the world-wide-web, please send an email
       
    14  * to license@zend.com so we can send you a copy immediately.
       
    15  *
       
    16  * @category   Zend
       
    17  * @package    Zend_Gdata
       
    18  * @subpackage App
       
    19  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    21  * @version    $Id: FeedEntryParent.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    22  */
       
    23 
       
    24 /**
       
    25  * @see Zend_Gdata_App_Extension_Element
       
    26 */
       
    27 require_once 'Zend/Gdata/App/Extension/Element.php';
       
    28 
       
    29 /**
       
    30  * @see Zend_Gdata_App_Extension_Author
       
    31 */
       
    32 require_once 'Zend/Gdata/App/Extension/Author.php';
       
    33 
       
    34 /**
       
    35  * @see Zend_Gdata_App_Extension_Category
       
    36 */
       
    37 require_once 'Zend/Gdata/App/Extension/Category.php';
       
    38 
       
    39 /**
       
    40  * @see Zend_Gdata_App_Extension_Contributor
       
    41 */
       
    42 require_once 'Zend/Gdata/App/Extension/Contributor.php';
       
    43 
       
    44 /**
       
    45  * @see Zend_Gdata_App_Extension_Id
       
    46  */
       
    47 require_once 'Zend/Gdata/App/Extension/Id.php';
       
    48 
       
    49 /**
       
    50  * @see Zend_Gdata_App_Extension_Link
       
    51  */
       
    52 require_once 'Zend/Gdata/App/Extension/Link.php';
       
    53 
       
    54 /**
       
    55  * @see Zend_Gdata_App_Extension_Rights
       
    56  */
       
    57 require_once 'Zend/Gdata/App/Extension/Rights.php';
       
    58 
       
    59 /**
       
    60  * @see Zend_Gdata_App_Extension_Title
       
    61  */
       
    62 require_once 'Zend/Gdata/App/Extension/Title.php';
       
    63 
       
    64 /**
       
    65  * @see Zend_Gdata_App_Extension_Updated
       
    66  */
       
    67 require_once 'Zend/Gdata/App/Extension/Updated.php';
       
    68 
       
    69 /**
       
    70  * Zend_Version
       
    71  */
       
    72 require_once 'Zend/Version.php';
       
    73 
       
    74 /**
       
    75  * Abstract class for common functionality in entries and feeds
       
    76  *
       
    77  * @category   Zend
       
    78  * @package    Zend_Gdata
       
    79  * @subpackage App
       
    80  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    81  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    82  */
       
    83 abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
       
    84 {
       
    85     /**
       
    86      * Service instance used to make network requests.
       
    87      *
       
    88      * @see setService(), getService()
       
    89      */
       
    90     protected $_service = null;
       
    91 
       
    92     /**
       
    93      * The HTTP ETag associated with this entry. Used for optimistic
       
    94      * concurrency in protoco v2 or greater.
       
    95      *
       
    96      * @var string|null
       
    97      */
       
    98     protected $_etag = NULL;
       
    99 
       
   100     protected $_author = array();
       
   101     protected $_category = array();
       
   102     protected $_contributor = array();
       
   103     protected $_id = null;
       
   104     protected $_link = array();
       
   105     protected $_rights = null;
       
   106     protected $_title = null;
       
   107     protected $_updated = null;
       
   108 
       
   109     /**
       
   110       * Indicates the major protocol version that should be used.
       
   111       * At present, recognized values are either 1 or 2. However, any integer
       
   112       * value >= 1 is considered valid.
       
   113       *
       
   114       * @see setMajorProtocolVersion()
       
   115       * @see getMajorProtocolVersion()
       
   116       */
       
   117     protected $_majorProtocolVersion = 1;
       
   118 
       
   119     /**
       
   120       * Indicates the minor protocol version that should be used. Can be set
       
   121       * to either an integer >= 0, or NULL if no minor version should be sent
       
   122       * to the server.
       
   123       *
       
   124       * @see setMinorProtocolVersion()
       
   125       * @see getMinorProtocolVersion()
       
   126       */
       
   127     protected $_minorProtocolVersion = null;
       
   128 
       
   129     /**
       
   130      * Constructs a Feed or Entry
       
   131      */
       
   132     public function __construct($element = null)
       
   133     {
       
   134         if (!($element instanceof DOMElement)) {
       
   135             if ($element) {
       
   136                 $this->transferFromXML($element);
       
   137             }
       
   138         } else {
       
   139             $this->transferFromDOM($element);
       
   140         }
       
   141     }
       
   142 
       
   143     /**
       
   144      * Set the HTTP client instance
       
   145      *
       
   146      * Sets the HTTP client object to use for retrieving the feed.
       
   147      *
       
   148      * @deprecated Deprecated as of Zend Framework 1.7. Use
       
   149      *             setService() instead.
       
   150      * @param  Zend_Http_Client $httpClient
       
   151      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
       
   152      */
       
   153     public function setHttpClient(Zend_Http_Client $httpClient)
       
   154     {
       
   155         if (!$this->_service) {
       
   156             $this->_service = new Zend_Gdata_App();
       
   157         }
       
   158         $this->_service->setHttpClient($httpClient);
       
   159         return $this;
       
   160     }
       
   161 
       
   162     /**
       
   163      * Gets the HTTP client object. If none is set, a new Zend_Http_Client
       
   164      * will be used.
       
   165      *
       
   166      * @deprecated Deprecated as of Zend Framework 1.7. Use
       
   167      *             getService() instead.
       
   168      * @return Zend_Http_Client_Abstract
       
   169      */
       
   170     public function getHttpClient()
       
   171     {
       
   172         if (!$this->_service) {
       
   173             $this->_service = new Zend_Gdata_App();
       
   174         }
       
   175         $client = $this->_service->getHttpClient();
       
   176         return $client;
       
   177     }
       
   178 
       
   179     /**
       
   180      * Set the active service instance for this object. This will be used to
       
   181      * perform network requests, such as when calling save() and delete().
       
   182      *
       
   183      * @param Zend_Gdata_App $instance The new service instance.
       
   184      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface.
       
   185      */
       
   186     public function setService($instance)
       
   187     {
       
   188         $this->_service = $instance;
       
   189         return $this;
       
   190     }
       
   191 
       
   192     /**
       
   193      * Get the active service instance for this object. This will be used to
       
   194      * perform network requests, such as when calling save() and delete().
       
   195      *
       
   196      * @return Zend_Gdata_App|null The current service instance, or null if
       
   197      *         not set.
       
   198      */
       
   199     public function getService()
       
   200     {
       
   201         return $this->_service;
       
   202     }
       
   203 
       
   204     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
       
   205     {
       
   206         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
       
   207         foreach ($this->_author as $author) {
       
   208             $element->appendChild($author->getDOM($element->ownerDocument));
       
   209         }
       
   210         foreach ($this->_category as $category) {
       
   211             $element->appendChild($category->getDOM($element->ownerDocument));
       
   212         }
       
   213         foreach ($this->_contributor as $contributor) {
       
   214             $element->appendChild($contributor->getDOM($element->ownerDocument));
       
   215         }
       
   216         if ($this->_id != null) {
       
   217             $element->appendChild($this->_id->getDOM($element->ownerDocument));
       
   218         }
       
   219         foreach ($this->_link as $link) {
       
   220             $element->appendChild($link->getDOM($element->ownerDocument));
       
   221         }
       
   222         if ($this->_rights != null) {
       
   223             $element->appendChild($this->_rights->getDOM($element->ownerDocument));
       
   224         }
       
   225         if ($this->_title != null) {
       
   226             $element->appendChild($this->_title->getDOM($element->ownerDocument));
       
   227         }
       
   228         if ($this->_updated != null) {
       
   229             $element->appendChild($this->_updated->getDOM($element->ownerDocument));
       
   230         }
       
   231         return $element;
       
   232     }
       
   233 
       
   234     protected function takeChildFromDOM($child)
       
   235     {
       
   236         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
       
   237         switch ($absoluteNodeName) {
       
   238         case $this->lookupNamespace('atom') . ':' . 'author':
       
   239             $author = new Zend_Gdata_App_Extension_Author();
       
   240             $author->transferFromDOM($child);
       
   241             $this->_author[] = $author;
       
   242             break;
       
   243         case $this->lookupNamespace('atom') . ':' . 'category':
       
   244             $category = new Zend_Gdata_App_Extension_Category();
       
   245             $category->transferFromDOM($child);
       
   246             $this->_category[] = $category;
       
   247             break;
       
   248         case $this->lookupNamespace('atom') . ':' . 'contributor':
       
   249             $contributor = new Zend_Gdata_App_Extension_Contributor();
       
   250             $contributor->transferFromDOM($child);
       
   251             $this->_contributor[] = $contributor;
       
   252             break;
       
   253         case $this->lookupNamespace('atom') . ':' . 'id':
       
   254             $id = new Zend_Gdata_App_Extension_Id();
       
   255             $id->transferFromDOM($child);
       
   256             $this->_id = $id;
       
   257             break;
       
   258         case $this->lookupNamespace('atom') . ':' . 'link':
       
   259             $link = new Zend_Gdata_App_Extension_Link();
       
   260             $link->transferFromDOM($child);
       
   261             $this->_link[] = $link;
       
   262             break;
       
   263         case $this->lookupNamespace('atom') . ':' . 'rights':
       
   264             $rights = new Zend_Gdata_App_Extension_Rights();
       
   265             $rights->transferFromDOM($child);
       
   266             $this->_rights = $rights;
       
   267             break;
       
   268         case $this->lookupNamespace('atom') . ':' . 'title':
       
   269             $title = new Zend_Gdata_App_Extension_Title();
       
   270             $title->transferFromDOM($child);
       
   271             $this->_title = $title;
       
   272             break;
       
   273         case $this->lookupNamespace('atom') . ':' . 'updated':
       
   274             $updated = new Zend_Gdata_App_Extension_Updated();
       
   275             $updated->transferFromDOM($child);
       
   276             $this->_updated = $updated;
       
   277             break;
       
   278         default:
       
   279             parent::takeChildFromDOM($child);
       
   280             break;
       
   281         }
       
   282     }
       
   283 
       
   284     /**
       
   285      * @return Zend_Gdata_App_Extension_Author
       
   286      */
       
   287     public function getAuthor()
       
   288     {
       
   289         return $this->_author;
       
   290     }
       
   291 
       
   292     /**
       
   293      * Sets the list of the authors of this feed/entry.  In an atom feed, each
       
   294      * author is represented by an atom:author element
       
   295      *
       
   296      * @param array $value
       
   297      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
       
   298      */
       
   299     public function setAuthor($value)
       
   300     {
       
   301         $this->_author = $value;
       
   302         return $this;
       
   303     }
       
   304 
       
   305     /**
       
   306      * Returns the array of categories that classify this feed/entry.  Each
       
   307      * category is represented in an atom feed by an atom:category element.
       
   308      *
       
   309      * @return array Array of Zend_Gdata_App_Extension_Category
       
   310      */
       
   311     public function getCategory()
       
   312     {
       
   313         return $this->_category;
       
   314     }
       
   315 
       
   316     /**
       
   317      * Sets the array of categories that classify this feed/entry.  Each
       
   318      * category is represented in an atom feed by an atom:category element.
       
   319      *
       
   320      * @param array $value Array of Zend_Gdata_App_Extension_Category
       
   321      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
       
   322      */
       
   323     public function setCategory($value)
       
   324     {
       
   325         $this->_category = $value;
       
   326         return $this;
       
   327     }
       
   328 
       
   329     /**
       
   330      * Returns the array of contributors to this feed/entry.  Each contributor
       
   331      * is represented in an atom feed by an atom:contributor XML element
       
   332      *
       
   333      * @return array An array of Zend_Gdata_App_Extension_Contributor
       
   334      */
       
   335     public function getContributor()
       
   336     {
       
   337         return $this->_contributor;
       
   338     }
       
   339 
       
   340     /**
       
   341      * Sets the array of contributors to this feed/entry.  Each contributor
       
   342      * is represented in an atom feed by an atom:contributor XML element
       
   343      *
       
   344      * @param array $value
       
   345      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
       
   346      */
       
   347     public function setContributor($value)
       
   348     {
       
   349         $this->_contributor = $value;
       
   350         return $this;
       
   351     }
       
   352 
       
   353     /**
       
   354      * @return Zend_Gdata_App_Extension_Id
       
   355      */
       
   356     public function getId()
       
   357     {
       
   358         return $this->_id;
       
   359     }
       
   360 
       
   361     /**
       
   362      * @param Zend_Gdata_App_Extension_Id $value
       
   363      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
       
   364      */
       
   365     public function setId($value)
       
   366     {
       
   367         $this->_id = $value;
       
   368         return $this;
       
   369     }
       
   370 
       
   371     /**
       
   372      * Given a particular 'rel' value, this method returns a matching
       
   373      * Zend_Gdata_App_Extension_Link element.  If the 'rel' value
       
   374      * is not provided, the full array of Zend_Gdata_App_Extension_Link
       
   375      * elements is returned.  In an atom feed, each link is represented
       
   376      * by an atom:link element.  The 'rel' value passed to this function
       
   377      * is the atom:link/@rel attribute.  Example rel values include 'self',
       
   378      * 'edit', and 'alternate'.
       
   379      *
       
   380      * @param string $rel The rel value of the link to be found.  If null,
       
   381      *     the array of Zend_Gdata_App_Extension_link elements is returned
       
   382      * @return mixed Either a single Zend_Gdata_App_Extension_link element,
       
   383      *     an array of the same or null is returned depending on the rel value
       
   384      *     supplied as the argument to this function
       
   385      */
       
   386     public function getLink($rel = null)
       
   387     {
       
   388         if ($rel == null) {
       
   389             return $this->_link;
       
   390         } else {
       
   391             foreach ($this->_link as $link) {
       
   392                 if ($link->rel == $rel) {
       
   393                     return $link;
       
   394                 }
       
   395             }
       
   396             return null;
       
   397         }
       
   398     }
       
   399 
       
   400     /**
       
   401      * Returns the Zend_Gdata_App_Extension_Link element which represents
       
   402      * the URL used to edit this resource.  This link is in the atom feed/entry
       
   403      * as an atom:link with a rel attribute value of 'edit'.
       
   404      *
       
   405      * @return Zend_Gdata_App_Extension_Link The link, or null if not found
       
   406      */
       
   407     public function getEditLink()
       
   408     {
       
   409         return $this->getLink('edit');
       
   410     }
       
   411 
       
   412     /**
       
   413      * Returns the Zend_Gdata_App_Extension_Link element which represents
       
   414      * the URL used to retrieve the next chunk of results when paging through
       
   415      * a feed.  This link is in the atom feed as an atom:link with a
       
   416      * rel attribute value of 'next'.
       
   417      *
       
   418      * @return Zend_Gdata_App_Extension_Link The link, or null if not found
       
   419      */
       
   420     public function getNextLink()
       
   421     {
       
   422         return $this->getLink('next');
       
   423     }
       
   424 
       
   425     /**
       
   426      * Returns the Zend_Gdata_App_Extension_Link element which represents
       
   427      * the URL used to retrieve the previous chunk of results when paging
       
   428      * through a feed.  This link is in the atom feed as an atom:link with a
       
   429      * rel attribute value of 'previous'.
       
   430      *
       
   431      * @return Zend_Gdata_App_Extension_Link The link, or null if not found
       
   432      */
       
   433     public function getPreviousLink()
       
   434     {
       
   435         return $this->getLink('previous');
       
   436     }
       
   437 
       
   438     /**
       
   439      * @return Zend_Gdata_App_Extension_Link
       
   440      */
       
   441     public function getLicenseLink()
       
   442     {
       
   443         return $this->getLink('license');
       
   444     }
       
   445 
       
   446     /**
       
   447      * Returns the Zend_Gdata_App_Extension_Link element which represents
       
   448      * the URL used to retrieve the entry or feed represented by this object
       
   449      * This link is in the atom feed/entry as an atom:link with a
       
   450      * rel attribute value of 'self'.
       
   451      *
       
   452      * @return Zend_Gdata_App_Extension_Link The link, or null if not found
       
   453      */
       
   454     public function getSelfLink()
       
   455     {
       
   456         return $this->getLink('self');
       
   457     }
       
   458 
       
   459     /**
       
   460      * Returns the Zend_Gdata_App_Extension_Link element which represents
       
   461      * the URL for an alternate view of the data represented by this feed or
       
   462      * entry.  This alternate view is commonly a user-facing webpage, blog
       
   463      * post, etc.  The MIME type for the data at the URL is available from the
       
   464      * returned Zend_Gdata_App_Extension_Link element.
       
   465      * This link is in the atom feed/entry as an atom:link with a
       
   466      * rel attribute value of 'self'.
       
   467      *
       
   468      * @return Zend_Gdata_App_Extension_Link The link, or null if not found
       
   469      */
       
   470     public function getAlternateLink()
       
   471     {
       
   472         return $this->getLink('alternate');
       
   473     }
       
   474 
       
   475     /**
       
   476      * @param array $value The array of Zend_Gdata_App_Extension_Link elements
       
   477      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
       
   478      */
       
   479     public function setLink($value)
       
   480     {
       
   481         $this->_link = $value;
       
   482         return $this;
       
   483     }
       
   484 
       
   485     /**
       
   486      * @return Zend_Gdata_AppExtension_Rights
       
   487      */
       
   488     public function getRights()
       
   489     {
       
   490         return $this->_rights;
       
   491     }
       
   492 
       
   493     /**
       
   494      * @param Zend_Gdata_App_Extension_Rights $value
       
   495      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
       
   496      */
       
   497     public function setRights($value)
       
   498     {
       
   499         $this->_rights = $value;
       
   500         return $this;
       
   501     }
       
   502 
       
   503     /**
       
   504      * Returns the title of this feed or entry.  The title is an extremely
       
   505      * short textual representation of this resource and is found as
       
   506      * an atom:title element in a feed or entry
       
   507      *
       
   508      * @return Zend_Gdata_App_Extension_Title
       
   509      */
       
   510     public function getTitle()
       
   511     {
       
   512         return $this->_title;
       
   513     }
       
   514 
       
   515     /**
       
   516      * Returns a string representation of the title of this feed or entry.
       
   517      * The title is an extremely short textual representation of this
       
   518      * resource and is found as an atom:title element in a feed or entry
       
   519      *
       
   520      * @return string
       
   521      */
       
   522     public function getTitleValue()
       
   523     {
       
   524         if (($titleObj = $this->getTitle()) != null) {
       
   525             return $titleObj->getText();
       
   526         } else {
       
   527             return null;
       
   528         }
       
   529     }
       
   530 
       
   531     /**
       
   532      * Returns the title of this feed or entry.  The title is an extremely
       
   533      * short textual representation of this resource and is found as
       
   534      * an atom:title element in a feed or entry
       
   535      *
       
   536      * @param Zend_Gdata_App_Extension_Title $value
       
   537      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
       
   538      */
       
   539     public function setTitle($value)
       
   540     {
       
   541         $this->_title = $value;
       
   542         return $this;
       
   543     }
       
   544 
       
   545     /**
       
   546      * @return Zend_Gdata_App_Extension_Updated
       
   547      */
       
   548     public function getUpdated()
       
   549     {
       
   550         return $this->_updated;
       
   551     }
       
   552 
       
   553     /**
       
   554      * @param Zend_Gdata_App_Extension_Updated $value
       
   555      * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
       
   556      */
       
   557     public function setUpdated($value)
       
   558     {
       
   559         $this->_updated = $value;
       
   560         return $this;
       
   561     }
       
   562 
       
   563     /**
       
   564      * Set the Etag for the current entry to $value. Setting $value to null
       
   565      * unsets the Etag.
       
   566      *
       
   567      * @param string|null $value
       
   568      * @return Zend_Gdata_App_Entry Provides a fluent interface
       
   569      */
       
   570     public function setEtag($value) {
       
   571         $this->_etag = $value;
       
   572         return $this;
       
   573     }
       
   574 
       
   575     /**
       
   576      * Return the Etag for the current entry, or null if not set.
       
   577      *
       
   578      * @return string|null
       
   579      */
       
   580     public function getEtag() {
       
   581         return $this->_etag;
       
   582     }
       
   583 
       
   584     /**
       
   585      * Set the major protocol version that should be used. Values < 1
       
   586      * (excluding NULL) will cause a Zend_Gdata_App_InvalidArgumentException
       
   587      * to be thrown.
       
   588      *
       
   589      * @see _majorProtocolVersion
       
   590      * @param (int|NULL) $value The major protocol version to use.
       
   591      * @throws Zend_Gdata_App_InvalidArgumentException
       
   592      */
       
   593     public function setMajorProtocolVersion($value)
       
   594     {
       
   595         if (!($value >= 1) && ($value !== null)) {
       
   596             require_once('Zend/Gdata/App/InvalidArgumentException.php');
       
   597             throw new Zend_Gdata_App_InvalidArgumentException(
       
   598                     'Major protocol version must be >= 1');
       
   599         }
       
   600         $this->_majorProtocolVersion = $value;
       
   601     }
       
   602 
       
   603     /**
       
   604      * Get the major protocol version that is in use.
       
   605      *
       
   606      * @see _majorProtocolVersion
       
   607      * @return (int|NULL) The major protocol version in use.
       
   608      */
       
   609     public function getMajorProtocolVersion()
       
   610     {
       
   611         return $this->_majorProtocolVersion;
       
   612     }
       
   613 
       
   614     /**
       
   615      * Set the minor protocol version that should be used. If set to NULL, no
       
   616      * minor protocol version will be sent to the server. Values < 0 will
       
   617      * cause a Zend_Gdata_App_InvalidArgumentException to be thrown.
       
   618      *
       
   619      * @see _minorProtocolVersion
       
   620      * @param (int|NULL) $value The minor protocol version to use.
       
   621      * @throws Zend_Gdata_App_InvalidArgumentException
       
   622      */
       
   623     public function setMinorProtocolVersion($value)
       
   624     {
       
   625         if (!($value >= 0)) {
       
   626             require_once('Zend/Gdata/App/InvalidArgumentException.php');
       
   627             throw new Zend_Gdata_App_InvalidArgumentException(
       
   628                     'Minor protocol version must be >= 0 or null');
       
   629         }
       
   630         $this->_minorProtocolVersion = $value;
       
   631     }
       
   632 
       
   633     /**
       
   634      * Get the minor protocol version that is in use.
       
   635      *
       
   636      * @see _minorProtocolVersion
       
   637      * @return (int|NULL) The major protocol version in use, or NULL if no
       
   638      *         minor version is specified.
       
   639      */
       
   640     public function getMinorProtocolVersion()
       
   641     {
       
   642         return $this->_minorProtocolVersion;
       
   643     }
       
   644 
       
   645     /**
       
   646      * Get the full version of a namespace prefix
       
   647      *
       
   648      * Looks up a prefix (atom:, etc.) in the list of registered
       
   649      * namespaces and returns the full namespace URI if
       
   650      * available. Returns the prefix, unmodified, if it's not
       
   651      * registered.
       
   652      *
       
   653      * The current entry or feed's version will be used when performing the
       
   654      * namespace lookup unless overridden using $majorVersion and
       
   655      * $minorVersion. If the entry/fee has a null version, then the latest
       
   656      * protocol version will be used by default.
       
   657      *
       
   658      * @param string $prefix The namespace prefix to lookup.
       
   659      * @param integer $majorVersion The major protocol version in effect.
       
   660      *        Defaults to null (auto-select).
       
   661      * @param integer $minorVersion The minor protocol version in effect.
       
   662      *        Defaults to null (auto-select).
       
   663      * @return string
       
   664      */
       
   665     public function lookupNamespace($prefix,
       
   666                                     $majorVersion = null,
       
   667                                     $minorVersion = null)
       
   668     {
       
   669         // Auto-select current version
       
   670         if ($majorVersion === null) {
       
   671             $majorVersion = $this->getMajorProtocolVersion();
       
   672         }
       
   673         if ($minorVersion === null) {
       
   674             $minorVersion = $this->getMinorProtocolVersion();
       
   675         }
       
   676 
       
   677         // Perform lookup
       
   678         return parent::lookupNamespace($prefix, $majorVersion, $minorVersion);
       
   679     }
       
   680 
       
   681 }