Esempio n. 1
0
 public function update(SubjectInterface $subject)
 {
     if (method_exists($this, $subject->getState())) {
         $subject->count();
         call_user_func_array(array($this, $subject->getState()), array($subject));
     }
     return false;
 }
 /**
  * Receive update from subject
  * @param SubjectInterface $subject The subject notifying the observer of an update.
  */
 public function update(SubjectInterface $subject)
 {
     echo sprintf('Product has a new price: %d€.', $subject->getPrice());
 }