@@ -61,12 +61,12 @@ public function init($firstname, $lastname, $email, $org, $send_mail = true)
6161 {
6262 $ ldapGroupEntry = $ this ->getGroupEntry ();
6363 $ id = $ this ->LDAP ->getNextUIDGIDNumber ($ this ->uid );
64- assert (!$ ldapGroupEntry ->exists ());
64+ \ensure (!$ ldapGroupEntry ->exists ());
6565 $ ldapGroupEntry ->setAttribute ("objectclass " , UnityLDAP::POSIX_GROUP_CLASS );
6666 $ ldapGroupEntry ->setAttribute ("gidnumber " , strval ($ id ));
6767 $ ldapGroupEntry ->write ();
6868
69- assert (!$ this ->entry ->exists ());
69+ \ensure (!$ this ->entry ->exists ());
7070 $ this ->entry ->setAttribute ("objectclass " , UnityLDAP::POSIX_ACCOUNT_CLASS );
7171 $ this ->entry ->setAttribute ("uid " , $ this ->uid );
7272 $ this ->entry ->setAttribute ("givenname " , $ firstname );
@@ -145,7 +145,7 @@ public function setOrg($org)
145145
146146 public function getOrg ($ ignorecache = false )
147147 {
148- assert ($ this ->exists ());
148+ \ensure ($ this ->exists ());
149149 if (!$ ignorecache ) {
150150 $ cached_val = $ this ->REDIS ->getCache ($ this ->uid , "org " );
151151 if (!is_null ($ cached_val )) {
@@ -194,7 +194,7 @@ public function setFirstname($firstname, $operator = null)
194194 */
195195 public function getFirstname ($ ignorecache = false )
196196 {
197- assert ($ this ->exists ());
197+ \ensure ($ this ->exists ());
198198 if (!$ ignorecache ) {
199199 $ cached_val = $ this ->REDIS ->getCache ($ this ->uid , "firstname " );
200200 if (!is_null ($ cached_val )) {
@@ -243,7 +243,7 @@ public function setLastname($lastname, $operator = null)
243243 */
244244 public function getLastname ($ ignorecache = false )
245245 {
246- assert ($ this ->exists ());
246+ \ensure ($ this ->exists ());
247247 if (!$ ignorecache ) {
248248 $ cached_val = $ this ->REDIS ->getCache ($ this ->uid , "lastname " );
249249 if (!is_null ($ cached_val )) {
@@ -266,7 +266,7 @@ public function getLastname($ignorecache = false)
266266
267267 public function getFullname ()
268268 {
269- assert ($ this ->exists ());
269+ \ensure ($ this ->exists ());
270270 return $ this ->getFirstname () . " " . $ this ->getLastname ();
271271 }
272272
@@ -298,7 +298,7 @@ public function setMail($email, $operator = null)
298298 */
299299 public function getMail ($ ignorecache = false )
300300 {
301- assert ($ this ->exists ());
301+ \ensure ($ this ->exists ());
302302 if (!$ ignorecache ) {
303303 $ cached_val = $ this ->REDIS ->getCache ($ this ->uid , "mail " );
304304 if (!is_null ($ cached_val )) {
@@ -328,7 +328,7 @@ public function setSSHKeys($keys, $operator = null, $send_mail = true)
328328 {
329329 $ operator = is_null ($ operator ) ? $ this ->uid : $ operator ->uid ;
330330 $ keys_filt = array_values (array_unique ($ keys ));
331- assert ($ this ->entry ->exists ());
331+ \ensure ($ this ->entry ->exists ());
332332 $ this ->entry ->setAttribute ("sshpublickey " , $ keys_filt );
333333 $ this ->entry ->write ();
334334
@@ -357,7 +357,7 @@ public function setSSHKeys($keys, $operator = null, $send_mail = true)
357357 */
358358 public function getSSHKeys ($ ignorecache = false )
359359 {
360- assert ($ this ->exists ());
360+ \ensure ($ this ->exists ());
361361 if (!$ ignorecache ) {
362362 $ cached_val = $ this ->REDIS ->getCache ($ this ->uid , "sshkeys " );
363363 if (!is_null ($ cached_val )) {
@@ -400,7 +400,7 @@ public function setLoginShell($shell, $operator = null, $send_mail = true)
400400 if (empty ($ shell )) {
401401 throw new Exception ("login shell must not be empty! " );
402402 }
403- assert ($ this ->entry ->exists ());
403+ \ensure ($ this ->entry ->exists ());
404404 $ this ->entry ->setAttribute ("loginshell " , $ shell );
405405 $ this ->entry ->write ();
406406
@@ -431,7 +431,7 @@ public function setLoginShell($shell, $operator = null, $send_mail = true)
431431 */
432432 public function getLoginShell ($ ignorecache = false )
433433 {
434- assert ($ this ->exists ());
434+ \ensure ($ this ->exists ());
435435 if (!$ ignorecache ) {
436436 $ cached_val = $ this ->REDIS ->getCache ($ this ->uid , "loginshell " );
437437 if (!is_null ($ cached_val )) {
@@ -454,7 +454,7 @@ public function getLoginShell($ignorecache = false)
454454
455455 public function setHomeDir ($ home , $ operator = null )
456456 {
457- assert ($ this ->entry ->exists ());
457+ \ensure ($ this ->entry ->exists ());
458458 $ this ->entry ->setAttribute ("homedirectory " , $ home );
459459 $ this ->entry ->write ();
460460 $ operator = is_null ($ operator ) ? $ this ->uid : $ operator ->uid ;
@@ -476,7 +476,7 @@ public function setHomeDir($home, $operator = null)
476476 */
477477 public function getHomeDir ($ ignorecache = false )
478478 {
479- assert ($ this ->exists ());
479+ \ensure ($ this ->exists ());
480480 if (!$ ignorecache ) {
481481 $ cached_val = $ this ->REDIS ->getCache ($ this ->uid , "homedir " );
482482 if (!is_null ($ cached_val )) {
0 commit comments