Skip to content

Commit 98dd0f4

Browse files
committed
Tweak the code to avoid fabbot false positives
1 parent 1c444da commit 98dd0f4

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Adapter/ExtLdap/Collection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function count()
4848
return $count;
4949
}
5050

51-
throw new LdapException(sprintf('Error while retrieving entry count: %s.', ldap_error($this->connection->getResource())));
51+
throw new LdapException('Error while retrieving entry count: '.ldap_error($this->connection->getResource()));
5252
}
5353

5454
public function getIterator()
@@ -62,7 +62,7 @@ public function getIterator()
6262
}
6363

6464
if (false === $current) {
65-
throw new LdapException(sprintf('Could not rewind entries array: %s.', ldap_error($con)));
65+
throw new LdapException('Could not rewind entries array: '.ldap_error($con));
6666
}
6767

6868
yield $this->getSingleEntry($con, $current);
@@ -105,15 +105,15 @@ private function getSingleEntry($con, $current)
105105
$attributes = ldap_get_attributes($con, $current);
106106

107107
if (false === $attributes) {
108-
throw new LdapException(sprintf('Could not fetch attributes: %s.', ldap_error($con)));
108+
throw new LdapException('Could not fetch attributes: '.ldap_error($con));
109109
}
110110

111111
$attributes = $this->cleanupAttributes($attributes);
112112

113113
$dn = ldap_get_dn($con, $current);
114114

115115
if (false === $dn) {
116-
throw new LdapException(sprintf('Could not fetch DN: %s.', ldap_error($con)));
116+
throw new LdapException('Could not fetch DN: '.ldap_error($con));
117117
}
118118

119119
return new Entry($dn, $attributes);

Adapter/ExtLdap/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ private function connect()
138138
}
139139

140140
if (false === $this->connection) {
141-
throw new LdapException(sprintf('Could not connect to Ldap server: %s.', ldap_error($this->connection)));
141+
throw new LdapException('Could not connect to Ldap server: '.ldap_error($this->connection));
142142
}
143143

144144
if ('tls' === $this->config['encryption'] && false === @ldap_start_tls($this->connection)) {
145-
throw new LdapException(sprintf('Could not initiate TLS connection: %s.', ldap_error($this->connection)));
145+
throw new LdapException('Could not initiate TLS connection: '.ldap_error($this->connection));
146146
}
147147
}
148148

Adapter/ExtLdap/EntryManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function add(Entry $entry)
3838
$con = $this->getConnectionResource();
3939

4040
if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) {
41-
throw new LdapException(sprintf('Could not add entry "%s": %s.', $entry->getDn(), ldap_error($con)));
41+
throw new LdapException(sprintf('Could not add entry "%s": '.ldap_error($con), $entry->getDn()));
4242
}
4343

4444
return $this;
@@ -52,7 +52,7 @@ public function update(Entry $entry)
5252
$con = $this->getConnectionResource();
5353

5454
if (!@ldap_modify($con, $entry->getDn(), $entry->getAttributes())) {
55-
throw new LdapException(sprintf('Could not update entry "%s": %s.', $entry->getDn(), ldap_error($con)));
55+
throw new LdapException(sprintf('Could not update entry "%s": '.ldap_error($con), $entry->getDn()));
5656
}
5757
}
5858

@@ -64,7 +64,7 @@ public function remove(Entry $entry)
6464
$con = $this->getConnectionResource();
6565

6666
if (!@ldap_delete($con, $entry->getDn())) {
67-
throw new LdapException(sprintf('Could not remove entry "%s": %s.', $entry->getDn(), ldap_error($con)));
67+
throw new LdapException(sprintf('Could not remove entry "%s": '.ldap_error($con), $entry->getDn()));
6868
}
6969
}
7070

@@ -76,7 +76,7 @@ public function rename(Entry $entry, $newRdn, $removeOldRdn = true)
7676
$con = $this->getConnectionResource();
7777

7878
if (!@ldap_rename($con, $entry->getDn(), $newRdn, null, $removeOldRdn)) {
79-
throw new LdapException(sprintf('Could not rename entry "%s" to "%s": %s.', $entry->getDn(), $newRdn, ldap_error($con)));
79+
throw new LdapException(sprintf('Could not rename entry "%s" to "%s": '.ldap_error($con), $entry->getDn(), $newRdn));
8080
}
8181
}
8282

Adapter/ExtLdap/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __destruct()
4545
$this->search = null;
4646

4747
if (!$success) {
48-
throw new LdapException(sprintf('Could not free results: %s.', ldap_error($con)));
48+
throw new LdapException('Could not free results: '.ldap_error($con));
4949
}
5050
}
5151

0 commit comments

Comments
 (0)