ZF-11658: Add setWebmaster() / getWebmaster() method

Description

A getter/setter for the webmaster property would be handy.

webMaster Email address for person responsible for technical issues relating to channel. betty@herald.com (Betty Guernsey) as explained in http://cyber.law.harvard.edu/rss/rss.html


    /**
     * Email address for person responsible for technical issues
     * Ignored if atom is used
     *
     * @param  string $webmaster
     * @param  string $name
     * @return Zend_Feed_Builder_Header
     * @throws Zend_Feed_Builder_Exception
     */
    public function setWebmaster($webmaster, $name = null) {

        /**
         * @see Zend_Validate_EmailAddress
         */
        require_once 'Zend/Validate/EmailAddress.php';
        $validate = new Zend_Validate_EmailAddress();

        if (!$validate->isValid($webmaster)) {
            /**
             * @see Zend_Feed_Builder_Exception
             */
            require_once 'Zend/Feed/Exception.php';
            throw new Zend_Feed_Exception("you have to set a valid email address into the webmaster property");
        }

        if (!is_null($name)) {
            $webmaster .= " ({$name})";
        }

        $this->_data['webMaster'] = $webmaster;
    }

    /**
     * Get the feed webmaster entry
     *
     * @return string|null
     */
    public function getWebmaster()
    {
        if (!array_key_exists('webMaster', $this->_data)) {
            return null;
        }
        return $this->_data['webMaster'];
    }

Plus the additional changes needed in the renderer classes.

Comments

No comments to display