Ejemplo n.º 1
0
 public function change(BookColleague $bookColleague)
 {
     if ($bookColleague instanceof BookTitleColleague) {
         switch ($bookColleague->getState()) {
             case 'upper':
                 if ($this->getAuthor()->getState() != 'upper') {
                     $this->getAuthor()->setAuthorUpperCase();
                 }
                 break;
             case 'lower':
                 if ($this->getAuthor()->getState() != 'lower') {
                     $this->getAuthor()->setAuthorLowerCase();
                 }
                 break;
         }
     } elseif ($bookColleague instanceof BookAuthorColleague) {
         switch ($bookColleague->getState()) {
             case 'upper':
                 if ($this->getTitle()->getState() != 'upper') {
                     $this->getTitle()->setTitleUpperCase();
                 }
                 break;
             case 'lower':
                 if ($this->getTitle()->getState() != 'lower') {
                     $this->getTitle()->setTitleLowerCase();
                 }
                 break;
         }
     }
 }
Ejemplo n.º 2
0
 function change(BookColleague $changingClassIn)
 {
     if ($changingClassIn instanceof BookAuthorColleague) {
         if ('upper' == $changingClassIn->getState()) {
             if ('upper' != $this->getTitle()->getState()) {
                 $this->getTitle()->setTitleUpperCase();
             }
         } elseif ('lower' == $changingClassIn->getState()) {
             if ('lower' != $this->getTitle()->getState()) {
                 $this->getTitle()->setTitleLowerCase();
             }
         }
     } elseif ($changingClassIn instanceof BookTitleColleague) {
         if ('upper' == $changingClassIn->getState()) {
             if ('upper' != $this->getAuthor()->getState()) {
                 $this->getAuthor()->setAuthorUpperCase();
             }
         } elseif ('lower' == $changingClassIn->getState()) {
             if ('lower' != $this->getAuthor()->getState()) {
                 $this->getAuthor()->setAuthorLowerCase();
             }
         }
     }
 }