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P_s㤋NwHy pp"N wgFN5K]OwgFN5K]OiZԯ8p&%'8倪? hY1m~\s2wgFN5K]OwgFN5K]O?QPFۃSqB.I}َCl=Te K|=³ʖ[Wg ꭽmPꗉiZ:q fiTC>GZBwG8e6uċDǕdI)VCm~O62 Tj -M3B5xl> Z3CFO +ȝ ?bN<1FZ =øW *mP"ƒ@O ֪xftfUog)SOp4}>[v✯H0@7@t{+U{wPJ֑$Qp筎ʃfkh$+\wFI@-dఐ#5xx@j/q<;s&xK$b,7Y*&?#w3KK`D^ =.xZ8/'TТ ?i9xsւ '@ڮ(w,K6Q㘡{rgx2n|AJc I,=`궻 Ō`ʪ] m}YAyMkr# p$/}(.8_A6ɻD( $aʨ iYBPa Z7ݥ0r\.+[v{:(z}c<+?F: @d%C $this->setRevoked($userId['revoked']); } if (array_key_exists('valid', $userId)) { $this->setValid($userId['valid']); } } } /** * Gets the name field of this user id * * @return string the name field of this user id. */ public function getName() { return $this->_name; } /** * Gets the comments field of this user id * * @return string the comments field of this user id. */ public function getComment() { return $this->_comment; } /** * Gets the email field of this user id * * @return string the email field of this user id. */ public function getEmail() { return $this->_email; } /** * Gets whether or not this user id is revoked * * @return boolean true if this user id is revoked and false if it is not. */ public function isRevoked() { return $this->_isRevoked; } /** * Gets whether or not this user id is valid * * @return boolean true if this user id is valid and false if it is not. */ public function isValid() { return $this->_isValid; } /** * Gets a string representation of this user id * * The string is formatted as: * name (comment) . * * @return string a string representation of this user id. */ public function __toString() { $components = array(); if (mb_strlen($this->_name, '8bit') > 0) { $components[] = $this->_name; } if (mb_strlen($this->_comment, '8bit') > 0) { $components[] = '(' . $this->_comment . ')'; } if (mb_strlen($this->_email, '8bit') > 0) { $components[] = '<' . $this->_email. '>'; } return implode(' ', $components); } /** * Sets the name field of this user id * * @param string $name the name field of this user id. * * @return Crypt_GPG_UserId the current object, for fluent interface. */ public function setName($name) { $this->_name = strval($name); return $this; } /** * Sets the comment field of this user id * * @param string $comment the comment field of this user id. * * @return Crypt_GPG_UserId the current object, for fluent interface. */ public function setComment($comment) { $this->_comment = strval($comment); return $this; } /** * Sets the email field of this user id * * @param string $email the email field of this user id. * * @return Crypt_GPG_UserId the current object, for fluent interface. */ public function setEmail($email) { $this->_email = strval($email); return $this; } /** * Sets whether or not this user id is revoked * * @param boolean $isRevoked whether or not this user id is revoked. * * @return Crypt_GPG_UserId the current object, for fluent interface. */ public function setRevoked($isRevoked) { $this->_isRevoked = ($isRevoked) ? true : false; return $this; } /** * Sets whether or not this user id is valid * * @param boolean $isValid whether or not this user id is valid. * * @return Crypt_GPG_UserId the current object, for fluent interface. */ public function setValid($isValid) { $this->_isValid = ($isValid) ? true : false; return $this; } /** * Parses a user id object from a user id string * * A user id string is of the form: * name (comment) with the comment * and email-address fields being optional. * * @param string $string the user id string to parse. * * @return Crypt_GPG_UserId the user id object parsed from the string. */ public static function parse($string) { $userId = new Crypt_GPG_UserId(); $name = ''; $email = ''; $comment = ''; // get email address from end of string if it exists $matches = array(); if (preg_match('/^(.*?)<([^>]+)>$/', $string, $matches) === 1) { $string = trim($matches[1]); $email = $matches[2]; } // get comment from end of string if it exists $matches = array(); if (preg_match('/^(.+?) \(([^\)]+)\)$/', $string, $matches) === 1) { $string = $matches[1]; $comment = $matches[2]; } // there can be an email without a name if (!$email && preg_match('/^[\S]+@[\S]+$/', $string, $matches) === 1) { $email = $string; } else { $name = $string; } $userId->setName($name); $userId->setComment($comment); $userId->setEmail($email); return $userId; } }