original_string: public function onAddPasswordToHistory($event)
      {
          $password = $event->data;
          $sender = $event->sender;
          /* @var $sender static */
          if (empty($sender->passwordHistoryClass) ||
                  !class_exists($sender->passwordHistoryClass) ||
                  empty($sender->passwordHashAttribute) ||
                  !is_string($sender->passwordHashAttribute)) {
              return false;
          }
          if (empty($password)) {
              $password = ['pass_hash' => $sender->{$sender->passwordHashAttribute}];
          }
          $class = $sender->passwordHistoryClass;
          if (array_key_exists('pass_hash', $password)) {
              return $class::addHash($password['pass_hash'], $sender);
          }
          if (array_key_exists('password', $password)) {
              return $class::add($password['password'], $sender);
          }
          return false;
      }
code: public function onAddPasswordToHistory($event)
      {
          $password = $event->data;
          $sender = $event->sender;
          /* @var $sender static */
          if (empty($sender->passwordHistoryClass) ||
                  !class_exists($sender->passwordHistoryClass) ||
                  empty($sender->passwordHashAttribute) ||
                  !is_string($sender->passwordHashAttribute)) {
              return false;
          }
          if (empty($password)) {
              $password = ['pass_hash' => $sender->{$sender->passwordHashAttribute}];
          }
          $class = $sender->passwordHistoryClass;
          if (array_key_exists('pass_hash', $password)) {
              return $class::addHash($password['pass_hash'], $sender);
          }
          if (array_key_exists('password', $password)) {
              return $class::add($password['password'], $sender);
          }
          return false;
      }
code_tokens: public function onAddPasswordToHistory ( $ event ) { $ password = $ event -> data ; $ sender = $ event -> sender ; /* @var $sender static */ if ( empty ( $ sender -> passwordHistoryClass ) || ! class_exists ( $ sender -> passwordHistoryClass ) || empty ( $ sender -> passwordHashAttribute ) || ! is_string ( $ sender -> passwordHashAttribute ) ) { return false ; } if ( empty ( $ password ) ) { $ password = [ 'pass_hash' => $ sender -> { $ sender -> passwordHashAttribute } ] ; } $ class = $ sender -> passwordHistoryClass ; if ( array_key_exists ( 'pass_hash' , $ password ) ) { return $ class :: addHash ( $ password [ 'pass_hash' ] , $ sender ) ; } if ( array_key_exists ( 'password' , $ password ) ) { return $ class :: add ( $ password [ 'password' ] , $ sender ) ; } return false ; }
docstring: This event is ONLY used for adding password to history.
  You SHOULD NOT call this method directly, or you know the consequences of doing so
  @param ModelEvent $event
  @return boolean False if no password was added to history.
docstring_tokens: This event is ONLY used for adding password to history . You SHOULD NOT call this method directly or you know the consequences of doing so