original_string: public static function isUsed($password, $user = null)
      {
          if (!User::isValid($user)) {
              throw new InvalidParamException('User Invalid.');
          }
          $passwords = static::find()->createdBy($user)->all();
          foreach ($passwords as $p) {
              /* @var $p static */
              if ($p->validatePassword($password)) {
                  return $p;
              }
          }
          return false;
      }
code: public static function isUsed($password, $user = null)
      {
          if (!User::isValid($user)) {
              throw new InvalidParamException('User Invalid.');
          }
          $passwords = static::find()->createdBy($user)->all();
          foreach ($passwords as $p) {
              /* @var $p static */
              if ($p->validatePassword($password)) {
                  return $p;
              }
          }
          return false;
      }
code_tokens: public static function isUsed ( $ password , $ user = null ) { if ( ! User :: isValid ( $ user ) ) { throw new InvalidParamException ( 'User Invalid.' ) ; } $ passwords = static :: find ( ) -> createdBy ( $ user ) -> all ( ) ; foreach ( $ passwords as $ p ) { /* @var $p static */ if ( $ p -> validatePassword ( $ password ) ) { return $ p ; } } return false ; }
docstring: Check whether the password has been used.
  @param string $password Password or Password Hash.
  @param User $user
  @return false|static The first validated password model, or false if not validated.
docstring_tokens: Check whether the password has been used .