public function setId($id, $permaLink = false)
    {
        if ($this->version == Feed::RSS2) {
            if (!is_bool($permaLink))
                throw new \InvalidArgumentException('The permaLink parameter must be boolean.');

            $permaLink = $permaLink ? 'true' : 'false';

            $this->addElement('guid', $id, array('isPermaLink' => $permaLink));
        } elseif ($this->version == Feed::ATOM) {
            // Check if the given ID is an valid URI scheme (see RFC 4287 4.2.6)
            // The list of valid schemes was generated from http://www.iana.org/assignments/uri-schemes
            // by using only permanent or historical schemes.
            $validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'cap', 'cid', 'coap', 'coaps', 'crid', 'data', 'dav', 'dict', 'dns', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
            $found = FALSE;
            $checkId = strtolower($id);

            foreach($validSchemes as $scheme)
                if (strrpos($checkId, $scheme . ':', -strlen($checkId)) !== FALSE)
                {
                    $found = TRUE;
                    break;
                }

            if (!$found)
                throw new \InvalidArgumentException("The ID must begin with an IANA-registered URI scheme.");

            $this->addElement('id', $id, NULL, TRUE);
        } else
            throw new InvalidOperationException('A unique ID is not supported in RSS1 feeds.');

        return $this;
    }
public function setId($id, $permaLink = false)
    {
        if ($this->version == Feed::RSS2) {
            if (!is_bool($permaLink))
                throw new \InvalidArgumentException('The permaLink parameter must be boolean.');

            $permaLink = $permaLink ? 'true' : 'false';

            $this->addElement('guid', $id, array('isPermaLink' => $permaLink));
        } elseif ($this->version == Feed::ATOM) {
            // Check if the given ID is an valid URI scheme (see RFC 4287 4.2.6)
            // The list of valid schemes was generated from http://www.iana.org/assignments/uri-schemes
            // by using only permanent or historical schemes.
            $validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'cap', 'cid', 'coap', 'coaps', 'crid', 'data', 'dav', 'dict', 'dns', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
            $found = FALSE;
            $checkId = strtolower($id);

            foreach($validSchemes as $scheme)
                if (strrpos($checkId, $scheme . ':', -strlen($checkId)) !== FALSE)
                {
                    $found = TRUE;
                    break;
                }

            if (!$found)
                throw new \InvalidArgumentException("The ID must begin with an IANA-registered URI scheme.");

            $this->addElement('id', $id, NULL, TRUE);
        } else
            throw new InvalidOperationException('A unique ID is not supported in RSS1 feeds.');

        return $this;
    }
public function setId ( $ id , $ permaLink = false ) { if ( $ this -> version == Feed :: RSS2 ) { if ( ! is_bool ( $ permaLink ) ) throw new \ InvalidArgumentException ( 'The permaLink parameter must be boolean.' ) ; $ permaLink = $ permaLink ? 'true' : 'false' ; $ this -> addElement ( 'guid' , $ id , array ( 'isPermaLink' => $ permaLink ) ) ; } elseif ( $ this -> version == Feed :: ATOM ) { // Check if the given ID is an valid URI scheme (see RFC 4287 4.2.6) // The list of valid schemes was generated from http://www.iana.org/assignments/uri-schemes // by using only permanent or historical schemes. $ validSchemes = array ( 'aaa' , 'aaas' , 'about' , 'acap' , 'acct' , 'cap' , 'cid' , 'coap' , 'coaps' , 'crid' , 'data' , 'dav' , 'dict' , 'dns' , 'example' , 'fax' , 'file' , 'filesystem' , 'ftp' , 'geo' , 'go' , 'gopher' , 'h323' , 'http' , 'https' , 'iax' , 'icap' , 'im' , 'imap' , 'info' , 'ipp' , 'ipps' , 'iris' , 'iris.beep' , 'iris.lwz' , 'iris.xpc' , 'iris.xpcs' , 'jabber' , 'ldap' , 'mailserver' , 'mailto' , 'mid' , 'modem' , 'msrp' , 'msrps' , 'mtqp' , 'mupdate' , 'news' , 'nfs' , 'ni' , 'nih' , 'nntp' , 'opaquelocktoken' , 'pack' , 'pkcs11' , 'pop' , 'pres' , 'prospero' , 'reload' , 'rtsp' , 'rtsps' , 'rtspu' , 'service' , 'session' , 'shttp' , 'sieve' , 'sip' , 'sips' , 'sms' , 'snews' , 'snmp' , 'soap.beep' , 'soap.beeps' , 'stun' , 'stuns' , 'tag' , 'tel' , 'telnet' , 'tftp' , 'thismessage' , 'tip' , 'tn3270' , 'turn' , 'turns' , 'tv' , 'urn' , 'vemmi' , 'videotex' , 'vnc' , 'wais' , 'ws' , 'wss' , 'xcon' , 'xcon-userid' , 'xmlrpc.beep' , 'xmlrpc.beeps' , 'xmpp' , 'z39.50' , 'z39.50r' , 'z39.50s' ) ; $ found = FALSE ; $ checkId = strtolower ( $ id ) ; foreach ( $ validSchemes as $ scheme ) if ( strrpos ( $ checkId , $ scheme . ':' , - strlen ( $ checkId ) ) !== FALSE ) { $ found = TRUE ; break ; } if ( ! $ found ) throw new \ InvalidArgumentException ( "The ID must begin with an IANA-registered URI scheme." ) ; $ this -> addElement ( 'id' , $ id , NULL , TRUE ) ; } else throw new InvalidOperationException ( 'A unique ID is not supported in RSS1 feeds.' ) ; return $ this ; }
Set the unique identifier of the feed item

On ATOM feeds, the identifier must begin with an valid URI scheme.

@access   public
@param    string $id         The unique identifier of this item
@param    boolean $permaLink The value of the 'isPermaLink' attribute in RSS 2 feeds.
@return   self
@throws   \InvalidArgumentException if the permaLink parameter is not boolean.
@throws   InvalidOperationException if this method is called on RSS1 feeds.
Set the unique identifier of the feed item