blob: 641843a9bf874f45a6e413c9c76edfff25d0cb63 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace LdapRecord\Exceptions;
4
5use LdapRecord\DetectsErrors;
6use LdapRecord\LdapRecordException;
7
8class ConstraintViolationException extends LdapRecordException
9{
10 use DetectsErrors;
11
12 /**
13 * Determine if the exception was generated due to the password policy.
14 *
15 * @return bool
16 */
17 public function causedByPasswordPolicy()
18 {
19 return isset($this->detailedError)
20 ? $this->errorContainsMessage($this->detailedError->getDiagnosticMessage(), '0000052D')
21 : false;
22 }
23
24 /**
25 * Determine if the exception was generated due to an incorrect password.
26 *
27 * @return bool
28 */
29 public function causedByIncorrectPassword()
30 {
31 return isset($this->detailedError)
32 ? $this->errorContainsMessage($this->detailedError->getDiagnosticMessage(), '00000056')
33 : false;
34 }
35}