repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
Adldap2/Adldap2
src/Query/Builder.php
Builder.findByGuid
public function findByGuid($guid, $columns = []) { try { return $this->findByGuidOrFail($guid, $columns); } catch (ModelNotFoundException $e) { return false; } }
php
public function findByGuid($guid, $columns = []) { try { return $this->findByGuidOrFail($guid, $columns); } catch (ModelNotFoundException $e) { return false; } }
[ "public", "function", "findByGuid", "(", "$", "guid", ",", "$", "columns", "=", "[", "]", ")", "{", "try", "{", "return", "$", "this", "->", "findByGuidOrFail", "(", "$", "guid", ",", "$", "columns", ")", ";", "}", "catch", "(", "ModelNotFoundException...
Finds a record by its string GUID. @param string $guid @param array|string $columns @return Model|array|false
[ "Finds", "a", "record", "by", "its", "string", "GUID", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L643-L650
Adldap2/Adldap2
src/Query/Builder.php
Builder.findByGuidOrFail
public function findByGuidOrFail($guid, $columns = []) { if ($this->schema->objectGuidRequiresConversion()) { $guid = Utilities::stringGuidToHex($guid); } return $this->select($columns)->whereRaw([ $this->schema->objectGuid() => $guid ])->firstOrFail(); }
php
public function findByGuidOrFail($guid, $columns = []) { if ($this->schema->objectGuidRequiresConversion()) { $guid = Utilities::stringGuidToHex($guid); } return $this->select($columns)->whereRaw([ $this->schema->objectGuid() => $guid ])->firstOrFail(); }
[ "public", "function", "findByGuidOrFail", "(", "$", "guid", ",", "$", "columns", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "schema", "->", "objectGuidRequiresConversion", "(", ")", ")", "{", "$", "guid", "=", "Utilities", "::", "stringGuidTo...
Finds a record by its string GUID. Fails upon no records returned. @param string $guid @param array|string $columns @throws ModelNotFoundException @return Model|array
[ "Finds", "a", "record", "by", "its", "string", "GUID", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L664-L673
Adldap2/Adldap2
src/Query/Builder.php
Builder.findBySid
public function findBySid($sid, $columns = []) { try { return $this->findBySidOrFail($sid, $columns); } catch (ModelNotFoundException $e) { return false; } }
php
public function findBySid($sid, $columns = []) { try { return $this->findBySidOrFail($sid, $columns); } catch (ModelNotFoundException $e) { return false; } }
[ "public", "function", "findBySid", "(", "$", "sid", ",", "$", "columns", "=", "[", "]", ")", "{", "try", "{", "return", "$", "this", "->", "findBySidOrFail", "(", "$", "sid", ",", "$", "columns", ")", ";", "}", "catch", "(", "ModelNotFoundException", ...
Finds a record by its Object SID. @param string $sid @param array|string $columns @return Model|array|false
[ "Finds", "a", "record", "by", "its", "Object", "SID", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L683-L690
Adldap2/Adldap2
src/Query/Builder.php
Builder.findBySidOrFail
public function findBySidOrFail($sid, $columns = []) { return $this->findByOrFail($this->schema->objectSid(), $sid, $columns); }
php
public function findBySidOrFail($sid, $columns = []) { return $this->findByOrFail($this->schema->objectSid(), $sid, $columns); }
[ "public", "function", "findBySidOrFail", "(", "$", "sid", ",", "$", "columns", "=", "[", "]", ")", "{", "return", "$", "this", "->", "findByOrFail", "(", "$", "this", "->", "schema", "->", "objectSid", "(", ")", ",", "$", "sid", ",", "$", "columns", ...
Finds a record by its Object SID. Fails upon no records returned. @param string $sid @param array|string $columns @throws ModelNotFoundException @return Model|array
[ "Finds", "a", "record", "by", "its", "Object", "SID", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L704-L707
Adldap2/Adldap2
src/Query/Builder.php
Builder.findBaseDn
public function findBaseDn() { $result = $this->setDn(null) ->read() ->raw() ->whereHas($this->schema->objectClass()) ->first(); $key = $this->schema->defaultNamingContext(); if (is_array($result) && array_key_exists($key, $result)) { ...
php
public function findBaseDn() { $result = $this->setDn(null) ->read() ->raw() ->whereHas($this->schema->objectClass()) ->first(); $key = $this->schema->defaultNamingContext(); if (is_array($result) && array_key_exists($key, $result)) { ...
[ "public", "function", "findBaseDn", "(", ")", "{", "$", "result", "=", "$", "this", "->", "setDn", "(", "null", ")", "->", "read", "(", ")", "->", "raw", "(", ")", "->", "whereHas", "(", "$", "this", "->", "schema", "->", "objectClass", "(", ")", ...
Finds the Base DN of your domain controller. @return string|bool
[ "Finds", "the", "Base", "DN", "of", "your", "domain", "controller", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L714-L731
Adldap2/Adldap2
src/Query/Builder.php
Builder.select
public function select($columns = []) { $columns = is_array($columns) ? $columns : func_get_args(); if (! empty($columns)) { $this->columns = $columns; } return $this; }
php
public function select($columns = []) { $columns = is_array($columns) ? $columns : func_get_args(); if (! empty($columns)) { $this->columns = $columns; } return $this; }
[ "public", "function", "select", "(", "$", "columns", "=", "[", "]", ")", "{", "$", "columns", "=", "is_array", "(", "$", "columns", ")", "?", "$", "columns", ":", "func_get_args", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "columns", ")", ...
Adds the inserted fields to query on the current LDAP connection. @param array|string $columns @return Builder
[ "Adds", "the", "inserted", "fields", "to", "query", "on", "the", "current", "LDAP", "connection", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L740-L749
Adldap2/Adldap2
src/Query/Builder.php
Builder.rawFilter
public function rawFilter($filters = []) { $filters = is_array($filters) ? $filters : func_get_args(); foreach ($filters as $filter) { $this->filters['raw'][] = $filter; } return $this; }
php
public function rawFilter($filters = []) { $filters = is_array($filters) ? $filters : func_get_args(); foreach ($filters as $filter) { $this->filters['raw'][] = $filter; } return $this; }
[ "public", "function", "rawFilter", "(", "$", "filters", "=", "[", "]", ")", "{", "$", "filters", "=", "is_array", "(", "$", "filters", ")", "?", "$", "filters", ":", "func_get_args", "(", ")", ";", "foreach", "(", "$", "filters", "as", "$", "filter",...
Adds a raw filter to the current query. @param array|string $filters @return Builder
[ "Adds", "a", "raw", "filter", "to", "the", "current", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L758-L767
Adldap2/Adldap2
src/Query/Builder.php
Builder.andFilter
public function andFilter(Closure $closure) { $query = $this->newNestedInstance($closure); $filter = $this->grammar->compileAnd($query->getQuery()); return $this->rawFilter($filter); }
php
public function andFilter(Closure $closure) { $query = $this->newNestedInstance($closure); $filter = $this->grammar->compileAnd($query->getQuery()); return $this->rawFilter($filter); }
[ "public", "function", "andFilter", "(", "Closure", "$", "closure", ")", "{", "$", "query", "=", "$", "this", "->", "newNestedInstance", "(", "$", "closure", ")", ";", "$", "filter", "=", "$", "this", "->", "grammar", "->", "compileAnd", "(", "$", "quer...
Adds a nested 'and' filter to the current query. @param Closure $closure @return Builder
[ "Adds", "a", "nested", "and", "filter", "to", "the", "current", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L776-L783
Adldap2/Adldap2
src/Query/Builder.php
Builder.orFilter
public function orFilter(Closure $closure) { $query = $this->newNestedInstance($closure); $filter = $this->grammar->compileOr($query->getQuery()); return $this->rawFilter($filter); }
php
public function orFilter(Closure $closure) { $query = $this->newNestedInstance($closure); $filter = $this->grammar->compileOr($query->getQuery()); return $this->rawFilter($filter); }
[ "public", "function", "orFilter", "(", "Closure", "$", "closure", ")", "{", "$", "query", "=", "$", "this", "->", "newNestedInstance", "(", "$", "closure", ")", ";", "$", "filter", "=", "$", "this", "->", "grammar", "->", "compileOr", "(", "$", "query"...
Adds a nested 'or' filter to the current query. @param Closure $closure @return Builder
[ "Adds", "a", "nested", "or", "filter", "to", "the", "current", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L792-L799
Adldap2/Adldap2
src/Query/Builder.php
Builder.notFilter
public function notFilter(Closure $closure) { $query = $this->newNestedInstance($closure); $filter = $this->grammar->compileNot($query->getQuery()); return $this->rawFilter($filter); }
php
public function notFilter(Closure $closure) { $query = $this->newNestedInstance($closure); $filter = $this->grammar->compileNot($query->getQuery()); return $this->rawFilter($filter); }
[ "public", "function", "notFilter", "(", "Closure", "$", "closure", ")", "{", "$", "query", "=", "$", "this", "->", "newNestedInstance", "(", "$", "closure", ")", ";", "$", "filter", "=", "$", "this", "->", "grammar", "->", "compileNot", "(", "$", "quer...
Adds a nested 'not' filter to the current query. @param Closure $closure @return Builder
[ "Adds", "a", "nested", "not", "filter", "to", "the", "current", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L808-L815
Adldap2/Adldap2
src/Query/Builder.php
Builder.where
public function where($field, $operator = null, $value = null, $boolean = 'and', $raw = false) { if (is_array($field)) { // If the column is an array, we will assume it is an array of // key-value pairs and can add them each as a where clause. return $this->addArrayOfWher...
php
public function where($field, $operator = null, $value = null, $boolean = 'and', $raw = false) { if (is_array($field)) { // If the column is an array, we will assume it is an array of // key-value pairs and can add them each as a where clause. return $this->addArrayOfWher...
[ "public", "function", "where", "(", "$", "field", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ",", "$", "boolean", "=", "'and'", ",", "$", "raw", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "field", ")", ")", ...
Adds a where clause to the current query. @param string|array $field @param string $operator @param string $value @param string $boolean @param bool $raw @throws InvalidArgumentException @return Builder
[ "Adds", "a", "where", "clause", "to", "the", "current", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L830-L861
Adldap2/Adldap2
src/Query/Builder.php
Builder.whereRaw
public function whereRaw($field, $operator = null, $value = null) { return $this->where($field, $operator, $value, 'and', true); }
php
public function whereRaw($field, $operator = null, $value = null) { return $this->where($field, $operator, $value, 'and', true); }
[ "public", "function", "whereRaw", "(", "$", "field", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "return", "$", "this", "->", "where", "(", "$", "field", ",", "$", "operator", ",", "$", "value", ",", "'and'", ",", ...
Adds a raw where clause to the current query. Values given to this method are not escaped. @param string|array $field @param string $operator @param string $value @return Builder
[ "Adds", "a", "raw", "where", "clause", "to", "the", "current", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L874-L877
Adldap2/Adldap2
src/Query/Builder.php
Builder.whereIn
public function whereIn($field, array $values) { return $this->orFilter(function (Builder $query) use ($field, $values) { foreach ($values as $value) { $query->whereEquals($field, $value); } }); }
php
public function whereIn($field, array $values) { return $this->orFilter(function (Builder $query) use ($field, $values) { foreach ($values as $value) { $query->whereEquals($field, $value); } }); }
[ "public", "function", "whereIn", "(", "$", "field", ",", "array", "$", "values", ")", "{", "return", "$", "this", "->", "orFilter", "(", "function", "(", "Builder", "$", "query", ")", "use", "(", "$", "field", ",", "$", "values", ")", "{", "foreach",...
Query for entries that match any of the values provided for the given field. @param string $field @param array $values @return Builder
[ "Query", "for", "entries", "that", "match", "any", "of", "the", "values", "provided", "for", "the", "given", "field", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L976-L983
Adldap2/Adldap2
src/Query/Builder.php
Builder.orWhereRaw
public function orWhereRaw($field, $operator = null, $value = null) { return $this->where($field, $operator, $value, 'or', true); }
php
public function orWhereRaw($field, $operator = null, $value = null) { return $this->where($field, $operator, $value, 'or', true); }
[ "public", "function", "orWhereRaw", "(", "$", "field", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "return", "$", "this", "->", "where", "(", "$", "field", ",", "$", "operator", ",", "$", "value", ",", "'or'", ",", ...
Adds a raw or where clause to the current query. Values given to this method are not escaped. @param string $field @param string $operator @param string $value @return Builder
[ "Adds", "a", "raw", "or", "where", "clause", "to", "the", "current", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L1110-L1113
Adldap2/Adldap2
src/Query/Builder.php
Builder.addFilter
public function addFilter($type, array $bindings) { // Here we will ensure we have been given a proper filter type. if (! array_key_exists($type, $this->filters)) { throw new InvalidArgumentException("Invalid filter type: {$type}."); } // The required filter key bindings...
php
public function addFilter($type, array $bindings) { // Here we will ensure we have been given a proper filter type. if (! array_key_exists($type, $this->filters)) { throw new InvalidArgumentException("Invalid filter type: {$type}."); } // The required filter key bindings...
[ "public", "function", "addFilter", "(", "$", "type", ",", "array", "$", "bindings", ")", "{", "// Here we will ensure we have been given a proper filter type.", "if", "(", "!", "array_key_exists", "(", "$", "type", ",", "$", "this", "->", "filters", ")", ")", "{...
Adds a filter onto the current query. @param string $type The type of filter to add. @param array $bindings The bindings of the filter. @return $this @throws InvalidArgumentException
[ "Adds", "a", "filter", "onto", "the", "current", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L1278-L1299
Adldap2/Adldap2
src/Query/Builder.php
Builder.clearFilters
public function clearFilters() { foreach ($this->filters as $type => $filters) { $this->filters[$type] = []; } return $this; }
php
public function clearFilters() { foreach ($this->filters as $type => $filters) { $this->filters[$type] = []; } return $this; }
[ "public", "function", "clearFilters", "(", ")", "{", "foreach", "(", "$", "this", "->", "filters", "as", "$", "type", "=>", "$", "filters", ")", "{", "$", "this", "->", "filters", "[", "$", "type", "]", "=", "[", "]", ";", "}", "return", "$", "th...
Clear the query builders filters. @return $this
[ "Clear", "the", "query", "builders", "filters", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L1306-L1313
Adldap2/Adldap2
src/Query/Builder.php
Builder.getSelects
public function getSelects() { $selects = $this->columns; // If the asterisk is not provided in the selected columns, we need to // ensure we always select the object class and category, as these // are used for constructing models. The asterisk indicates that // we want all...
php
public function getSelects() { $selects = $this->columns; // If the asterisk is not provided in the selected columns, we need to // ensure we always select the object class and category, as these // are used for constructing models. The asterisk indicates that // we want all...
[ "public", "function", "getSelects", "(", ")", "{", "$", "selects", "=", "$", "this", "->", "columns", ";", "// If the asterisk is not provided in the selected columns, we need to", "// ensure we always select the object class and category, as these", "// are used for constructing mod...
Returns the current selected fields to retrieve. @return array
[ "Returns", "the", "current", "selected", "fields", "to", "retrieve", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L1331-L1345
Adldap2/Adldap2
src/Query/Builder.php
Builder.sortBy
public function sortBy($field, $direction = 'asc', $flags = null) { $this->sortByField = $field; // Normalize direction. $direction = strtolower($direction); if ($direction === 'asc' || $direction === 'desc') { $this->sortByDirection = $direction; } if ...
php
public function sortBy($field, $direction = 'asc', $flags = null) { $this->sortByField = $field; // Normalize direction. $direction = strtolower($direction); if ($direction === 'asc' || $direction === 'desc') { $this->sortByDirection = $direction; } if ...
[ "public", "function", "sortBy", "(", "$", "field", ",", "$", "direction", "=", "'asc'", ",", "$", "flags", "=", "null", ")", "{", "$", "this", "->", "sortByField", "=", "$", "field", ";", "// Normalize direction.", "$", "direction", "=", "strtolower", "(...
Sorts the LDAP search results by the specified field and direction. @param string $field @param string $direction @param int|null $flags @return Builder
[ "Sorts", "the", "LDAP", "search", "results", "by", "the", "specified", "field", "and", "direction", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L1356-L1372
Adldap2/Adldap2
src/Query/Builder.php
Builder.dynamicWhere
public function dynamicWhere($method, $parameters) { $finder = substr($method, 5); $segments = preg_split('/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE); // The connector variable will determine which connector will be used for the // query condition. We will change ...
php
public function dynamicWhere($method, $parameters) { $finder = substr($method, 5); $segments = preg_split('/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE); // The connector variable will determine which connector will be used for the // query condition. We will change ...
[ "public", "function", "dynamicWhere", "(", "$", "method", ",", "$", "parameters", ")", "{", "$", "finder", "=", "substr", "(", "$", "method", ",", "5", ")", ";", "$", "segments", "=", "preg_split", "(", "'/(And|Or)(?=[A-Z])/'", ",", "$", "finder", ",", ...
Handles dynamic "where" clauses to the query. @param string $method @param array $parameters @return Builder
[ "Handles", "dynamic", "where", "clauses", "to", "the", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L1556-L1588
Adldap2/Adldap2
src/Query/Builder.php
Builder.addArrayOfWheres
protected function addArrayOfWheres($wheres, $boolean, $raw) { foreach ($wheres as $key => $value) { if (is_numeric($key) && is_array($value)) { // If the key is numeric and the value is an array, we'll // assume we've been given an array with conditionals. ...
php
protected function addArrayOfWheres($wheres, $boolean, $raw) { foreach ($wheres as $key => $value) { if (is_numeric($key) && is_array($value)) { // If the key is numeric and the value is an array, we'll // assume we've been given an array with conditionals. ...
[ "protected", "function", "addArrayOfWheres", "(", "$", "wheres", ",", "$", "boolean", ",", "$", "raw", ")", "{", "foreach", "(", "$", "wheres", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_numeric", "(", "$", "key", ")", "&&", "is...
Adds an array of wheres to the current query. @param array $wheres @param string $boolean @param bool $raw @return Builder
[ "Adds", "an", "array", "of", "wheres", "to", "the", "current", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L1599-L1620
Adldap2/Adldap2
src/Models/Attributes/DistinguishedName.php
DistinguishedName.get
public function get() { $components = []; // We'll go through each component type and assemble its RDN. foreach ($this->components as $component => $values) { array_map(function ($value) use ($component, &$components) { // Assemble the component and escape the va...
php
public function get() { $components = []; // We'll go through each component type and assemble its RDN. foreach ($this->components as $component => $values) { array_map(function ($value) use ($component, &$components) { // Assemble the component and escape the va...
[ "public", "function", "get", "(", ")", "{", "$", "components", "=", "[", "]", ";", "// We'll go through each component type and assemble its RDN.", "foreach", "(", "$", "this", "->", "components", "as", "$", "component", "=>", "$", "values", ")", "{", "array_map...
Returns the complete distinguished name by assembling the RDN components. @return string
[ "Returns", "the", "complete", "distinguished", "name", "by", "assembling", "the", "RDN", "components", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/DistinguishedName.php#L47-L60
Adldap2/Adldap2
src/Models/Attributes/DistinguishedName.php
DistinguishedName.setBase
public function setBase($base) { // Typecast base to string in case we've been given // an instance of the distinguished name object. $base = (string) $base; // If the base DN isn't null we'll try to explode it. $base = Utilities::explodeDn($base, false) ?: []; // R...
php
public function setBase($base) { // Typecast base to string in case we've been given // an instance of the distinguished name object. $base = (string) $base; // If the base DN isn't null we'll try to explode it. $base = Utilities::explodeDn($base, false) ?: []; // R...
[ "public", "function", "setBase", "(", "$", "base", ")", "{", "// Typecast base to string in case we've been given", "// an instance of the distinguished name object.", "$", "base", "=", "(", "string", ")", "$", "base", ";", "// If the base DN isn't null we'll try to explode it....
Sets the base RDN of the distinguished name. @param string|DistinguishedName $base @return DistinguishedName
[ "Sets", "the", "base", "RDN", "of", "the", "distinguished", "name", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/DistinguishedName.php#L209-L239
Adldap2/Adldap2
src/Models/Attributes/DistinguishedName.php
DistinguishedName.getComponents
public function getComponents($component = null) { if (is_null($component)) { return $this->components; } $this->validateComponentExists($component); return $this->components[$component]; }
php
public function getComponents($component = null) { if (is_null($component)) { return $this->components; } $this->validateComponentExists($component); return $this->components[$component]; }
[ "public", "function", "getComponents", "(", "$", "component", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "component", ")", ")", "{", "return", "$", "this", "->", "components", ";", "}", "$", "this", "->", "validateComponentExists", "(", "$", ...
Returns an array of all components in the distinguished name. If a component name is given ('cn', 'dc' for example) then the values of that component will be returned. @param string|null $component The component to retrieve values of @return array
[ "Returns", "an", "array", "of", "all", "components", "in", "the", "distinguished", "name", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/DistinguishedName.php#L251-L260
Adldap2/Adldap2
src/Models/Attributes/DistinguishedName.php
DistinguishedName.addComponent
protected function addComponent($component, $value) { $this->validateComponentExists($component); // We need to make sure the value we're given isn't empty before adding it into our components. if (! empty($value)) { $this->components[$component][] = $value; } }
php
protected function addComponent($component, $value) { $this->validateComponentExists($component); // We need to make sure the value we're given isn't empty before adding it into our components. if (! empty($value)) { $this->components[$component][] = $value; } }
[ "protected", "function", "addComponent", "(", "$", "component", ",", "$", "value", ")", "{", "$", "this", "->", "validateComponentExists", "(", "$", "component", ")", ";", "// We need to make sure the value we're given isn't empty before adding it into our components.", "if...
Adds a component to the distinguished name. @param string $component @param string $value @throws \UnexpectedValueException When the given name does not exist.
[ "Adds", "a", "component", "to", "the", "distinguished", "name", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/DistinguishedName.php#L270-L278
Adldap2/Adldap2
src/Models/Attributes/DistinguishedName.php
DistinguishedName.removeComponent
protected function removeComponent($component, $value) { $this->validateComponentExists($component); $this->components[$component] = array_diff($this->components[$component], [$value]); }
php
protected function removeComponent($component, $value) { $this->validateComponentExists($component); $this->components[$component] = array_diff($this->components[$component], [$value]); }
[ "protected", "function", "removeComponent", "(", "$", "component", ",", "$", "value", ")", "{", "$", "this", "->", "validateComponentExists", "(", "$", "component", ")", ";", "$", "this", "->", "components", "[", "$", "component", "]", "=", "array_diff", "...
Removes the given value from the given component. @param string $component @param string $value @throws \UnexpectedValueException When the given component does not exist. @return void
[ "Removes", "the", "given", "value", "from", "the", "given", "component", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/DistinguishedName.php#L290-L295
Adldap2/Adldap2
src/Schemas/Schema.php
Schema.objectClassModelMap
public function objectClassModelMap() { return [ $this->objectClassComputer() => $this->computerModel(), $this->objectClassContact() => $this->contactModel(), $this->objectClassPerson() => $this->userModel(), ...
php
public function objectClassModelMap() { return [ $this->objectClassComputer() => $this->computerModel(), $this->objectClassContact() => $this->contactModel(), $this->objectClassPerson() => $this->userModel(), ...
[ "public", "function", "objectClassModelMap", "(", ")", "{", "return", "[", "$", "this", "->", "objectClassComputer", "(", ")", "=>", "$", "this", "->", "computerModel", "(", ")", ",", "$", "this", "->", "objectClassContact", "(", ")", "=>", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Schemas/Schema.php#L677-L689
Adldap2/Adldap2
src/Models/Attributes/Sid.php
Sid.getBinary
public function getBinary() { $sid = explode('-', ltrim($this->value, 'S-')); $level = (int) array_shift($sid); $authority = (int) array_shift($sid); $subAuthorities = array_map('intval', $sid); $params = array_merge( ['C2xxNV*', $level, count($subAuthorities)...
php
public function getBinary() { $sid = explode('-', ltrim($this->value, 'S-')); $level = (int) array_shift($sid); $authority = (int) array_shift($sid); $subAuthorities = array_map('intval', $sid); $params = array_merge( ['C2xxNV*', $level, count($subAuthorities)...
[ "public", "function", "getBinary", "(", ")", "{", "$", "sid", "=", "explode", "(", "'-'", ",", "ltrim", "(", "$", "this", "->", "value", ",", "'S-'", ")", ")", ";", "$", "level", "=", "(", "int", ")", "array_shift", "(", "$", "sid", ")", ";", "...
Returns the binary variant of the SID. @return string
[ "Returns", "the", "binary", "variant", "of", "the", "SID", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/Sid.php#L72-L88
Adldap2/Adldap2
src/Models/ModelNotFoundException.php
ModelNotFoundException.setQuery
public function setQuery($query, $baseDn) { $this->query = $query; $this->baseDn = $baseDn; $this->message = "No LDAP query results for filter: [{$query}] in: [{$baseDn}]"; return $this; }
php
public function setQuery($query, $baseDn) { $this->query = $query; $this->baseDn = $baseDn; $this->message = "No LDAP query results for filter: [{$query}] in: [{$baseDn}]"; return $this; }
[ "public", "function", "setQuery", "(", "$", "query", ",", "$", "baseDn", ")", "{", "$", "this", "->", "query", "=", "$", "query", ";", "$", "this", "->", "baseDn", "=", "$", "baseDn", ";", "$", "this", "->", "message", "=", "\"No LDAP query results for...
Sets the query that was used. @param string $query @param string $baseDn @return ModelNotFoundException
[ "Sets", "the", "query", "that", "was", "used", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/ModelNotFoundException.php#L38-L46
Adldap2/Adldap2
src/Models/Group.php
Group.getMembers
public function getMembers() { $members = $this->getMembersFromAttribute($this->schema->member()); if(count($members) === 0) { $members = $this->getPaginatedMembers(); } return $this->newCollection($members); }
php
public function getMembers() { $members = $this->getMembersFromAttribute($this->schema->member()); if(count($members) === 0) { $members = $this->getPaginatedMembers(); } return $this->newCollection($members); }
[ "public", "function", "getMembers", "(", ")", "{", "$", "members", "=", "$", "this", "->", "getMembersFromAttribute", "(", "$", "this", "->", "schema", "->", "member", "(", ")", ")", ";", "if", "(", "count", "(", "$", "members", ")", "===", "0", ")",...
Returns all users apart of the current group. @link https://msdn.microsoft.com/en-us/library/ms677097(v=vs.85).aspx @return \Adldap\Query\Collection
[ "Returns", "all", "users", "apart", "of", "the", "current", "group", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Group.php#L27-L36
Adldap2/Adldap2
src/Models/Group.php
Group.getMemberNames
public function getMemberNames() { $members = []; $dns = $this->getAttribute($this->schema->member()) ?: []; foreach ($dns as $dn) { $exploded = Utilities::explodeDn($dn); if (array_key_exists(0, $exploded)) { $members[] = $exploded[0]; ...
php
public function getMemberNames() { $members = []; $dns = $this->getAttribute($this->schema->member()) ?: []; foreach ($dns as $dn) { $exploded = Utilities::explodeDn($dn); if (array_key_exists(0, $exploded)) { $members[] = $exploded[0]; ...
[ "public", "function", "getMemberNames", "(", ")", "{", "$", "members", "=", "[", "]", ";", "$", "dns", "=", "$", "this", "->", "getAttribute", "(", "$", "this", "->", "schema", "->", "member", "(", ")", ")", "?", ":", "[", "]", ";", "foreach", "(...
Returns the group's member names only. @return array
[ "Returns", "the", "group", "s", "member", "names", "only", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Group.php#L43-L58
Adldap2/Adldap2
src/Models/Group.php
Group.addMembers
public function addMembers(array $members) { $members = array_map(function ($member) { return $member instanceof Model ? $member->getDn() : $member; }, $members); $mod = $this->newBatchModification( $this->schema->member(), ...
php
public function addMembers(array $members) { $members = array_map(function ($member) { return $member instanceof Model ? $member->getDn() : $member; }, $members); $mod = $this->newBatchModification( $this->schema->member(), ...
[ "public", "function", "addMembers", "(", "array", "$", "members", ")", "{", "$", "members", "=", "array_map", "(", "function", "(", "$", "member", ")", "{", "return", "$", "member", "instanceof", "Model", "?", "$", "member", "->", "getDn", "(", ")", ":...
Adds multiple entries to the current group. @param array $members @return bool
[ "Adds", "multiple", "entries", "to", "the", "current", "group", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Group.php#L79-L94
Adldap2/Adldap2
src/Models/Group.php
Group.addMember
public function addMember($member) { $member = ($member instanceof Model ? $member->getDn() : $member); if (is_null($member)) { throw new InvalidArgumentException( 'Cannot add member to group. The members distinguished name cannot be null.' ); } ...
php
public function addMember($member) { $member = ($member instanceof Model ? $member->getDn() : $member); if (is_null($member)) { throw new InvalidArgumentException( 'Cannot add member to group. The members distinguished name cannot be null.' ); } ...
[ "public", "function", "addMember", "(", "$", "member", ")", "{", "$", "member", "=", "(", "$", "member", "instanceof", "Model", "?", "$", "member", "->", "getDn", "(", ")", ":", "$", "member", ")", ";", "if", "(", "is_null", "(", "$", "member", ")"...
Adds an entry to the current group. @param string|Entry $member @throws InvalidArgumentException When the given entry is empty or contains no distinguished name. @return bool
[ "Adds", "an", "entry", "to", "the", "current", "group", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Group.php#L105-L122
Adldap2/Adldap2
src/Models/Group.php
Group.removeMember
public function removeMember($member) { $member = ($member instanceof Model ? $member->getDn() : $member); if (is_null($member)) { throw new InvalidArgumentException( 'Cannot remove member to group. The members distinguished name cannot be null.' ); }...
php
public function removeMember($member) { $member = ($member instanceof Model ? $member->getDn() : $member); if (is_null($member)) { throw new InvalidArgumentException( 'Cannot remove member to group. The members distinguished name cannot be null.' ); }...
[ "public", "function", "removeMember", "(", "$", "member", ")", "{", "$", "member", "=", "(", "$", "member", "instanceof", "Model", "?", "$", "member", "->", "getDn", "(", ")", ":", "$", "member", ")", ";", "if", "(", "is_null", "(", "$", "member", ...
Removes an entry from the current group. @param string|Entry $member @throws InvalidArgumentException @return bool
[ "Removes", "an", "entry", "from", "the", "current", "group", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Group.php#L133-L150
Adldap2/Adldap2
src/Models/Group.php
Group.removeMembers
public function removeMembers() { $mod = $this->newBatchModification( $this->schema->member(), LDAP_MODIFY_BATCH_REMOVE_ALL ); return $this->addModification($mod)->save(); }
php
public function removeMembers() { $mod = $this->newBatchModification( $this->schema->member(), LDAP_MODIFY_BATCH_REMOVE_ALL ); return $this->addModification($mod)->save(); }
[ "public", "function", "removeMembers", "(", ")", "{", "$", "mod", "=", "$", "this", "->", "newBatchModification", "(", "$", "this", "->", "schema", "->", "member", "(", ")", ",", "LDAP_MODIFY_BATCH_REMOVE_ALL", ")", ";", "return", "$", "this", "->", "addMo...
Removes all members from the current group. @return bool
[ "Removes", "all", "members", "from", "the", "current", "group", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Group.php#L157-L165
Adldap2/Adldap2
src/Models/Group.php
Group.getMembersFromAttribute
protected function getMembersFromAttribute($attribute) { $members = []; $entries = $this->getAttribute($attribute) ?: []; $query = $this->query->newInstance(); // Retrieving the member identifier to allow // compatibility with LDAP variants. $identifier = $this->sc...
php
protected function getMembersFromAttribute($attribute) { $members = []; $entries = $this->getAttribute($attribute) ?: []; $query = $this->query->newInstance(); // Retrieving the member identifier to allow // compatibility with LDAP variants. $identifier = $this->sc...
[ "protected", "function", "getMembersFromAttribute", "(", "$", "attribute", ")", "{", "$", "members", "=", "[", "]", ";", "$", "entries", "=", "$", "this", "->", "getAttribute", "(", "$", "attribute", ")", "?", ":", "[", "]", ";", "$", "query", "=", "...
Retrieves group members by the specified model attribute. @param $attribute @return array
[ "Retrieves", "group", "members", "by", "the", "specified", "model", "attribute", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Group.php#L186-L218
Adldap2/Adldap2
src/Models/Group.php
Group.getPaginatedMembers
protected function getPaginatedMembers() { $members = []; $keys = array_keys($this->attributes); // We need to filter out the model attributes so // we only retrieve the member range. $attributes = array_values(array_filter($keys, function ($key) { return strpos...
php
protected function getPaginatedMembers() { $members = []; $keys = array_keys($this->attributes); // We need to filter out the model attributes so // we only retrieve the member range. $attributes = array_values(array_filter($keys, function ($key) { return strpos...
[ "protected", "function", "getPaginatedMembers", "(", ")", "{", "$", "members", "=", "[", "]", ";", "$", "keys", "=", "array_keys", "(", "$", "this", "->", "attributes", ")", ";", "// We need to filter out the model attributes so", "// we only retrieve the member range...
Retrieves members that are contained in a member range. @return array
[ "Retrieves", "members", "that", "are", "contained", "in", "a", "member", "range", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Group.php#L225-L289
Adldap2/Adldap2
src/Query/Factory.php
Factory.users
public function users() { $wheres = [ [$this->schema->objectClass(), Operator::$equals, $this->schema->objectClassUser()], [$this->schema->objectCategory(), Operator::$equals, $this->schema->objectCategoryPerson()] ]; // OpenLDAP doesn't like specifying the omission ...
php
public function users() { $wheres = [ [$this->schema->objectClass(), Operator::$equals, $this->schema->objectClassUser()], [$this->schema->objectCategory(), Operator::$equals, $this->schema->objectCategoryPerson()] ]; // OpenLDAP doesn't like specifying the omission ...
[ "public", "function", "users", "(", ")", "{", "$", "wheres", "=", "[", "[", "$", "this", "->", "schema", "->", "objectClass", "(", ")", ",", "Operator", "::", "$", "equals", ",", "$", "this", "->", "schema", "->", "objectClassUser", "(", ")", "]", ...
Returns a query builder scoped to users. @return Builder
[ "Returns", "a", "query", "builder", "scoped", "to", "users", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Factory.php#L123-L138
Adldap2/Adldap2
src/Query/Factory.php
Factory.getRootDse
public function getRootDse() { $query = $this->newQuery(); $root = $query->in('')->read()->whereHas($this->schema->objectClass())->first(); if ($root) { return (new RootDse([], $query)) ->setRawAttributes($root->getAttributes()); } }
php
public function getRootDse() { $query = $this->newQuery(); $root = $query->in('')->read()->whereHas($this->schema->objectClass())->first(); if ($root) { return (new RootDse([], $query)) ->setRawAttributes($root->getAttributes()); } }
[ "public", "function", "getRootDse", "(", ")", "{", "$", "query", "=", "$", "this", "->", "newQuery", "(", ")", ";", "$", "root", "=", "$", "query", "->", "in", "(", "''", ")", "->", "read", "(", ")", "->", "whereHas", "(", "$", "this", "->", "s...
Returns the root DSE record. @return RootDse|null
[ "Returns", "the", "root", "DSE", "record", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Factory.php#L217-L227
Adldap2/Adldap2
src/Query/Grammar.php
Grammar.compile
public function compile(Builder $builder) { $ands = $builder->filters['and']; $ors = $builder->filters['or']; $raws = $builder->filters['raw']; $query = $this->concatenate($raws); $query = $this->compileWheres($ands, $query); $query = $this->compileOrWheres($ors, $...
php
public function compile(Builder $builder) { $ands = $builder->filters['and']; $ors = $builder->filters['or']; $raws = $builder->filters['raw']; $query = $this->concatenate($raws); $query = $this->compileWheres($ands, $query); $query = $this->compileOrWheres($ors, $...
[ "public", "function", "compile", "(", "Builder", "$", "builder", ")", "{", "$", "ands", "=", "$", "builder", "->", "filters", "[", "'and'", "]", ";", "$", "ors", "=", "$", "builder", "->", "filters", "[", "'or'", "]", ";", "$", "raws", "=", "$", ...
Compiles the Builder instance into an LDAP query string. @param Builder $builder @return string
[ "Compiles", "the", "Builder", "instance", "into", "an", "LDAP", "query", "string", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Grammar.php#L30-L57
Adldap2/Adldap2
src/Query/Grammar.php
Grammar.concatenate
public function concatenate(array $bindings = []) { // Filter out empty query segments. $bindings = array_filter($bindings, function ($value) { return (string) $value !== ''; }); return implode('', $bindings); }
php
public function concatenate(array $bindings = []) { // Filter out empty query segments. $bindings = array_filter($bindings, function ($value) { return (string) $value !== ''; }); return implode('', $bindings); }
[ "public", "function", "concatenate", "(", "array", "$", "bindings", "=", "[", "]", ")", "{", "// Filter out empty query segments.", "$", "bindings", "=", "array_filter", "(", "$", "bindings", ",", "function", "(", "$", "value", ")", "{", "return", "(", "stri...
Concatenates filters into a single string. @param array $bindings @return string
[ "Concatenates", "filters", "into", "a", "single", "string", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Grammar.php#L66-L74
Adldap2/Adldap2
src/Query/Grammar.php
Grammar.compileStartsWith
public function compileStartsWith($field, $value) { return $this->wrap($field.Operator::$equals.$value.Operator::$has); }
php
public function compileStartsWith($field, $value) { return $this->wrap($field.Operator::$equals.$value.Operator::$has); }
[ "public", "function", "compileStartsWith", "(", "$", "field", ",", "$", "value", ")", "{", "return", "$", "this", "->", "wrap", "(", "$", "field", ".", "Operator", "::", "$", "equals", ".", "$", "value", ".", "Operator", "::", "$", "has", ")", ";", ...
Returns a query string for starts with. Produces: (field=value*) @param string $field @param string $value @return string
[ "Returns", "a", "query", "string", "for", "starts", "with", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Grammar.php#L176-L179
Adldap2/Adldap2
src/Query/Grammar.php
Grammar.compileEndsWith
public function compileEndsWith($field, $value) { return $this->wrap($field.Operator::$equals.Operator::$has.$value); }
php
public function compileEndsWith($field, $value) { return $this->wrap($field.Operator::$equals.Operator::$has.$value); }
[ "public", "function", "compileEndsWith", "(", "$", "field", ",", "$", "value", ")", "{", "return", "$", "this", "->", "wrap", "(", "$", "field", ".", "Operator", "::", "$", "equals", ".", "Operator", "::", "$", "has", ".", "$", "value", ")", ";", "...
Returns a query string for ends with. Produces: (field=*value) @param string $field @param string $value @return string
[ "Returns", "a", "query", "string", "for", "ends", "with", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Grammar.php#L206-L209
Adldap2/Adldap2
src/Query/Grammar.php
Grammar.compileContains
public function compileContains($field, $value) { return $this->wrap($field.Operator::$equals.Operator::$has.$value.Operator::$has); }
php
public function compileContains($field, $value) { return $this->wrap($field.Operator::$equals.Operator::$has.$value.Operator::$has); }
[ "public", "function", "compileContains", "(", "$", "field", ",", "$", "value", ")", "{", "return", "$", "this", "->", "wrap", "(", "$", "field", ".", "Operator", "::", "$", "equals", ".", "Operator", "::", "$", "has", ".", "$", "value", ".", "Operato...
Returns a query string for contains. Produces: (field=*value*) @param string $field @param string $value @return string
[ "Returns", "a", "query", "string", "for", "contains", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Grammar.php#L236-L239
Adldap2/Adldap2
src/Query/Grammar.php
Grammar.compileWheres
protected function compileWheres(array $wheres = [], $query = '') { foreach ($wheres as $where) { $query .= $this->compileWhere($where); } return $query; }
php
protected function compileWheres(array $wheres = [], $query = '') { foreach ($wheres as $where) { $query .= $this->compileWhere($where); } return $query; }
[ "protected", "function", "compileWheres", "(", "array", "$", "wheres", "=", "[", "]", ",", "$", "query", "=", "''", ")", "{", "foreach", "(", "$", "wheres", "as", "$", "where", ")", "{", "$", "query", ".=", "$", "this", "->", "compileWhere", "(", "...
Assembles all where clauses in the current wheres property. @param array $wheres @param string $query @return string
[ "Assembles", "all", "where", "clauses", "in", "the", "current", "wheres", "property", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Grammar.php#L332-L339
Adldap2/Adldap2
src/Query/Grammar.php
Grammar.compileOrWheres
protected function compileOrWheres(array $orWheres = [], $query = '') { $or = ''; foreach ($orWheres as $where) { $or .= $this->compileWhere($where); } // Make sure we wrap the query in an 'or' if using multiple // orWheres. For example (|(QUERY)(ORWHEREQUERY))....
php
protected function compileOrWheres(array $orWheres = [], $query = '') { $or = ''; foreach ($orWheres as $where) { $or .= $this->compileWhere($where); } // Make sure we wrap the query in an 'or' if using multiple // orWheres. For example (|(QUERY)(ORWHEREQUERY))....
[ "protected", "function", "compileOrWheres", "(", "array", "$", "orWheres", "=", "[", "]", ",", "$", "query", "=", "''", ")", "{", "$", "or", "=", "''", ";", "foreach", "(", "$", "orWheres", "as", "$", "where", ")", "{", "$", "or", ".=", "$", "thi...
Assembles all or where clauses in the current orWheres property. @param array $orWheres @param string $query @return string
[ "Assembles", "all", "or", "where", "clauses", "in", "the", "current", "orWheres", "property", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Grammar.php#L349-L366
Adldap2/Adldap2
src/Query/Grammar.php
Grammar.compileWhere
protected function compileWhere(array $where) { // Get the name of the operator. if ($name = array_search($where['operator'], Operator::all())) { // If the name was found we'll camel case it // to run it through the compile method. $method = 'compile'.ucfirst($nam...
php
protected function compileWhere(array $where) { // Get the name of the operator. if ($name = array_search($where['operator'], Operator::all())) { // If the name was found we'll camel case it // to run it through the compile method. $method = 'compile'.ucfirst($nam...
[ "protected", "function", "compileWhere", "(", "array", "$", "where", ")", "{", "// Get the name of the operator.", "if", "(", "$", "name", "=", "array_search", "(", "$", "where", "[", "'operator'", "]", ",", "Operator", "::", "all", "(", ")", ")", ")", "{"...
Assembles a single where query based on its operator and returns it. @param array $where @return string|null
[ "Assembles", "a", "single", "where", "query", "based", "on", "its", "operator", "and", "returns", "it", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Grammar.php#L376-L389
Adldap2/Adldap2
src/Adldap.php
Adldap.addProvider
public function addProvider($config, $name = 'default', ConnectionInterface $connection = null) { if ($this->isValidConfig($config)) { $config = new Provider($config, $connection ?? new Ldap($name)); } if ($config instanceof ProviderInterface) { $this->providers[$nam...
php
public function addProvider($config, $name = 'default', ConnectionInterface $connection = null) { if ($this->isValidConfig($config)) { $config = new Provider($config, $connection ?? new Ldap($name)); } if ($config instanceof ProviderInterface) { $this->providers[$nam...
[ "public", "function", "addProvider", "(", "$", "config", ",", "$", "name", "=", "'default'", ",", "ConnectionInterface", "$", "connection", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isValidConfig", "(", "$", "config", ")", ")", "{", "$", "c...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Adldap.php#L52-L67
Adldap2/Adldap2
src/Adldap.php
Adldap.getProvider
public function getProvider($name) { if (array_key_exists($name, $this->providers)) { return $this->providers[$name]; } throw new AdldapException("The connection provider '$name' does not exist."); }
php
public function getProvider($name) { if (array_key_exists($name, $this->providers)) { return $this->providers[$name]; } throw new AdldapException("The connection provider '$name' does not exist."); }
[ "public", "function", "getProvider", "(", "$", "name", ")", "{", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "providers", ")", ")", "{", "return", "$", "this", "->", "providers", "[", "$", "name", "]", ";", "}", "throw", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Adldap.php#L92-L99
Adldap2/Adldap2
src/Adldap.php
Adldap.connect
public function connect($name = null, $username = null, $password = null) { $provider = $name ? $this->getProvider($name) : $this->getDefaultProvider(); return $provider->connect($username, $password); }
php
public function connect($name = null, $username = null, $password = null) { $provider = $name ? $this->getProvider($name) : $this->getDefaultProvider(); return $provider->connect($username, $password); }
[ "public", "function", "connect", "(", "$", "name", "=", "null", ",", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "$", "provider", "=", "$", "name", "?", "$", "this", "->", "getProvider", "(", "$", "name", ")", ":", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Adldap.php#L132-L137
Adldap2/Adldap2
src/Adldap.php
Adldap.initEventLogger
public function initEventLogger() { $dispatcher = static::getEventDispatcher(); $logger = $this->newEventLogger(); $dispatcher->listen('Adldap\Auth\Events\*', function ($eventName, $events) use ($logger) { foreach ($events as $event) { $logger->auth($event); ...
php
public function initEventLogger() { $dispatcher = static::getEventDispatcher(); $logger = $this->newEventLogger(); $dispatcher->listen('Adldap\Auth\Events\*', function ($eventName, $events) use ($logger) { foreach ($events as $event) { $logger->auth($event); ...
[ "public", "function", "initEventLogger", "(", ")", "{", "$", "dispatcher", "=", "static", "::", "getEventDispatcher", "(", ")", ";", "$", "logger", "=", "$", "this", "->", "newEventLogger", "(", ")", ";", "$", "dispatcher", "->", "listen", "(", "'Adldap\\A...
Initializes the event logger. @return void
[ "Initializes", "the", "event", "logger", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Adldap.php#L160-L177
Adldap2/Adldap2
src/Models/Attributes/AccountControl.php
AccountControl.has
public function has($flag) { // We'll extract the given flag into an array of possible flags, and // see if our AccountControl object contains any of them. $flagsUsed = array_intersect($this->extractFlags($flag), $this->values); return in_array($flag, $flagsUsed); }
php
public function has($flag) { // We'll extract the given flag into an array of possible flags, and // see if our AccountControl object contains any of them. $flagsUsed = array_intersect($this->extractFlags($flag), $this->values); return in_array($flag, $flagsUsed); }
[ "public", "function", "has", "(", "$", "flag", ")", "{", "// We'll extract the given flag into an array of possible flags, and", "// see if our AccountControl object contains any of them.", "$", "flagsUsed", "=", "array_intersect", "(", "$", "this", "->", "extractFlags", "(", ...
Determine if the current AccountControl object contains the given UAC flag(s). @param int $flag @return bool
[ "Determine", "if", "the", "current", "AccountControl", "object", "contains", "the", "given", "UAC", "flag", "(", "s", ")", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/AccountControl.php#L117-L124
Adldap2/Adldap2
src/Models/Attributes/AccountControl.php
AccountControl.getValue
public function getValue() { $total = 0; foreach ($this->values as $value) { $total = $total + $value; } return $total; }
php
public function getValue() { $total = 0; foreach ($this->values as $value) { $total = $total + $value; } return $total; }
[ "public", "function", "getValue", "(", ")", "{", "$", "total", "=", "0", ";", "foreach", "(", "$", "this", "->", "values", "as", "$", "value", ")", "{", "$", "total", "=", "$", "total", "+", "$", "value", ";", "}", "return", "$", "total", ";", ...
Returns the complete account control value. @return int
[ "Returns", "the", "complete", "account", "control", "value", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/AccountControl.php#L376-L385
Adldap2/Adldap2
src/Models/Attributes/AccountControl.php
AccountControl.extractFlags
public function extractFlags($flag) { $flags = []; for ($i = 0; $i <= 26; $i++) { if ((int) $flag & (1 << $i)) { array_push($flags, 1 << $i); } } return $flags; }
php
public function extractFlags($flag) { $flags = []; for ($i = 0; $i <= 26; $i++) { if ((int) $flag & (1 << $i)) { array_push($flags, 1 << $i); } } return $flags; }
[ "public", "function", "extractFlags", "(", "$", "flag", ")", "{", "$", "flags", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<=", "26", ";", "$", "i", "++", ")", "{", "if", "(", "(", "int", ")", "$", "flag", "&", "(...
Extracts the given flag into an array of flags used. @param int $flag @return array
[ "Extracts", "the", "given", "flag", "into", "an", "array", "of", "flags", "used", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/AccountControl.php#L424-L435
Adldap2/Adldap2
src/Query/Collection.php
Collection.valueRetriever
protected function valueRetriever($value) { if ($this->useAsCallable($value)) { return $value; } return function ($item) use ($value) { if ($item instanceof Model) { return $item->getFirstAttribute($value); } return data_get($...
php
protected function valueRetriever($value) { if ($this->useAsCallable($value)) { return $value; } return function ($item) use ($value) { if ($item instanceof Model) { return $item->getFirstAttribute($value); } return data_get($...
[ "protected", "function", "valueRetriever", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "useAsCallable", "(", "$", "value", ")", ")", "{", "return", "$", "value", ";", "}", "return", "function", "(", "$", "item", ")", "use", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Collection.php#L13-L26
Adldap2/Adldap2
src/Models/BatchModification.php
BatchModification.setValues
public function setValues(array $values = []) { $this->values = array_map(function($value) { // We need to make sure all values given to a batch modification are // strings, otherwise we'll receive an LDAP exception when // we try to process the modification. ...
php
public function setValues(array $values = []) { $this->values = array_map(function($value) { // We need to make sure all values given to a batch modification are // strings, otherwise we'll receive an LDAP exception when // we try to process the modification. ...
[ "public", "function", "setValues", "(", "array", "$", "values", "=", "[", "]", ")", "{", "$", "this", "->", "values", "=", "array_map", "(", "function", "(", "$", "value", ")", "{", "// We need to make sure all values given to a batch modification are", "// string...
Sets the values of the modification. @param array $values @return $this
[ "Sets", "the", "values", "of", "the", "modification", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/BatchModification.php#L121-L131
Adldap2/Adldap2
src/Models/BatchModification.php
BatchModification.setType
public function setType($type = null) { if (! is_null($type) && ! $this->isValidType($type)) { throw new InvalidArgumentException("Given batch modification type is invalid."); } $this->type = $type; return $this; }
php
public function setType($type = null) { if (! is_null($type) && ! $this->isValidType($type)) { throw new InvalidArgumentException("Given batch modification type is invalid."); } $this->type = $type; return $this; }
[ "public", "function", "setType", "(", "$", "type", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "type", ")", "&&", "!", "$", "this", "->", "isValidType", "(", "$", "type", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(",...
Sets the type of the modification. @param int|null $type @return $this
[ "Sets", "the", "type", "of", "the", "modification", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/BatchModification.php#L150-L159
Adldap2/Adldap2
src/Models/BatchModification.php
BatchModification.build
public function build() { $filtered = array_diff( array_map('trim', $this->values), [''] ); if (is_null($this->original)) { // If the original value is null, we'll assume // that the attribute doesn't exist yet. if (! empty($filter...
php
public function build() { $filtered = array_diff( array_map('trim', $this->values), [''] ); if (is_null($this->original)) { // If the original value is null, we'll assume // that the attribute doesn't exist yet. if (! empty($filter...
[ "public", "function", "build", "(", ")", "{", "$", "filtered", "=", "array_diff", "(", "array_map", "(", "'trim'", ",", "$", "this", "->", "values", ")", ",", "[", "''", "]", ")", ";", "if", "(", "is_null", "(", "$", "this", "->", "original", ")", ...
Builds the type of modification automatically based on the current and original values. @return $this
[ "Builds", "the", "type", "of", "modification", "automatically", "based", "on", "the", "current", "and", "original", "values", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/BatchModification.php#L188-L223
Adldap2/Adldap2
src/Models/BatchModification.php
BatchModification.get
public function get() { switch ($this->type) { case LDAP_MODIFY_BATCH_REMOVE_ALL: // A values key cannot be provided when // a remove all type is selected. return [ static::KEY_ATTRIB => $this->attribute, sta...
php
public function get() { switch ($this->type) { case LDAP_MODIFY_BATCH_REMOVE_ALL: // A values key cannot be provided when // a remove all type is selected. return [ static::KEY_ATTRIB => $this->attribute, sta...
[ "public", "function", "get", "(", ")", "{", "switch", "(", "$", "this", "->", "type", ")", "{", "case", "LDAP_MODIFY_BATCH_REMOVE_ALL", ":", "// A values key cannot be provided when", "// a remove all type is selected.", "return", "[", "static", "::", "KEY_ATTRIB", "=...
Returns the built batch modification array. @return array|null
[ "Returns", "the", "built", "batch", "modification", "array", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/BatchModification.php#L230-L254
Adldap2/Adldap2
src/Models/Model.php
Model.newBatchModification
public function newBatchModification($attribute = null, $type = null, $values = []) { return new BatchModification($attribute, $type, $values); }
php
public function newBatchModification($attribute = null, $type = null, $values = []) { return new BatchModification($attribute, $type, $values); }
[ "public", "function", "newBatchModification", "(", "$", "attribute", "=", "null", ",", "$", "type", "=", "null", ",", "$", "values", "=", "[", "]", ")", "{", "return", "new", "BatchModification", "(", "$", "attribute", ",", "$", "type", ",", "$", "valu...
Returns a new batch modification. @param string|null $attribute @param string|int|null $type @param array $values @return BatchModification
[ "Returns", "a", "new", "batch", "modification", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L128-L131
Adldap2/Adldap2
src/Models/Model.php
Model.jsonSerialize
public function jsonSerialize() { $attributes = $this->getAttributes(); array_walk_recursive($attributes, function(&$val) { if (MbString::isLoaded()) { // If we're able to detect the attribute // encoding, we'll encode only the // attribut...
php
public function jsonSerialize() { $attributes = $this->getAttributes(); array_walk_recursive($attributes, function(&$val) { if (MbString::isLoaded()) { // If we're able to detect the attribute // encoding, we'll encode only the // attribut...
[ "public", "function", "jsonSerialize", "(", ")", "{", "$", "attributes", "=", "$", "this", "->", "getAttributes", "(", ")", ";", "array_walk_recursive", "(", "$", "attributes", ",", "function", "(", "&", "$", "val", ")", "{", "if", "(", "MbString", "::",...
Convert the object into something JSON serializable. @return array
[ "Convert", "the", "object", "into", "something", "JSON", "serializable", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L223-L249
Adldap2/Adldap2
src/Models/Model.php
Model.fresh
public function fresh() { $model = $this->query->newInstance()->findByDn($this->getDn()); return $model instanceof Model ? $model : null; }
php
public function fresh() { $model = $this->query->newInstance()->findByDn($this->getDn()); return $model instanceof Model ? $model : null; }
[ "public", "function", "fresh", "(", ")", "{", "$", "model", "=", "$", "this", "->", "query", "->", "newInstance", "(", ")", "->", "findByDn", "(", "$", "this", "->", "getDn", "(", ")", ")", ";", "return", "$", "model", "instanceof", "Model", "?", "...
Reload a fresh model instance from the directory. @return static|null
[ "Reload", "a", "fresh", "model", "instance", "from", "the", "directory", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L256-L261
Adldap2/Adldap2
src/Models/Model.php
Model.syncRaw
public function syncRaw() { if ($model = $this->fresh()) { $this->setRawAttributes($model->getAttributes()); return true; } return false; }
php
public function syncRaw() { if ($model = $this->fresh()) { $this->setRawAttributes($model->getAttributes()); return true; } return false; }
[ "public", "function", "syncRaw", "(", ")", "{", "if", "(", "$", "model", "=", "$", "this", "->", "fresh", "(", ")", ")", "{", "$", "this", "->", "setRawAttributes", "(", "$", "model", "->", "getAttributes", "(", ")", ")", ";", "return", "true", ";"...
Synchronizes the current models attributes with the directory values. @return bool
[ "Synchronizes", "the", "current", "models", "attributes", "with", "the", "directory", "values", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L268-L277
Adldap2/Adldap2
src/Models/Model.php
Model.addModification
public function addModification($mod = []) { if ($mod instanceof BatchModification) { $mod = $mod->get(); } if ($this->isValidModification($mod)) { $this->modifications[] = $mod; return $this; } throw new InvalidArgumentException( ...
php
public function addModification($mod = []) { if ($mod instanceof BatchModification) { $mod = $mod->get(); } if ($this->isValidModification($mod)) { $this->modifications[] = $mod; return $this; } throw new InvalidArgumentException( ...
[ "public", "function", "addModification", "(", "$", "mod", "=", "[", "]", ")", "{", "if", "(", "$", "mod", "instanceof", "BatchModification", ")", "{", "$", "mod", "=", "$", "mod", "->", "get", "(", ")", ";", "}", "if", "(", "$", "this", "->", "is...
Adds a batch modification to the models modifications array. @param array|BatchModification $mod @throws InvalidArgumentException @return $this
[ "Adds", "a", "batch", "modification", "to", "the", "models", "modifications", "array", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L314-L329
Adldap2/Adldap2
src/Models/Model.php
Model.setDistinguishedName
public function setDistinguishedName($dn) { $this->setFirstAttribute($this->schema->distinguishedName(), (string) $dn); return $this; }
php
public function setDistinguishedName($dn) { $this->setFirstAttribute($this->schema->distinguishedName(), (string) $dn); return $this; }
[ "public", "function", "setDistinguishedName", "(", "$", "dn", ")", "{", "$", "this", "->", "setFirstAttribute", "(", "$", "this", "->", "schema", "->", "distinguishedName", "(", ")", ",", "(", "string", ")", "$", "dn", ")", ";", "return", "$", "this", ...
Sets the model's distinguished name attribute. @param string|DistinguishedName $dn @return $this
[ "Sets", "the", "model", "s", "distinguished", "name", "attribute", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L350-L355
Adldap2/Adldap2
src/Models/Model.php
Model.getDnBuilder
public function getDnBuilder() { // If we currently don't have a distinguished name, we'll set // it to our base, otherwise we'll use our query's base DN. $dn = $this->getDistinguishedName() ?: $this->query->getDn(); return $this->getNewDnBuilder($dn); }
php
public function getDnBuilder() { // If we currently don't have a distinguished name, we'll set // it to our base, otherwise we'll use our query's base DN. $dn = $this->getDistinguishedName() ?: $this->query->getDn(); return $this->getNewDnBuilder($dn); }
[ "public", "function", "getDnBuilder", "(", ")", "{", "// If we currently don't have a distinguished name, we'll set", "// it to our base, otherwise we'll use our query's base DN.", "$", "dn", "=", "$", "this", "->", "getDistinguishedName", "(", ")", "?", ":", "$", "this", "...
Returns a DistinguishedName object for modifying the current models DN. @return DistinguishedName
[ "Returns", "a", "DistinguishedName", "object", "for", "modifying", "the", "current", "models", "DN", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L376-L383
Adldap2/Adldap2
src/Models/Model.php
Model.getManagedByUser
public function getManagedByUser() { if ($dn = $this->getManagedBy()) { return $this->query->newInstance()->findByDn($dn); } return false; }
php
public function getManagedByUser() { if ($dn = $this->getManagedBy()) { return $this->query->newInstance()->findByDn($dn); } return false; }
[ "public", "function", "getManagedByUser", "(", ")", "{", "if", "(", "$", "dn", "=", "$", "this", "->", "getManagedBy", "(", ")", ")", "{", "return", "$", "this", "->", "query", "->", "newInstance", "(", ")", "->", "findByDn", "(", "$", "dn", ")", "...
Returns the user model of the user who is assigned to manage this object. Returns false otherwise. @return User|bool
[ "Returns", "the", "user", "model", "of", "the", "user", "who", "is", "assigned", "to", "manage", "this", "object", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L720-L727
Adldap2/Adldap2
src/Models/Model.php
Model.setManagedBy
public function setManagedBy($dn) { if ($dn instanceof Model) { $dn = $dn->getDn(); } return $this->setFirstAttribute($this->schema->managedBy(), $dn); }
php
public function setManagedBy($dn) { if ($dn instanceof Model) { $dn = $dn->getDn(); } return $this->setFirstAttribute($this->schema->managedBy(), $dn); }
[ "public", "function", "setManagedBy", "(", "$", "dn", ")", "{", "if", "(", "$", "dn", "instanceof", "Model", ")", "{", "$", "dn", "=", "$", "dn", "->", "getDn", "(", ")", ";", "}", "return", "$", "this", "->", "setFirstAttribute", "(", "$", "this",...
Sets the user who is assigned to managed this object. @param Model|string $dn @return $this
[ "Sets", "the", "user", "who", "is", "assigned", "to", "managed", "this", "object", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L736-L743
Adldap2/Adldap2
src/Models/Model.php
Model.inOu
public function inOu($ou, $strict = false) { if ($ou instanceof Model) { // If we've been given an OU model, we can // just check if the OU's DN is inside // the current models DN. return (bool) strpos($this->getDn(), $ou->getDn()); } $suffix ...
php
public function inOu($ou, $strict = false) { if ($ou instanceof Model) { // If we've been given an OU model, we can // just check if the OU's DN is inside // the current models DN. return (bool) strpos($this->getDn(), $ou->getDn()); } $suffix ...
[ "public", "function", "inOu", "(", "$", "ou", ",", "$", "strict", "=", "false", ")", "{", "if", "(", "$", "ou", "instanceof", "Model", ")", "{", "// If we've been given an OU model, we can", "// just check if the OU's DN is inside", "// the current models DN.", "retur...
Determine if the current model is located inside the given OU. If a model instance is given, the strict parameter is ignored. @param Model|string $ou The organizational unit to check. @param bool $strict Whether the check is case-sensitive. @return bool
[ "Determine", "if", "the", "current", "model", "is", "located", "inside", "the", "given", "OU", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L777-L789
Adldap2/Adldap2
src/Models/Model.php
Model.save
public function save(array $attributes = []) { $this->fireModelEvent(new Events\Saving($this)); $saved = $this->exists ? $this->update($attributes) : $this->create($attributes); if ($saved) { $this->fireModelEvent(new Events\Saved($this)); } return $saved; ...
php
public function save(array $attributes = []) { $this->fireModelEvent(new Events\Saving($this)); $saved = $this->exists ? $this->update($attributes) : $this->create($attributes); if ($saved) { $this->fireModelEvent(new Events\Saved($this)); } return $saved; ...
[ "public", "function", "save", "(", "array", "$", "attributes", "=", "[", "]", ")", "{", "$", "this", "->", "fireModelEvent", "(", "new", "Events", "\\", "Saving", "(", "$", "this", ")", ")", ";", "$", "saved", "=", "$", "this", "->", "exists", "?",...
Saves the changes to LDAP and returns the results. @param array $attributes The attributes to update or create for the current entry. @return bool
[ "Saves", "the", "changes", "to", "LDAP", "and", "returns", "the", "results", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L809-L820
Adldap2/Adldap2
src/Models/Model.php
Model.update
public function update(array $attributes = []) { $this->fill($attributes); $modifications = $this->getModifications(); if (count($modifications) > 0) { $this->fireModelEvent(new Events\Updating($this)); // Push the update. if ($this->query->getConnectio...
php
public function update(array $attributes = []) { $this->fill($attributes); $modifications = $this->getModifications(); if (count($modifications) > 0) { $this->fireModelEvent(new Events\Updating($this)); // Push the update. if ($this->query->getConnectio...
[ "public", "function", "update", "(", "array", "$", "attributes", "=", "[", "]", ")", "{", "$", "this", "->", "fill", "(", "$", "attributes", ")", ";", "$", "modifications", "=", "$", "this", "->", "getModifications", "(", ")", ";", "if", "(", "count"...
Updates the model. @param array $attributes The attributes to update for the current entry. @return bool
[ "Updates", "the", "model", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L829-L859
Adldap2/Adldap2
src/Models/Model.php
Model.create
public function create(array $attributes = []) { $this->fill($attributes); if (empty($this->getDn())) { // If the model doesn't currently have a distinguished // name set, we'll create one automatically using // the current query builders base DN. $dn...
php
public function create(array $attributes = []) { $this->fill($attributes); if (empty($this->getDn())) { // If the model doesn't currently have a distinguished // name set, we'll create one automatically using // the current query builders base DN. $dn...
[ "public", "function", "create", "(", "array", "$", "attributes", "=", "[", "]", ")", "{", "$", "this", "->", "fill", "(", "$", "attributes", ")", ";", "if", "(", "empty", "(", "$", "this", "->", "getDn", "(", ")", ")", ")", "{", "// If the model do...
Creates the entry in LDAP. @param array $attributes The attributes for the new entry. @throws UnexpectedValueException @return bool
[ "Creates", "the", "entry", "in", "LDAP", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L870-L905
Adldap2/Adldap2
src/Models/Model.php
Model.createAttribute
public function createAttribute($attribute, $value, $sync = true) { if ( $this->exists && $this->query->getConnection()->modAdd($this->getDn(), [$attribute => $value]) ) { if ($sync) { $this->syncRaw(); } return true; ...
php
public function createAttribute($attribute, $value, $sync = true) { if ( $this->exists && $this->query->getConnection()->modAdd($this->getDn(), [$attribute => $value]) ) { if ($sync) { $this->syncRaw(); } return true; ...
[ "public", "function", "createAttribute", "(", "$", "attribute", ",", "$", "value", ",", "$", "sync", "=", "true", ")", "{", "if", "(", "$", "this", "->", "exists", "&&", "$", "this", "->", "query", "->", "getConnection", "(", ")", "->", "modAdd", "("...
Creates an attribute on the current model. @param string $attribute The attribute to create @param mixed $value The value of the new attribute @param bool $sync Whether to re-sync all attributes @return bool
[ "Creates", "an", "attribute", "on", "the", "current", "model", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L916-L930
Adldap2/Adldap2
src/Models/Model.php
Model.updateAttribute
public function updateAttribute($attribute, $value, $sync = true) { if ( $this->exists && $this->query->getConnection()->modReplace($this->getDn(), [$attribute => $value]) ) { if ($sync) { $this->syncRaw(); } return true; ...
php
public function updateAttribute($attribute, $value, $sync = true) { if ( $this->exists && $this->query->getConnection()->modReplace($this->getDn(), [$attribute => $value]) ) { if ($sync) { $this->syncRaw(); } return true; ...
[ "public", "function", "updateAttribute", "(", "$", "attribute", ",", "$", "value", ",", "$", "sync", "=", "true", ")", "{", "if", "(", "$", "this", "->", "exists", "&&", "$", "this", "->", "query", "->", "getConnection", "(", ")", "->", "modReplace", ...
Updates the specified attribute with the specified value. @param string $attribute The attribute to modify @param mixed $value The new value for the attribute @param bool $sync Whether to re-sync all attributes @return bool
[ "Updates", "the", "specified", "attribute", "with", "the", "specified", "value", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L941-L955
Adldap2/Adldap2
src/Models/Model.php
Model.deleteAttribute
public function deleteAttribute($attributes, $sync = true) { // If we've been given a string, we'll assume we're removing a // single attribute. Otherwise, we'll assume it's // an array of attributes to remove. $attributes = is_string($attributes) ? [$attributes => []] : $attributes;...
php
public function deleteAttribute($attributes, $sync = true) { // If we've been given a string, we'll assume we're removing a // single attribute. Otherwise, we'll assume it's // an array of attributes to remove. $attributes = is_string($attributes) ? [$attributes => []] : $attributes;...
[ "public", "function", "deleteAttribute", "(", "$", "attributes", ",", "$", "sync", "=", "true", ")", "{", "// If we've been given a string, we'll assume we're removing a", "// single attribute. Otherwise, we'll assume it's", "// an array of attributes to remove.", "$", "attributes"...
Deletes an attribute on the current entry. @param string|array $attributes The attribute(s) to delete @param bool $sync Whether to re-sync all attributes Delete specific values in attributes: ["memberuid" => "username"] Delete an entire attribute: ["memberuid" => []] @return bool
[ "Deletes", "an", "attribute", "on", "the", "current", "entry", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L973-L992
Adldap2/Adldap2
src/Models/Model.php
Model.delete
public function delete($recursive = false) { $dn = $this->getDn(); if ($this->exists === false || empty($dn)) { // Make sure the record exists before we can delete it. // Otherwise, we'll throw an exception. throw (new ModelDoesNotExistException())->setModel(get_...
php
public function delete($recursive = false) { $dn = $this->getDn(); if ($this->exists === false || empty($dn)) { // Make sure the record exists before we can delete it. // Otherwise, we'll throw an exception. throw (new ModelDoesNotExistException())->setModel(get_...
[ "public", "function", "delete", "(", "$", "recursive", "=", "false", ")", "{", "$", "dn", "=", "$", "this", "->", "getDn", "(", ")", ";", "if", "(", "$", "this", "->", "exists", "===", "false", "||", "empty", "(", "$", "dn", ")", ")", "{", "// ...
Deletes the current entry. Throws a ModelNotFoundException if the current model does not exist or does not contain a distinguished name. @param bool $recursive Whether to recursively delete leaf nodes (models that are children). @throws ModelDoesNotExistException @return bool
[ "Deletes", "the", "current", "entry", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L1006-L1037
Adldap2/Adldap2
src/Models/Model.php
Model.move
public function move($newParentDn, $deleteOldRdn = true) { // First we'll explode the current models distinguished name and keep their attributes prefixes. $parts = Utilities::explodeDn($this->getDn(), $removeAttrPrefixes = false); // If the current model has an empty RDN, we can't move it....
php
public function move($newParentDn, $deleteOldRdn = true) { // First we'll explode the current models distinguished name and keep their attributes prefixes. $parts = Utilities::explodeDn($this->getDn(), $removeAttrPrefixes = false); // If the current model has an empty RDN, we can't move it....
[ "public", "function", "move", "(", "$", "newParentDn", ",", "$", "deleteOldRdn", "=", "true", ")", "{", "// First we'll explode the current models distinguished name and keep their attributes prefixes.", "$", "parts", "=", "Utilities", "::", "explodeDn", "(", "$", "this",...
Moves the current model into the given new parent. For example: $user->move($ou); @param Model|string $newParentDn The new parent of the current model. @param bool $deleteOldRdn Whether to delete the old models relative distinguished name once renamed / moved. @return bool
[ "Moves", "the", "current", "model", "into", "the", "given", "new", "parent", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L1049-L1063
Adldap2/Adldap2
src/Models/Model.php
Model.rename
public function rename($rdn, $newParentDn = null, $deleteOldRdn = true) { if ($newParentDn instanceof Model) { $newParentDn = $newParentDn->getDn(); } $moved = $this->query->getConnection()->rename($this->getDn(), $rdn, $newParentDn, $deleteOldRdn); if ($moved) { ...
php
public function rename($rdn, $newParentDn = null, $deleteOldRdn = true) { if ($newParentDn instanceof Model) { $newParentDn = $newParentDn->getDn(); } $moved = $this->query->getConnection()->rename($this->getDn(), $rdn, $newParentDn, $deleteOldRdn); if ($moved) { ...
[ "public", "function", "rename", "(", "$", "rdn", ",", "$", "newParentDn", "=", "null", ",", "$", "deleteOldRdn", "=", "true", ")", "{", "if", "(", "$", "newParentDn", "instanceof", "Model", ")", "{", "$", "newParentDn", "=", "$", "newParentDn", "->", "...
Renames the current model to a new RDN and new parent. @param string $rdn The models new relative distinguished name. Example: "cn=JohnDoe" @param Model|string|null $newParentDn The models new parent distinguished name (if moving). Leave this null if you are only renaming. Example: "ou=MovedUsers,...
[ "Renames", "the", "current", "model", "to", "a", "new", "RDN", "and", "new", "parent", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L1074-L1093
Adldap2/Adldap2
src/Models/Model.php
Model.isValidModification
protected function isValidModification($mod) { return is_array($mod) && array_key_exists(BatchModification::KEY_MODTYPE, $mod) && array_key_exists(BatchModification::KEY_ATTRIB, $mod); }
php
protected function isValidModification($mod) { return is_array($mod) && array_key_exists(BatchModification::KEY_MODTYPE, $mod) && array_key_exists(BatchModification::KEY_ATTRIB, $mod); }
[ "protected", "function", "isValidModification", "(", "$", "mod", ")", "{", "return", "is_array", "(", "$", "mod", ")", "&&", "array_key_exists", "(", "BatchModification", "::", "KEY_MODTYPE", ",", "$", "mod", ")", "&&", "array_key_exists", "(", "BatchModificatio...
Determines if the given modification is valid. @param mixed $mod @return bool
[ "Determines", "if", "the", "given", "modification", "is", "valid", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L1122-L1127
Adldap2/Adldap2
src/Models/Model.php
Model.buildModificationsFromDirty
protected function buildModificationsFromDirty() { foreach ($this->getDirty() as $attribute => $values) { // Make sure values is always an array. $values = (is_array($values) ? $values : [$values]); // Create a new modification. $modification = $this->newBatc...
php
protected function buildModificationsFromDirty() { foreach ($this->getDirty() as $attribute => $values) { // Make sure values is always an array. $values = (is_array($values) ? $values : [$values]); // Create a new modification. $modification = $this->newBatc...
[ "protected", "function", "buildModificationsFromDirty", "(", ")", "{", "foreach", "(", "$", "this", "->", "getDirty", "(", ")", "as", "$", "attribute", "=>", "$", "values", ")", "{", "// Make sure values is always an array.", "$", "values", "=", "(", "is_array",...
Builds the models modifications from its dirty attributes. @return array
[ "Builds", "the", "models", "modifications", "from", "its", "dirty", "attributes", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L1134-L1161
Adldap2/Adldap2
src/Models/Model.php
Model.convertStringToBool
protected function convertStringToBool($bool) { $bool = strtoupper($bool); if ($bool === strtoupper($this->schema->false())) { return false; } elseif ($bool === strtoupper($this->schema->true())) { return true; } else { return; } }
php
protected function convertStringToBool($bool) { $bool = strtoupper($bool); if ($bool === strtoupper($this->schema->false())) { return false; } elseif ($bool === strtoupper($this->schema->true())) { return true; } else { return; } }
[ "protected", "function", "convertStringToBool", "(", "$", "bool", ")", "{", "$", "bool", "=", "strtoupper", "(", "$", "bool", ")", ";", "if", "(", "$", "bool", "===", "strtoupper", "(", "$", "this", "->", "schema", "->", "false", "(", ")", ")", ")", ...
Converts the inserted string boolean to a PHP boolean. @param string $bool @return null|bool
[ "Converts", "the", "inserted", "string", "boolean", "to", "a", "PHP", "boolean", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Model.php#L1186-L1197
Adldap2/Adldap2
src/Query/Paginator.php
Paginator.getIterator
public function getIterator() { $entries = array_slice($this->getResults(), $this->getCurrentOffset(), $this->getPerPage(), true); return new ArrayIterator($entries); }
php
public function getIterator() { $entries = array_slice($this->getResults(), $this->getCurrentOffset(), $this->getPerPage(), true); return new ArrayIterator($entries); }
[ "public", "function", "getIterator", "(", ")", "{", "$", "entries", "=", "array_slice", "(", "$", "this", "->", "getResults", "(", ")", ",", "$", "this", "->", "getCurrentOffset", "(", ")", ",", "$", "this", "->", "getPerPage", "(", ")", ",", "true", ...
Get an iterator for the entries. @return ArrayIterator
[ "Get", "an", "iterator", "for", "the", "entries", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Paginator.php#L68-L73
Adldap2/Adldap2
src/Utilities.php
Utilities.explodeDn
public static function explodeDn($dn, $removeAttributePrefixes = true) { $dn = ldap_explode_dn($dn, ($removeAttributePrefixes ? 1 : 0)); if (is_array($dn) && array_key_exists('count', $dn)) { foreach ($dn as $rdn => $value) { $dn[$rdn] = self::unescape($value); ...
php
public static function explodeDn($dn, $removeAttributePrefixes = true) { $dn = ldap_explode_dn($dn, ($removeAttributePrefixes ? 1 : 0)); if (is_array($dn) && array_key_exists('count', $dn)) { foreach ($dn as $rdn => $value) { $dn[$rdn] = self::unescape($value); ...
[ "public", "static", "function", "explodeDn", "(", "$", "dn", ",", "$", "removeAttributePrefixes", "=", "true", ")", "{", "$", "dn", "=", "ldap_explode_dn", "(", "$", "dn", ",", "(", "$", "removeAttributePrefixes", "?", "1", ":", "0", ")", ")", ";", "if...
Converts a DN string into an array of RDNs. This will also decode hex characters into their true UTF-8 representation embedded inside the DN as well. @param string $dn @param bool $removeAttributePrefixes @return array|false
[ "Converts", "a", "DN", "string", "into", "an", "array", "of", "RDNs", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Utilities.php#L18-L29
Adldap2/Adldap2
src/Utilities.php
Utilities.binarySidToString
public static function binarySidToString($value) { // Revision - 8bit unsigned int (C1) // Count - 8bit unsigned int (C1) // 2 null bytes // ID - 32bit unsigned long, big-endian order $sid = @unpack('C1rev/C1count/x2/N1id', $value); if (! isset($sid['id']) || ! isset...
php
public static function binarySidToString($value) { // Revision - 8bit unsigned int (C1) // Count - 8bit unsigned int (C1) // 2 null bytes // ID - 32bit unsigned long, big-endian order $sid = @unpack('C1rev/C1count/x2/N1id', $value); if (! isset($sid['id']) || ! isset...
[ "public", "static", "function", "binarySidToString", "(", "$", "value", ")", "{", "// Revision - 8bit unsigned int (C1)", "// Count - 8bit unsigned int (C1)", "// 2 null bytes", "// ID - 32bit unsigned long, big-endian order", "$", "sid", "=", "@", "unpack", "(", "'C1rev/C1coun...
Convert a binary SID to a string SID. @author Chad Sikorra @link https://github.com/ChadSikorra @link https://stackoverflow.com/questions/39533560/php-ldap-get-user-sid @param string $value The Binary SID @return string|null
[ "Convert", "a", "binary", "SID", "to", "a", "string", "SID", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Utilities.php#L58-L97
Adldap2/Adldap2
src/Utilities.php
Utilities.binaryGuidToString
public static function binaryGuidToString($binGuid) { if (trim($binGuid) == '' || is_null($binGuid)) { return; } $hex = unpack('H*hex', $binGuid)['hex']; $hex1 = substr($hex, -26, 2).substr($hex, -28, 2).substr($hex, -30, 2).substr($hex, -32, 2); $hex2 = substr(...
php
public static function binaryGuidToString($binGuid) { if (trim($binGuid) == '' || is_null($binGuid)) { return; } $hex = unpack('H*hex', $binGuid)['hex']; $hex1 = substr($hex, -26, 2).substr($hex, -28, 2).substr($hex, -30, 2).substr($hex, -32, 2); $hex2 = substr(...
[ "public", "static", "function", "binaryGuidToString", "(", "$", "binGuid", ")", "{", "if", "(", "trim", "(", "$", "binGuid", ")", "==", "''", "||", "is_null", "(", "$", "binGuid", ")", ")", "{", "return", ";", "}", "$", "hex", "=", "unpack", "(", "...
Convert a binary GUID to a string GUID. @param string $binGuid @return string|null
[ "Convert", "a", "binary", "GUID", "to", "a", "string", "GUID", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Utilities.php#L106-L123
Adldap2/Adldap2
src/Utilities.php
Utilities.stringGuidToHex
public static function stringGuidToHex($string) { $hex = '\\' . substr($string, 6, 2) . '\\' . substr($string, 4, 2) . '\\' . substr($string, 2, 2) . '\\' . substr($string, 0, 2); $hex = $hex . '\\' . substr($string, 11, 2) . '\\' . substr($string, 9, 2); $hex = $hex . '\\' . substr($string,...
php
public static function stringGuidToHex($string) { $hex = '\\' . substr($string, 6, 2) . '\\' . substr($string, 4, 2) . '\\' . substr($string, 2, 2) . '\\' . substr($string, 0, 2); $hex = $hex . '\\' . substr($string, 11, 2) . '\\' . substr($string, 9, 2); $hex = $hex . '\\' . substr($string,...
[ "public", "static", "function", "stringGuidToHex", "(", "$", "string", ")", "{", "$", "hex", "=", "'\\\\'", ".", "substr", "(", "$", "string", ",", "6", ",", "2", ")", ".", "'\\\\'", ".", "substr", "(", "$", "string", ",", "4", ",", "2", ")", "."...
Converts a string GUID to it's hex variant. @param string $string @return string
[ "Converts", "a", "string", "GUID", "to", "it", "s", "hex", "variant", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Utilities.php#L132-L141
Adldap2/Adldap2
src/Log/EventLogger.php
EventLogger.auth
public function auth(AuthEvent $event) { if (isset($this->logger)) { $operation = get_class($event); $connection = $event->getConnection(); $message = "LDAP ({$connection->getHost()})" . " - Connection: {$connection->getName()}" . " - Ope...
php
public function auth(AuthEvent $event) { if (isset($this->logger)) { $operation = get_class($event); $connection = $event->getConnection(); $message = "LDAP ({$connection->getHost()})" . " - Connection: {$connection->getName()}" . " - Ope...
[ "public", "function", "auth", "(", "AuthEvent", "$", "event", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "logger", ")", ")", "{", "$", "operation", "=", "get_class", "(", "$", "event", ")", ";", "$", "connection", "=", "$", "event", "->"...
Logs an authentication event. @param AuthEvent $event @return void
[ "Logs", "an", "authentication", "event", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Log/EventLogger.php#L36-L58
Adldap2/Adldap2
src/Log/EventLogger.php
EventLogger.model
public function model(ModelEvent $event) { if (isset($this->logger)) { $operation = get_class($event); $model = $event->getModel(); $on = get_class($model); $connection = $model->getQuery()->getConnection(); $message = "LDAP ({$connection->getH...
php
public function model(ModelEvent $event) { if (isset($this->logger)) { $operation = get_class($event); $model = $event->getModel(); $on = get_class($model); $connection = $model->getQuery()->getConnection(); $message = "LDAP ({$connection->getH...
[ "public", "function", "model", "(", "ModelEvent", "$", "event", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "logger", ")", ")", "{", "$", "operation", "=", "get_class", "(", "$", "event", ")", ";", "$", "model", "=", "$", "event", "->", ...
Logs a model event. @param ModelEvent $event @return void
[ "Logs", "a", "model", "event", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Log/EventLogger.php#L67-L86
Adldap2/Adldap2
src/Models/Concerns/HasCriticalSystemObject.php
HasCriticalSystemObject.isCriticalSystemObject
public function isCriticalSystemObject() { $attribute = $this->getFirstAttribute($this->schema->isCriticalSystemObject()); return $this->convertStringToBool($attribute); }
php
public function isCriticalSystemObject() { $attribute = $this->getFirstAttribute($this->schema->isCriticalSystemObject()); return $this->convertStringToBool($attribute); }
[ "public", "function", "isCriticalSystemObject", "(", ")", "{", "$", "attribute", "=", "$", "this", "->", "getFirstAttribute", "(", "$", "this", "->", "schema", "->", "isCriticalSystemObject", "(", ")", ")", ";", "return", "$", "this", "->", "convertStringToBoo...
Returns true / false if the entry is a critical system object. @return null|bool
[ "Returns", "true", "/", "false", "if", "the", "entry", "is", "a", "critical", "system", "object", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasCriticalSystemObject.php#L12-L17
Adldap2/Adldap2
src/Models/User.php
User.getUserWorkstations
public function getUserWorkstations() { $workstations = $this->getFirstAttribute($this->schema->userWorkstations()); return array_filter(explode(',', $workstations)); }
php
public function getUserWorkstations() { $workstations = $this->getFirstAttribute($this->schema->userWorkstations()); return array_filter(explode(',', $workstations)); }
[ "public", "function", "getUserWorkstations", "(", ")", "{", "$", "workstations", "=", "$", "this", "->", "getFirstAttribute", "(", "$", "this", "->", "schema", "->", "userWorkstations", "(", ")", ")", ";", "return", "array_filter", "(", "explode", "(", "','"...
Returns an array of workstations the user is assigned to. @return array
[ "Returns", "an", "array", "of", "workstations", "the", "user", "is", "assigned", "to", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L295-L300
Adldap2/Adldap2
src/Models/User.php
User.setUserWorkstations
public function setUserWorkstations($workstations = []) { if (is_array($workstations)) { $workstations = implode(',', $workstations); } return $this->setFirstAttribute($this->schema->userWorkstations(), $workstations); }
php
public function setUserWorkstations($workstations = []) { if (is_array($workstations)) { $workstations = implode(',', $workstations); } return $this->setFirstAttribute($this->schema->userWorkstations(), $workstations); }
[ "public", "function", "setUserWorkstations", "(", "$", "workstations", "=", "[", "]", ")", "{", "if", "(", "is_array", "(", "$", "workstations", ")", ")", "{", "$", "workstations", "=", "implode", "(", "','", ",", "$", "workstations", ")", ";", "}", "r...
Sets the workstations the user can login to. @param string|array $workstations The names of the workstations the user can login to. Must be an array of names, or a comma separated list of names. @return $this
[ "Sets", "the", "workstations", "the", "user", "can", "login", "to", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L311-L318
Adldap2/Adldap2
src/Models/User.php
User.getBadPasswordDate
public function getBadPasswordDate() { if ($timestamp = $this->getBadPasswordTimestamp()) { return (new DateTime())->setTimestamp($timestamp)->format($this->dateFormat); } }
php
public function getBadPasswordDate() { if ($timestamp = $this->getBadPasswordTimestamp()) { return (new DateTime())->setTimestamp($timestamp)->format($this->dateFormat); } }
[ "public", "function", "getBadPasswordDate", "(", ")", "{", "if", "(", "$", "timestamp", "=", "$", "this", "->", "getBadPasswordTimestamp", "(", ")", ")", "{", "return", "(", "new", "DateTime", "(", ")", ")", "->", "setTimestamp", "(", "$", "timestamp", "...
Returns the formatted timestamp of the bad password date. @return string|null @throws \Exception
[ "Returns", "the", "formatted", "timestamp", "of", "the", "bad", "password", "date", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L383-L388
Adldap2/Adldap2
src/Models/User.php
User.getPasswordLastSetDate
public function getPasswordLastSetDate() { if ($timestamp = $this->getPasswordLastSetTimestamp()) { return (new DateTime())->setTimestamp($timestamp)->format($this->dateFormat); } }
php
public function getPasswordLastSetDate() { if ($timestamp = $this->getPasswordLastSetTimestamp()) { return (new DateTime())->setTimestamp($timestamp)->format($this->dateFormat); } }
[ "public", "function", "getPasswordLastSetDate", "(", ")", "{", "if", "(", "$", "timestamp", "=", "$", "this", "->", "getPasswordLastSetTimestamp", "(", ")", ")", "{", "return", "(", "new", "DateTime", "(", ")", ")", "->", "setTimestamp", "(", "$", "timesta...
Returns the formatted timestamp of the password last set date. @return string|null @throws \Exception
[ "Returns", "the", "formatted", "timestamp", "of", "the", "password", "last", "set", "date", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L419-L424
Adldap2/Adldap2
src/Models/User.php
User.getLockoutDate
public function getLockoutDate() { if ($timestamp = $this->getLockoutTimestamp()) { return (new DateTime())->setTimestamp($timestamp)->format($this->dateFormat); } }
php
public function getLockoutDate() { if ($timestamp = $this->getLockoutTimestamp()) { return (new DateTime())->setTimestamp($timestamp)->format($this->dateFormat); } }
[ "public", "function", "getLockoutDate", "(", ")", "{", "if", "(", "$", "timestamp", "=", "$", "this", "->", "getLockoutTimestamp", "(", ")", ")", "{", "return", "(", "new", "DateTime", "(", ")", ")", "->", "setTimestamp", "(", "$", "timestamp", ")", "-...
Returns the formatted timestamp of the lockout date. @return string|null @throws \Exception
[ "Returns", "the", "formatted", "timestamp", "of", "the", "lockout", "date", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L455-L460
Adldap2/Adldap2
src/Models/User.php
User.setAccountExpiry
public function setAccountExpiry($expiryTime) { $time = is_null($expiryTime) ? '9223372036854775807' : (string) Utilities::convertUnixTimeToWindowsTime($expiryTime); return $this->setFirstAttribute($this->schema->accountExpires(), $time); }
php
public function setAccountExpiry($expiryTime) { $time = is_null($expiryTime) ? '9223372036854775807' : (string) Utilities::convertUnixTimeToWindowsTime($expiryTime); return $this->setFirstAttribute($this->schema->accountExpires(), $time); }
[ "public", "function", "setAccountExpiry", "(", "$", "expiryTime", ")", "{", "$", "time", "=", "is_null", "(", "$", "expiryTime", ")", "?", "'9223372036854775807'", ":", "(", "string", ")", "Utilities", "::", "convertUnixTimeToWindowsTime", "(", "$", "expiryTime"...
Sets the users account expiry date. If no expiry time is given, the account is set to never expire. @link https://msdn.microsoft.com/en-us/library/ms675098(v=vs.85).aspx @param float $expiryTime @return $this
[ "Sets", "the", "users", "account", "expiry", "date", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L515-L520
Adldap2/Adldap2
src/Models/User.php
User.getThumbnailEncoded
public function getThumbnailEncoded() { if ($data = base64_decode($this->getThumbnail(), $strict = true)) { // In case we don't have the file info extension enabled, // we'll set the jpeg mime type as default. $mime = 'image/jpeg'; $image = base64_encode($dat...
php
public function getThumbnailEncoded() { if ($data = base64_decode($this->getThumbnail(), $strict = true)) { // In case we don't have the file info extension enabled, // we'll set the jpeg mime type as default. $mime = 'image/jpeg'; $image = base64_encode($dat...
[ "public", "function", "getThumbnailEncoded", "(", ")", "{", "if", "(", "$", "data", "=", "base64_decode", "(", "$", "this", "->", "getThumbnail", "(", ")", ",", "$", "strict", "=", "true", ")", ")", "{", "// In case we don't have the file info extension enabled,...
Returns the users thumbnail photo base 64 encoded. Suitable for inserting into an HTML image element. @return string|null
[ "Returns", "the", "users", "thumbnail", "photo", "base", "64", "encoded", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L540-L559
Adldap2/Adldap2
src/Models/User.php
User.setThumbnail
public function setThumbnail($data, $encode = true) { if ($encode && ! base64_decode($data, $strict = true)) { // If the string we're given is not base 64 encoded, then // we will encode it before setting it on the user. $data = base64_encode($data); } re...
php
public function setThumbnail($data, $encode = true) { if ($encode && ! base64_decode($data, $strict = true)) { // If the string we're given is not base 64 encoded, then // we will encode it before setting it on the user. $data = base64_encode($data); } re...
[ "public", "function", "setThumbnail", "(", "$", "data", ",", "$", "encode", "=", "true", ")", "{", "if", "(", "$", "encode", "&&", "!", "base64_decode", "(", "$", "data", ",", "$", "strict", "=", "true", ")", ")", "{", "// If the string we're given is no...
Sets the users thumbnail photo. @param string $data @param bool $encode @return $this
[ "Sets", "the", "users", "thumbnail", "photo", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L579-L588
Adldap2/Adldap2
src/Models/User.php
User.setJpegPhoto
public function setJpegPhoto($string) { if (! base64_decode($string, $strict = true)) { $string = base64_encode($string); } return $this->setAttribute($this->schema->jpegPhoto(), $string); }
php
public function setJpegPhoto($string) { if (! base64_decode($string, $strict = true)) { $string = base64_encode($string); } return $this->setAttribute($this->schema->jpegPhoto(), $string); }
[ "public", "function", "setJpegPhoto", "(", "$", "string", ")", "{", "if", "(", "!", "base64_decode", "(", "$", "string", ",", "$", "strict", "=", "true", ")", ")", "{", "$", "string", "=", "base64_encode", "(", "$", "string", ")", ";", "}", "return",...
Sets the users JPEG photo. @param string $string @return $this
[ "Sets", "the", "users", "JPEG", "photo", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L619-L626
Adldap2/Adldap2
src/Models/User.php
User.getPrimaryGroup
public function getPrimaryGroup() { $groupSid = preg_replace('/\d+$/', $this->getPrimaryGroupId(), $this->getConvertedSid()); return $this->query->newInstance()->findBySid($groupSid); }
php
public function getPrimaryGroup() { $groupSid = preg_replace('/\d+$/', $this->getPrimaryGroupId(), $this->getConvertedSid()); return $this->query->newInstance()->findBySid($groupSid); }
[ "public", "function", "getPrimaryGroup", "(", ")", "{", "$", "groupSid", "=", "preg_replace", "(", "'/\\d+$/'", ",", "$", "this", "->", "getPrimaryGroupId", "(", ")", ",", "$", "this", "->", "getConvertedSid", "(", ")", ")", ";", "return", "$", "this", "...
Retrieves the primary group of the current user. @return Model|bool
[ "Retrieves", "the", "primary", "group", "of", "the", "current", "user", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L765-L770
Adldap2/Adldap2
src/Models/User.php
User.setPassword
public function setPassword($password) { $this->validateSecureConnection(); $encodedPassword = Utilities::encodePassword($password); if ($this->exists) { // If the record exists, we need to add a batch replace // modification, otherwise we'll receive a "type or ...
php
public function setPassword($password) { $this->validateSecureConnection(); $encodedPassword = Utilities::encodePassword($password); if ($this->exists) { // If the record exists, we need to add a batch replace // modification, otherwise we'll receive a "type or ...
[ "public", "function", "setPassword", "(", "$", "password", ")", "{", "$", "this", "->", "validateSecureConnection", "(", ")", ";", "$", "encodedPassword", "=", "Utilities", "::", "encodePassword", "(", "$", "password", ")", ";", "if", "(", "$", "this", "->...
Sets the password on the current user. @param string $password @throws AdldapException When no SSL or TLS secured connection is present. @return $this
[ "Sets", "the", "password", "on", "the", "current", "user", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L781-L806
Adldap2/Adldap2
src/Models/User.php
User.changePassword
public function changePassword($oldPassword, $newPassword, $replaceNotRemove = false) { $this->validateSecureConnection(); $attribute = $this->schema->unicodePassword(); $modifications = []; if ($replaceNotRemove) { $modifications[] = $this->newBatchModification( ...
php
public function changePassword($oldPassword, $newPassword, $replaceNotRemove = false) { $this->validateSecureConnection(); $attribute = $this->schema->unicodePassword(); $modifications = []; if ($replaceNotRemove) { $modifications[] = $this->newBatchModification( ...
[ "public", "function", "changePassword", "(", "$", "oldPassword", ",", "$", "newPassword", ",", "$", "replaceNotRemove", "=", "false", ")", "{", "$", "this", "->", "validateSecureConnection", "(", ")", ";", "$", "attribute", "=", "$", "this", "->", "schema", ...
Change the password of the current user. This must be performed over SSL / TLS. Throws an exception on failure. @param string $oldPassword The new password @param string $newPassword The old password @param bool $replaceNotRemove Alternative password change method. Set to true if you're receiving 'CONSTRAINT' errors....
[ "Change", "the", "password", "of", "the", "current", "user", ".", "This", "must", "be", "performed", "over", "SSL", "/", "TLS", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/User.php#L846-L904