repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
adldap/adLDAP
src/Objects/Group.php
Group.validateRequired
public function validateRequired() { parent::validateRequired(); if (!is_array($this->getAttribute('container'))) { $message = 'Container attribute must be an array.'; throw new AdldapException($message); } return true; }
php
public function validateRequired() { parent::validateRequired(); if (!is_array($this->getAttribute('container'))) { $message = 'Container attribute must be an array.'; throw new AdldapException($message); } return true; }
[ "public", "function", "validateRequired", "(", ")", "{", "parent", "::", "validateRequired", "(", ")", ";", "if", "(", "!", "is_array", "(", "$", "this", "->", "getAttribute", "(", "'container'", ")", ")", ")", "{", "$", "message", "=", "'Container attribu...
Validate the required attributes. @return bool @throws AdldapException
[ "Validate", "the", "required", "attributes", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Objects/Group.php#L31-L42
train
adldap/adLDAP
src/Classes/AbstractAdldapQueryable.php
AbstractAdldapQueryable.all
public function all($fields = [], $sorted = true, $sortBy = 'cn', $sortByDirection = 'asc') { $search = $this->adldap->search() ->select($fields) ->where('objectClass', '=', $this->objectClass); if ($sorted) { $search->sortBy($sortBy, $sortByDirection); } return $search->get(); }
php
public function all($fields = [], $sorted = true, $sortBy = 'cn', $sortByDirection = 'asc') { $search = $this->adldap->search() ->select($fields) ->where('objectClass', '=', $this->objectClass); if ($sorted) { $search->sortBy($sortBy, $sortByDirection); } return $search->get(); }
[ "public", "function", "all", "(", "$", "fields", "=", "[", "]", ",", "$", "sorted", "=", "true", ",", "$", "sortBy", "=", "'cn'", ",", "$", "sortByDirection", "=", "'asc'", ")", "{", "$", "search", "=", "$", "this", "->", "adldap", "->", "search", ...
Returns all entries with the current object class. @param array $fields @param bool $sorted @param string $sortBy @param string $sortByDirection @return array|bool
[ "Returns", "all", "entries", "with", "the", "current", "object", "class", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AbstractAdldapQueryable.php#L35-L46
train
adldap/adLDAP
src/Classes/AbstractAdldapQueryable.php
AbstractAdldapQueryable.find
public function find($name, $fields = []) { $results = $this->adldap->search() ->select($fields) ->where('objectClass', '=', $this->objectClass) ->where('anr', '=', $name) ->first(); if (count($results) > 0) { return $results; } return false; }
php
public function find($name, $fields = []) { $results = $this->adldap->search() ->select($fields) ->where('objectClass', '=', $this->objectClass) ->where('anr', '=', $name) ->first(); if (count($results) > 0) { return $results; } return false; }
[ "public", "function", "find", "(", "$", "name", ",", "$", "fields", "=", "[", "]", ")", "{", "$", "results", "=", "$", "this", "->", "adldap", "->", "search", "(", ")", "->", "select", "(", "$", "fields", ")", "->", "where", "(", "'objectClass'", ...
Finds a single entry using the objects current class and the specified common name. If fields are specified, then only those fields are returned in the result array. @param string $name @param array $fields @return array|bool
[ "Finds", "a", "single", "entry", "using", "the", "objects", "current", "class", "and", "the", "specified", "common", "name", ".", "If", "fields", "are", "specified", "then", "only", "those", "fields", "are", "returned", "in", "the", "result", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AbstractAdldapQueryable.php#L58-L71
train
adldap/adLDAP
src/Classes/AbstractAdldapQueryable.php
AbstractAdldapQueryable.dn
public function dn($name) { $info = $this->find($name); if (is_array($info) && array_key_exists('dn', $info)) { return $info['dn']; } return false; }
php
public function dn($name) { $info = $this->find($name); if (is_array($info) && array_key_exists('dn', $info)) { return $info['dn']; } return false; }
[ "public", "function", "dn", "(", "$", "name", ")", "{", "$", "info", "=", "$", "this", "->", "find", "(", "$", "name", ")", ";", "if", "(", "is_array", "(", "$", "info", ")", "&&", "array_key_exists", "(", "'dn'", ",", "$", "info", ")", ")", "{...
Returns the DN of the current object class. @param string $name @return string|bool
[ "Returns", "the", "DN", "of", "the", "current", "object", "class", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AbstractAdldapQueryable.php#L80-L89
train
adldap/adLDAP
src/Classes/AbstractAdldapQueryable.php
AbstractAdldapQueryable.delete
public function delete($dn) { $this->adldap->utilities()->validateNotNullOrEmpty('Distinguished Name [dn]', $dn); return $this->connection->delete($dn); }
php
public function delete($dn) { $this->adldap->utilities()->validateNotNullOrEmpty('Distinguished Name [dn]', $dn); return $this->connection->delete($dn); }
[ "public", "function", "delete", "(", "$", "dn", ")", "{", "$", "this", "->", "adldap", "->", "utilities", "(", ")", "->", "validateNotNullOrEmpty", "(", "'Distinguished Name [dn]'", ",", "$", "dn", ")", ";", "return", "$", "this", "->", "connection", "->",...
Delete a distinguished name from Active Directory. @param string $dn The distinguished name to delete @return bool
[ "Delete", "a", "distinguished", "name", "from", "Active", "Directory", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AbstractAdldapQueryable.php#L98-L103
train
adldap/adLDAP
src/Objects/Ldap/Entry.php
Entry.applyAttributes
private function applyAttributes($attributes) { if (array_key_exists('count', $attributes) && $attributes['count'] > 0) { $keys = array_keys($attributes); foreach ($keys as $key) { if (is_array($attributes[$key]) && array_key_exists(0, $attributes[$key])) { // If the entry has multiple attributes, we'll make sure we loop through each one if (array_key_exists('count', $attributes[$key]) && $attributes[$key]['count'] > 1) { $data = []; for ($i = 0; $i <= $attributes[$key]['count']; $i++) { $data[] = $attributes[$key][$i]; } $this->setAttribute($key, array_filter($data)); } else { // Looks like only one attribute exists, let's set it $this->setAttribute($key, $attributes[$key][0]); } } } $this->applyExtraAttributes(); } }
php
private function applyAttributes($attributes) { if (array_key_exists('count', $attributes) && $attributes['count'] > 0) { $keys = array_keys($attributes); foreach ($keys as $key) { if (is_array($attributes[$key]) && array_key_exists(0, $attributes[$key])) { // If the entry has multiple attributes, we'll make sure we loop through each one if (array_key_exists('count', $attributes[$key]) && $attributes[$key]['count'] > 1) { $data = []; for ($i = 0; $i <= $attributes[$key]['count']; $i++) { $data[] = $attributes[$key][$i]; } $this->setAttribute($key, array_filter($data)); } else { // Looks like only one attribute exists, let's set it $this->setAttribute($key, $attributes[$key][0]); } } } $this->applyExtraAttributes(); } }
[ "private", "function", "applyAttributes", "(", "$", "attributes", ")", "{", "if", "(", "array_key_exists", "(", "'count'", ",", "$", "attributes", ")", "&&", "$", "attributes", "[", "'count'", "]", ">", "0", ")", "{", "$", "keys", "=", "array_keys", "(",...
Applies the proper object attributes if they exist. @param array $attributes
[ "Applies", "the", "proper", "object", "attributes", "if", "they", "exist", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Objects/Ldap/Entry.php#L40-L65
train
adldap/adLDAP
src/Objects/Ldap/Entry.php
Entry.applyExtraAttributes
private function applyExtraAttributes() { // Convert distinguished name string into an array if ($this->hasAttribute('distinguishedname')) { $dn = $this->getAttribute('distinguishedname'); $this->setAttribute('dn', $dn); $this->setAttribute('dn_array', $this->connection->explodeDn($dn, true)); } // Convert the object category string into an array if ($this->hasAttribute('objectcategory')) { $oc = $this->getAttribute('objectcategory'); $this->setAttribute('oc', $oc); $this->setAttribute('oc_array', $this->connection->explodeDn($oc, true)); } }
php
private function applyExtraAttributes() { // Convert distinguished name string into an array if ($this->hasAttribute('distinguishedname')) { $dn = $this->getAttribute('distinguishedname'); $this->setAttribute('dn', $dn); $this->setAttribute('dn_array', $this->connection->explodeDn($dn, true)); } // Convert the object category string into an array if ($this->hasAttribute('objectcategory')) { $oc = $this->getAttribute('objectcategory'); $this->setAttribute('oc', $oc); $this->setAttribute('oc_array', $this->connection->explodeDn($oc, true)); } }
[ "private", "function", "applyExtraAttributes", "(", ")", "{", "// Convert distinguished name string into an array", "if", "(", "$", "this", "->", "hasAttribute", "(", "'distinguishedname'", ")", ")", "{", "$", "dn", "=", "$", "this", "->", "getAttribute", "(", "'d...
Applies extra attributes to the returned array.
[ "Applies", "extra", "attributes", "to", "the", "returned", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Objects/Ldap/Entry.php#L70-L89
train
adldap/adLDAP
src/Classes/AdldapContacts.php
AdldapContacts.create
public function create(array $attributes) { $contact = new Contact($attributes); $contact->validateRequired(); // Translate the schema $add = $this->adldap->ldapSchema($attributes); // Set the cn to the contacts display name $add['cn'][0] = $contact->{'display_name'}; $add['objectclass'][0] = 'top'; $add['objectclass'][1] = 'person'; $add['objectclass'][2] = 'organizationalPerson'; $add['objectclass'][3] = 'contact'; if (!$contact->hasAttribute('exchange_hidefromlists')) { $add['msExchHideFromAddressLists'][0] = 'TRUE'; } // Determine the container $attributes['container'] = array_reverse($attributes['container']); $container = 'OU='.implode(',OU=', $attributes['container']); $dn = 'CN='.$this->adldap->utilities()->escapeCharacters($add['cn'][0]).', '.$container.','.$this->adldap->getBaseDn(); // Add the entry return $this->connection->add($dn, $add); }
php
public function create(array $attributes) { $contact = new Contact($attributes); $contact->validateRequired(); // Translate the schema $add = $this->adldap->ldapSchema($attributes); // Set the cn to the contacts display name $add['cn'][0] = $contact->{'display_name'}; $add['objectclass'][0] = 'top'; $add['objectclass'][1] = 'person'; $add['objectclass'][2] = 'organizationalPerson'; $add['objectclass'][3] = 'contact'; if (!$contact->hasAttribute('exchange_hidefromlists')) { $add['msExchHideFromAddressLists'][0] = 'TRUE'; } // Determine the container $attributes['container'] = array_reverse($attributes['container']); $container = 'OU='.implode(',OU=', $attributes['container']); $dn = 'CN='.$this->adldap->utilities()->escapeCharacters($add['cn'][0]).', '.$container.','.$this->adldap->getBaseDn(); // Add the entry return $this->connection->add($dn, $add); }
[ "public", "function", "create", "(", "array", "$", "attributes", ")", "{", "$", "contact", "=", "new", "Contact", "(", "$", "attributes", ")", ";", "$", "contact", "->", "validateRequired", "(", ")", ";", "// Translate the schema", "$", "add", "=", "$", ...
Create a contact. @param array $attributes The attributes to set to the contact @return bool|string
[ "Create", "a", "contact", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapContacts.php#L28-L58
train
adldap/adLDAP
src/Classes/AdldapContacts.php
AdldapContacts.modify
public function modify($contactName, $attributes) { $contactDn = $this->dn($contactName); if ($contactDn) { // Translate the update to the LDAP schema $mod = $this->adldap->ldapSchema($attributes); // Check to see if this is an enabled status update if (!$mod) { return false; } // Do the update return $this->connection->modify($contactDn, $mod); } return false; }
php
public function modify($contactName, $attributes) { $contactDn = $this->dn($contactName); if ($contactDn) { // Translate the update to the LDAP schema $mod = $this->adldap->ldapSchema($attributes); // Check to see if this is an enabled status update if (!$mod) { return false; } // Do the update return $this->connection->modify($contactDn, $mod); } return false; }
[ "public", "function", "modify", "(", "$", "contactName", ",", "$", "attributes", ")", "{", "$", "contactDn", "=", "$", "this", "->", "dn", "(", "$", "contactName", ")", ";", "if", "(", "$", "contactDn", ")", "{", "// Translate the update to the LDAP schema",...
Modify a contact. Note if you set the enabled attribute you must not specify any other attributes. @param string $contactName The contact to query @param array $attributes The attributes to modify @return bool|string
[ "Modify", "a", "contact", ".", "Note", "if", "you", "set", "the", "enabled", "attribute", "you", "must", "not", "specify", "any", "other", "attributes", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapContacts.php#L69-L87
train
adldap/adLDAP
src/Classes/AdldapContacts.php
AdldapContacts.contactMailEnable
public function contactMailEnable($contactName, $emailAddress, $mailNickname = null) { $contactDn = $this->dn($contactName); if ($contactDn) { return $this->adldap->exchange()->contactMailEnable($contactDn, $emailAddress, $mailNickname); } return false; }
php
public function contactMailEnable($contactName, $emailAddress, $mailNickname = null) { $contactDn = $this->dn($contactName); if ($contactDn) { return $this->adldap->exchange()->contactMailEnable($contactDn, $emailAddress, $mailNickname); } return false; }
[ "public", "function", "contactMailEnable", "(", "$", "contactName", ",", "$", "emailAddress", ",", "$", "mailNickname", "=", "null", ")", "{", "$", "contactDn", "=", "$", "this", "->", "dn", "(", "$", "contactName", ")", ";", "if", "(", "$", "contactDn",...
Mail enable a contact. Allows email to be sent to them through Exchange. @param string $contactName The contacts name @param string $emailAddress The contacts email address @param null $mailNickname @return bool
[ "Mail", "enable", "a", "contact", ".", "Allows", "email", "to", "be", "sent", "to", "them", "through", "Exchange", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapContacts.php#L98-L107
train
adldap/adLDAP
src/Objects/Mailbox.php
Mailbox.toLdapArray
public function toLdapArray() { return [ 'exchange_homemdb' => $this->container.','.$this->baseDn, 'exchange_proxyaddress' => 'SMTP:'.$this->emailAddress, 'exchange_mailnickname' => $this->mailNickname, 'exchange_usedefaults' => $this->mdbUseDefaults, ]; }
php
public function toLdapArray() { return [ 'exchange_homemdb' => $this->container.','.$this->baseDn, 'exchange_proxyaddress' => 'SMTP:'.$this->emailAddress, 'exchange_mailnickname' => $this->mailNickname, 'exchange_usedefaults' => $this->mdbUseDefaults, ]; }
[ "public", "function", "toLdapArray", "(", ")", "{", "return", "[", "'exchange_homemdb'", "=>", "$", "this", "->", "container", ".", "','", ".", "$", "this", "->", "baseDn", ",", "'exchange_proxyaddress'", "=>", "'SMTP:'", ".", "$", "this", "->", "emailAddres...
Returns the Mailboxes attributes to an LDAP compatible array. @return array
[ "Returns", "the", "Mailboxes", "attributes", "to", "an", "LDAP", "compatible", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Objects/Mailbox.php#L50-L58
train
adldap/adLDAP
src/Objects/AbstractObject.php
AbstractObject.validateRequired
public function validateRequired($only = []) { if (count($only) > 0) { return $this->validateSpecific($only); } /* * Go through each required attribute * and make sure they're not null */ foreach ($this->required as $required) { if ($this->getAttribute($required) === null) { throw new AdldapException(sprintf($this->messages['required'], $required)); } } return true; }
php
public function validateRequired($only = []) { if (count($only) > 0) { return $this->validateSpecific($only); } /* * Go through each required attribute * and make sure they're not null */ foreach ($this->required as $required) { if ($this->getAttribute($required) === null) { throw new AdldapException(sprintf($this->messages['required'], $required)); } } return true; }
[ "public", "function", "validateRequired", "(", "$", "only", "=", "[", "]", ")", "{", "if", "(", "count", "(", "$", "only", ")", ">", "0", ")", "{", "return", "$", "this", "->", "validateSpecific", "(", "$", "only", ")", ";", "}", "/*\n * Go t...
Validates the required attributes for preventing null keys. If an array is provided, then the specified required attributes are only validated. @param array $only @return bool @throws AdldapException
[ "Validates", "the", "required", "attributes", "for", "preventing", "null", "keys", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Objects/AbstractObject.php#L181-L198
train
adldap/adLDAP
src/Objects/AbstractObject.php
AbstractObject.validateSpecific
public function validateSpecific(array $required = []) { foreach ($required as $field) { /* * If the field is in the required array, and the * object attribute equals null, we'll throw an exception. */ if (in_array($field, $this->required) && $this->getAttribute($field) === null) { throw new AdldapException(sprintf($this->messages['required'], $field)); } } return true; }
php
public function validateSpecific(array $required = []) { foreach ($required as $field) { /* * If the field is in the required array, and the * object attribute equals null, we'll throw an exception. */ if (in_array($field, $this->required) && $this->getAttribute($field) === null) { throw new AdldapException(sprintf($this->messages['required'], $field)); } } return true; }
[ "public", "function", "validateSpecific", "(", "array", "$", "required", "=", "[", "]", ")", "{", "foreach", "(", "$", "required", "as", "$", "field", ")", "{", "/*\n * If the field is in the required array, and the\n * object attribute equals null, ...
Validates the specified attributes inside the required array. The attributes inside the required array must also exist inside the required property. @param array $required @return bool @throws AdldapException
[ "Validates", "the", "specified", "attributes", "inside", "the", "required", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Objects/AbstractObject.php#L212-L225
train
adldap/adLDAP
src/Query/Builder.php
Builder.get
public function get() { // Return the query if it exists if (!empty($this->query)) { return $this->query; } /* * Looks like our query hasn't been assembled * yet, let's try to assemble it */ $this->assembleQuery(); // Return the assembled query return $this->query; }
php
public function get() { // Return the query if it exists if (!empty($this->query)) { return $this->query; } /* * Looks like our query hasn't been assembled * yet, let's try to assemble it */ $this->assembleQuery(); // Return the assembled query return $this->query; }
[ "public", "function", "get", "(", ")", "{", "// Return the query if it exists", "if", "(", "!", "empty", "(", "$", "this", "->", "query", ")", ")", "{", "return", "$", "this", "->", "query", ";", "}", "/*\n * Looks like our query hasn't been assembled\n ...
Returns the current query. @return string
[ "Returns", "the", "current", "query", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L79-L94
train
adldap/adLDAP
src/Query/Builder.php
Builder.orWhere
public function orWhere($field, $operator = null, $value = null) { $this->addOrWhere($field, $operator, $value); return $this; }
php
public function orWhere($field, $operator = null, $value = null) { $this->addOrWhere($field, $operator, $value); return $this; }
[ "public", "function", "orWhere", "(", "$", "field", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "addOrWhere", "(", "$", "field", ",", "$", "operator", ",", "$", "value", ")", ";", "return", "$", ...
Adds an or where clause to the current query. @param string $field @param string $operator @param string $value @return $this
[ "Adds", "an", "or", "where", "clause", "to", "the", "current", "query", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L141-L146
train
adldap/adLDAP
src/Query/Builder.php
Builder.getQuery
public function getQuery() { // Return the query if it exists if (!empty($this->query)) { return $this->query; } /* * Looks like our query hasn't been assembled * yet, let's try to assemble it */ $this->assembleQuery(); // Return the assembled query return $this->query; }
php
public function getQuery() { // Return the query if it exists if (!empty($this->query)) { return $this->query; } /* * Looks like our query hasn't been assembled * yet, let's try to assemble it */ $this->assembleQuery(); // Return the assembled query return $this->query; }
[ "public", "function", "getQuery", "(", ")", "{", "// Return the query if it exists", "if", "(", "!", "empty", "(", "$", "this", "->", "query", ")", ")", "{", "return", "$", "this", "->", "query", ";", "}", "/*\n * Looks like our query hasn't been assembled...
Returns the current query string. @return string
[ "Returns", "the", "current", "query", "string", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L198-L213
train
adldap/adLDAP
src/Query/Builder.php
Builder.addWhere
private function addWhere($field, $operator, $value = null) { $this->wheres[] = [ 'field' => $field, 'operator' => $this->getOperator($operator), 'value' => $this->connection->escape($value), ]; }
php
private function addWhere($field, $operator, $value = null) { $this->wheres[] = [ 'field' => $field, 'operator' => $this->getOperator($operator), 'value' => $this->connection->escape($value), ]; }
[ "private", "function", "addWhere", "(", "$", "field", ",", "$", "operator", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "wheres", "[", "]", "=", "[", "'field'", "=>", "$", "field", ",", "'operator'", "=>", "$", "this", "->", "getOp...
Adds the inserted field, operator and value to the wheres property array. @param string $field @param string $operator @param null $value @throws InvalidQueryOperator
[ "Adds", "the", "inserted", "field", "operator", "and", "value", "to", "the", "wheres", "property", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L235-L242
train
adldap/adLDAP
src/Query/Builder.php
Builder.addOrWhere
private function addOrWhere($field, $operator, $value = null) { $this->orWheres[] = [ 'field' => $field, 'operator' => $this->getOperator($operator), 'value' => $this->connection->escape($value), ]; }
php
private function addOrWhere($field, $operator, $value = null) { $this->orWheres[] = [ 'field' => $field, 'operator' => $this->getOperator($operator), 'value' => $this->connection->escape($value), ]; }
[ "private", "function", "addOrWhere", "(", "$", "field", ",", "$", "operator", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "orWheres", "[", "]", "=", "[", "'field'", "=>", "$", "field", ",", "'operator'", "=>", "$", "this", "->", "g...
Adds the inserted field, operator and value to the orWheres property array. @param string $field @param string $operator @param null $value @throws InvalidQueryOperator
[ "Adds", "the", "inserted", "field", "operator", "and", "value", "to", "the", "orWheres", "property", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L254-L261
train
adldap/adLDAP
src/Query/Builder.php
Builder.buildDoesNotEqual
private function buildDoesNotEqual($field, $value) { return $this::$open.Operator::$doesNotEqual.$this->buildEquals($field, $value).$this::$close; }
php
private function buildDoesNotEqual($field, $value) { return $this::$open.Operator::$doesNotEqual.$this->buildEquals($field, $value).$this::$close; }
[ "private", "function", "buildDoesNotEqual", "(", "$", "field", ",", "$", "value", ")", "{", "return", "$", "this", "::", "$", "open", ".", "Operator", "::", "$", "doesNotEqual", ".", "$", "this", "->", "buildEquals", "(", "$", "field", ",", "$", "value...
Returns a query string for does not equal. Produces: (!(field=value)) @param string $field @param string $value @return string
[ "Returns", "a", "query", "string", "for", "does", "not", "equal", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L273-L276
train
adldap/adLDAP
src/Query/Builder.php
Builder.buildEquals
private function buildEquals($field, $value) { return $this::$open.$field.Operator::$equals.$value.$this::$close; }
php
private function buildEquals($field, $value) { return $this::$open.$field.Operator::$equals.$value.$this::$close; }
[ "private", "function", "buildEquals", "(", "$", "field", ",", "$", "value", ")", "{", "return", "$", "this", "::", "$", "open", ".", "$", "field", ".", "Operator", "::", "$", "equals", ".", "$", "value", ".", "$", "this", "::", "$", "close", ";", ...
Returns a query string for equals. Produces: (field=value) @param string $field @param string $value @return string
[ "Returns", "a", "query", "string", "for", "equals", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L288-L291
train
adldap/adLDAP
src/Query/Builder.php
Builder.buildGreaterThanOrEquals
private function buildGreaterThanOrEquals($field, $value) { return $this::$open.$field.Operator::$greaterThanOrEqual.$value.$this::$close; }
php
private function buildGreaterThanOrEquals($field, $value) { return $this::$open.$field.Operator::$greaterThanOrEqual.$value.$this::$close; }
[ "private", "function", "buildGreaterThanOrEquals", "(", "$", "field", ",", "$", "value", ")", "{", "return", "$", "this", "::", "$", "open", ".", "$", "field", ".", "Operator", "::", "$", "greaterThanOrEqual", ".", "$", "value", ".", "$", "this", "::", ...
Returns a query string for greater than or equals. Produces: (field<=value) @param string $field @param string $value @return string
[ "Returns", "a", "query", "string", "for", "greater", "than", "or", "equals", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L303-L306
train
adldap/adLDAP
src/Query/Builder.php
Builder.buildLessThanOrEquals
private function buildLessThanOrEquals($field, $value) { return $this::$open.$field.Operator::$lessThanOrEqual.$value.$this::$close; }
php
private function buildLessThanOrEquals($field, $value) { return $this::$open.$field.Operator::$lessThanOrEqual.$value.$this::$close; }
[ "private", "function", "buildLessThanOrEquals", "(", "$", "field", ",", "$", "value", ")", "{", "return", "$", "this", "::", "$", "open", ".", "$", "field", ".", "Operator", "::", "$", "lessThanOrEqual", ".", "$", "value", ".", "$", "this", "::", "$", ...
Returns a query string for less than or equals. Produces: (field<=value) @param string $field @param string $value @return string
[ "Returns", "a", "query", "string", "for", "less", "than", "or", "equals", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L318-L321
train
adldap/adLDAP
src/Query/Builder.php
Builder.buildApproximatelyEquals
private function buildApproximatelyEquals($field, $value) { return $this::$open.$field.Operator::$approximateEqual.$value.$this::$close; }
php
private function buildApproximatelyEquals($field, $value) { return $this::$open.$field.Operator::$approximateEqual.$value.$this::$close; }
[ "private", "function", "buildApproximatelyEquals", "(", "$", "field", ",", "$", "value", ")", "{", "return", "$", "this", "::", "$", "open", ".", "$", "field", ".", "Operator", "::", "$", "approximateEqual", ".", "$", "value", ".", "$", "this", "::", "...
Returns a query string for approximately equals. Produces: (field=value) @param string $field @param string $value @return string
[ "Returns", "a", "query", "string", "for", "approximately", "equals", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L333-L336
train
adldap/adLDAP
src/Query/Builder.php
Builder.buildWildcard
private function buildWildcard($field) { return $this::$open.$field.Operator::$equals.Operator::$wildcard.$this::$close; }
php
private function buildWildcard($field) { return $this::$open.$field.Operator::$equals.Operator::$wildcard.$this::$close; }
[ "private", "function", "buildWildcard", "(", "$", "field", ")", "{", "return", "$", "this", "::", "$", "open", ".", "$", "field", ".", "Operator", "::", "$", "equals", ".", "Operator", "::", "$", "wildcard", ".", "$", "this", "::", "$", "close", ";",...
Returns a query string for a wildcard. Produces: (field=*) @param string $field @return string
[ "Returns", "a", "query", "string", "for", "a", "wildcard", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L392-L395
train
adldap/adLDAP
src/Query/Builder.php
Builder.getOperator
private function getOperator($operator) { $operators = $this->getOperators(); $key = array_search(strtolower($operator), $operators); if ($key !== false && array_key_exists($key, $operators)) { return $operators[$key]; } $operators = implode(', ', $operators); $message = "Operator: $operator cannot be used in an LDAP query. Available operators are $operators"; throw new InvalidQueryOperator($message); }
php
private function getOperator($operator) { $operators = $this->getOperators(); $key = array_search(strtolower($operator), $operators); if ($key !== false && array_key_exists($key, $operators)) { return $operators[$key]; } $operators = implode(', ', $operators); $message = "Operator: $operator cannot be used in an LDAP query. Available operators are $operators"; throw new InvalidQueryOperator($message); }
[ "private", "function", "getOperator", "(", "$", "operator", ")", "{", "$", "operators", "=", "$", "this", "->", "getOperators", "(", ")", ";", "$", "key", "=", "array_search", "(", "strtolower", "(", "$", "operator", ")", ",", "$", "operators", ")", ";...
Retrieves an operator from the available operators. Throws an AdldapException if no operator is found. @param $operator @return string @throws InvalidQueryOperator
[ "Retrieves", "an", "operator", "from", "the", "available", "operators", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L436-L451
train
adldap/adLDAP
src/Query/Builder.php
Builder.getOperators
private function getOperators() { return [ Operator::$wildcard, Operator::$equals, Operator::$doesNotEqual, Operator::$greaterThanOrEqual, Operator::$lessThanOrEqual, Operator::$approximateEqual, Operator::$startsWith, Operator::$endsWith, Operator::$contains, Operator::$and, ]; }
php
private function getOperators() { return [ Operator::$wildcard, Operator::$equals, Operator::$doesNotEqual, Operator::$greaterThanOrEqual, Operator::$lessThanOrEqual, Operator::$approximateEqual, Operator::$startsWith, Operator::$endsWith, Operator::$contains, Operator::$and, ]; }
[ "private", "function", "getOperators", "(", ")", "{", "return", "[", "Operator", "::", "$", "wildcard", ",", "Operator", "::", "$", "equals", ",", "Operator", "::", "$", "doesNotEqual", ",", "Operator", "::", "$", "greaterThanOrEqual", ",", "Operator", "::",...
Returns an array of available operators. @return array
[ "Returns", "an", "array", "of", "available", "operators", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L458-L472
train
adldap/adLDAP
src/Query/Builder.php
Builder.assembleQuery
private function assembleQuery() { $this->assembleWheres(); $this->assembleOrWheres(); /* * Make sure we wrap the query in an 'and' * if using multiple wheres or if we have any * orWheres. For example (&(cn=John*)(|(description=User*))) */ if (count($this->getWheres()) > 1 || count($this->getOrWheres()) > 0) { $this->setQuery($this->buildAnd($this->getQuery())); } }
php
private function assembleQuery() { $this->assembleWheres(); $this->assembleOrWheres(); /* * Make sure we wrap the query in an 'and' * if using multiple wheres or if we have any * orWheres. For example (&(cn=John*)(|(description=User*))) */ if (count($this->getWheres()) > 1 || count($this->getOrWheres()) > 0) { $this->setQuery($this->buildAnd($this->getQuery())); } }
[ "private", "function", "assembleQuery", "(", ")", "{", "$", "this", "->", "assembleWheres", "(", ")", ";", "$", "this", "->", "assembleOrWheres", "(", ")", ";", "/*\n * Make sure we wrap the query in an 'and'\n * if using multiple wheres or if we have any\n ...
Returns an assembled query using the current object parameters. @return string
[ "Returns", "an", "assembled", "query", "using", "the", "current", "object", "parameters", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Query/Builder.php#L479-L493
train
adldap/adLDAP
src/Objects/User.php
User.toCreateSchema
public function toCreateSchema() { $this->validateRequired(); if (!is_array($this->getAttribute('container'))) { throw new AdldapException('Container attribute must be an array'); } // Set the display name if it's not set if ($this->getAttribute('display_name') === null) { $displayName = $this->getAttribute('firstname').' '.$this->getAttribute('surname'); $this->setAttribute('display_name', $displayName); } return $this->getAttributes(); }
php
public function toCreateSchema() { $this->validateRequired(); if (!is_array($this->getAttribute('container'))) { throw new AdldapException('Container attribute must be an array'); } // Set the display name if it's not set if ($this->getAttribute('display_name') === null) { $displayName = $this->getAttribute('firstname').' '.$this->getAttribute('surname'); $this->setAttribute('display_name', $displayName); } return $this->getAttributes(); }
[ "public", "function", "toCreateSchema", "(", ")", "{", "$", "this", "->", "validateRequired", "(", ")", ";", "if", "(", "!", "is_array", "(", "$", "this", "->", "getAttribute", "(", "'container'", ")", ")", ")", "{", "throw", "new", "AdldapException", "(...
Checks the attributes for existence and returns the attributes array. @return array @throws AdldapException
[ "Checks", "the", "attributes", "for", "existence", "and", "returns", "the", "attributes", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Objects/User.php#L32-L48
train
adldap/adLDAP
src/Objects/User.php
User.toModifySchema
public function toModifySchema() { $this->validateRequired(['username']); if ($this->hasAttribute('container')) { if (!is_array($this->getAttribute('container'))) { throw new AdldapException('Container attribute must be an array'); } } return $this->getAttributes(); }
php
public function toModifySchema() { $this->validateRequired(['username']); if ($this->hasAttribute('container')) { if (!is_array($this->getAttribute('container'))) { throw new AdldapException('Container attribute must be an array'); } } return $this->getAttributes(); }
[ "public", "function", "toModifySchema", "(", ")", "{", "$", "this", "->", "validateRequired", "(", "[", "'username'", "]", ")", ";", "if", "(", "$", "this", "->", "hasAttribute", "(", "'container'", ")", ")", "{", "if", "(", "!", "is_array", "(", "$", ...
Checks the username attribute for existence and returns the attributes array. @return array @throws AdldapException
[ "Checks", "the", "username", "attribute", "for", "existence", "and", "returns", "the", "attributes", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Objects/User.php#L57-L68
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.search
public function search($sAMAaccountType = Adldap::ADLDAP_SECURITY_GLOBAL_GROUP, $select = [], $sorted = true) { $search = $this->adldap->search() ->select($select) ->where('objectCategory', '=', 'group'); if ($sAMAaccountType !== null) { $search->where('samaccounttype', '=', $sAMAaccountType); } if ($sorted) { $search->sortBy('samaccountname', 'asc'); } return $search->get(); }
php
public function search($sAMAaccountType = Adldap::ADLDAP_SECURITY_GLOBAL_GROUP, $select = [], $sorted = true) { $search = $this->adldap->search() ->select($select) ->where('objectCategory', '=', 'group'); if ($sAMAaccountType !== null) { $search->where('samaccounttype', '=', $sAMAaccountType); } if ($sorted) { $search->sortBy('samaccountname', 'asc'); } return $search->get(); }
[ "public", "function", "search", "(", "$", "sAMAaccountType", "=", "Adldap", "::", "ADLDAP_SECURITY_GLOBAL_GROUP", ",", "$", "select", "=", "[", "]", ",", "$", "sorted", "=", "true", ")", "{", "$", "search", "=", "$", "this", "->", "adldap", "->", "search...
Returns a complete list of the groups in AD based on a SAM Account Type. @param int $sAMAaccountType The account type to return @param array $select The fields you want to retrieve for each @param bool $sorted Whether to sort the results @return array|bool
[ "Returns", "a", "complete", "list", "of", "the", "groups", "in", "AD", "based", "on", "a", "SAM", "Account", "Type", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L38-L53
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.addGroup
public function addGroup($parent, $child) { // Find the parent group's dn $parentDn = $this->dn($parent); $childDn = $this->dn($child); if ($parentDn && $childDn) { $add['member'] = $childDn; // Add the child to the parent group and return the result return $this->connection->modAdd($parentDn, $add); } return false; }
php
public function addGroup($parent, $child) { // Find the parent group's dn $parentDn = $this->dn($parent); $childDn = $this->dn($child); if ($parentDn && $childDn) { $add['member'] = $childDn; // Add the child to the parent group and return the result return $this->connection->modAdd($parentDn, $add); } return false; }
[ "public", "function", "addGroup", "(", "$", "parent", ",", "$", "child", ")", "{", "// Find the parent group's dn", "$", "parentDn", "=", "$", "this", "->", "dn", "(", "$", "parent", ")", ";", "$", "childDn", "=", "$", "this", "->", "dn", "(", "$", "...
Add a group to a group. @param string $parent The parent group name @param string $child The child group name @return bool
[ "Add", "a", "group", "to", "a", "group", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L63-L78
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.addUser
public function addUser($groupName, $username) { $groupDn = $this->dn($groupName); $userDn = $this->adldap->user()->dn($username); if ($groupDn && $userDn) { $add['member'] = $userDn; return $this->connection->modAdd($groupDn, $add); } return false; }
php
public function addUser($groupName, $username) { $groupDn = $this->dn($groupName); $userDn = $this->adldap->user()->dn($username); if ($groupDn && $userDn) { $add['member'] = $userDn; return $this->connection->modAdd($groupDn, $add); } return false; }
[ "public", "function", "addUser", "(", "$", "groupName", ",", "$", "username", ")", "{", "$", "groupDn", "=", "$", "this", "->", "dn", "(", "$", "groupName", ")", ";", "$", "userDn", "=", "$", "this", "->", "adldap", "->", "user", "(", ")", "->", ...
Add a user to a group. @param string $groupName The group to add the user to @param string $username The user to add to the group @return bool
[ "Add", "a", "user", "to", "a", "group", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L88-L101
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.addContact
public function addContact($groupName, $contactDn) { $groupDn = $this->dn($groupName); if ($groupDn && $contactDn) { $add = []; $add['member'] = $contactDn; return $this->connection->modAdd($groupDn, $add); } return false; }
php
public function addContact($groupName, $contactDn) { $groupDn = $this->dn($groupName); if ($groupDn && $contactDn) { $add = []; $add['member'] = $contactDn; return $this->connection->modAdd($groupDn, $add); } return false; }
[ "public", "function", "addContact", "(", "$", "groupName", ",", "$", "contactDn", ")", "{", "$", "groupDn", "=", "$", "this", "->", "dn", "(", "$", "groupName", ")", ";", "if", "(", "$", "groupDn", "&&", "$", "contactDn", ")", "{", "$", "add", "=",...
Add a contact to a group. @param string $groupName The group to add the contact to @param string $contactDn The DN of the contact to add @return bool
[ "Add", "a", "contact", "to", "a", "group", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L111-L123
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.rename
public function rename($groupName, $newName, $container) { $groupDn = $this->dn($groupName); if ($groupDn) { $newRDN = 'CN='.$newName; // Determine the container $container = array_reverse($container); $container = 'OU='.implode(', OU=', $container); $dn = $container.', '.$this->adldap->getBaseDn(); return $this->connection->rename($groupDn, $newRDN, $dn, true); } return false; }
php
public function rename($groupName, $newName, $container) { $groupDn = $this->dn($groupName); if ($groupDn) { $newRDN = 'CN='.$newName; // Determine the container $container = array_reverse($container); $container = 'OU='.implode(', OU=', $container); $dn = $container.', '.$this->adldap->getBaseDn(); return $this->connection->rename($groupDn, $newRDN, $dn, true); } return false; }
[ "public", "function", "rename", "(", "$", "groupName", ",", "$", "newName", ",", "$", "container", ")", "{", "$", "groupDn", "=", "$", "this", "->", "dn", "(", "$", "groupName", ")", ";", "if", "(", "$", "groupDn", ")", "{", "$", "newRDN", "=", "...
Rename a group. @param string $groupName The group to rename @param string $newName The new name to give the group @param array $container @return bool
[ "Rename", "a", "group", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L162-L179
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.removeGroup
public function removeGroup($parentName, $childName) { $parentDn = $this->dn($parentName); $childDn = $this->dn($childName); if (is_string($parentDn) && is_string($childDn)) { $del = []; $del['member'] = $childDn; return $this->connection->modDelete($parentDn, $del); } return false; }
php
public function removeGroup($parentName, $childName) { $parentDn = $this->dn($parentName); $childDn = $this->dn($childName); if (is_string($parentDn) && is_string($childDn)) { $del = []; $del['member'] = $childDn; return $this->connection->modDelete($parentDn, $del); } return false; }
[ "public", "function", "removeGroup", "(", "$", "parentName", ",", "$", "childName", ")", "{", "$", "parentDn", "=", "$", "this", "->", "dn", "(", "$", "parentName", ")", ";", "$", "childDn", "=", "$", "this", "->", "dn", "(", "$", "childName", ")", ...
Remove a group from a group. @param string $parentName The parent group name @param string $childName The child group name @return bool
[ "Remove", "a", "group", "from", "a", "group", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L189-L203
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.removeUser
public function removeUser($groupName, $username) { $groupDn = $this->dn($groupName); $userDn = $this->adldap->user()->dn($username); if (is_string($groupDn) && is_string($userDn)) { $del = []; $del['member'] = $userDn; return $this->connection->modDelete($groupDn, $del); } return false; }
php
public function removeUser($groupName, $username) { $groupDn = $this->dn($groupName); $userDn = $this->adldap->user()->dn($username); if (is_string($groupDn) && is_string($userDn)) { $del = []; $del['member'] = $userDn; return $this->connection->modDelete($groupDn, $del); } return false; }
[ "public", "function", "removeUser", "(", "$", "groupName", ",", "$", "username", ")", "{", "$", "groupDn", "=", "$", "this", "->", "dn", "(", "$", "groupName", ")", ";", "$", "userDn", "=", "$", "this", "->", "adldap", "->", "user", "(", ")", "->",...
Remove a user from a group. @param string $groupName The group to remove a user from @param string $username The AD user to remove from the group @return bool
[ "Remove", "a", "user", "from", "a", "group", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L213-L227
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.removeContact
public function removeContact($group, $contactName) { // Find the parent dn $groupDn = $this->dn($group); $contactDn = $this->adldap->contact()->dn($contactName); if (is_string($groupDn) && is_string($contactDn)) { $del = []; $del['member'] = $contactDn; return $this->connection->modDelete($groupDn, $del); } return false; }
php
public function removeContact($group, $contactName) { // Find the parent dn $groupDn = $this->dn($group); $contactDn = $this->adldap->contact()->dn($contactName); if (is_string($groupDn) && is_string($contactDn)) { $del = []; $del['member'] = $contactDn; return $this->connection->modDelete($groupDn, $del); } return false; }
[ "public", "function", "removeContact", "(", "$", "group", ",", "$", "contactName", ")", "{", "// Find the parent dn", "$", "groupDn", "=", "$", "this", "->", "dn", "(", "$", "group", ")", ";", "$", "contactDn", "=", "$", "this", "->", "adldap", "->", "...
Remove a contact from a group. @param string $group The group to remove the contact from @param string $contactName The contact to remove @return bool
[ "Remove", "a", "contact", "from", "a", "group", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L237-L252
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.members
public function members($group, $fields = []) { $group = $this->find($group); if (is_array($group) && array_key_exists('member', $group)) { $members = []; foreach ($group['member'] as $member) { $members[] = $this->adldap->search() ->setDn($member) ->select($fields) ->where('objectClass', '=', 'user') ->where('objectClass', '=', 'person') ->first(); } return $members; } return false; }
php
public function members($group, $fields = []) { $group = $this->find($group); if (is_array($group) && array_key_exists('member', $group)) { $members = []; foreach ($group['member'] as $member) { $members[] = $this->adldap->search() ->setDn($member) ->select($fields) ->where('objectClass', '=', 'user') ->where('objectClass', '=', 'person') ->first(); } return $members; } return false; }
[ "public", "function", "members", "(", "$", "group", ",", "$", "fields", "=", "[", "]", ")", "{", "$", "group", "=", "$", "this", "->", "find", "(", "$", "group", ")", ";", "if", "(", "is_array", "(", "$", "group", ")", "&&", "array_key_exists", "...
Return a list of members in a group. @param string $group The group to query @param array $fields The fields to retrieve for each member @return array|bool
[ "Return", "a", "list", "of", "members", "in", "a", "group", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L262-L282
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.recursiveGroups
public function recursiveGroups($groupName) { $groups = []; $info = $this->find($groupName); if (is_array($info) && array_key_exists('cn', $info)) { $groups[] = $info['cn']; if (array_key_exists('memberof', $info)) { if (is_array($info['memberof'])) { foreach ($info['memberof'] as $group) { $explodedDn = $this->connection->explodeDn($group); $groups = array_merge($groups, $this->recursiveGroups($explodedDn[0])); } } } } return $groups; }
php
public function recursiveGroups($groupName) { $groups = []; $info = $this->find($groupName); if (is_array($info) && array_key_exists('cn', $info)) { $groups[] = $info['cn']; if (array_key_exists('memberof', $info)) { if (is_array($info['memberof'])) { foreach ($info['memberof'] as $group) { $explodedDn = $this->connection->explodeDn($group); $groups = array_merge($groups, $this->recursiveGroups($explodedDn[0])); } } } } return $groups; }
[ "public", "function", "recursiveGroups", "(", "$", "groupName", ")", "{", "$", "groups", "=", "[", "]", ";", "$", "info", "=", "$", "this", "->", "find", "(", "$", "groupName", ")", ";", "if", "(", "is_array", "(", "$", "info", ")", "&&", "array_ke...
Return a complete list of "groups in groups". @param string $groupName The group to get the list from @return array|bool
[ "Return", "a", "complete", "list", "of", "groups", "in", "groups", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L291-L312
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.allSecurity
public function allSecurity($includeDescription = false, $search = '*', $sorted = true) { return $this->search(Adldap::ADLDAP_SECURITY_GLOBAL_GROUP, $includeDescription, $search, $sorted); }
php
public function allSecurity($includeDescription = false, $search = '*', $sorted = true) { return $this->search(Adldap::ADLDAP_SECURITY_GLOBAL_GROUP, $includeDescription, $search, $sorted); }
[ "public", "function", "allSecurity", "(", "$", "includeDescription", "=", "false", ",", "$", "search", "=", "'*'", ",", "$", "sorted", "=", "true", ")", "{", "return", "$", "this", "->", "search", "(", "Adldap", "::", "ADLDAP_SECURITY_GLOBAL_GROUP", ",", "...
Returns a complete list of security groups in AD. @param bool $includeDescription Whether to return a description @param string $search Search parameters @param bool $sorted Whether to sort the results @return array|bool
[ "Returns", "a", "complete", "list", "of", "security", "groups", "in", "AD", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L323-L326
train
adldap/adLDAP
src/Classes/AdldapGroups.php
AdldapGroups.allDistribution
public function allDistribution($includeDescription = false, $search = '*', $sorted = true) { return $this->search(Adldap::ADLDAP_DISTRIBUTION_GROUP, $includeDescription, $search, $sorted); }
php
public function allDistribution($includeDescription = false, $search = '*', $sorted = true) { return $this->search(Adldap::ADLDAP_DISTRIBUTION_GROUP, $includeDescription, $search, $sorted); }
[ "public", "function", "allDistribution", "(", "$", "includeDescription", "=", "false", ",", "$", "search", "=", "'*'", ",", "$", "sorted", "=", "true", ")", "{", "return", "$", "this", "->", "search", "(", "Adldap", "::", "ADLDAP_DISTRIBUTION_GROUP", ",", ...
Returns a complete list of distribution lists in AD. @param bool $includeDescription Whether to return a description @param string $search Search parameters @param bool $sorted Whether to sort the results @return array|bool
[ "Returns", "a", "complete", "list", "of", "distribution", "lists", "in", "AD", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapGroups.php#L337-L340
train
adldap/adLDAP
src/Classes/AdldapComputers.php
AdldapComputers.groups
public function groups($computerName, $recursive = null) { if ($recursive === null) { $recursive = $this->adldap->getRecursiveGroups(); } $info = $this->find($computerName); if (is_array($info) && array_key_exists('memberof', $info)) { $groups = $this->adldap->utilities()->niceNames($info['memberof']); if ($recursive === true) { foreach ($groups as $id => $groupName) { $extraGroups = $this->adldap->group()->recursiveGroups($groupName); $groups = array_merge($groups, $extraGroups); } } return $groups; } return false; }
php
public function groups($computerName, $recursive = null) { if ($recursive === null) { $recursive = $this->adldap->getRecursiveGroups(); } $info = $this->find($computerName); if (is_array($info) && array_key_exists('memberof', $info)) { $groups = $this->adldap->utilities()->niceNames($info['memberof']); if ($recursive === true) { foreach ($groups as $id => $groupName) { $extraGroups = $this->adldap->group()->recursiveGroups($groupName); $groups = array_merge($groups, $extraGroups); } } return $groups; } return false; }
[ "public", "function", "groups", "(", "$", "computerName", ",", "$", "recursive", "=", "null", ")", "{", "if", "(", "$", "recursive", "===", "null", ")", "{", "$", "recursive", "=", "$", "this", "->", "adldap", "->", "getRecursiveGroups", "(", ")", ";",...
Get the groups a computer is in. @param string $computerName The name of the computer @param null $recursive Whether to check recursively @return array|bool
[ "Get", "the", "groups", "a", "computer", "is", "in", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapComputers.php#L27-L50
train
adldap/adLDAP
src/Classes/AdldapSearch.php
AdldapSearch.orWhere
public function orWhere($field, $operator = null, $value = null) { $this->query->orWhere($field, $operator, $value); return $this; }
php
public function orWhere($field, $operator = null, $value = null) { $this->query->orWhere($field, $operator, $value); return $this; }
[ "public", "function", "orWhere", "(", "$", "field", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "query", "->", "orWhere", "(", "$", "field", ",", "$", "operator", ",", "$", "value", ")", ";", "r...
Adds an orWhere clause to the current query. @param string $field @param string $operator @param string $value @return $this
[ "Adds", "an", "orWhere", "clause", "to", "the", "current", "query", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapSearch.php#L218-L223
train
adldap/adLDAP
src/Classes/AdldapSearch.php
AdldapSearch.setDn
public function setDn($dn) { if ($dn === null) { $this->dn = null; } else { $this->dn = (string) $dn; } return $this; }
php
public function setDn($dn) { if ($dn === null) { $this->dn = null; } else { $this->dn = (string) $dn; } return $this; }
[ "public", "function", "setDn", "(", "$", "dn", ")", "{", "if", "(", "$", "dn", "===", "null", ")", "{", "$", "this", "->", "dn", "=", "null", ";", "}", "else", "{", "$", "this", "->", "dn", "=", "(", "string", ")", "$", "dn", ";", "}", "ret...
Sets the complete distinguished name to search on. @param string $dn @return $this
[ "Sets", "the", "complete", "distinguished", "name", "to", "search", "on", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapSearch.php#L315-L324
train
adldap/adLDAP
src/Classes/AdldapSearch.php
AdldapSearch.getDn
public function getDn() { if ($this->dn === null) { return $this->dn; } elseif (empty($this->dn)) { return $this->adldap->getBaseDn(); } return $this->dn; }
php
public function getDn() { if ($this->dn === null) { return $this->dn; } elseif (empty($this->dn)) { return $this->adldap->getBaseDn(); } return $this->dn; }
[ "public", "function", "getDn", "(", ")", "{", "if", "(", "$", "this", "->", "dn", "===", "null", ")", "{", "return", "$", "this", "->", "dn", ";", "}", "elseif", "(", "empty", "(", "$", "this", "->", "dn", ")", ")", "{", "return", "$", "this", ...
Returns the current distinguished name. This will return the domains base DN if a search DN is not set. @return string
[ "Returns", "the", "current", "distinguished", "name", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapSearch.php#L334-L343
train
adldap/adLDAP
src/Classes/AdldapSearch.php
AdldapSearch.recursive
public function recursive($recursive = true) { $this->recursive = true; if ($recursive === false) { $this->recursive = false; } return $this; }
php
public function recursive($recursive = true) { $this->recursive = true; if ($recursive === false) { $this->recursive = false; } return $this; }
[ "public", "function", "recursive", "(", "$", "recursive", "=", "true", ")", "{", "$", "this", "->", "recursive", "=", "true", ";", "if", "(", "$", "recursive", "===", "false", ")", "{", "$", "this", "->", "recursive", "=", "false", ";", "}", "return"...
Sets the recursive property to tell the search whether or not to search recursively. @param bool $recursive @return $this
[ "Sets", "the", "recursive", "property", "to", "tell", "the", "search", "whether", "or", "not", "to", "search", "recursively", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapSearch.php#L353-L362
train
adldap/adLDAP
src/Classes/AdldapSearch.php
AdldapSearch.read
public function read($read = false) { $this->read = true; if ($read === false) { $this->read = false; } return $this; }
php
public function read($read = false) { $this->read = true; if ($read === false) { $this->read = false; } return $this; }
[ "public", "function", "read", "(", "$", "read", "=", "false", ")", "{", "$", "this", "->", "read", "=", "true", ";", "if", "(", "$", "read", "===", "false", ")", "{", "$", "this", "->", "read", "=", "false", ";", "}", "return", "$", "this", ";"...
Sets the recursive property to tell the search whether or not to search on the base scope and return a single entry. @param bool $read @return $this
[ "Sets", "the", "recursive", "property", "to", "tell", "the", "search", "whether", "or", "not", "to", "search", "on", "the", "base", "scope", "and", "return", "a", "single", "entry", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapSearch.php#L373-L382
train
adldap/adLDAP
src/Classes/AdldapSearch.php
AdldapSearch.newPaginator
public function newPaginator($entries, $perPage, $currentPage, $totalPages) { return new Paginator($entries, $perPage, $currentPage, $totalPages); }
php
public function newPaginator($entries, $perPage, $currentPage, $totalPages) { return new Paginator($entries, $perPage, $currentPage, $totalPages); }
[ "public", "function", "newPaginator", "(", "$", "entries", ",", "$", "perPage", ",", "$", "currentPage", ",", "$", "totalPages", ")", "{", "return", "new", "Paginator", "(", "$", "entries", ",", "$", "perPage", ",", "$", "currentPage", ",", "$", "totalPa...
Returns a new Paginator instance. @param array $entries @param int $perPage @param int $currentPage @param int $totalPages @return Paginator
[ "Returns", "a", "new", "Paginator", "instance", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapSearch.php#L407-L410
train
adldap/adLDAP
src/Classes/AdldapSearch.php
AdldapSearch.processResults
private function processResults($results) { $entries = $this->connection->getEntries($results); $objects = []; if (array_key_exists('count', $entries)) { for ($i = 0; $i < $entries['count']; $i++) { $entry = $this->newLdapEntry($entries[$i], $this->connection); $objects[] = $entry->getAttributes(); } if (!empty($this->sortByField)) { return $this->processSortBy($objects); } } return $objects; }
php
private function processResults($results) { $entries = $this->connection->getEntries($results); $objects = []; if (array_key_exists('count', $entries)) { for ($i = 0; $i < $entries['count']; $i++) { $entry = $this->newLdapEntry($entries[$i], $this->connection); $objects[] = $entry->getAttributes(); } if (!empty($this->sortByField)) { return $this->processSortBy($objects); } } return $objects; }
[ "private", "function", "processResults", "(", "$", "results", ")", "{", "$", "entries", "=", "$", "this", "->", "connection", "->", "getEntries", "(", "$", "results", ")", ";", "$", "objects", "=", "[", "]", ";", "if", "(", "array_key_exists", "(", "'c...
Processes LDAP search results into a nice array. @param resource $results @return array
[ "Processes", "LDAP", "search", "results", "into", "a", "nice", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapSearch.php#L429-L448
train
adldap/adLDAP
src/Classes/AdldapSearch.php
AdldapSearch.processSortBy
private function processSortBy($objects) { if (count($objects) > 0) { foreach ($objects as $key => $row) { if (array_key_exists($this->sortByField, $row)) { $sort[$key] = $row[$this->sortByField]; } } array_multisort($sort, $this->sortByDirection, $objects); } return $objects; }
php
private function processSortBy($objects) { if (count($objects) > 0) { foreach ($objects as $key => $row) { if (array_key_exists($this->sortByField, $row)) { $sort[$key] = $row[$this->sortByField]; } } array_multisort($sort, $this->sortByDirection, $objects); } return $objects; }
[ "private", "function", "processSortBy", "(", "$", "objects", ")", "{", "if", "(", "count", "(", "$", "objects", ")", ">", "0", ")", "{", "foreach", "(", "$", "objects", "as", "$", "key", "=>", "$", "row", ")", "{", "if", "(", "array_key_exists", "(...
Processes the array of specified object results and sorts them by the field and direction search property. @param $objects @param array
[ "Processes", "the", "array", "of", "specified", "object", "results", "and", "sorts", "them", "by", "the", "field", "and", "direction", "search", "property", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapSearch.php#L508-L521
train
adldap/adLDAP
src/Classes/AdldapExchange.php
AdldapExchange.all
public function all($fields = [], $sorted = true, $sortBy = 'cn', $sortByDirection = 'asc') { $namingContext = $this->getConfigurationNamingContext(); if ($namingContext) { $search = $this->adldap->search() ->setDn($namingContext) ->select($fields) ->where('objectCategory', '=', $this->serverObjectCategory); if ($sorted) { $search->sortBy($sortBy, $sortByDirection); } return $search->get(); } return false; }
php
public function all($fields = [], $sorted = true, $sortBy = 'cn', $sortByDirection = 'asc') { $namingContext = $this->getConfigurationNamingContext(); if ($namingContext) { $search = $this->adldap->search() ->setDn($namingContext) ->select($fields) ->where('objectCategory', '=', $this->serverObjectCategory); if ($sorted) { $search->sortBy($sortBy, $sortByDirection); } return $search->get(); } return false; }
[ "public", "function", "all", "(", "$", "fields", "=", "[", "]", ",", "$", "sorted", "=", "true", ",", "$", "sortBy", "=", "'cn'", ",", "$", "sortByDirection", "=", "'asc'", ")", "{", "$", "namingContext", "=", "$", "this", "->", "getConfigurationNaming...
Returns all exchange servers. @param array $fields @param bool $sorted @param string $sortBy @param string $sortByDirection @return array|bool
[ "Returns", "all", "exchange", "servers", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapExchange.php#L39-L57
train
adldap/adLDAP
src/Classes/AdldapExchange.php
AdldapExchange.find
public function find($name, $fields = []) { $namingContext = $this->getConfigurationNamingContext(); if ($namingContext) { return $this->adldap->search() ->setDn($namingContext) ->select($fields) ->where('objectCategory', '=', $this->serverObjectCategory) ->where('anr', '=', $name) ->first(); } return false; }
php
public function find($name, $fields = []) { $namingContext = $this->getConfigurationNamingContext(); if ($namingContext) { return $this->adldap->search() ->setDn($namingContext) ->select($fields) ->where('objectCategory', '=', $this->serverObjectCategory) ->where('anr', '=', $name) ->first(); } return false; }
[ "public", "function", "find", "(", "$", "name", ",", "$", "fields", "=", "[", "]", ")", "{", "$", "namingContext", "=", "$", "this", "->", "getConfigurationNamingContext", "(", ")", ";", "if", "(", "$", "namingContext", ")", "{", "return", "$", "this",...
Finds an exchange server. @param string $name @param array $fields @return array|bool
[ "Finds", "an", "exchange", "server", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapExchange.php#L67-L81
train
adldap/adLDAP
src/Classes/AdldapExchange.php
AdldapExchange.createMailbox
public function createMailbox($username, $storageGroup, $emailAddress, $mailNickname = null, $useDefaults = true, $baseDn = null, $isGUID = false) { $mailbox = new Mailbox([ 'username' => $username, 'storageGroup' => $storageGroup, 'emailAddress' => $emailAddress, 'mailNickname' => $mailNickname, 'baseDn' => ($baseDn ? $baseDn : $this->adldap->getBaseDn()), 'mdbUseDefaults' => $this->adldap->utilities()->boolToStr($useDefaults), ]); // Validate the mailbox fields $mailbox->validateRequired(); // Set the container attribute by imploding the storage group array $mailbox->setAttribute('container', 'CN='.implode(',CN=', $storageGroup)); // Set the mail nickname to the username if it isn't provided if ($mailbox->{'mailNickname'} === null) { $mailbox->setAttribute('mailNickname', $mailbox->{'username'}); } // Perform the creation and return the result return $this->adldap->user()->modify($username, $mailbox->toLdapArray(), $isGUID); }
php
public function createMailbox($username, $storageGroup, $emailAddress, $mailNickname = null, $useDefaults = true, $baseDn = null, $isGUID = false) { $mailbox = new Mailbox([ 'username' => $username, 'storageGroup' => $storageGroup, 'emailAddress' => $emailAddress, 'mailNickname' => $mailNickname, 'baseDn' => ($baseDn ? $baseDn : $this->adldap->getBaseDn()), 'mdbUseDefaults' => $this->adldap->utilities()->boolToStr($useDefaults), ]); // Validate the mailbox fields $mailbox->validateRequired(); // Set the container attribute by imploding the storage group array $mailbox->setAttribute('container', 'CN='.implode(',CN=', $storageGroup)); // Set the mail nickname to the username if it isn't provided if ($mailbox->{'mailNickname'} === null) { $mailbox->setAttribute('mailNickname', $mailbox->{'username'}); } // Perform the creation and return the result return $this->adldap->user()->modify($username, $mailbox->toLdapArray(), $isGUID); }
[ "public", "function", "createMailbox", "(", "$", "username", ",", "$", "storageGroup", ",", "$", "emailAddress", ",", "$", "mailNickname", "=", "null", ",", "$", "useDefaults", "=", "true", ",", "$", "baseDn", "=", "null", ",", "$", "isGUID", "=", "false...
Create an Exchange account. @param string $username The username of the user to add the Exchange account to @param array $storageGroup The mailbox, Exchange Storage Group, for the user account, this must be a full CN @param string $emailAddress The primary email address to add to this user @param null $mailNickname The mail nick name. If mail nickname is blank, the username will be used @param bool $useDefaults Indicates whether the store should use the default quota, rather than the per-mailbox quota. @param null $baseDn Specify an alternative base_dn for the Exchange storage group @param bool $isGUID Is the username passed a GUID or a samAccountName @return bool|string @throws AdldapException
[ "Create", "an", "Exchange", "account", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapExchange.php#L98-L122
train
adldap/adLDAP
src/Classes/AdldapExchange.php
AdldapExchange.deleteAddress
public function deleteAddress($username, $emailAddress, $isGUID = false) { $this->adldap->utilities()->validateNotNull('Username', $username); $this->adldap->utilities()->validateNotNull('Email Address', $emailAddress); // Find the dn of the user $user = $this->adldap->user()->info($username, ['cn', 'proxyaddresses'], $isGUID); if ($user[0]['dn'] === null) { return false; } $userDn = $user[0]['dn']; if (is_array($user[0]['proxyaddresses'])) { $mod = []; for ($i = 0; $i < $user[0]['proxyaddresses']['count']; $i++) { if (strpos($user[0]['proxyaddresses'][$i], 'SMTP:') !== false && $user[0]['proxyaddresses'][$i] == 'SMTP:'.$emailAddress) { $mod['proxyAddresses'][0] = 'SMTP:'.$emailAddress; } elseif (strpos($user[0]['proxyaddresses'][$i], 'smtp:') !== false && $user[0]['proxyaddresses'][$i] == 'smtp:'.$emailAddress) { $mod['proxyAddresses'][0] = 'smtp:'.$emailAddress; } } return $this->connection->modDelete($userDn, $mod); } return false; }
php
public function deleteAddress($username, $emailAddress, $isGUID = false) { $this->adldap->utilities()->validateNotNull('Username', $username); $this->adldap->utilities()->validateNotNull('Email Address', $emailAddress); // Find the dn of the user $user = $this->adldap->user()->info($username, ['cn', 'proxyaddresses'], $isGUID); if ($user[0]['dn'] === null) { return false; } $userDn = $user[0]['dn']; if (is_array($user[0]['proxyaddresses'])) { $mod = []; for ($i = 0; $i < $user[0]['proxyaddresses']['count']; $i++) { if (strpos($user[0]['proxyaddresses'][$i], 'SMTP:') !== false && $user[0]['proxyaddresses'][$i] == 'SMTP:'.$emailAddress) { $mod['proxyAddresses'][0] = 'SMTP:'.$emailAddress; } elseif (strpos($user[0]['proxyaddresses'][$i], 'smtp:') !== false && $user[0]['proxyaddresses'][$i] == 'smtp:'.$emailAddress) { $mod['proxyAddresses'][0] = 'smtp:'.$emailAddress; } } return $this->connection->modDelete($userDn, $mod); } return false; }
[ "public", "function", "deleteAddress", "(", "$", "username", ",", "$", "emailAddress", ",", "$", "isGUID", "=", "false", ")", "{", "$", "this", "->", "adldap", "->", "utilities", "(", ")", "->", "validateNotNull", "(", "'Username'", ",", "$", "username", ...
Remove an address to Exchange. If you remove a default address the account will no longer have a default, we recommend changing the default address first. @param string $username The username of the user to add the Exchange account to @param string $emailAddress The email address to add to this user @param bool $isGUID Is the username passed a GUID or a samAccountName @return bool|string
[ "Remove", "an", "address", "to", "Exchange", ".", "If", "you", "remove", "a", "default", "address", "the", "account", "will", "no", "longer", "have", "a", "default", "we", "recommend", "changing", "the", "default", "address", "first", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapExchange.php#L251-L280
train
adldap/adLDAP
src/Classes/AdldapExchange.php
AdldapExchange.primaryAddress
public function primaryAddress($username, $emailAddress, $isGUID = false) { $this->adldap->utilities()->validateNotNull('Username', $username); $this->adldap->utilities()->validateNotNull('Email Address', $emailAddress); // Find the dn of the user $user = $this->adldap->user()->info($username, ['cn', 'proxyaddresses'], $isGUID); if ($user[0]['dn'] === null) { return false; } $userDn = $user[0]['dn']; if (is_array($user[0]['proxyaddresses'])) { $modAddresses = []; for ($i = 0; $i < $user[0]['proxyaddresses']['count']; $i++) { if (strpos($user[0]['proxyaddresses'][$i], 'SMTP:') !== false) { $user[0]['proxyaddresses'][$i] = str_replace('SMTP:', 'smtp:', $user[0]['proxyaddresses'][$i]); } if ($user[0]['proxyaddresses'][$i] == 'smtp:'.$emailAddress) { $user[0]['proxyaddresses'][$i] = str_replace('smtp:', 'SMTP:', $user[0]['proxyaddresses'][$i]); } if ($user[0]['proxyaddresses'][$i] != '') { $modAddresses['proxyAddresses'][$i] = $user[0]['proxyaddresses'][$i]; } } return $this->connection->modReplace($userDn, $modAddresses); } return false; }
php
public function primaryAddress($username, $emailAddress, $isGUID = false) { $this->adldap->utilities()->validateNotNull('Username', $username); $this->adldap->utilities()->validateNotNull('Email Address', $emailAddress); // Find the dn of the user $user = $this->adldap->user()->info($username, ['cn', 'proxyaddresses'], $isGUID); if ($user[0]['dn'] === null) { return false; } $userDn = $user[0]['dn']; if (is_array($user[0]['proxyaddresses'])) { $modAddresses = []; for ($i = 0; $i < $user[0]['proxyaddresses']['count']; $i++) { if (strpos($user[0]['proxyaddresses'][$i], 'SMTP:') !== false) { $user[0]['proxyaddresses'][$i] = str_replace('SMTP:', 'smtp:', $user[0]['proxyaddresses'][$i]); } if ($user[0]['proxyaddresses'][$i] == 'smtp:'.$emailAddress) { $user[0]['proxyaddresses'][$i] = str_replace('smtp:', 'SMTP:', $user[0]['proxyaddresses'][$i]); } if ($user[0]['proxyaddresses'][$i] != '') { $modAddresses['proxyAddresses'][$i] = $user[0]['proxyaddresses'][$i]; } } return $this->connection->modReplace($userDn, $modAddresses); } return false; }
[ "public", "function", "primaryAddress", "(", "$", "username", ",", "$", "emailAddress", ",", "$", "isGUID", "=", "false", ")", "{", "$", "this", "->", "adldap", "->", "utilities", "(", ")", "->", "validateNotNull", "(", "'Username'", ",", "$", "username", ...
Change the default address. @param string $username The username of the user to add the Exchange account to @param string $emailAddress The email address to make default @param bool $isGUID Is the username passed a GUID or a samAccountName @return bool|string
[ "Change", "the", "default", "address", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapExchange.php#L291-L326
train
adldap/adLDAP
src/Classes/AdldapExchange.php
AdldapExchange.contactMailEnable
public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = null) { $this->adldap->utilities()->validateNotNull('Distinguished Name [dn]', $distinguishedName); $this->adldap->utilities()->validateNotNull('Email Address', $emailAddress); if ($mailNickname !== null) { // Find the dn of the user $user = $this->adldap->contact()->info($distinguishedName, ['cn', 'displayname']); if ($user[0]['displayname'] === null) { return false; } $mailNickname = $user[0]['displayname'][0]; } $attributes = ['email' => $emailAddress,'contact_email' => 'SMTP:'.$emailAddress,'exchange_proxyaddress' => 'SMTP:'.$emailAddress,'exchange_mailnickname' => $mailNickname]; // Translate the update to the LDAP schema $mod = $this->adldap->ldapSchema($attributes); // Check to see if this is an enabled status update if (!$mod) { return false; } // Do the update return $this->connection->modify($distinguishedName, $mod); }
php
public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = null) { $this->adldap->utilities()->validateNotNull('Distinguished Name [dn]', $distinguishedName); $this->adldap->utilities()->validateNotNull('Email Address', $emailAddress); if ($mailNickname !== null) { // Find the dn of the user $user = $this->adldap->contact()->info($distinguishedName, ['cn', 'displayname']); if ($user[0]['displayname'] === null) { return false; } $mailNickname = $user[0]['displayname'][0]; } $attributes = ['email' => $emailAddress,'contact_email' => 'SMTP:'.$emailAddress,'exchange_proxyaddress' => 'SMTP:'.$emailAddress,'exchange_mailnickname' => $mailNickname]; // Translate the update to the LDAP schema $mod = $this->adldap->ldapSchema($attributes); // Check to see if this is an enabled status update if (!$mod) { return false; } // Do the update return $this->connection->modify($distinguishedName, $mod); }
[ "public", "function", "contactMailEnable", "(", "$", "distinguishedName", ",", "$", "emailAddress", ",", "$", "mailNickname", "=", "null", ")", "{", "$", "this", "->", "adldap", "->", "utilities", "(", ")", "->", "validateNotNull", "(", "'Distinguished Name [dn]...
Mail enable a contact Allows email to be sent to them through Exchange. @param string $distinguishedName The contact to mail enable @param string $emailAddress The email address to allow emails to be sent through @param string $mailNickname The mailnickname for the contact in Exchange. If NULL this will be set to the display name @return bool
[ "Mail", "enable", "a", "contact", "Allows", "email", "to", "be", "sent", "to", "them", "through", "Exchange", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapExchange.php#L338-L366
train
adldap/adLDAP
src/Classes/AdldapExchange.php
AdldapExchange.storageGroups
public function storageGroups($exchangeServer, $attributes = ['cn', 'distinguishedname'], $recursive = null) { $this->adldap->utilities()->validateNotNull('Exchange Server', $exchangeServer); $this->adldap->utilities()->validateLdapIsBound(); if ($recursive === null) { $recursive = $this->adldap->getRecursiveGroups(); } $filter = "(&(objectCategory=$this->storageGroupObjectCategory))"; $results = $this->connection->search($exchangeServer, $filter, $attributes); if ($results) { $entries = $this->connection->getEntries($results); if ($recursive === true) { for ($i = 0; $i < $entries['count']; $i++) { $entries[$i]['msexchprivatemdb'] = $this->storageDatabases($entries[$i]['distinguishedname'][0]); } } return $entries; } return false; }
php
public function storageGroups($exchangeServer, $attributes = ['cn', 'distinguishedname'], $recursive = null) { $this->adldap->utilities()->validateNotNull('Exchange Server', $exchangeServer); $this->adldap->utilities()->validateLdapIsBound(); if ($recursive === null) { $recursive = $this->adldap->getRecursiveGroups(); } $filter = "(&(objectCategory=$this->storageGroupObjectCategory))"; $results = $this->connection->search($exchangeServer, $filter, $attributes); if ($results) { $entries = $this->connection->getEntries($results); if ($recursive === true) { for ($i = 0; $i < $entries['count']; $i++) { $entries[$i]['msexchprivatemdb'] = $this->storageDatabases($entries[$i]['distinguishedname'][0]); } } return $entries; } return false; }
[ "public", "function", "storageGroups", "(", "$", "exchangeServer", ",", "$", "attributes", "=", "[", "'cn'", ",", "'distinguishedname'", "]", ",", "$", "recursive", "=", "null", ")", "{", "$", "this", "->", "adldap", "->", "utilities", "(", ")", "->", "v...
Returns a list of Storage Groups in Exchange for a given mail server. @param string $exchangeServer The full DN of an Exchange server. You can use exchange_servers() to find the DN for your server @param array $attributes An array of the AD attributes you wish to return @param null $recursive If enabled this will automatically query the databases within a storage group @return bool|array
[ "Returns", "a", "list", "of", "Storage", "Groups", "in", "Exchange", "for", "a", "given", "mail", "server", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapExchange.php#L389-L416
train
adldap/adLDAP
src/Classes/AdldapExchange.php
AdldapExchange.storageDatabases
public function storageDatabases($storageGroup, $attributes = ['cn', 'distinguishedname', 'displayname']) { $this->adldap->utilities()->validateNotNull('Storage Group', $storageGroup); $this->adldap->utilities()->validateLdapIsBound(); $filter = '(&(objectCategory=msExchPrivateMDB))'; $results = $this->connection->search($storageGroup, $filter, $attributes); $entries = $this->connection->getEntries($results); return $entries; }
php
public function storageDatabases($storageGroup, $attributes = ['cn', 'distinguishedname', 'displayname']) { $this->adldap->utilities()->validateNotNull('Storage Group', $storageGroup); $this->adldap->utilities()->validateLdapIsBound(); $filter = '(&(objectCategory=msExchPrivateMDB))'; $results = $this->connection->search($storageGroup, $filter, $attributes); $entries = $this->connection->getEntries($results); return $entries; }
[ "public", "function", "storageDatabases", "(", "$", "storageGroup", ",", "$", "attributes", "=", "[", "'cn'", ",", "'distinguishedname'", ",", "'displayname'", "]", ")", "{", "$", "this", "->", "adldap", "->", "utilities", "(", ")", "->", "validateNotNull", ...
Returns a list of Databases within any given storage group in Exchange for a given mail server. @param string $storageGroup The full DN of an Storage Group. You can use exchange_storage_groups() to find the DN @param array $attributes An array of the AD attributes you wish to return @return array|bool|string
[ "Returns", "a", "list", "of", "Databases", "within", "any", "given", "storage", "group", "in", "Exchange", "for", "a", "given", "mail", "server", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapExchange.php#L426-L439
train
adldap/adLDAP
src/Classes/AdldapExchange.php
AdldapExchange.getConfigurationNamingContext
private function getConfigurationNamingContext() { $result = $this->adldap->getRootDse(['configurationnamingcontext']); if (is_array($result) && array_key_exists('configurationnamingcontext', $result)) { return $result['configurationnamingcontext']; } return false; }
php
private function getConfigurationNamingContext() { $result = $this->adldap->getRootDse(['configurationnamingcontext']); if (is_array($result) && array_key_exists('configurationnamingcontext', $result)) { return $result['configurationnamingcontext']; } return false; }
[ "private", "function", "getConfigurationNamingContext", "(", ")", "{", "$", "result", "=", "$", "this", "->", "adldap", "->", "getRootDse", "(", "[", "'configurationnamingcontext'", "]", ")", ";", "if", "(", "is_array", "(", "$", "result", ")", "&&", "array_...
Returns the current configuration naming context of the current domain. @return string|bool
[ "Returns", "the", "current", "configuration", "naming", "context", "of", "the", "current", "domain", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapExchange.php#L447-L456
train
adldap/adLDAP
src/Classes/AdldapFolders.php
AdldapFolders.create
public function create(array $attributes) { $folder = new Folder($attributes); $folder->validateRequired(); $folder->setAttribute('container', array_reverse($folder->getAttribute('container'))); $add = []; $add['objectClass'] = 'organizationalUnit'; $add['OU'] = $folder->getAttribute('ou_name'); $containers = 'OU='.implode(',OU=', $folder->getAttribute('container')); $dn = 'OU='.$add['OU'].', '.$containers.$this->adldap->getBaseDn(); return $this->connection->add($dn, $add); }
php
public function create(array $attributes) { $folder = new Folder($attributes); $folder->validateRequired(); $folder->setAttribute('container', array_reverse($folder->getAttribute('container'))); $add = []; $add['objectClass'] = 'organizationalUnit'; $add['OU'] = $folder->getAttribute('ou_name'); $containers = 'OU='.implode(',OU=', $folder->getAttribute('container')); $dn = 'OU='.$add['OU'].', '.$containers.$this->adldap->getBaseDn(); return $this->connection->add($dn, $add); }
[ "public", "function", "create", "(", "array", "$", "attributes", ")", "{", "$", "folder", "=", "new", "Folder", "(", "$", "attributes", ")", ";", "$", "folder", "->", "validateRequired", "(", ")", ";", "$", "folder", "->", "setAttribute", "(", "'containe...
Create an organizational unit. @param array $attributes Default attributes of the ou @return bool|string
[ "Create", "an", "organizational", "unit", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapFolders.php#L124-L142
train
adldap/adLDAP
src/Classes/AdldapUtils.php
AdldapUtils.strGuidToHex
public function strGuidToHex($strGUID) { $strGUID = str_replace('-', '', $strGUID); $octet_str = '\\'.substr($strGUID, 6, 2); $octet_str .= '\\'.substr($strGUID, 4, 2); $octet_str .= '\\'.substr($strGUID, 2, 2); $octet_str .= '\\'.substr($strGUID, 0, 2); $octet_str .= '\\'.substr($strGUID, 10, 2); $octet_str .= '\\'.substr($strGUID, 8, 2); $octet_str .= '\\'.substr($strGUID, 14, 2); $octet_str .= '\\'.substr($strGUID, 12, 2); $length = (strlen($strGUID) - 2); for ($i = 16; $i <= $length; $i++) { if (($i % 2) == 0) { $octet_str .= '\\'.substr($strGUID, $i, 2); } } return $octet_str; }
php
public function strGuidToHex($strGUID) { $strGUID = str_replace('-', '', $strGUID); $octet_str = '\\'.substr($strGUID, 6, 2); $octet_str .= '\\'.substr($strGUID, 4, 2); $octet_str .= '\\'.substr($strGUID, 2, 2); $octet_str .= '\\'.substr($strGUID, 0, 2); $octet_str .= '\\'.substr($strGUID, 10, 2); $octet_str .= '\\'.substr($strGUID, 8, 2); $octet_str .= '\\'.substr($strGUID, 14, 2); $octet_str .= '\\'.substr($strGUID, 12, 2); $length = (strlen($strGUID) - 2); for ($i = 16; $i <= $length; $i++) { if (($i % 2) == 0) { $octet_str .= '\\'.substr($strGUID, $i, 2); } } return $octet_str; }
[ "public", "function", "strGuidToHex", "(", "$", "strGUID", ")", "{", "$", "strGUID", "=", "str_replace", "(", "'-'", ",", "''", ",", "$", "strGUID", ")", ";", "$", "octet_str", "=", "'\\\\'", ".", "substr", "(", "$", "strGUID", ",", "6", ",", "2", ...
Converts a string GUID to a hexdecimal value so it can be queried. @param string $strGUID A string representation of a GUID @return string
[ "Converts", "a", "string", "GUID", "to", "a", "hexdecimal", "value", "so", "it", "can", "be", "queried", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapUtils.php#L61-L83
train
adldap/adLDAP
src/Classes/AdldapUtils.php
AdldapUtils.getTextSID
public function getTextSID($binsid) { $hex_sid = bin2hex($binsid); $rev = hexdec(substr($hex_sid, 0, 2)); $subcount = hexdec(substr($hex_sid, 2, 2)); $auth = hexdec(substr($hex_sid, 4, 12)); $result = "$rev-$auth"; $subauth = []; for ($x = 0;$x < $subcount; $x++) { $subauth[$x] = hexdec($this->littleEndian(substr($hex_sid, 16 + ($x * 8), 8))); $result .= '-'.$subauth[$x]; } // Cheat by tacking on the S- return 'S-'.$result; }
php
public function getTextSID($binsid) { $hex_sid = bin2hex($binsid); $rev = hexdec(substr($hex_sid, 0, 2)); $subcount = hexdec(substr($hex_sid, 2, 2)); $auth = hexdec(substr($hex_sid, 4, 12)); $result = "$rev-$auth"; $subauth = []; for ($x = 0;$x < $subcount; $x++) { $subauth[$x] = hexdec($this->littleEndian(substr($hex_sid, 16 + ($x * 8), 8))); $result .= '-'.$subauth[$x]; } // Cheat by tacking on the S- return 'S-'.$result; }
[ "public", "function", "getTextSID", "(", "$", "binsid", ")", "{", "$", "hex_sid", "=", "bin2hex", "(", "$", "binsid", ")", ";", "$", "rev", "=", "hexdec", "(", "substr", "(", "$", "hex_sid", ",", "0", ",", "2", ")", ")", ";", "$", "subcount", "="...
Convert a binary SID to a text SID. @param string $binsid A Binary SID @return string
[ "Convert", "a", "binary", "SID", "to", "a", "text", "SID", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapUtils.php#L92-L114
train
adldap/adLDAP
src/Classes/AdldapUtils.php
AdldapUtils.binaryToText
public function binaryToText($bin) { $hex_guid = bin2hex($bin); $hex_guid_to_guid_str = ''; for ($k = 1; $k <= 4; ++$k) { $hex_guid_to_guid_str .= substr($hex_guid, 8 - 2 * $k, 2); } $hex_guid_to_guid_str .= '-'; for ($k = 1; $k <= 2; ++$k) { $hex_guid_to_guid_str .= substr($hex_guid, 12 - 2 * $k, 2); } $hex_guid_to_guid_str .= '-'; for ($k = 1; $k <= 2; ++$k) { $hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2); } $hex_guid_to_guid_str .= '-'.substr($hex_guid, 16, 4); $hex_guid_to_guid_str .= '-'.substr($hex_guid, 20); return strtoupper($hex_guid_to_guid_str); }
php
public function binaryToText($bin) { $hex_guid = bin2hex($bin); $hex_guid_to_guid_str = ''; for ($k = 1; $k <= 4; ++$k) { $hex_guid_to_guid_str .= substr($hex_guid, 8 - 2 * $k, 2); } $hex_guid_to_guid_str .= '-'; for ($k = 1; $k <= 2; ++$k) { $hex_guid_to_guid_str .= substr($hex_guid, 12 - 2 * $k, 2); } $hex_guid_to_guid_str .= '-'; for ($k = 1; $k <= 2; ++$k) { $hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2); } $hex_guid_to_guid_str .= '-'.substr($hex_guid, 16, 4); $hex_guid_to_guid_str .= '-'.substr($hex_guid, 20); return strtoupper($hex_guid_to_guid_str); }
[ "public", "function", "binaryToText", "(", "$", "bin", ")", "{", "$", "hex_guid", "=", "bin2hex", "(", "$", "bin", ")", ";", "$", "hex_guid_to_guid_str", "=", "''", ";", "for", "(", "$", "k", "=", "1", ";", "$", "k", "<=", "4", ";", "++", "$", ...
Converts a binary attribute to a string. @param string $bin A binary LDAP attribute @return string
[ "Converts", "a", "binary", "attribute", "to", "a", "string", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapUtils.php#L141-L168
train
adldap/adLDAP
src/Classes/AdldapUtils.php
AdldapUtils.decodeGuid
public function decodeGuid($binaryGuid) { $this->validateNotNull('Binary GUID', $binaryGuid); $strGUID = $this->binaryToText($binaryGuid); return $strGUID; }
php
public function decodeGuid($binaryGuid) { $this->validateNotNull('Binary GUID', $binaryGuid); $strGUID = $this->binaryToText($binaryGuid); return $strGUID; }
[ "public", "function", "decodeGuid", "(", "$", "binaryGuid", ")", "{", "$", "this", "->", "validateNotNull", "(", "'Binary GUID'", ",", "$", "binaryGuid", ")", ";", "$", "strGUID", "=", "$", "this", "->", "binaryToText", "(", "$", "binaryGuid", ")", ";", ...
Converts a binary GUID to a string GUID. @param string $binaryGuid The binary GUID attribute to convert @return string
[ "Converts", "a", "binary", "GUID", "to", "a", "string", "GUID", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapUtils.php#L177-L184
train
adldap/adLDAP
src/Classes/AdldapUtils.php
AdldapUtils.dnStrToArr
public function dnStrToArr($dnStr, $excludeBaseDn = true, $includeAttributes = false) { if ($excludeBaseDn) { return ldap_explode_dn($dnStr, ($includeAttributes ? 0 : 1)); } else { return ldap_explode_dn($this->adldap->getBaseDn().$dnStr, ($includeAttributes ? 0 : 1)); } }
php
public function dnStrToArr($dnStr, $excludeBaseDn = true, $includeAttributes = false) { if ($excludeBaseDn) { return ldap_explode_dn($dnStr, ($includeAttributes ? 0 : 1)); } else { return ldap_explode_dn($this->adldap->getBaseDn().$dnStr, ($includeAttributes ? 0 : 1)); } }
[ "public", "function", "dnStrToArr", "(", "$", "dnStr", ",", "$", "excludeBaseDn", "=", "true", ",", "$", "includeAttributes", "=", "false", ")", "{", "if", "(", "$", "excludeBaseDn", ")", "{", "return", "ldap_explode_dn", "(", "$", "dnStr", ",", "(", "$"...
Convert DN string to array. @param $dnStr @param bool $excludeBaseDn exclude base DN from results @return array
[ "Convert", "DN", "string", "to", "array", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapUtils.php#L245-L252
train
adldap/adLDAP
src/Classes/AdldapUtils.php
AdldapUtils.validateNotNullOrEmpty
public function validateNotNullOrEmpty($parameter, $value) { $this->validateNotNull($parameter, $value); $this->validateNotEmpty($parameter, $value); return true; }
php
public function validateNotNullOrEmpty($parameter, $value) { $this->validateNotNull($parameter, $value); $this->validateNotEmpty($parameter, $value); return true; }
[ "public", "function", "validateNotNullOrEmpty", "(", "$", "parameter", ",", "$", "value", ")", "{", "$", "this", "->", "validateNotNull", "(", "$", "parameter", ",", "$", "value", ")", ";", "$", "this", "->", "validateNotEmpty", "(", "$", "parameter", ",",...
Validates that the inserted value is not null or empty. This will throw an AdldapException otherwise. @param string $parameter @param string $value @return bool @throws AdldapException
[ "Validates", "that", "the", "inserted", "value", "is", "not", "null", "or", "empty", ".", "This", "will", "throw", "an", "AdldapException", "otherwise", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapUtils.php#L303-L310
train
adldap/adLDAP
src/Classes/AdldapUtils.php
AdldapUtils.validateNotNull
public function validateNotNull($parameter, $value) { if ($value !== null) { return true; } $message = sprintf('Parameter: %s cannot be null.', $parameter); throw new AdldapException($message); }
php
public function validateNotNull($parameter, $value) { if ($value !== null) { return true; } $message = sprintf('Parameter: %s cannot be null.', $parameter); throw new AdldapException($message); }
[ "public", "function", "validateNotNull", "(", "$", "parameter", ",", "$", "value", ")", "{", "if", "(", "$", "value", "!==", "null", ")", "{", "return", "true", ";", "}", "$", "message", "=", "sprintf", "(", "'Parameter: %s cannot be null.'", ",", "$", "...
Validates that the inserted value of the specified parameter is not null. This will throw an AdldapException otherwise. @param string $parameter @param mixed $value @return bool @throws AdldapException
[ "Validates", "that", "the", "inserted", "value", "of", "the", "specified", "parameter", "is", "not", "null", ".", "This", "will", "throw", "an", "AdldapException", "otherwise", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapUtils.php#L323-L332
train
adldap/adLDAP
src/Classes/AdldapUtils.php
AdldapUtils.validateNotEmpty
public function validateNotEmpty($parameter, $value) { if (!empty($value)) { return true; } $message = sprintf('Parameter: %s cannot be empty.', $parameter); throw new AdldapException($message); }
php
public function validateNotEmpty($parameter, $value) { if (!empty($value)) { return true; } $message = sprintf('Parameter: %s cannot be empty.', $parameter); throw new AdldapException($message); }
[ "public", "function", "validateNotEmpty", "(", "$", "parameter", ",", "$", "value", ")", "{", "if", "(", "!", "empty", "(", "$", "value", ")", ")", "{", "return", "true", ";", "}", "$", "message", "=", "sprintf", "(", "'Parameter: %s cannot be empty.'", ...
Validates that the inserted value of the specified parameter is not empty. This will throw an AdldapException otherwise. @param string $parameter @param mixed $value @return bool @throws AdldapException
[ "Validates", "that", "the", "inserted", "value", "of", "the", "specified", "parameter", "is", "not", "empty", ".", "This", "will", "throw", "an", "AdldapException", "otherwise", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Classes/AdldapUtils.php#L345-L354
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.getEntries
public function getEntries($searchResults) { if ($this->suppressErrors) { return @ldap_get_entries($this->getConnection(), $searchResults); } else { return ldap_get_entries($this->getConnection(), $searchResults); } }
php
public function getEntries($searchResults) { if ($this->suppressErrors) { return @ldap_get_entries($this->getConnection(), $searchResults); } else { return ldap_get_entries($this->getConnection(), $searchResults); } }
[ "public", "function", "getEntries", "(", "$", "searchResults", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_get_entries", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "searchResults", ")", ";", ...
Retrieves and returns the results of an LDAP search into an array format. @param $searchResults @return array
[ "Retrieves", "and", "returns", "the", "results", "of", "an", "LDAP", "search", "into", "an", "array", "format", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L220-L227
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.getFirstEntry
public function getFirstEntry($searchResults) { if ($this->suppressErrors) { return @ldap_first_entry($this->getConnection(), $searchResults); } return ldap_first_entry($this->getConnection(), $searchResults); }
php
public function getFirstEntry($searchResults) { if ($this->suppressErrors) { return @ldap_first_entry($this->getConnection(), $searchResults); } return ldap_first_entry($this->getConnection(), $searchResults); }
[ "public", "function", "getFirstEntry", "(", "$", "searchResults", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_first_entry", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "searchResults", ")", ";",...
Returns the first entry from the specified search results. @param $searchResults @return resource
[ "Returns", "the", "first", "entry", "from", "the", "specified", "search", "results", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L237-L244
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.countEntries
public function countEntries($searchResults) { if ($this->suppressErrors) { return @ldap_count_entries($this->getConnection(), $searchResults); } return ldap_count_entries($this->getConnection(), $searchResults); }
php
public function countEntries($searchResults) { if ($this->suppressErrors) { return @ldap_count_entries($this->getConnection(), $searchResults); } return ldap_count_entries($this->getConnection(), $searchResults); }
[ "public", "function", "countEntries", "(", "$", "searchResults", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_count_entries", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "searchResults", ")", ";"...
Returns the count of the returned entries from the specified search results. @param $searchResults @return int
[ "Returns", "the", "count", "of", "the", "returned", "entries", "from", "the", "specified", "search", "results", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L254-L261
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.getValuesLen
public function getValuesLen($entry, $attribute) { if ($this->suppressErrors) { return @ldap_get_values_len($this->getConnection(), $entry, $attribute); } return ldap_get_values_len($this->getConnection(), $entry, $attribute); }
php
public function getValuesLen($entry, $attribute) { if ($this->suppressErrors) { return @ldap_get_values_len($this->getConnection(), $entry, $attribute); } return ldap_get_values_len($this->getConnection(), $entry, $attribute); }
[ "public", "function", "getValuesLen", "(", "$", "entry", ",", "$", "attribute", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_get_values_len", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "entry"...
Get all binary values from the specified result entry. @param $entry @param $attribute @return array
[ "Get", "all", "binary", "values", "from", "the", "specified", "result", "entry", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L286-L293
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.setOption
public function setOption($option, $value) { if ($this->suppressErrors) { return @ldap_set_option($this->getConnection(), $option, $value); } return ldap_set_option($this->getConnection(), $option, $value); }
php
public function setOption($option, $value) { if ($this->suppressErrors) { return @ldap_set_option($this->getConnection(), $option, $value); } return ldap_set_option($this->getConnection(), $option, $value); }
[ "public", "function", "setOption", "(", "$", "option", ",", "$", "value", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_set_option", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "option", ",", ...
Sets an option and value on the current LDAP connection. @param int $option @param mixed $value @return bool
[ "Sets", "an", "option", "and", "value", "on", "the", "current", "LDAP", "connection", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L304-L311
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.connect
public function connect($hostname, $port = '389') { $protocol = $this::PROTOCOL; if ($this->isUsingSSL()) { $protocol = $this::PROTOCOL_SSL; } return $this->connection = ldap_connect($protocol.$hostname, $port); }
php
public function connect($hostname, $port = '389') { $protocol = $this::PROTOCOL; if ($this->isUsingSSL()) { $protocol = $this::PROTOCOL_SSL; } return $this->connection = ldap_connect($protocol.$hostname, $port); }
[ "public", "function", "connect", "(", "$", "hostname", ",", "$", "port", "=", "'389'", ")", "{", "$", "protocol", "=", "$", "this", "::", "PROTOCOL", ";", "if", "(", "$", "this", "->", "isUsingSSL", "(", ")", ")", "{", "$", "protocol", "=", "$", ...
Connects to the specified hostname using the PHP ldap protocol. @param string $hostname @param string $port @return resource
[ "Connects", "to", "the", "specified", "hostname", "using", "the", "PHP", "ldap", "protocol", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L336-L345
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.search
public function search($dn, $filter, array $fields) { if ($this->suppressErrors) { return @ldap_search($this->getConnection(), $dn, $filter, $fields); } return ldap_search($this->getConnection(), $dn, $filter, $fields); }
php
public function search($dn, $filter, array $fields) { if ($this->suppressErrors) { return @ldap_search($this->getConnection(), $dn, $filter, $fields); } return ldap_search($this->getConnection(), $dn, $filter, $fields); }
[ "public", "function", "search", "(", "$", "dn", ",", "$", "filter", ",", "array", "$", "fields", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_search", "(", "$", "this", "->", "getConnection", "(", ")", ",",...
Performs a search on the current connection with the specified distinguished name, filter and fields. @param string $dn @param string $filter @param array $fields @return resource
[ "Performs", "a", "search", "on", "the", "current", "connection", "with", "the", "specified", "distinguished", "name", "filter", "and", "fields", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L375-L382
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.listing
public function listing($dn, $filter, array $attributes) { if ($this->suppressErrors) { return @ldap_list($this->getConnection(), $dn, $filter, $attributes); } return ldap_list($this->getConnection(), $dn, $filter, $attributes); }
php
public function listing($dn, $filter, array $attributes) { if ($this->suppressErrors) { return @ldap_list($this->getConnection(), $dn, $filter, $attributes); } return ldap_list($this->getConnection(), $dn, $filter, $attributes); }
[ "public", "function", "listing", "(", "$", "dn", ",", "$", "filter", ",", "array", "$", "attributes", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_list", "(", "$", "this", "->", "getConnection", "(", ")", "...
Performs a single level search on the current connection. @param string $dn @param string $filter @param array $attributes @return mixed
[ "Performs", "a", "single", "level", "search", "on", "the", "current", "connection", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L393-L400
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.read
public function read($dn, $filter, array $fields) { if ($this->suppressErrors) { return @ldap_read($this->getConnection(), $dn, $filter, $fields); } return ldap_read($this->getConnection(), $dn, $filter, $fields); }
php
public function read($dn, $filter, array $fields) { if ($this->suppressErrors) { return @ldap_read($this->getConnection(), $dn, $filter, $fields); } return ldap_read($this->getConnection(), $dn, $filter, $fields); }
[ "public", "function", "read", "(", "$", "dn", ",", "$", "filter", ",", "array", "$", "fields", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_read", "(", "$", "this", "->", "getConnection", "(", ")", ",", "...
Reads an entry on the current LDAP connection. @param $dn @param $filter @param array $fields @return resource
[ "Reads", "an", "entry", "on", "the", "current", "LDAP", "connection", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L411-L418
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.bind
public function bind($username, $password, $sasl = false) { if ($sasl) { if ($this->suppressErrors) { return $this->bound = @ldap_sasl_bind($this->getConnection(), null, null, 'GSSAPI'); } return $this->bound = ldap_sasl_bind($this->getConnection(), null, null, 'GSSAPI'); } else { if ($this->suppressErrors) { return $this->bound = @ldap_bind($this->getConnection(), $username, $password); } return $this->bound = ldap_bind($this->getConnection(), $username, $password); } }
php
public function bind($username, $password, $sasl = false) { if ($sasl) { if ($this->suppressErrors) { return $this->bound = @ldap_sasl_bind($this->getConnection(), null, null, 'GSSAPI'); } return $this->bound = ldap_sasl_bind($this->getConnection(), null, null, 'GSSAPI'); } else { if ($this->suppressErrors) { return $this->bound = @ldap_bind($this->getConnection(), $username, $password); } return $this->bound = ldap_bind($this->getConnection(), $username, $password); } }
[ "public", "function", "bind", "(", "$", "username", ",", "$", "password", ",", "$", "sasl", "=", "false", ")", "{", "if", "(", "$", "sasl", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "$", "this", "->", "bound", ...
Binds to the current LDAP connection. If SASL is true, we'll set up a SASL bind instead. @param string $username @param string $password @param bool $sasl @return bool
[ "Binds", "to", "the", "current", "LDAP", "connection", ".", "If", "SASL", "is", "true", "we", "ll", "set", "up", "a", "SASL", "bind", "instead", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L430-L445
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.add
public function add($dn, array $entry) { if ($this->suppressErrors) { return @ldap_add($this->getConnection(), $dn, $entry); } return ldap_add($this->getConnection(), $dn, $entry); }
php
public function add($dn, array $entry) { if ($this->suppressErrors) { return @ldap_add($this->getConnection(), $dn, $entry); } return ldap_add($this->getConnection(), $dn, $entry); }
[ "public", "function", "add", "(", "$", "dn", ",", "array", "$", "entry", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_add", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ",", "$", "...
Adds entries to the current LDAP directory. @param string $dn @param array $entry @return bool
[ "Adds", "entries", "to", "the", "current", "LDAP", "directory", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L455-L462
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.delete
public function delete($dn) { if ($this->suppressErrors) { return @ldap_delete($this->getConnection(), $dn); } return ldap_delete($this->getConnection(), $dn); }
php
public function delete($dn) { if ($this->suppressErrors) { return @ldap_delete($this->getConnection(), $dn); } return ldap_delete($this->getConnection(), $dn); }
[ "public", "function", "delete", "(", "$", "dn", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_delete", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ")", ";", "}", "return", "ldap_delete...
Deletes an entry on the current LDAP directory. @param string $dn @return bool
[ "Deletes", "an", "entry", "on", "the", "current", "LDAP", "directory", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L471-L478
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.rename
public function rename($dn, $newRdn, $newParent, $deleteOldRdn = false) { if ($this->suppressErrors) { return @ldap_rename($this->getConnection(), $dn, $newRdn, $newParent, $deleteOldRdn); } return ldap_rename($this->getConnection(), $dn, $newRdn, $newParent, $deleteOldRdn); }
php
public function rename($dn, $newRdn, $newParent, $deleteOldRdn = false) { if ($this->suppressErrors) { return @ldap_rename($this->getConnection(), $dn, $newRdn, $newParent, $deleteOldRdn); } return ldap_rename($this->getConnection(), $dn, $newRdn, $newParent, $deleteOldRdn); }
[ "public", "function", "rename", "(", "$", "dn", ",", "$", "newRdn", ",", "$", "newParent", ",", "$", "deleteOldRdn", "=", "false", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_rename", "(", "$", "this", "->...
Modify the name of an LDAP entry. @param string $dn @param string $newRdn @param string $newParent @param bool $deleteOldRdn @return bool
[ "Modify", "the", "name", "of", "an", "LDAP", "entry", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L490-L497
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.modify
public function modify($dn, array $entry) { if ($this->suppressErrors) { return @ldap_modify($this->getConnection(), $dn, $entry); } return ldap_modify($this->getConnection(), $dn, $entry); }
php
public function modify($dn, array $entry) { if ($this->suppressErrors) { return @ldap_modify($this->getConnection(), $dn, $entry); } return ldap_modify($this->getConnection(), $dn, $entry); }
[ "public", "function", "modify", "(", "$", "dn", ",", "array", "$", "entry", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_modify", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ",", "$...
Modifies the specified LDAP entry. @param string $dn @param array $entry @return bool
[ "Modifies", "the", "specified", "LDAP", "entry", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L507-L514
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.modifyBatch
public function modifyBatch($dn, array $entry) { if ($this->suppressErrors) { return @ldap_modify_batch($this->getConnection(), $dn, $entry); } return ldap_modify_batch($this->getConnection(), $dn, $entry); }
php
public function modifyBatch($dn, array $entry) { if ($this->suppressErrors) { return @ldap_modify_batch($this->getConnection(), $dn, $entry); } return ldap_modify_batch($this->getConnection(), $dn, $entry); }
[ "public", "function", "modifyBatch", "(", "$", "dn", ",", "array", "$", "entry", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_modify_batch", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ...
Batch modifies the specified LDAP entry. @param string $dn @param array $entry @return bool
[ "Batch", "modifies", "the", "specified", "LDAP", "entry", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L524-L531
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.modAdd
public function modAdd($dn, array $entry) { if ($this->suppressErrors) { return @ldap_mod_add($this->getConnection(), $dn, $entry); } return ldap_mod_add($this->getConnection(), $dn, $entry); }
php
public function modAdd($dn, array $entry) { if ($this->suppressErrors) { return @ldap_mod_add($this->getConnection(), $dn, $entry); } return ldap_mod_add($this->getConnection(), $dn, $entry); }
[ "public", "function", "modAdd", "(", "$", "dn", ",", "array", "$", "entry", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_mod_add", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ",", "...
Add attribute values to current attributes. @param string $dn @param array $entry @return bool
[ "Add", "attribute", "values", "to", "current", "attributes", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L541-L548
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.modReplace
public function modReplace($dn, array $entry) { if ($this->suppressErrors) { return @ldap_mod_replace($this->getConnection(), $dn, $entry); } return ldap_mod_replace($this->getConnection(), $dn, $entry); }
php
public function modReplace($dn, array $entry) { if ($this->suppressErrors) { return @ldap_mod_replace($this->getConnection(), $dn, $entry); } return ldap_mod_replace($this->getConnection(), $dn, $entry); }
[ "public", "function", "modReplace", "(", "$", "dn", ",", "array", "$", "entry", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_mod_replace", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ...
Replaces attribute values with new ones. @param $dn @param array $entry @return bool
[ "Replaces", "attribute", "values", "with", "new", "ones", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L558-L565
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.modDelete
public function modDelete($dn, array $entry) { if ($this->suppressErrors) { return @ldap_mod_del($this->getConnection(), $dn, $entry); } return ldap_mod_del($this->getConnection(), $dn, $entry); }
php
public function modDelete($dn, array $entry) { if ($this->suppressErrors) { return @ldap_mod_del($this->getConnection(), $dn, $entry); } return ldap_mod_del($this->getConnection(), $dn, $entry); }
[ "public", "function", "modDelete", "(", "$", "dn", ",", "array", "$", "entry", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "ldap_mod_del", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ",", ...
Delete attribute values from current attributes. @param string $dn @param array $entry @return bool
[ "Delete", "attribute", "values", "from", "current", "attributes", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L575-L582
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.controlPagedResult
public function controlPagedResult($pageSize = 1000, $isCritical = false, $cookie = '') { if ($this->isPagingSupported()) { if ($this->suppressErrors) { return @ldap_control_paged_result($this->getConnection(), $pageSize, $isCritical, $cookie); } return ldap_control_paged_result($this->getConnection(), $pageSize, $isCritical, $cookie); } $message = 'LDAP Pagination is not supported on your current PHP installation.'; throw new AdldapException($message); }
php
public function controlPagedResult($pageSize = 1000, $isCritical = false, $cookie = '') { if ($this->isPagingSupported()) { if ($this->suppressErrors) { return @ldap_control_paged_result($this->getConnection(), $pageSize, $isCritical, $cookie); } return ldap_control_paged_result($this->getConnection(), $pageSize, $isCritical, $cookie); } $message = 'LDAP Pagination is not supported on your current PHP installation.'; throw new AdldapException($message); }
[ "public", "function", "controlPagedResult", "(", "$", "pageSize", "=", "1000", ",", "$", "isCritical", "=", "false", ",", "$", "cookie", "=", "''", ")", "{", "if", "(", "$", "this", "->", "isPagingSupported", "(", ")", ")", "{", "if", "(", "$", "this...
Send LDAP pagination control. @param int $pageSize @param bool $isCritical @param string $cookie @return bool @throws AdldapException
[ "Send", "LDAP", "pagination", "control", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L595-L608
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.controlPagedResultResponse
public function controlPagedResultResponse($result, &$cookie) { if ($this->isPagingSupported()) { if ($this->suppressErrors) { return @ldap_control_paged_result_response($this->getConnection(), $result, $cookie); } return ldap_control_paged_result_response($this->getConnection(), $result, $cookie); } $message = 'LDAP Pagination is not supported on your current PHP installation.'; throw new AdldapException($message); }
php
public function controlPagedResultResponse($result, &$cookie) { if ($this->isPagingSupported()) { if ($this->suppressErrors) { return @ldap_control_paged_result_response($this->getConnection(), $result, $cookie); } return ldap_control_paged_result_response($this->getConnection(), $result, $cookie); } $message = 'LDAP Pagination is not supported on your current PHP installation.'; throw new AdldapException($message); }
[ "public", "function", "controlPagedResultResponse", "(", "$", "result", ",", "&", "$", "cookie", ")", "{", "if", "(", "$", "this", "->", "isPagingSupported", "(", ")", ")", "{", "if", "(", "$", "this", "->", "suppressErrors", ")", "{", "return", "@", "...
Retrieve a paginated result response. @param resource $result @paaram string $cookie @return bool @throws AdldapException
[ "Retrieve", "a", "paginated", "result", "response", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L620-L633
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.escape
public function escape($value, $ignore = '', $flags = 0) { if (!$this->isEscapingSupported()) { return $this->escapeManual($value, $ignore, $flags); } return ldap_escape($value, $ignore, $flags); }
php
public function escape($value, $ignore = '', $flags = 0) { if (!$this->isEscapingSupported()) { return $this->escapeManual($value, $ignore, $flags); } return ldap_escape($value, $ignore, $flags); }
[ "public", "function", "escape", "(", "$", "value", ",", "$", "ignore", "=", "''", ",", "$", "flags", "=", "0", ")", "{", "if", "(", "!", "$", "this", "->", "isEscapingSupported", "(", ")", ")", "{", "return", "$", "this", "->", "escapeManual", "(",...
Returns an escaped string for use in an LDAP filter. @param string $value @param string $ignore @param $flags @return string
[ "Returns", "an", "escaped", "string", "for", "use", "in", "an", "LDAP", "filter", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L697-L704
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.escapeManual
protected function escapeManual($value, $ignore = '', $flags = 0) { /* * If a flag was supplied, we'll send the value * off to be escaped using the PHP flag values * and return the result. */ if ($flags) { return $this->escapeManualWithFlags($value, $ignore, $flags); } // Convert ignore string into an array $ignores = str_split($ignore); // Convert the value to a hex string $hex = bin2hex($value); /* * Separate the string, with the hex length of 2, * and place a backslash on the end of each section */ $value = chunk_split($hex, 2, '\\'); /* * We'll append a backslash at the front of the string * and remove the ending backslash of the string */ $value = '\\'.substr($value, 0, -1); // Go through each character to ignore foreach ($ignores as $charToIgnore) { // Convert the character to ignore to a hex $hexed = bin2hex($charToIgnore); // Replace the hexed variant with the original character $value = str_replace('\\'.$hexed, $charToIgnore, $value); } // Finally we can return the escaped value return $value; }
php
protected function escapeManual($value, $ignore = '', $flags = 0) { /* * If a flag was supplied, we'll send the value * off to be escaped using the PHP flag values * and return the result. */ if ($flags) { return $this->escapeManualWithFlags($value, $ignore, $flags); } // Convert ignore string into an array $ignores = str_split($ignore); // Convert the value to a hex string $hex = bin2hex($value); /* * Separate the string, with the hex length of 2, * and place a backslash on the end of each section */ $value = chunk_split($hex, 2, '\\'); /* * We'll append a backslash at the front of the string * and remove the ending backslash of the string */ $value = '\\'.substr($value, 0, -1); // Go through each character to ignore foreach ($ignores as $charToIgnore) { // Convert the character to ignore to a hex $hexed = bin2hex($charToIgnore); // Replace the hexed variant with the original character $value = str_replace('\\'.$hexed, $charToIgnore, $value); } // Finally we can return the escaped value return $value; }
[ "protected", "function", "escapeManual", "(", "$", "value", ",", "$", "ignore", "=", "''", ",", "$", "flags", "=", "0", ")", "{", "/*\n * If a flag was supplied, we'll send the value\n * off to be escaped using the PHP flag values\n * and return the result...
Escapes the inserted value for LDAP. @param string $value @param string $ignore @param int $flags @return string
[ "Escapes", "the", "inserted", "value", "for", "LDAP", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L715-L755
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.escapeManualWithFlags
protected function escapeManualWithFlags($value, $ignore = '', $flags = 0) { // Convert ignore string into an array $ignores = str_split($ignore); $escapeFilter = ['\\', '*', '(', ')']; $escapeDn = ['\\', ',', '=', '+', '<', '>', ';', '"', '#']; switch ($flags) { case 1: // Int 1 equals to LDAP_ESCAPE_FILTER $escapes = $escapeFilter; break; case 2: // Int 2 equals to LDAP_ESCAPE_DN $escapes = $escapeDn; break; case 3: // If both LDAP_ESCAPE_FILTER and LDAP_ESCAPE_DN are used $escapes = array_merge($escapeFilter, $escapeDn); break; default: return false; } foreach ($escapes as $escape) { // Make sure the escaped value isn't being ignored if (!in_array($escape, $ignores)) { $hexed = chunk_split(bin2hex($escape), 2, '\\'); $hexed = '\\'.substr($hexed, 0, -1); $value = str_replace($escape, $hexed, $value); } } return $value; }
php
protected function escapeManualWithFlags($value, $ignore = '', $flags = 0) { // Convert ignore string into an array $ignores = str_split($ignore); $escapeFilter = ['\\', '*', '(', ')']; $escapeDn = ['\\', ',', '=', '+', '<', '>', ';', '"', '#']; switch ($flags) { case 1: // Int 1 equals to LDAP_ESCAPE_FILTER $escapes = $escapeFilter; break; case 2: // Int 2 equals to LDAP_ESCAPE_DN $escapes = $escapeDn; break; case 3: // If both LDAP_ESCAPE_FILTER and LDAP_ESCAPE_DN are used $escapes = array_merge($escapeFilter, $escapeDn); break; default: return false; } foreach ($escapes as $escape) { // Make sure the escaped value isn't being ignored if (!in_array($escape, $ignores)) { $hexed = chunk_split(bin2hex($escape), 2, '\\'); $hexed = '\\'.substr($hexed, 0, -1); $value = str_replace($escape, $hexed, $value); } } return $value; }
[ "protected", "function", "escapeManualWithFlags", "(", "$", "value", ",", "$", "ignore", "=", "''", ",", "$", "flags", "=", "0", ")", "{", "// Convert ignore string into an array", "$", "ignores", "=", "str_split", "(", "$", "ignore", ")", ";", "$", "escapeF...
Escapes the inserted value with flags. Supplying either 1 or 2 into the flags parameter will escape only certain values. @param string $value @param string $ignore @param int $flags @return bool|mixed
[ "Escapes", "the", "inserted", "value", "with", "flags", ".", "Supplying", "either", "1", "or", "2", "into", "the", "flags", "parameter", "will", "escape", "only", "certain", "values", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L768-L805
train
adldap/adLDAP
src/Connections/Ldap.php
Ldap.unescape
public function unescape($value) { $callback = function ($matches) { return chr(hexdec($matches[1])); }; return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', $callback, $value); }
php
public function unescape($value) { $callback = function ($matches) { return chr(hexdec($matches[1])); }; return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', $callback, $value); }
[ "public", "function", "unescape", "(", "$", "value", ")", "{", "$", "callback", "=", "function", "(", "$", "matches", ")", "{", "return", "chr", "(", "hexdec", "(", "$", "matches", "[", "1", "]", ")", ")", ";", "}", ";", "return", "preg_replace_callb...
Un-escapes a hexadecimal string into its original string representation. @param string $value @return string
[ "Un", "-", "escapes", "a", "hexadecimal", "string", "into", "its", "original", "string", "representation", "." ]
63fd63e4f680e521bdf6cba23e0e524a2c34c0d5
https://github.com/adldap/adLDAP/blob/63fd63e4f680e521bdf6cba23e0e524a2c34c0d5/src/Connections/Ldap.php#L815-L822
train
brick/money
src/MoneyComparator.php
MoneyComparator.compare
public function compare(Money $a, Money $b) : int { $aCurrencyCode = $a->getCurrency()->getCurrencyCode(); $bCurrencyCode = $b->getCurrency()->getCurrencyCode(); if ($aCurrencyCode === $bCurrencyCode) { return $a->compareTo($b); } $aAmount = $a->getAmount(); $bAmount = $b->getAmount(); $exchangeRate = $this->exchangeRateProvider->getExchangeRate($aCurrencyCode, $bCurrencyCode); $aAmount = $aAmount->toBigRational()->multipliedBy($exchangeRate); return $aAmount->compareTo($bAmount); }
php
public function compare(Money $a, Money $b) : int { $aCurrencyCode = $a->getCurrency()->getCurrencyCode(); $bCurrencyCode = $b->getCurrency()->getCurrencyCode(); if ($aCurrencyCode === $bCurrencyCode) { return $a->compareTo($b); } $aAmount = $a->getAmount(); $bAmount = $b->getAmount(); $exchangeRate = $this->exchangeRateProvider->getExchangeRate($aCurrencyCode, $bCurrencyCode); $aAmount = $aAmount->toBigRational()->multipliedBy($exchangeRate); return $aAmount->compareTo($bAmount); }
[ "public", "function", "compare", "(", "Money", "$", "a", ",", "Money", "$", "b", ")", ":", "int", "{", "$", "aCurrencyCode", "=", "$", "a", "->", "getCurrency", "(", ")", "->", "getCurrencyCode", "(", ")", ";", "$", "bCurrencyCode", "=", "$", "b", ...
Compares the given monies. The amount is not rounded before comparison, so the results are more relevant than when using `convert($a, $b->getCurrency())->compareTo($b)`. Note that the comparison is performed by converting A into B's currency. This order is important if the exchange rate provider uses different exchange rates when converting back and forth two currencies. @param Money $a @param Money $b @return int -1, 0 or 1. @throws CurrencyConversionException If the exchange rate is not available.
[ "Compares", "the", "given", "monies", "." ]
7ff8dce2546878097714e7380e2a228408c0edc7
https://github.com/brick/money/blob/7ff8dce2546878097714e7380e2a228408c0edc7/src/MoneyComparator.php#L55-L72
train
brick/money
src/MoneyComparator.php
MoneyComparator.min
public function min(Money $money, Money ...$monies) : Money { $min = $money; foreach ($monies as $money) { if ($this->isGreater($min, $money)) { $min = $money; } } return $min; }
php
public function min(Money $money, Money ...$monies) : Money { $min = $money; foreach ($monies as $money) { if ($this->isGreater($min, $money)) { $min = $money; } } return $min; }
[ "public", "function", "min", "(", "Money", "$", "money", ",", "Money", "...", "$", "monies", ")", ":", "Money", "{", "$", "min", "=", "$", "money", ";", "foreach", "(", "$", "monies", "as", "$", "money", ")", "{", "if", "(", "$", "this", "->", ...
Returns the smallest of the given monies. The monies are compared from left to right. This distinction can be important if the exchange rate provider does not have bidirectional exchange rates, or applies different rates depending on the direction of the conversion. For example, when comparing [A, B, C], this method will first compare A against B, then min(A,B) against C. If several monies are equal to the minimum value, the first one is returned. @param Money $money The first money. @param Money ...$monies The subsequent monies. @return Money The smallest Money. @throws CurrencyConversionException If an exchange rate is not available.
[ "Returns", "the", "smallest", "of", "the", "given", "monies", "." ]
7ff8dce2546878097714e7380e2a228408c0edc7
https://github.com/brick/money/blob/7ff8dce2546878097714e7380e2a228408c0edc7/src/MoneyComparator.php#L156-L167
train
brick/money
src/MoneyComparator.php
MoneyComparator.max
public function max(Money $money, Money ...$monies) : Money { $max = $money; foreach ($monies as $money) { if ($this->isLess($max, $money)) { $max = $money; } } return $max; }
php
public function max(Money $money, Money ...$monies) : Money { $max = $money; foreach ($monies as $money) { if ($this->isLess($max, $money)) { $max = $money; } } return $max; }
[ "public", "function", "max", "(", "Money", "$", "money", ",", "Money", "...", "$", "monies", ")", ":", "Money", "{", "$", "max", "=", "$", "money", ";", "foreach", "(", "$", "monies", "as", "$", "money", ")", "{", "if", "(", "$", "this", "->", ...
Returns the largest of the given monies. The monies are compared from left to right. This distinction can be important if the exchange rate provider does not have bidirectional exchange rates, or applies different rates depending on the direction of the conversion. For example, when comparing [A, B, C], this method will first compare A against B, then max(A,B) against C. If several monies are equal to the maximum value, the first one is returned. @param Money $money The first money. @param Money ...$monies The subsequent monies. @return Money The largest Money. @throws CurrencyConversionException If an exchange rate is not available.
[ "Returns", "the", "largest", "of", "the", "given", "monies", "." ]
7ff8dce2546878097714e7380e2a228408c0edc7
https://github.com/brick/money/blob/7ff8dce2546878097714e7380e2a228408c0edc7/src/MoneyComparator.php#L186-L197
train
brick/money
src/CurrencyConverter.php
CurrencyConverter.convert
public function convert(MoneyContainer $moneyContainer, $currency, int $roundingMode = RoundingMode::UNNECESSARY) : Money { if (! $currency instanceof Currency) { $currency = Currency::of($currency); } $currencyCode = $currency->getCurrencyCode(); $total = BigRational::zero(); foreach ($moneyContainer->getAmounts() as $sourceCurrencyCode => $amount) { if ($sourceCurrencyCode !== $currencyCode) { $exchangeRate = $this->exchangeRateProvider->getExchangeRate($sourceCurrencyCode, $currencyCode); $amount = $amount->toBigRational()->multipliedBy($exchangeRate); } $total = $total->plus($amount); } return Money::create($total, $currency, $this->context, $roundingMode); }
php
public function convert(MoneyContainer $moneyContainer, $currency, int $roundingMode = RoundingMode::UNNECESSARY) : Money { if (! $currency instanceof Currency) { $currency = Currency::of($currency); } $currencyCode = $currency->getCurrencyCode(); $total = BigRational::zero(); foreach ($moneyContainer->getAmounts() as $sourceCurrencyCode => $amount) { if ($sourceCurrencyCode !== $currencyCode) { $exchangeRate = $this->exchangeRateProvider->getExchangeRate($sourceCurrencyCode, $currencyCode); $amount = $amount->toBigRational()->multipliedBy($exchangeRate); } $total = $total->plus($amount); } return Money::create($total, $currency, $this->context, $roundingMode); }
[ "public", "function", "convert", "(", "MoneyContainer", "$", "moneyContainer", ",", "$", "currency", ",", "int", "$", "roundingMode", "=", "RoundingMode", "::", "UNNECESSARY", ")", ":", "Money", "{", "if", "(", "!", "$", "currency", "instanceof", "Currency", ...
Converts the given money to the given currency. @param MoneyContainer $moneyContainer The Money, RationalMoney or MoneyBag to convert. @param Currency|string|int $currency The Currency instance, ISO currency code or ISO numeric currency code. @param int $roundingMode The rounding mode, if necessary. @return Money @throws CurrencyConversionException If the exchange rate is not available. @throws RoundingNecessaryException If rounding is necessary and RoundingMode::UNNECESSARY is used.
[ "Converts", "the", "given", "money", "to", "the", "given", "currency", "." ]
7ff8dce2546878097714e7380e2a228408c0edc7
https://github.com/brick/money/blob/7ff8dce2546878097714e7380e2a228408c0edc7/src/CurrencyConverter.php#L59-L79
train
brick/money
src/ExchangeRateProvider/ProviderChain.php
ProviderChain.addExchangeRateProvider
public function addExchangeRateProvider(ExchangeRateProvider $provider) : self { $hash = spl_object_hash($provider); $this->providers[$hash] = $provider; return $this; }
php
public function addExchangeRateProvider(ExchangeRateProvider $provider) : self { $hash = spl_object_hash($provider); $this->providers[$hash] = $provider; return $this; }
[ "public", "function", "addExchangeRateProvider", "(", "ExchangeRateProvider", "$", "provider", ")", ":", "self", "{", "$", "hash", "=", "spl_object_hash", "(", "$", "provider", ")", ";", "$", "this", "->", "providers", "[", "$", "hash", "]", "=", "$", "pro...
Adds an exchange rate provider to the chain. If the provider is already registered, this method does nothing. @param ExchangeRateProvider $provider The exchange rate provider to add. @return ProviderChain This instance, for chaining.
[ "Adds", "an", "exchange", "rate", "provider", "to", "the", "chain", "." ]
7ff8dce2546878097714e7380e2a228408c0edc7
https://github.com/brick/money/blob/7ff8dce2546878097714e7380e2a228408c0edc7/src/ExchangeRateProvider/ProviderChain.php#L31-L37
train
brick/money
src/ExchangeRateProvider/ProviderChain.php
ProviderChain.removeExchangeRateProvider
public function removeExchangeRateProvider(ExchangeRateProvider $provider) : self { $hash = spl_object_hash($provider); unset($this->providers[$hash]); return $this; }
php
public function removeExchangeRateProvider(ExchangeRateProvider $provider) : self { $hash = spl_object_hash($provider); unset($this->providers[$hash]); return $this; }
[ "public", "function", "removeExchangeRateProvider", "(", "ExchangeRateProvider", "$", "provider", ")", ":", "self", "{", "$", "hash", "=", "spl_object_hash", "(", "$", "provider", ")", ";", "unset", "(", "$", "this", "->", "providers", "[", "$", "hash", "]",...
Removes an exchange rate provider from the chain. If the provider is not registered, this method does nothing. @param ExchangeRateProvider $provider The exchange rate provider to remove. @return ProviderChain This instance, for chaining.
[ "Removes", "an", "exchange", "rate", "provider", "from", "the", "chain", "." ]
7ff8dce2546878097714e7380e2a228408c0edc7
https://github.com/brick/money/blob/7ff8dce2546878097714e7380e2a228408c0edc7/src/ExchangeRateProvider/ProviderChain.php#L48-L54
train
brick/money
src/MoneyBag.php
MoneyBag.getAmount
public function getAmount($currency) : BigRational { $currencyCode = (string) $currency; return isset($this->amounts[$currencyCode]) ? $this->amounts[$currencyCode] : BigRational::zero(); }
php
public function getAmount($currency) : BigRational { $currencyCode = (string) $currency; return isset($this->amounts[$currencyCode]) ? $this->amounts[$currencyCode] : BigRational::zero(); }
[ "public", "function", "getAmount", "(", "$", "currency", ")", ":", "BigRational", "{", "$", "currencyCode", "=", "(", "string", ")", "$", "currency", ";", "return", "isset", "(", "$", "this", "->", "amounts", "[", "$", "currencyCode", "]", ")", "?", "$...
Returns the amount in the given currency contained in the bag, as a rational number. @param Currency|string $currency The Currency instance or currency code. @return BigRational
[ "Returns", "the", "amount", "in", "the", "given", "currency", "contained", "in", "the", "bag", "as", "a", "rational", "number", "." ]
7ff8dce2546878097714e7380e2a228408c0edc7
https://github.com/brick/money/blob/7ff8dce2546878097714e7380e2a228408c0edc7/src/MoneyBag.php#L30-L37
train
brick/money
src/MoneyBag.php
MoneyBag.add
public function add(MoneyContainer $money) : MoneyBag { foreach ($money->getAmounts() as $currencyCode => $amount) { $this->amounts[$currencyCode] = $this->getAmount($currencyCode)->plus($amount); } return $this; }
php
public function add(MoneyContainer $money) : MoneyBag { foreach ($money->getAmounts() as $currencyCode => $amount) { $this->amounts[$currencyCode] = $this->getAmount($currencyCode)->plus($amount); } return $this; }
[ "public", "function", "add", "(", "MoneyContainer", "$", "money", ")", ":", "MoneyBag", "{", "foreach", "(", "$", "money", "->", "getAmounts", "(", ")", "as", "$", "currencyCode", "=>", "$", "amount", ")", "{", "$", "this", "->", "amounts", "[", "$", ...
Adds money to this bag. @param MoneyContainer $money A Money, RationalMoney, or MoneyBag instance. @return MoneyBag This instance.
[ "Adds", "money", "to", "this", "bag", "." ]
7ff8dce2546878097714e7380e2a228408c0edc7
https://github.com/brick/money/blob/7ff8dce2546878097714e7380e2a228408c0edc7/src/MoneyBag.php#L56-L63
train