dmBridge PHP API
DMComment.php
00001 <?php
00002 #
00003 # dmBridge: a data access framework for CONTENTdm(R)
00004 #
00005 # Copyright © 2009, 2010, 2011 Board of Regents of the Nevada System of Higher
00006 # Education, on behalf of the University of Nevada, Las Vegas
00007 #
00008 
00017 class DMComment extends DMAbstractSocialEntity implements DMURIAddressable,
00018       DMSocialEntity {
00019 
00021    private $author;
00023    private $author_email;
00024 
00029    public function getEmail() {
00030       return $this->author_email;
00031    }
00032 
00037    public function setEmail($email) {
00038       if ($email && !DMMailer::isValidEmail($email)) {
00039          throw new DMInvalidEmailException($email);
00040       }
00041       $this->author_email = $email;
00042    }
00043 
00047    public function getName() {
00048       return $this->author;
00049    }
00050 
00055    public function setName($str) {
00056       if (strlen($str) < 2) {
00057          throw new DMIllegalArgumentException(
00058             sprintf(
00059                DMLocalizedString::getString("STRING_TOO_SHORT"),
00060                "Name", 2));
00061       } else if (strlen($str) > 50) {
00062          throw new DMIllegalArgumentException(
00063             sprintf(
00064                DMLocalizedString::getString("STRING_TOO_LONG"),
00065                "Name", 50));
00066       }
00067       $this->author = $str;
00068    }
00069 
00073    public function getURI() {
00074       return DMInternalURI::getResourceURI(
00075             DMBridgeComponent::HTTPAPI,
00076             "comments/" . $this->getID());
00077    }
00078 
00079 }
 All Data Structures Functions Variables