code: public function checkPasswordPolicy(Password $password)
      {
          $result = true;
          $policy = $this->picoAuth->getContainer()->get("PasswordPolicy");
          $maxAllowedLen = $this->getPasswordEncoder()->getMaxAllowedLen();
          if (is_int($maxAllowedLen) && strlen($password)>$maxAllowedLen) {
              $this->session->addFlash("error", "Maximum length is {$maxAllowedLen}.");
              $result = false;
          }
          if (!$policy->check($password)) {
              $errors = $policy->getErrors();
              foreach ($errors as $error) {
                  $this->session->addFlash("error", $error);
              }
              return false;
          }
          
          return $result;
      }
docs: Validates the password policy constraints against the supplied password
  
  Additionally, a maximum length constraint is added based on the limitations
  of the current password encoder used for storage.
  
  @param Password $password Password string to be checked
  @return boolean true - passed, false otherwise