@@ -34,8 +34,12 @@ class UpdateOperation
34
34
*/
35
35
public function __construct (int $ operationType , string $ attribute , ?array $ values )
36
36
{
37
- $ this ->assertValidOperationType ($ operationType );
38
- $ this ->assertNullValuesOnRemoveAll ($ operationType , $ values );
37
+ if (!in_array ($ operationType , $ this ->validOperationTypes , true )) {
38
+ throw new UpdateOperationException (sprintf ('"%s" is not a valid modification type. ' , $ operationType ));
39
+ }
40
+ if (LDAP_MODIFY_BATCH_REMOVE_ALL === $ operationType && null !== $ values ) {
41
+ throw new UpdateOperationException (sprintf ('$values must be null for LDAP_MODIFY_BATCH_REMOVE_ALL operation, "%s" given. ' , gettype ($ values )));
42
+ }
39
43
40
44
$ this ->operationType = $ operationType ;
41
45
$ this ->attribute = $ attribute ;
@@ -50,27 +54,4 @@ public function toArray(): array
50
54
'values ' => $ this ->values ,
51
55
);
52
56
}
53
-
54
- /**
55
- * @param int $operationType
56
- */
57
- private function assertValidOperationType (int $ operationType ): void
58
- {
59
- if (!in_array ($ operationType , $ this ->validOperationTypes , true )) {
60
- throw new UpdateOperationException (sprintf ('"%s" is not a valid modification type. ' , $ operationType ));
61
- }
62
- }
63
-
64
- /**
65
- * @param int $operationType
66
- * @param array|null $values
67
- *
68
- * @throws \Symfony\Component\Ldap\Exception\UpdateOperationException
69
- */
70
- private function assertNullValuesOnRemoveAll (int $ operationType , ?array $ values ): void
71
- {
72
- if (LDAP_MODIFY_BATCH_REMOVE_ALL === $ operationType && null !== $ values ) {
73
- throw new UpdateOperationException (sprintf ('$values must be null for LDAP_MODIFY_BATCH_REMOVE_ALL operation, "%s" given. ' , gettype ($ values )));
74
- }
75
- }
76
57
}
0 commit comments