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
schmittjoh/serializer
src/XmlSerializationVisitor.php
XmlSerializationVisitor.startVisitingObject
public function startVisitingObject(ClassMetadata $metadata, object $data, array $type): void { $this->objectMetadataStack->push($metadata); if (null === $this->currentNode) { $this->createRoot($metadata); } $this->addNamespaceAttributes($metadata, $this->currentNode); ...
php
public function startVisitingObject(ClassMetadata $metadata, object $data, array $type): void { $this->objectMetadataStack->push($metadata); if (null === $this->currentNode) { $this->createRoot($metadata); } $this->addNamespaceAttributes($metadata, $this->currentNode); ...
[ "public", "function", "startVisitingObject", "(", "ClassMetadata", "$", "metadata", ",", "object", "$", "data", ",", "array", "$", "type", ")", ":", "void", "{", "$", "this", "->", "objectMetadataStack", "->", "push", "(", "$", "metadata", ")", ";", "if", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlSerializationVisitor.php#L222-L233
schmittjoh/serializer
src/XmlSerializationVisitor.php
XmlSerializationVisitor.visitProperty
public function visitProperty(PropertyMetadata $metadata, $v): void { if ($metadata->xmlAttribute) { $this->setCurrentMetadata($metadata); $node = $this->navigator->accept($v, $metadata->type); $this->revertCurrentMetadata(); if (!$node instanceof \DOMCharact...
php
public function visitProperty(PropertyMetadata $metadata, $v): void { if ($metadata->xmlAttribute) { $this->setCurrentMetadata($metadata); $node = $this->navigator->accept($v, $metadata->type); $this->revertCurrentMetadata(); if (!$node instanceof \DOMCharact...
[ "public", "function", "visitProperty", "(", "PropertyMetadata", "$", "metadata", ",", "$", "v", ")", ":", "void", "{", "if", "(", "$", "metadata", "->", "xmlAttribute", ")", "{", "$", "this", "->", "setCurrentMetadata", "(", "$", "metadata", ")", ";", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlSerializationVisitor.php#L238-L331
schmittjoh/serializer
src/XmlSerializationVisitor.php
XmlSerializationVisitor.getResult
public function getResult($node) { if (null === $this->document->documentElement) { if ($node instanceof \DOMElement) { $this->document->appendChild($node); } else { $this->createRoot(); if ($node) { $this->document-...
php
public function getResult($node) { if (null === $this->document->documentElement) { if ($node instanceof \DOMElement) { $this->document->appendChild($node); } else { $this->createRoot(); if ($node) { $this->document-...
[ "public", "function", "getResult", "(", "$", "node", ")", "{", "if", "(", "null", "===", "$", "this", "->", "document", "->", "documentElement", ")", "{", "if", "(", "$", "node", "instanceof", "\\", "DOMElement", ")", "{", "$", "this", "->", "document"...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlSerializationVisitor.php#L361-L382
schmittjoh/serializer
src/XmlSerializationVisitor.php
XmlSerializationVisitor.addNamespaceAttributes
private function addNamespaceAttributes(ClassMetadata $metadata, \DOMElement $element): void { foreach ($metadata->xmlNamespaces as $prefix => $uri) { $attribute = 'xmlns'; if ('' !== $prefix) { $attribute .= ':' . $prefix; } elseif ($element->namespaceURI...
php
private function addNamespaceAttributes(ClassMetadata $metadata, \DOMElement $element): void { foreach ($metadata->xmlNamespaces as $prefix => $uri) { $attribute = 'xmlns'; if ('' !== $prefix) { $attribute .= ':' . $prefix; } elseif ($element->namespaceURI...
[ "private", "function", "addNamespaceAttributes", "(", "ClassMetadata", "$", "metadata", ",", "\\", "DOMElement", "$", "element", ")", ":", "void", "{", "foreach", "(", "$", "metadata", "->", "xmlNamespaces", "as", "$", "prefix", "=>", "$", "uri", ")", "{", ...
Adds namespace attributes to the XML root element
[ "Adds", "namespace", "attributes", "to", "the", "XML", "root", "element" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlSerializationVisitor.php#L451-L462
schmittjoh/serializer
src/Serializer.php
Serializer.parseDirection
public static function parseDirection(string $dirStr): int { switch (strtolower($dirStr)) { case 'serialization': return GraphNavigatorInterface::DIRECTION_SERIALIZATION; case 'deserialization': return GraphNavigatorInterface::DIRECTION_DESERIALIZATIO...
php
public static function parseDirection(string $dirStr): int { switch (strtolower($dirStr)) { case 'serialization': return GraphNavigatorInterface::DIRECTION_SERIALIZATION; case 'deserialization': return GraphNavigatorInterface::DIRECTION_DESERIALIZATIO...
[ "public", "static", "function", "parseDirection", "(", "string", "$", "dirStr", ")", ":", "int", "{", "switch", "(", "strtolower", "(", "$", "dirStr", ")", ")", "{", "case", "'serialization'", ":", "return", "GraphNavigatorInterface", "::", "DIRECTION_SERIALIZAT...
Parses a direction string to one of the direction constants.
[ "Parses", "a", "direction", "string", "to", "one", "of", "the", "direction", "constants", "." ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Serializer.php#L91-L103
schmittjoh/serializer
src/Serializer.php
Serializer.serialize
public function serialize($data, string $format, ?SerializationContext $context = null, ?string $type = null): string { if (null === $context) { $context = $this->serializationContextFactory->createSerializationContext(); } $visitor = $this->getVisitor(GraphNavigatorInterface::D...
php
public function serialize($data, string $format, ?SerializationContext $context = null, ?string $type = null): string { if (null === $context) { $context = $this->serializationContextFactory->createSerializationContext(); } $visitor = $this->getVisitor(GraphNavigatorInterface::D...
[ "public", "function", "serialize", "(", "$", "data", ",", "string", "$", "format", ",", "?", "SerializationContext", "$", "context", "=", "null", ",", "?", "string", "$", "type", "=", "null", ")", ":", "string", "{", "if", "(", "null", "===", "$", "c...
{@InheritDoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Serializer.php#L151-L164
schmittjoh/serializer
src/Serializer.php
Serializer.deserialize
public function deserialize(string $data, string $type, string $format, ?DeserializationContext $context = null) { if (null === $context) { $context = $this->deserializationContextFactory->createDeserializationContext(); } $visitor = $this->getVisitor(GraphNavigatorInterface::DI...
php
public function deserialize(string $data, string $type, string $format, ?DeserializationContext $context = null) { if (null === $context) { $context = $this->deserializationContextFactory->createDeserializationContext(); } $visitor = $this->getVisitor(GraphNavigatorInterface::DI...
[ "public", "function", "deserialize", "(", "string", "$", "data", ",", "string", "$", "type", ",", "string", "$", "format", ",", "?", "DeserializationContext", "$", "context", "=", "null", ")", "{", "if", "(", "null", "===", "$", "context", ")", "{", "$...
{@InheritDoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Serializer.php#L169-L181
schmittjoh/serializer
src/Serializer.php
Serializer.toArray
public function toArray($data, ?SerializationContext $context = null, ?string $type = null): array { if (null === $context) { $context = $this->serializationContextFactory->createSerializationContext(); } $visitor = $this->getVisitor(GraphNavigatorInterface::DIRECTION_SERIALIZAT...
php
public function toArray($data, ?SerializationContext $context = null, ?string $type = null): array { if (null === $context) { $context = $this->serializationContextFactory->createSerializationContext(); } $visitor = $this->getVisitor(GraphNavigatorInterface::DIRECTION_SERIALIZAT...
[ "public", "function", "toArray", "(", "$", "data", ",", "?", "SerializationContext", "$", "context", "=", "null", ",", "?", "string", "$", "type", "=", "null", ")", ":", "array", "{", "if", "(", "null", "===", "$", "context", ")", "{", "$", "context"...
{@InheritDoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Serializer.php#L186-L208
schmittjoh/serializer
src/Serializer.php
Serializer.fromArray
public function fromArray(array $data, string $type, ?DeserializationContext $context = null) { if (null === $context) { $context = $this->deserializationContextFactory->createDeserializationContext(); } $visitor = $this->getVisitor(GraphNavigatorInterface::DIRECTION_DESERIALIZA...
php
public function fromArray(array $data, string $type, ?DeserializationContext $context = null) { if (null === $context) { $context = $this->deserializationContextFactory->createDeserializationContext(); } $visitor = $this->getVisitor(GraphNavigatorInterface::DIRECTION_DESERIALIZA...
[ "public", "function", "fromArray", "(", "array", "$", "data", ",", "string", "$", "type", ",", "?", "DeserializationContext", "$", "context", "=", "null", ")", "{", "if", "(", "null", "===", "$", "context", ")", "{", "$", "context", "=", "$", "this", ...
{@InheritDoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Serializer.php#L213-L223
schmittjoh/serializer
src/Serializer.php
Serializer.visit
private function visit(GraphNavigatorInterface $navigator, VisitorInterface $visitor, Context $context, $data, string $format, ?string $type = null, bool $prepare = true) { $context->initialize( $format, $visitor, $navigator, $this->factory ); ...
php
private function visit(GraphNavigatorInterface $navigator, VisitorInterface $visitor, Context $context, $data, string $format, ?string $type = null, bool $prepare = true) { $context->initialize( $format, $visitor, $navigator, $this->factory ); ...
[ "private", "function", "visit", "(", "GraphNavigatorInterface", "$", "navigator", ",", "VisitorInterface", "$", "visitor", ",", "Context", "$", "context", ",", "$", "data", ",", "string", "$", "format", ",", "?", "string", "$", "type", "=", "null", ",", "b...
@param mixed $data @return mixed
[ "@param", "mixed", "$data" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Serializer.php#L230-L250
schmittjoh/serializer
src/Serializer.php
Serializer.convertArrayObjects
private function convertArrayObjects($data) { if ($data instanceof \ArrayObject || $data instanceof \stdClass) { $data = (array) $data; } if (\is_array($data)) { foreach ($data as $k => $v) { $data[$k] = $this->convertArrayObjects($v); } ...
php
private function convertArrayObjects($data) { if ($data instanceof \ArrayObject || $data instanceof \stdClass) { $data = (array) $data; } if (\is_array($data)) { foreach ($data as $k => $v) { $data[$k] = $this->convertArrayObjects($v); } ...
[ "private", "function", "convertArrayObjects", "(", "$", "data", ")", "{", "if", "(", "$", "data", "instanceof", "\\", "ArrayObject", "||", "$", "data", "instanceof", "\\", "stdClass", ")", "{", "$", "data", "=", "(", "array", ")", "$", "data", ";", "}"...
@param mixed $data @return mixed
[ "@param", "mixed", "$data" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Serializer.php#L257-L269
schmittjoh/serializer
src/Exclusion/DisjunctExclusionStrategy.php
DisjunctExclusionStrategy.shouldSkipClass
public function shouldSkipClass(ClassMetadata $metadata, Context $context): bool { foreach ($this->delegates as $delegate) { /** @var $delegate ExclusionStrategyInterface */ if ($delegate->shouldSkipClass($metadata, $context)) { return true; } } ...
php
public function shouldSkipClass(ClassMetadata $metadata, Context $context): bool { foreach ($this->delegates as $delegate) { /** @var $delegate ExclusionStrategyInterface */ if ($delegate->shouldSkipClass($metadata, $context)) { return true; } } ...
[ "public", "function", "shouldSkipClass", "(", "ClassMetadata", "$", "metadata", ",", "Context", "$", "context", ")", ":", "bool", "{", "foreach", "(", "$", "this", "->", "delegates", "as", "$", "delegate", ")", "{", "/** @var $delegate ExclusionStrategyInterface *...
Whether the class should be skipped.
[ "Whether", "the", "class", "should", "be", "skipped", "." ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Exclusion/DisjunctExclusionStrategy.php#L41-L51
schmittjoh/serializer
src/Exclusion/DisjunctExclusionStrategy.php
DisjunctExclusionStrategy.shouldSkipProperty
public function shouldSkipProperty(PropertyMetadata $property, Context $context): bool { foreach ($this->delegates as $delegate) { /** @var $delegate ExclusionStrategyInterface */ if ($delegate->shouldSkipProperty($property, $context)) { return true; } ...
php
public function shouldSkipProperty(PropertyMetadata $property, Context $context): bool { foreach ($this->delegates as $delegate) { /** @var $delegate ExclusionStrategyInterface */ if ($delegate->shouldSkipProperty($property, $context)) { return true; } ...
[ "public", "function", "shouldSkipProperty", "(", "PropertyMetadata", "$", "property", ",", "Context", "$", "context", ")", ":", "bool", "{", "foreach", "(", "$", "this", "->", "delegates", "as", "$", "delegate", ")", "{", "/** @var $delegate ExclusionStrategyInter...
Whether the property should be skipped.
[ "Whether", "the", "property", "should", "be", "skipped", "." ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Exclusion/DisjunctExclusionStrategy.php#L56-L66
schmittjoh/serializer
src/Handler/HandlerRegistry.php
HandlerRegistry.registerHandler
public function registerHandler(int $direction, string $typeName, string $format, $handler): void { $this->handlers[$direction][$typeName][$format] = $handler; }
php
public function registerHandler(int $direction, string $typeName, string $format, $handler): void { $this->handlers[$direction][$typeName][$format] = $handler; }
[ "public", "function", "registerHandler", "(", "int", "$", "direction", ",", "string", "$", "typeName", ",", "string", "$", "format", ",", "$", "handler", ")", ":", "void", "{", "$", "this", "->", "handlers", "[", "$", "direction", "]", "[", "$", "typeN...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/HandlerRegistry.php#L63-L66
schmittjoh/serializer
src/Handler/HandlerRegistry.php
HandlerRegistry.getHandler
public function getHandler(int $direction, string $typeName, string $format) { if (!isset($this->handlers[$direction][$typeName][$format])) { return null; } return $this->handlers[$direction][$typeName][$format]; }
php
public function getHandler(int $direction, string $typeName, string $format) { if (!isset($this->handlers[$direction][$typeName][$format])) { return null; } return $this->handlers[$direction][$typeName][$format]; }
[ "public", "function", "getHandler", "(", "int", "$", "direction", ",", "string", "$", "typeName", ",", "string", "$", "format", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "handlers", "[", "$", "direction", "]", "[", "$", "typeName", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/HandlerRegistry.php#L71-L78
schmittjoh/serializer
src/Handler/StdClassHandler.php
StdClassHandler.getSubscribingMethods
public static function getSubscribingMethods() { $methods = []; $formats = ['json', 'xml', 'yml']; foreach ($formats as $format) { $methods[] = [ 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, 'type' => 'stdClass', ...
php
public static function getSubscribingMethods() { $methods = []; $formats = ['json', 'xml', 'yml']; foreach ($formats as $format) { $methods[] = [ 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, 'type' => 'stdClass', ...
[ "public", "static", "function", "getSubscribingMethods", "(", ")", "{", "$", "methods", "=", "[", "]", ";", "$", "formats", "=", "[", "'json'", ",", "'xml'", ",", "'yml'", "]", ";", "foreach", "(", "$", "formats", "as", "$", "format", ")", "{", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/StdClassHandler.php#L20-L35
schmittjoh/serializer
src/Exclusion/ExpressionLanguageExclusionStrategy.php
ExpressionLanguageExclusionStrategy.shouldSkipProperty
public function shouldSkipProperty(PropertyMetadata $property, Context $navigatorContext): bool { if (null === $property->excludeIf) { return false; } $variables = [ 'context' => $navigatorContext, 'property_metadata' => $property, ]; if (...
php
public function shouldSkipProperty(PropertyMetadata $property, Context $navigatorContext): bool { if (null === $property->excludeIf) { return false; } $variables = [ 'context' => $navigatorContext, 'property_metadata' => $property, ]; if (...
[ "public", "function", "shouldSkipProperty", "(", "PropertyMetadata", "$", "property", ",", "Context", "$", "navigatorContext", ")", ":", "bool", "{", "if", "(", "null", "===", "$", "property", "->", "excludeIf", ")", "{", "return", "false", ";", "}", "$", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Exclusion/ExpressionLanguageExclusionStrategy.php#L37-L58
schmittjoh/serializer
src/Handler/ArrayCollectionHandler.php
ArrayCollectionHandler.getSubscribingMethods
public static function getSubscribingMethods() { $methods = []; $formats = ['json', 'xml', 'yml']; $collectionTypes = [ 'ArrayCollection', 'Doctrine\Common\Collections\ArrayCollection', 'Doctrine\ORM\PersistentCollection', 'Doctrine\ODM\MongoDB...
php
public static function getSubscribingMethods() { $methods = []; $formats = ['json', 'xml', 'yml']; $collectionTypes = [ 'ArrayCollection', 'Doctrine\Common\Collections\ArrayCollection', 'Doctrine\ORM\PersistentCollection', 'Doctrine\ODM\MongoDB...
[ "public", "static", "function", "getSubscribingMethods", "(", ")", "{", "$", "methods", "=", "[", "]", ";", "$", "formats", "=", "[", "'json'", ",", "'xml'", ",", "'yml'", "]", ";", "$", "collectionTypes", "=", "[", "'ArrayCollection'", ",", "'Doctrine\\Co...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/ArrayCollectionHandler.php#L30-L61
schmittjoh/serializer
src/Type/TypeVisitor.php
TypeVisitor.visit
public function visit(Element $element, &$handle = null, $eldnah = null) { switch ($element->getId()) { case '#simple_type': return $this->visitSimpleType($element); case '#compound_type': return $this->visitCompoundType($element, $handle, $eldnah); ...
php
public function visit(Element $element, &$handle = null, $eldnah = null) { switch ($element->getId()) { case '#simple_type': return $this->visitSimpleType($element); case '#compound_type': return $this->visitCompoundType($element, $handle, $eldnah); ...
[ "public", "function", "visit", "(", "Element", "$", "element", ",", "&", "$", "handle", "=", "null", ",", "$", "eldnah", "=", "null", ")", "{", "switch", "(", "$", "element", "->", "getId", "(", ")", ")", "{", "case", "'#simple_type'", ":", "return",...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Type/TypeVisitor.php#L18-L28
Adldap2/Adldap2
src/Models/Attributes/Guid.php
Guid.getBinary
public function getBinary() { $data = ''; $guid = str_replace('-', '', $this->value); foreach ($this->octetSections as $section) { $data .= $this->parseSection($guid, $section, true); } return hex2bin($data); }
php
public function getBinary() { $data = ''; $guid = str_replace('-', '', $this->value); foreach ($this->octetSections as $section) { $data .= $this->parseSection($guid, $section, true); } return hex2bin($data); }
[ "public", "function", "getBinary", "(", ")", "{", "$", "data", "=", "''", ";", "$", "guid", "=", "str_replace", "(", "'-'", ",", "''", ",", "$", "this", "->", "value", ")", ";", "foreach", "(", "$", "this", "->", "octetSections", "as", "$", "sectio...
Get the binary representation of the GUID string. @return string
[ "Get", "the", "binary", "representation", "of", "the", "GUID", "string", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/Guid.php#L103-L114
Adldap2/Adldap2
src/Models/Attributes/Guid.php
Guid.parseSection
protected function parseSection($hex, array $sections, $octet = false) { $parsedString = ''; foreach ($sections as $section) { $start = $octet ? $section : $section[0]; $length = $octet ? 2 : $section[1]; $parsedString .= substr($hex, $start, $length); ...
php
protected function parseSection($hex, array $sections, $octet = false) { $parsedString = ''; foreach ($sections as $section) { $start = $octet ? $section : $section[0]; $length = $octet ? 2 : $section[1]; $parsedString .= substr($hex, $start, $length); ...
[ "protected", "function", "parseSection", "(", "$", "hex", ",", "array", "$", "sections", ",", "$", "octet", "=", "false", ")", "{", "$", "parsedString", "=", "''", ";", "foreach", "(", "$", "sections", "as", "$", "section", ")", "{", "$", "start", "=...
Return the specified section of the hexadecimal string. @author Chad Sikorra <Chad.Sikorra@gmail.com> @link https://github.com/ldaptools/ldaptools @param string $hex The full hex string. @param array $sections An array of start and length (unless octet is true, then length is always 2). @param bool $octet ...
[ "Return", "the", "specified", "section", "of", "the", "hexadecimal", "string", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/Guid.php#L140-L153
Adldap2/Adldap2
src/Models/Attributes/TSProperty.php
TSProperty.toBinary
public function toBinary() { $name = bin2hex($this->name); $binValue = $this->getEncodedValueForProp($this->name, $this->value); $valueLen = strlen(bin2hex($binValue)) / 3; $binary = hex2bin( $this->dec2hex(strlen($name)) .$this->dec2hex($valueLen) ...
php
public function toBinary() { $name = bin2hex($this->name); $binValue = $this->getEncodedValueForProp($this->name, $this->value); $valueLen = strlen(bin2hex($binValue)) / 3; $binary = hex2bin( $this->dec2hex(strlen($name)) .$this->dec2hex($valueLen) ...
[ "public", "function", "toBinary", "(", ")", "{", "$", "name", "=", "bin2hex", "(", "$", "this", "->", "name", ")", ";", "$", "binValue", "=", "$", "this", "->", "getEncodedValueForProp", "(", "$", "this", "->", "name", ",", "$", "this", "->", "value"...
Convert the TSProperty name/value back to its binary representation for the userParameters blob. @return string
[ "Convert", "the", "TSProperty", "name", "/", "value", "back", "to", "its", "binary", "representation", "for", "the", "userParameters", "blob", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSProperty.php#L151-L167
Adldap2/Adldap2
src/Models/Attributes/TSProperty.php
TSProperty.decode
protected function decode($tsProperty) { $nameLength = hexdec(substr($tsProperty, 0, 2)); # 1 data byte is 3 encoded bytes $valueLength = hexdec(substr($tsProperty, 2, 2)) * 3; $this->valueType = hexdec(substr($tsProperty, 4, 2)); $this->name = pack('H*', substr($tsProperty...
php
protected function decode($tsProperty) { $nameLength = hexdec(substr($tsProperty, 0, 2)); # 1 data byte is 3 encoded bytes $valueLength = hexdec(substr($tsProperty, 2, 2)) * 3; $this->valueType = hexdec(substr($tsProperty, 4, 2)); $this->name = pack('H*', substr($tsProperty...
[ "protected", "function", "decode", "(", "$", "tsProperty", ")", "{", "$", "nameLength", "=", "hexdec", "(", "substr", "(", "$", "tsProperty", ",", "0", ",", "2", ")", ")", ";", "# 1 data byte is 3 encoded bytes", "$", "valueLength", "=", "hexdec", "(", "su...
Given a TSProperty blob, decode the name/value/type/etc. @param string $tsProperty
[ "Given", "a", "TSProperty", "blob", "decode", "the", "name", "/", "value", "/", "type", "/", "etc", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSProperty.php#L174-L184
Adldap2/Adldap2
src/Models/Attributes/TSProperty.php
TSProperty.decodePropValue
protected function decodePropValue($hex, $string = false) { $decodePropValue = ''; $blobs = str_split($hex, 6); foreach ($blobs as $blob) { $bin = decbin(hexdec($blob)); $controlY = substr($bin, 4, 6); $nibbleY = substr($bin, 10, 4); $contro...
php
protected function decodePropValue($hex, $string = false) { $decodePropValue = ''; $blobs = str_split($hex, 6); foreach ($blobs as $blob) { $bin = decbin(hexdec($blob)); $controlY = substr($bin, 4, 6); $nibbleY = substr($bin, 10, 4); $contro...
[ "protected", "function", "decodePropValue", "(", "$", "hex", ",", "$", "string", "=", "false", ")", "{", "$", "decodePropValue", "=", "''", ";", "$", "blobs", "=", "str_split", "(", "$", "hex", ",", "6", ")", ";", "foreach", "(", "$", "blobs", "as", ...
Decode the property by inspecting the nibbles of each blob, checking the control, and adding up the results into a final value. @param string $hex @param bool $string Whether or not this is simple string data. @return string
[ "Decode", "the", "property", "by", "inspecting", "the", "nibbles", "of", "each", "blob", "checking", "the", "control", "and", "adding", "up", "the", "results", "into", "a", "final", "value", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSProperty.php#L246-L270
Adldap2/Adldap2
src/Models/Attributes/TSProperty.php
TSProperty.encodePropValue
protected function encodePropValue($value, $string = false) { // An int must be properly padded. (then split and reversed). // For a string, we just split the chars. This seems // to be the easiest way to handle UTF-8 characters // instead of trying to work with their hex values. ...
php
protected function encodePropValue($value, $string = false) { // An int must be properly padded. (then split and reversed). // For a string, we just split the chars. This seems // to be the easiest way to handle UTF-8 characters // instead of trying to work with their hex values. ...
[ "protected", "function", "encodePropValue", "(", "$", "value", ",", "$", "string", "=", "false", ")", "{", "// An int must be properly padded. (then split and reversed).", "// For a string, we just split the chars. This seems", "// to be the easiest way to handle UTF-8 characters", "...
Get the encoded property value as a binary blob. @param string $value @param bool $string @return string
[ "Get", "the", "encoded", "property", "value", "as", "a", "binary", "blob", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSProperty.php#L280-L310
Adldap2/Adldap2
src/Models/Attributes/TSProperty.php
TSProperty.packBitString
protected function packBitString($bits, $len) { $bits = substr($bits, 0, $len); // Pad input with zeros to next multiple of 4 above $len $bits = str_pad($bits, 4 * (int) (($len + 3) / 4), '0'); // Split input into chunks of 4 bits, convert each to hex and pack them $nibbles ...
php
protected function packBitString($bits, $len) { $bits = substr($bits, 0, $len); // Pad input with zeros to next multiple of 4 above $len $bits = str_pad($bits, 4 * (int) (($len + 3) / 4), '0'); // Split input into chunks of 4 bits, convert each to hex and pack them $nibbles ...
[ "protected", "function", "packBitString", "(", "$", "bits", ",", "$", "len", ")", "{", "$", "bits", "=", "substr", "(", "$", "bits", ",", "0", ",", "$", "len", ")", ";", "// Pad input with zeros to next multiple of 4 above $len", "$", "bits", "=", "str_pad",...
PHP's pack() function has no 'b' or 'B' template. This is a workaround that turns a literal bit-string into a packed byte-string with 8 bits per byte. @param string $bits @param bool $len @return string
[ "PHP", "s", "pack", "()", "function", "has", "no", "b", "or", "B", "template", ".", "This", "is", "a", "workaround", "that", "turns", "a", "literal", "bit", "-", "string", "into", "a", "packed", "byte", "-", "string", "with", "8", "bits", "per", "byt...
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSProperty.php#L322-L335
Adldap2/Adldap2
src/Models/Attributes/TSProperty.php
TSProperty.getNibbleWithControl
protected function getNibbleWithControl($nibbleType, $nibble) { $dec = bindec($nibble); if ($dec > 9) { $dec -= 9; $control = self::NIBBLE_CONTROL[$nibbleType][1]; } else { $control = self::NIBBLE_CONTROL[$nibbleType][0]; } return $contro...
php
protected function getNibbleWithControl($nibbleType, $nibble) { $dec = bindec($nibble); if ($dec > 9) { $dec -= 9; $control = self::NIBBLE_CONTROL[$nibbleType][1]; } else { $control = self::NIBBLE_CONTROL[$nibbleType][0]; } return $contro...
[ "protected", "function", "getNibbleWithControl", "(", "$", "nibbleType", ",", "$", "nibble", ")", "{", "$", "dec", "=", "bindec", "(", "$", "nibble", ")", ";", "if", "(", "$", "dec", ">", "9", ")", "{", "$", "dec", "-=", "9", ";", "$", "control", ...
Get the nibble value with the control prefixed. If the nibble dec is <= 9, the control X equals 001011 and Y equals 001110, otherwise if the nibble dec is > 9 the control for X or Y equals 011010. Additionally, if the dec value of the nibble is > 9, then the nibble value must be subtracted by 9 before the final value ...
[ "Get", "the", "nibble", "value", "with", "the", "control", "prefixed", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSProperty.php#L370-L382
Adldap2/Adldap2
src/Models/Concerns/HasAttributes.php
HasAttributes.getAttribute
public function getAttribute($key, $subKey = null) { if (! $key) { return; } // We'll normalize the given key to prevent case sensitivity issues. $key = $this->normalizeAttributeKey($key); if (is_null($subKey) && $this->hasAttribute($key)) { return $...
php
public function getAttribute($key, $subKey = null) { if (! $key) { return; } // We'll normalize the given key to prevent case sensitivity issues. $key = $this->normalizeAttributeKey($key); if (is_null($subKey) && $this->hasAttribute($key)) { return $...
[ "public", "function", "getAttribute", "(", "$", "key", ",", "$", "subKey", "=", "null", ")", "{", "if", "(", "!", "$", "key", ")", "{", "return", ";", "}", "// We'll normalize the given key to prevent case sensitivity issues.", "$", "key", "=", "$", "this", ...
Returns the models attribute with the specified key. If a sub-key is specified, it will try and retrieve it from the parent keys array. @param int|string $key @param int|string $subKey @return mixed
[ "Returns", "the", "models", "attribute", "with", "the", "specified", "key", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasAttributes.php#L90-L104
Adldap2/Adldap2
src/Models/Concerns/HasAttributes.php
HasAttributes.fill
public function fill(array $attributes = []) { foreach ($attributes as $key => $value) { $this->setAttribute($key, $value); } return $this; }
php
public function fill(array $attributes = []) { foreach ($attributes as $key => $value) { $this->setAttribute($key, $value); } return $this; }
[ "public", "function", "fill", "(", "array", "$", "attributes", "=", "[", "]", ")", "{", "foreach", "(", "$", "attributes", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "setAttribute", "(", "$", "key", ",", "$", "value", ")", ...
Fills the entry with the supplied attributes. @param array $attributes @return $this
[ "Fills", "the", "entry", "with", "the", "supplied", "attributes", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasAttributes.php#L135-L142
Adldap2/Adldap2
src/Models/Concerns/HasAttributes.php
HasAttributes.setAttribute
public function setAttribute($key, $value, $subKey = null) { // Normalize key. $key = $this->normalizeAttributeKey($key); // If the key is equal to 'dn', we'll automatically // change it to the full attribute name. $key = ($key == 'dn' ? $this->schema->distinguishedName() : ...
php
public function setAttribute($key, $value, $subKey = null) { // Normalize key. $key = $this->normalizeAttributeKey($key); // If the key is equal to 'dn', we'll automatically // change it to the full attribute name. $key = ($key == 'dn' ? $this->schema->distinguishedName() : ...
[ "public", "function", "setAttribute", "(", "$", "key", ",", "$", "value", ",", "$", "subKey", "=", "null", ")", "{", "// Normalize key.", "$", "key", "=", "$", "this", "->", "normalizeAttributeKey", "(", "$", "key", ")", ";", "// If the key is equal to 'dn',...
Sets an attributes value by the specified key and sub-key. @param int|string $key @param mixed $value @param int|string $subKey @return $this
[ "Sets", "an", "attributes", "value", "by", "the", "specified", "key", "and", "sub", "-", "key", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasAttributes.php#L153-L171
Adldap2/Adldap2
src/Models/Concerns/HasAttributes.php
HasAttributes.setRawAttributes
public function setRawAttributes(array $attributes = []) { // We'll filter out those annoying 'count' keys returned with LDAP results, // and lowercase all root array keys to prevent any casing issues. $this->attributes = array_change_key_case($this->filterRawAttributes($attributes), CASE_LO...
php
public function setRawAttributes(array $attributes = []) { // We'll filter out those annoying 'count' keys returned with LDAP results, // and lowercase all root array keys to prevent any casing issues. $this->attributes = array_change_key_case($this->filterRawAttributes($attributes), CASE_LO...
[ "public", "function", "setRawAttributes", "(", "array", "$", "attributes", "=", "[", "]", ")", "{", "// We'll filter out those annoying 'count' keys returned with LDAP results,", "// and lowercase all root array keys to prevent any casing issues.", "$", "this", "->", "attributes", ...
Sets the attributes property. Used when constructing an existing LDAP record. @param array $attributes @return $this
[ "Sets", "the", "attributes", "property", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasAttributes.php#L195-L223
Adldap2/Adldap2
src/Models/Concerns/HasAttributes.php
HasAttributes.filterRawAttributes
public function filterRawAttributes(array $attributes = [], $keys = ['count', 'dn']) { $attributes = Arr::except($attributes, $keys); array_walk($attributes, function (&$value) use ($keys) { $value = is_array($value) ? $this->filterRawAttributes($value, $keys) : ...
php
public function filterRawAttributes(array $attributes = [], $keys = ['count', 'dn']) { $attributes = Arr::except($attributes, $keys); array_walk($attributes, function (&$value) use ($keys) { $value = is_array($value) ? $this->filterRawAttributes($value, $keys) : ...
[ "public", "function", "filterRawAttributes", "(", "array", "$", "attributes", "=", "[", "]", ",", "$", "keys", "=", "[", "'count'", ",", "'dn'", "]", ")", "{", "$", "attributes", "=", "Arr", "::", "except", "(", "$", "attributes", ",", "$", "keys", "...
Filters the count key recursively from raw LDAP attributes. @param array $attributes @param array|string $keys @return array
[ "Filters", "the", "count", "key", "recursively", "from", "raw", "LDAP", "attributes", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasAttributes.php#L233-L244
Adldap2/Adldap2
src/Models/Concerns/HasAttributes.php
HasAttributes.hasAttribute
public function hasAttribute($key, $subKey = null) { // Normalize key. $key = $this->normalizeAttributeKey($key); if (is_null($subKey)) { return Arr::has($this->attributes, $key); } return Arr::has($this->attributes, "$key.$subKey"); }
php
public function hasAttribute($key, $subKey = null) { // Normalize key. $key = $this->normalizeAttributeKey($key); if (is_null($subKey)) { return Arr::has($this->attributes, $key); } return Arr::has($this->attributes, "$key.$subKey"); }
[ "public", "function", "hasAttribute", "(", "$", "key", ",", "$", "subKey", "=", "null", ")", "{", "// Normalize key.", "$", "key", "=", "$", "this", "->", "normalizeAttributeKey", "(", "$", "key", ")", ";", "if", "(", "is_null", "(", "$", "subKey", ")"...
Returns true / false if the specified attribute exists in the attributes array. @param int|string $key @param int|string $subKey @return bool
[ "Returns", "true", "/", "false", "if", "the", "specified", "attribute", "exists", "in", "the", "attributes", "array", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasAttributes.php#L255-L265
Adldap2/Adldap2
src/Models/Concerns/HasAttributes.php
HasAttributes.getDirty
public function getDirty() { $dirty = []; foreach ($this->attributes as $key => $value) { if (! $this->originalIsEquivalent($key)) { // We need to reset the array's indices using array_values due to // LDAP requiring consecutive indices (0, 1, 2 etc.) ...
php
public function getDirty() { $dirty = []; foreach ($this->attributes as $key => $value) { if (! $this->originalIsEquivalent($key)) { // We need to reset the array's indices using array_values due to // LDAP requiring consecutive indices (0, 1, 2 etc.) ...
[ "public", "function", "getDirty", "(", ")", "{", "$", "dirty", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "attributes", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "originalIsEquivalent", "(", "$",...
Get the attributes that have been changed since last sync. @return array
[ "Get", "the", "attributes", "that", "have", "been", "changed", "since", "last", "sync", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasAttributes.php#L293-L306
Adldap2/Adldap2
src/Models/Concerns/HasAttributes.php
HasAttributes.originalIsEquivalent
protected function originalIsEquivalent($key) { if (! array_key_exists($key, $this->original)) { return false; } $current = $this->attributes[$key]; $original = $this->original[$key]; if ($current === $original) { return true; } ret...
php
protected function originalIsEquivalent($key) { if (! array_key_exists($key, $this->original)) { return false; } $current = $this->attributes[$key]; $original = $this->original[$key]; if ($current === $original) { return true; } ret...
[ "protected", "function", "originalIsEquivalent", "(", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "original", ")", ")", "{", "return", "false", ";", "}", "$", "current", "=", "$", "this", "->", "...
Determine if the new and old values for a given key are equivalent. @param string $key @return bool
[ "Determine", "if", "the", "new", "and", "old", "values", "for", "a", "given", "key", "are", "equivalent", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasAttributes.php#L327-L344
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.compare
public function compare($dn, $attribute, $value) { return ldap_compare($this->getConnection(), $dn, $attribute, $value); }
php
public function compare($dn, $attribute, $value) { return ldap_compare($this->getConnection(), $dn, $attribute, $value); }
[ "public", "function", "compare", "(", "$", "dn", ",", "$", "attribute", ",", "$", "value", ")", "{", "return", "ldap_compare", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ",", "$", "attribute", ",", "$", "value", ")", ";", "}...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L183-L186
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.getDetailedError
public function getDetailedError() { // If the returned error number is zero, the last LDAP operation // succeeded. We won't return a detailed error. if ($number = $this->errNo()) { ldap_get_option($this->getConnection(), LDAP_OPT_DIAGNOSTIC_MESSAGE, $message); retur...
php
public function getDetailedError() { // If the returned error number is zero, the last LDAP operation // succeeded. We won't return a detailed error. if ($number = $this->errNo()) { ldap_get_option($this->getConnection(), LDAP_OPT_DIAGNOSTIC_MESSAGE, $message); retur...
[ "public", "function", "getDetailedError", "(", ")", "{", "// If the returned error number is zero, the last LDAP operation", "// succeeded. We won't return a detailed error.", "if", "(", "$", "number", "=", "$", "this", "->", "errNo", "(", ")", ")", "{", "ldap_get_option", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L199-L210
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.connect
public function connect($hosts = [], $port = '389') { $this->host = $this->getConnectionString($hosts, $this->getProtocol(), $port); $this->connection = ldap_connect($this->host); if ($this->isUsingTLS() && $this->startTLS() === false) { throw new ConnectionExce...
php
public function connect($hosts = [], $port = '389') { $this->host = $this->getConnectionString($hosts, $this->getProtocol(), $port); $this->connection = ldap_connect($this->host); if ($this->isUsingTLS() && $this->startTLS() === false) { throw new ConnectionExce...
[ "public", "function", "connect", "(", "$", "hosts", "=", "[", "]", ",", "$", "port", "=", "'389'", ")", "{", "$", "this", "->", "host", "=", "$", "this", "->", "getConnectionString", "(", "$", "hosts", ",", "$", "this", "->", "getProtocol", "(", ")...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L257-L268
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.search
public function search($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0) { return ldap_search($this->getConnection(), $dn, $filter, $fields, $onlyAttributes, $size, $time); }
php
public function search($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0) { return ldap_search($this->getConnection(), $dn, $filter, $fields, $onlyAttributes, $size, $time); }
[ "public", "function", "search", "(", "$", "dn", ",", "$", "filter", ",", "array", "$", "fields", ",", "$", "onlyAttributes", "=", "false", ",", "$", "size", "=", "0", ",", "$", "time", "=", "0", ")", "{", "return", "ldap_search", "(", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L283-L286
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.listing
public function listing($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0) { return ldap_list($this->getConnection(), $dn, $filter, $fields, $onlyAttributes, $size, $time); }
php
public function listing($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0) { return ldap_list($this->getConnection(), $dn, $filter, $fields, $onlyAttributes, $size, $time); }
[ "public", "function", "listing", "(", "$", "dn", ",", "$", "filter", ",", "array", "$", "fields", ",", "$", "onlyAttributes", "=", "false", ",", "$", "size", "=", "0", ",", "$", "time", "=", "0", ")", "{", "return", "ldap_list", "(", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L291-L294
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.read
public function read($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0) { return ldap_read($this->getConnection(), $dn, $filter, $fields, $onlyAttributes, $size, $time); }
php
public function read($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0) { return ldap_read($this->getConnection(), $dn, $filter, $fields, $onlyAttributes, $size, $time); }
[ "public", "function", "read", "(", "$", "dn", ",", "$", "filter", ",", "array", "$", "fields", ",", "$", "onlyAttributes", "=", "false", ",", "$", "size", "=", "0", ",", "$", "time", "=", "0", ")", "{", "return", "ldap_read", "(", "$", "this", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L299-L302
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.bind
public function bind($username, $password, $sasl = false) { if ($sasl) { return $this->bound = ldap_sasl_bind($this->getConnection(), null, null, 'GSSAPI'); } return $this->bound = ldap_bind( $this->getConnection(), $username, html_entity_deco...
php
public function bind($username, $password, $sasl = false) { if ($sasl) { return $this->bound = ldap_sasl_bind($this->getConnection(), null, null, 'GSSAPI'); } return $this->bound = ldap_bind( $this->getConnection(), $username, html_entity_deco...
[ "public", "function", "bind", "(", "$", "username", ",", "$", "password", ",", "$", "sasl", "=", "false", ")", "{", "if", "(", "$", "sasl", ")", "{", "return", "$", "this", "->", "bound", "=", "ldap_sasl_bind", "(", "$", "this", "->", "getConnection"...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L307-L318
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.rename
public function rename($dn, $newRdn, $newParent, $deleteOldRdn = false) { return ldap_rename($this->getConnection(), $dn, $newRdn, $newParent, $deleteOldRdn); }
php
public function rename($dn, $newRdn, $newParent, $deleteOldRdn = false) { return ldap_rename($this->getConnection(), $dn, $newRdn, $newParent, $deleteOldRdn); }
[ "public", "function", "rename", "(", "$", "dn", ",", "$", "newRdn", ",", "$", "newParent", ",", "$", "deleteOldRdn", "=", "false", ")", "{", "return", "ldap_rename", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ",", "$", "newRdn...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L339-L342
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.controlPagedResult
public function controlPagedResult($pageSize = 1000, $isCritical = false, $cookie = '') { return ldap_control_paged_result($this->getConnection(), $pageSize, $isCritical, $cookie); }
php
public function controlPagedResult($pageSize = 1000, $isCritical = false, $cookie = '') { return ldap_control_paged_result($this->getConnection(), $pageSize, $isCritical, $cookie); }
[ "public", "function", "controlPagedResult", "(", "$", "pageSize", "=", "1000", ",", "$", "isCritical", "=", "false", ",", "$", "cookie", "=", "''", ")", "{", "return", "ldap_control_paged_result", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L387-L390
Adldap2/Adldap2
src/Connections/Ldap.php
Ldap.getConnectionString
protected function getConnectionString($hosts, $protocol, $port) { // Normalize hosts into an array. $hosts = is_array($hosts) ? $hosts : [$hosts]; $hosts = array_map(function ($host) use ($protocol, $port) { return "{$protocol}{$host}:{$port}"; }, $hosts); retu...
php
protected function getConnectionString($hosts, $protocol, $port) { // Normalize hosts into an array. $hosts = is_array($hosts) ? $hosts : [$hosts]; $hosts = array_map(function ($host) use ($protocol, $port) { return "{$protocol}{$host}:{$port}"; }, $hosts); retu...
[ "protected", "function", "getConnectionString", "(", "$", "hosts", ",", "$", "protocol", ",", "$", "port", ")", "{", "// Normalize hosts into an array.", "$", "hosts", "=", "is_array", "(", "$", "hosts", ")", "?", "$", "hosts", ":", "[", "$", "hosts", "]",...
Generates an LDAP connection string for each host given. @param string|array $hosts @param string $protocol @param string $port @return string
[ "Generates", "an", "LDAP", "connection", "string", "for", "each", "host", "given", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Ldap.php#L481-L491
Adldap2/Adldap2
src/Events/Dispatcher.php
Dispatcher.listen
public function listen($events, $listener) { foreach ((array) $events as $event) { if (strpos($event, '*') !== false) { $this->setupWildcardListen($event, $listener); } else { $this->listeners[$event][] = $this->makeListener($listener); } ...
php
public function listen($events, $listener) { foreach ((array) $events as $event) { if (strpos($event, '*') !== false) { $this->setupWildcardListen($event, $listener); } else { $this->listeners[$event][] = $this->makeListener($listener); } ...
[ "public", "function", "listen", "(", "$", "events", ",", "$", "listener", ")", "{", "foreach", "(", "(", "array", ")", "$", "events", "as", "$", "event", ")", "{", "if", "(", "strpos", "(", "$", "event", ",", "'*'", ")", "!==", "false", ")", "{",...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Events/Dispatcher.php#L47-L56
Adldap2/Adldap2
src/Events/Dispatcher.php
Dispatcher.fire
public function fire($event, $payload = [], $halt = false) { return $this->dispatch($event, $payload, $halt); }
php
public function fire($event, $payload = [], $halt = false) { return $this->dispatch($event, $payload, $halt); }
[ "public", "function", "fire", "(", "$", "event", ",", "$", "payload", "=", "[", "]", ",", "$", "halt", "=", "false", ")", "{", "return", "$", "this", "->", "dispatch", "(", "$", "event", ",", "$", "payload", ",", "$", "halt", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Events/Dispatcher.php#L92-L95
Adldap2/Adldap2
src/Events/Dispatcher.php
Dispatcher.dispatch
public function dispatch($event, $payload = [], $halt = false) { // When the given "event" is actually an object we will assume it is an event // object and use the class as the event name and this event itself as the // payload to the handler, which makes object based events quite simple. ...
php
public function dispatch($event, $payload = [], $halt = false) { // When the given "event" is actually an object we will assume it is an event // object and use the class as the event name and this event itself as the // payload to the handler, which makes object based events quite simple. ...
[ "public", "function", "dispatch", "(", "$", "event", ",", "$", "payload", "=", "[", "]", ",", "$", "halt", "=", "false", ")", "{", "// When the given \"event\" is actually an object we will assume it is an event", "// object and use the class as the event name and this event ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Events/Dispatcher.php#L100-L132
Adldap2/Adldap2
src/Events/Dispatcher.php
Dispatcher.parseEventAndPayload
protected function parseEventAndPayload($event, $payload) { if (is_object($event)) { list($payload, $event) = [[$event], get_class($event)]; } return [$event, Arr::wrap($payload)]; }
php
protected function parseEventAndPayload($event, $payload) { if (is_object($event)) { list($payload, $event) = [[$event], get_class($event)]; } return [$event, Arr::wrap($payload)]; }
[ "protected", "function", "parseEventAndPayload", "(", "$", "event", ",", "$", "payload", ")", "{", "if", "(", "is_object", "(", "$", "event", ")", ")", "{", "list", "(", "$", "payload", ",", "$", "event", ")", "=", "[", "[", "$", "event", "]", ",",...
Parse the given event and payload and prepare them for dispatching. @param mixed $event @param mixed $payload @return array
[ "Parse", "the", "given", "event", "and", "payload", "and", "prepare", "them", "for", "dispatching", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Events/Dispatcher.php#L142-L149
Adldap2/Adldap2
src/Events/Dispatcher.php
Dispatcher.getWildcardListeners
protected function getWildcardListeners($eventName) { $wildcards = []; foreach ($this->wildcards as $key => $listeners) { if ($this->wildcardContainsEvent($key, $eventName)) { $wildcards = array_merge($wildcards, $listeners); } } return $this...
php
protected function getWildcardListeners($eventName) { $wildcards = []; foreach ($this->wildcards as $key => $listeners) { if ($this->wildcardContainsEvent($key, $eventName)) { $wildcards = array_merge($wildcards, $listeners); } } return $this...
[ "protected", "function", "getWildcardListeners", "(", "$", "eventName", ")", "{", "$", "wildcards", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "wildcards", "as", "$", "key", "=>", "$", "listeners", ")", "{", "if", "(", "$", "this", "->", ...
Get the wildcard listeners for the event. @param string $eventName @return array
[ "Get", "the", "wildcard", "listeners", "for", "the", "event", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Events/Dispatcher.php#L175-L186
Adldap2/Adldap2
src/Events/Dispatcher.php
Dispatcher.wildcardContainsEvent
protected function wildcardContainsEvent($wildcard, $eventName) { $patterns = Arr::wrap($wildcard); if (empty($patterns)) { return false; } foreach ($patterns as $pattern) { // If the given event is an exact match we can of course return true right ...
php
protected function wildcardContainsEvent($wildcard, $eventName) { $patterns = Arr::wrap($wildcard); if (empty($patterns)) { return false; } foreach ($patterns as $pattern) { // If the given event is an exact match we can of course return true right ...
[ "protected", "function", "wildcardContainsEvent", "(", "$", "wildcard", ",", "$", "eventName", ")", "{", "$", "patterns", "=", "Arr", "::", "wrap", "(", "$", "wildcard", ")", ";", "if", "(", "empty", "(", "$", "patterns", ")", ")", "{", "return", "fals...
Determine if the wildcard matches or contains the given event. This function is a direct excerpt from Laravel's Str::is(). @param string $wildcard @param string $eventName @return bool
[ "Determine", "if", "the", "wildcard", "matches", "or", "contains", "the", "given", "event", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Events/Dispatcher.php#L198-L227
Adldap2/Adldap2
src/Events/Dispatcher.php
Dispatcher.forget
public function forget($event) { if (strpos($event, '*') !== false) { unset($this->wildcards[$event]); } else { unset($this->listeners[$event]); } }
php
public function forget($event) { if (strpos($event, '*') !== false) { unset($this->wildcards[$event]); } else { unset($this->listeners[$event]); } }
[ "public", "function", "forget", "(", "$", "event", ")", "{", "if", "(", "strpos", "(", "$", "event", ",", "'*'", ")", "!==", "false", ")", "{", "unset", "(", "$", "this", "->", "wildcards", "[", "$", "event", "]", ")", ";", "}", "else", "{", "u...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Events/Dispatcher.php#L311-L318
Adldap2/Adldap2
src/Connections/Provider.php
Provider.setConfiguration
public function setConfiguration($configuration = []) { if (is_array($configuration)) { $configuration = new DomainConfiguration($configuration); } if ($configuration instanceof DomainConfiguration) { $this->configuration = $configuration; $schema = $con...
php
public function setConfiguration($configuration = []) { if (is_array($configuration)) { $configuration = new DomainConfiguration($configuration); } if ($configuration instanceof DomainConfiguration) { $this->configuration = $configuration; $schema = $con...
[ "public", "function", "setConfiguration", "(", "$", "configuration", "=", "[", "]", ")", "{", "if", "(", "is_array", "(", "$", "configuration", ")", ")", "{", "$", "configuration", "=", "new", "DomainConfiguration", "(", "$", "configuration", ")", ";", "}"...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Provider.php#L81-L103
Adldap2/Adldap2
src/Connections/Provider.php
Provider.setConnection
public function setConnection(ConnectionInterface $connection = null) { // We'll create a standard connection if one isn't given. $this->connection = $connection ?: new Ldap(); // Prepare the connection. $this->prepareConnection(); // Instantiate the LDAP connection. ...
php
public function setConnection(ConnectionInterface $connection = null) { // We'll create a standard connection if one isn't given. $this->connection = $connection ?: new Ldap(); // Prepare the connection. $this->prepareConnection(); // Instantiate the LDAP connection. ...
[ "public", "function", "setConnection", "(", "ConnectionInterface", "$", "connection", "=", "null", ")", "{", "// We'll create a standard connection if one isn't given.", "$", "this", "->", "connection", "=", "$", "connection", "?", ":", "new", "Ldap", "(", ")", ";",...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Provider.php#L108-L123
Adldap2/Adldap2
src/Connections/Provider.php
Provider.getGuard
public function getGuard() { if (! $this->guard instanceof GuardInterface) { $this->setGuard($this->getDefaultGuard($this->connection, $this->configuration)); } return $this->guard; }
php
public function getGuard() { if (! $this->guard instanceof GuardInterface) { $this->setGuard($this->getDefaultGuard($this->connection, $this->configuration)); } return $this->guard; }
[ "public", "function", "getGuard", "(", ")", "{", "if", "(", "!", "$", "this", "->", "guard", "instanceof", "GuardInterface", ")", "{", "$", "this", "->", "setGuard", "(", "$", "this", "->", "getDefaultGuard", "(", "$", "this", "->", "connection", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Provider.php#L172-L179
Adldap2/Adldap2
src/Connections/Provider.php
Provider.getDefaultGuard
public function getDefaultGuard(ConnectionInterface $connection, DomainConfiguration $configuration) { $guard = new Guard($connection, $configuration); $guard->setDispatcher(Adldap::getEventDispatcher()); return $guard; }
php
public function getDefaultGuard(ConnectionInterface $connection, DomainConfiguration $configuration) { $guard = new Guard($connection, $configuration); $guard->setDispatcher(Adldap::getEventDispatcher()); return $guard; }
[ "public", "function", "getDefaultGuard", "(", "ConnectionInterface", "$", "connection", ",", "DomainConfiguration", "$", "configuration", ")", "{", "$", "guard", "=", "new", "Guard", "(", "$", "connection", ",", "$", "configuration", ")", ";", "$", "guard", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Provider.php#L184-L191
Adldap2/Adldap2
src/Connections/Provider.php
Provider.connect
public function connect($username = null, $password = null) { // Get the default guard instance. $guard = $this->getGuard(); if (is_null($username) && is_null($password)) { // If both the username and password are null, we'll connect to the server // using the config...
php
public function connect($username = null, $password = null) { // Get the default guard instance. $guard = $this->getGuard(); if (is_null($username) && is_null($password)) { // If both the username and password are null, we'll connect to the server // using the config...
[ "public", "function", "connect", "(", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "// Get the default guard instance.", "$", "guard", "=", "$", "this", "->", "getGuard", "(", ")", ";", "if", "(", "is_null", "(", "$", "usern...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Provider.php#L226-L241
Adldap2/Adldap2
src/Connections/Provider.php
Provider.prepareConnection
protected function prepareConnection() { if ($this->configuration->get('use_ssl')) { $this->connection->ssl(); } elseif ($this->configuration->get('use_tls')) { $this->connection->tls(); } $options = array_replace( $this->configuration->get('custo...
php
protected function prepareConnection() { if ($this->configuration->get('use_ssl')) { $this->connection->ssl(); } elseif ($this->configuration->get('use_tls')) { $this->connection->tls(); } $options = array_replace( $this->configuration->get('custo...
[ "protected", "function", "prepareConnection", "(", ")", "{", "if", "(", "$", "this", "->", "configuration", "->", "get", "(", "'use_ssl'", ")", ")", "{", "$", "this", "->", "connection", "->", "ssl", "(", ")", ";", "}", "elseif", "(", "$", "this", "-...
Prepares the connection by setting configured parameters. @return void @throws \Adldap\Configuration\ConfigurationException When configuration options requested do not exist
[ "Prepares", "the", "connection", "by", "setting", "configured", "parameters", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Connections/Provider.php#L250-L268
Adldap2/Adldap2
src/Models/Concerns/HasMemberOf.php
HasMemberOf.getMemberOf
public function getMemberOf() { $dns = $this->getAttribute($this->schema->memberOf()); // Normalize returned distinguished names if the attribute is null. return is_array($dns) ? $dns : []; }
php
public function getMemberOf() { $dns = $this->getAttribute($this->schema->memberOf()); // Normalize returned distinguished names if the attribute is null. return is_array($dns) ? $dns : []; }
[ "public", "function", "getMemberOf", "(", ")", "{", "$", "dns", "=", "$", "this", "->", "getAttribute", "(", "$", "this", "->", "schema", "->", "memberOf", "(", ")", ")", ";", "// Normalize returned distinguished names if the attribute is null.", "return", "is_arr...
Returns an array of distinguished names of groups that the current model belongs to. @link https://msdn.microsoft.com/en-us/library/ms677099(v=vs.85).aspx @return array
[ "Returns", "an", "array", "of", "distinguished", "names", "of", "groups", "that", "the", "current", "model", "belongs", "to", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasMemberOf.php#L19-L25
Adldap2/Adldap2
src/Models/Concerns/HasMemberOf.php
HasMemberOf.addGroup
public function addGroup($group) { if (is_string($group)) { // If the group is a string, we'll assume the dev is passing // in a DN string of the group. We'll try to locate it. $group = $this->query->newInstance()->findByDn($group); } if ($group instanceo...
php
public function addGroup($group) { if (is_string($group)) { // If the group is a string, we'll assume the dev is passing // in a DN string of the group. We'll try to locate it. $group = $this->query->newInstance()->findByDn($group); } if ($group instanceo...
[ "public", "function", "addGroup", "(", "$", "group", ")", "{", "if", "(", "is_string", "(", "$", "group", ")", ")", "{", "// If the group is a string, we'll assume the dev is passing", "// in a DN string of the group. We'll try to locate it.", "$", "group", "=", "$", "t...
Adds the current model to the specified group. @param string|Group $group @return bool
[ "Adds", "the", "current", "model", "to", "the", "specified", "group", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasMemberOf.php#L34-L49
Adldap2/Adldap2
src/Models/Concerns/HasMemberOf.php
HasMemberOf.removeGroup
public function removeGroup($group) { if (is_string($group)) { // If the group is a string, we'll assume the dev is passing // in a DN string of the group. We'll try to locate it. $group = $this->query->newInstance()->findByDn($group); } if ($group instan...
php
public function removeGroup($group) { if (is_string($group)) { // If the group is a string, we'll assume the dev is passing // in a DN string of the group. We'll try to locate it. $group = $this->query->newInstance()->findByDn($group); } if ($group instan...
[ "public", "function", "removeGroup", "(", "$", "group", ")", "{", "if", "(", "is_string", "(", "$", "group", ")", ")", "{", "// If the group is a string, we'll assume the dev is passing", "// in a DN string of the group. We'll try to locate it.", "$", "group", "=", "$", ...
Removes the current model from the specified group. @param string|Group $group @return bool
[ "Removes", "the", "current", "model", "from", "the", "specified", "group", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasMemberOf.php#L58-L73
Adldap2/Adldap2
src/Models/Concerns/HasMemberOf.php
HasMemberOf.removeAllGroups
public function removeAllGroups() { $removed = []; foreach ($this->getMemberOf() as $group) { if ($this->removeGroup($group)) { $removed[] = $group; } } return $removed; }
php
public function removeAllGroups() { $removed = []; foreach ($this->getMemberOf() as $group) { if ($this->removeGroup($group)) { $removed[] = $group; } } return $removed; }
[ "public", "function", "removeAllGroups", "(", ")", "{", "$", "removed", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getMemberOf", "(", ")", "as", "$", "group", ")", "{", "if", "(", "$", "this", "->", "removeGroup", "(", "$", "group", ")...
Removes the current model from all groups. @return array The group distinguished names that were successfully removed
[ "Removes", "the", "current", "model", "from", "all", "groups", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasMemberOf.php#L80-L91
Adldap2/Adldap2
src/Models/Concerns/HasMemberOf.php
HasMemberOf.getGroups
public function getGroups(array $fields = ['*'], $recursive = false, array $visited = []) { if (! in_array($this->schema->memberOf(), $fields)) { // We want to make sure that we always select the memberof // field in case developers want recursive members. $fields = array...
php
public function getGroups(array $fields = ['*'], $recursive = false, array $visited = []) { if (! in_array($this->schema->memberOf(), $fields)) { // We want to make sure that we always select the memberof // field in case developers want recursive members. $fields = array...
[ "public", "function", "getGroups", "(", "array", "$", "fields", "=", "[", "'*'", "]", ",", "$", "recursive", "=", "false", ",", "array", "$", "visited", "=", "[", "]", ")", "{", "if", "(", "!", "in_array", "(", "$", "this", "->", "schema", "->", ...
Returns the models groups that it is apart of. If a recursive option is given, groups of groups are retrieved and then merged with the resulting collection. @link https://msdn.microsoft.com/en-us/library/ms677099(v=vs.85).aspx @param array $fields @param bool $recursive @param array $visited @return Collection
[ "Returns", "the", "models", "groups", "that", "it", "is", "apart", "of", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasMemberOf.php#L108-L150
Adldap2/Adldap2
src/Models/Concerns/HasMemberOf.php
HasMemberOf.getGroupNames
public function getGroupNames($recursive = false) { $fields = [$this->schema->commonName(), $this->schema->memberOf()]; $names = $this->getGroups($fields, $recursive)->map(function (Group $group) { return $group->getCommonName(); })->toArray(); return array_unique($name...
php
public function getGroupNames($recursive = false) { $fields = [$this->schema->commonName(), $this->schema->memberOf()]; $names = $this->getGroups($fields, $recursive)->map(function (Group $group) { return $group->getCommonName(); })->toArray(); return array_unique($name...
[ "public", "function", "getGroupNames", "(", "$", "recursive", "=", "false", ")", "{", "$", "fields", "=", "[", "$", "this", "->", "schema", "->", "commonName", "(", ")", ",", "$", "this", "->", "schema", "->", "memberOf", "(", ")", "]", ";", "$", "...
Returns the models groups names in a single dimension array. If a recursive option is given, groups of groups are retrieved and then merged with the resulting collection. @param bool $recursive @return array
[ "Returns", "the", "models", "groups", "names", "in", "a", "single", "dimension", "array", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasMemberOf.php#L163-L172
Adldap2/Adldap2
src/Models/Concerns/HasMemberOf.php
HasMemberOf.inGroup
public function inGroup($group, $recursive = false) { $memberOf = $this->getGroups(['cn'], $recursive); if ($group instanceof Collection) { // If we've been given a collection then we'll convert // it to an array to normalize the value. $group = $group->toArray()...
php
public function inGroup($group, $recursive = false) { $memberOf = $this->getGroups(['cn'], $recursive); if ($group instanceof Collection) { // If we've been given a collection then we'll convert // it to an array to normalize the value. $group = $group->toArray()...
[ "public", "function", "inGroup", "(", "$", "group", ",", "$", "recursive", "=", "false", ")", "{", "$", "memberOf", "=", "$", "this", "->", "getGroups", "(", "[", "'cn'", "]", ",", "$", "recursive", ")", ";", "if", "(", "$", "group", "instanceof", ...
Determine if the current model is a member of the specified group(s). @param mixed $group @param bool $recursive @return bool
[ "Determine", "if", "the", "current", "model", "is", "a", "member", "of", "the", "specified", "group", "(", "s", ")", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasMemberOf.php#L182-L211
Adldap2/Adldap2
src/Models/Concerns/HasMemberOf.php
HasMemberOf.getGroupsByNames
protected function getGroupsByNames(array $dns = [], $fields = []) { $query = $this->query->newInstance(); return $query->newCollection($dns)->map(function ($dn) use ($query, $fields) { return $query->select($fields)->findByDn($dn); })->filter(function ($group) { ret...
php
protected function getGroupsByNames(array $dns = [], $fields = []) { $query = $this->query->newInstance(); return $query->newCollection($dns)->map(function ($dn) use ($query, $fields) { return $query->select($fields)->findByDn($dn); })->filter(function ($group) { ret...
[ "protected", "function", "getGroupsByNames", "(", "array", "$", "dns", "=", "[", "]", ",", "$", "fields", "=", "[", "]", ")", "{", "$", "query", "=", "$", "this", "->", "query", "->", "newInstance", "(", ")", ";", "return", "$", "query", "->", "new...
Retrieves groups by their distinguished name. @param array $dns @param array $fields @return Collection
[ "Retrieves", "groups", "by", "their", "distinguished", "name", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasMemberOf.php#L221-L230
Adldap2/Adldap2
src/Models/Concerns/HasMemberOf.php
HasMemberOf.groupIsParent
protected function groupIsParent($group, Group $parent) { if ($group instanceof Group) { // We've been given a group instance, we'll compare their DNs. return $parent->getDn() === $group->getDn(); } if (Utilities::explodeDn($group)) { // We've been given ...
php
protected function groupIsParent($group, Group $parent) { if ($group instanceof Group) { // We've been given a group instance, we'll compare their DNs. return $parent->getDn() === $group->getDn(); } if (Utilities::explodeDn($group)) { // We've been given ...
[ "protected", "function", "groupIsParent", "(", "$", "group", ",", "Group", "$", "parent", ")", "{", "if", "(", "$", "group", "instanceof", "Group", ")", "{", "// We've been given a group instance, we'll compare their DNs.", "return", "$", "parent", "->", "getDn", ...
Validates if the specified group is the given parent instance. @param Group|string $group @param Group $parent @return bool
[ "Validates", "if", "the", "specified", "group", "is", "the", "given", "parent", "instance", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasMemberOf.php#L240-L259
Adldap2/Adldap2
src/Models/Attributes/TSPropertyArray.php
TSPropertyArray.remove
public function remove($propName) { foreach (array_keys($this->tsProperty) as $property) { if (strtolower($propName) == strtolower($property)) { unset($this->tsProperty[$property]); } } return $this; }
php
public function remove($propName) { foreach (array_keys($this->tsProperty) as $property) { if (strtolower($propName) == strtolower($property)) { unset($this->tsProperty[$property]); } } return $this; }
[ "public", "function", "remove", "(", "$", "propName", ")", "{", "foreach", "(", "array_keys", "(", "$", "this", "->", "tsProperty", ")", "as", "$", "property", ")", "{", "if", "(", "strtolower", "(", "$", "propName", ")", "==", "strtolower", "(", "$", ...
Remove a TSProperty by its property name (ie. CtxMinEncryptionLevel). @param string $propName @return $this
[ "Remove", "a", "TSProperty", "by", "its", "property", "name", "(", "ie", ".", "CtxMinEncryptionLevel", ")", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSPropertyArray.php#L139-L148
Adldap2/Adldap2
src/Models/Attributes/TSPropertyArray.php
TSPropertyArray.set
public function set($propName, $propValue) { $this->validateProp($propName); $this->getTsPropObj($propName)->setValue($propValue); return $this; }
php
public function set($propName, $propValue) { $this->validateProp($propName); $this->getTsPropObj($propName)->setValue($propValue); return $this; }
[ "public", "function", "set", "(", "$", "propName", ",", "$", "propValue", ")", "{", "$", "this", "->", "validateProp", "(", "$", "propName", ")", ";", "$", "this", "->", "getTsPropObj", "(", "$", "propName", ")", "->", "setValue", "(", "$", "propValue"...
Set the value for a specific TSProperty by its name. @param string $propName @param mixed $propValue @return $this
[ "Set", "the", "value", "for", "a", "specific", "TSProperty", "by", "its", "name", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSPropertyArray.php#L158-L165
Adldap2/Adldap2
src/Models/Attributes/TSPropertyArray.php
TSPropertyArray.toArray
public function toArray() { $userParameters = []; foreach ($this->tsProperty as $property => $tsPropObj) { $userParameters[$property] = $tsPropObj->getValue(); } return $userParameters; }
php
public function toArray() { $userParameters = []; foreach ($this->tsProperty as $property => $tsPropObj) { $userParameters[$property] = $tsPropObj->getValue(); } return $userParameters; }
[ "public", "function", "toArray", "(", ")", "{", "$", "userParameters", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "tsProperty", "as", "$", "property", "=>", "$", "tsPropObj", ")", "{", "$", "userParameters", "[", "$", "property", "]", "=", ...
Get a simple associative array containing of all TSProperty names and values. @return array
[ "Get", "a", "simple", "associative", "array", "containing", "of", "all", "TSProperty", "names", "and", "values", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSPropertyArray.php#L192-L201
Adldap2/Adldap2
src/Models/Attributes/TSPropertyArray.php
TSPropertyArray.decodeUserParameters
protected function decodeUserParameters($userParameters) { $userParameters = bin2hex($userParameters); // Save the 96-byte array of reserved data, so as to not ruin anything that may be stored there. $this->preBinary = hex2bin(substr($userParameters, 0, 96)); // The signature is a 2...
php
protected function decodeUserParameters($userParameters) { $userParameters = bin2hex($userParameters); // Save the 96-byte array of reserved data, so as to not ruin anything that may be stored there. $this->preBinary = hex2bin(substr($userParameters, 0, 96)); // The signature is a 2...
[ "protected", "function", "decodeUserParameters", "(", "$", "userParameters", ")", "{", "$", "userParameters", "=", "bin2hex", "(", "$", "userParameters", ")", ";", "// Save the 96-byte array of reserved data, so as to not ruin anything that may be stored there.", "$", "this", ...
Get an associative array with all of the userParameters property names and values. @param string $userParameters @return void
[ "Get", "an", "associative", "array", "with", "all", "of", "the", "userParameters", "property", "names", "and", "values", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSPropertyArray.php#L242-L264
Adldap2/Adldap2
src/Models/Attributes/TSPropertyArray.php
TSPropertyArray.addTSPropData
protected function addTSPropData($tsPropertyArray, $tsPropCount) { $length = 0; for ($i = 0; $i < $tsPropCount; $i++) { // Prop length = name length + value length + type length + the space for the length data. $propLength = hexdec(substr($tsPropertyArray, $length, 2)) + (he...
php
protected function addTSPropData($tsPropertyArray, $tsPropCount) { $length = 0; for ($i = 0; $i < $tsPropCount; $i++) { // Prop length = name length + value length + type length + the space for the length data. $propLength = hexdec(substr($tsPropertyArray, $length, 2)) + (he...
[ "protected", "function", "addTSPropData", "(", "$", "tsPropertyArray", ",", "$", "tsPropCount", ")", "{", "$", "length", "=", "0", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "tsPropCount", ";", "$", "i", "++", ")", "{", "// Prop ...
Given the start of TSPropertyArray hex data, and the count for the number of TSProperty structures in contains, parse and split out the individual TSProperty structures. Return the full length of the TSPropertyArray data. @param string $tsPropertyArray @param int $tsPropCount @return int The length of the data in ...
[ "Given", "the", "start", "of", "TSPropertyArray", "hex", "data", "and", "the", "count", "for", "the", "number", "of", "TSProperty", "structures", "in", "contains", "parse", "and", "split", "out", "the", "individual", "TSProperty", "structures", ".", "Return", ...
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Attributes/TSPropertyArray.php#L277-L293
Adldap2/Adldap2
src/Auth/Guard.php
Guard.attempt
public function attempt($username, $password, $bindAsUser = false) { $this->validateCredentials($username, $password); $this->fireAttemptingEvent($username, $password); try { $this->bind( $this->applyPrefixAndSuffix($username), $password ...
php
public function attempt($username, $password, $bindAsUser = false) { $this->validateCredentials($username, $password); $this->fireAttemptingEvent($username, $password); try { $this->bind( $this->applyPrefixAndSuffix($username), $password ...
[ "public", "function", "attempt", "(", "$", "username", ",", "$", "password", ",", "$", "bindAsUser", "=", "false", ")", "{", "$", "this", "->", "validateCredentials", "(", "$", "username", ",", "$", "password", ")", ";", "$", "this", "->", "fireAttemptin...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Auth/Guard.php#L58-L91
Adldap2/Adldap2
src/Auth/Guard.php
Guard.bind
public function bind($username = null, $password = null) { $this->fireBindingEvent($username, $password); try { if (@$this->connection->bind($username, $password) === true) { $this->fireBoundEvent($username, $password); } else { throw new Exce...
php
public function bind($username = null, $password = null) { $this->fireBindingEvent($username, $password); try { if (@$this->connection->bind($username, $password) === true) { $this->fireBoundEvent($username, $password); } else { throw new Exce...
[ "public", "function", "bind", "(", "$", "username", "=", "null", ",", "$", "password", "=", "null", ")", "{", "$", "this", "->", "fireBindingEvent", "(", "$", "username", ",", "$", "password", ")", ";", "try", "{", "if", "(", "@", "$", "this", "->"...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Auth/Guard.php#L96-L112
Adldap2/Adldap2
src/Auth/Guard.php
Guard.applyPrefixAndSuffix
protected function applyPrefixAndSuffix($username) { $prefix = $this->configuration->get('account_prefix'); $suffix = $this->configuration->get('account_suffix'); return $prefix.$username.$suffix; }
php
protected function applyPrefixAndSuffix($username) { $prefix = $this->configuration->get('account_prefix'); $suffix = $this->configuration->get('account_suffix'); return $prefix.$username.$suffix; }
[ "protected", "function", "applyPrefixAndSuffix", "(", "$", "username", ")", "{", "$", "prefix", "=", "$", "this", "->", "configuration", "->", "get", "(", "'account_prefix'", ")", ";", "$", "suffix", "=", "$", "this", "->", "configuration", "->", "get", "(...
Applies the prefix and suffix to the given username. @param string $username @return string @throws \Adldap\Configuration\ConfigurationException If account_suffix or account_prefix do not exist in the providers domain configuration
[ "Applies", "the", "prefix", "and", "suffix", "to", "the", "given", "username", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Auth/Guard.php#L157-L163
Adldap2/Adldap2
src/Auth/Guard.php
Guard.fireAttemptingEvent
protected function fireAttemptingEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Attempting($this->connection, $username, $password)); } }
php
protected function fireAttemptingEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Attempting($this->connection, $username, $password)); } }
[ "protected", "function", "fireAttemptingEvent", "(", "$", "username", ",", "$", "password", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "events", ")", ")", "{", "$", "this", "->", "events", "->", "fire", "(", "new", "Attempting", "(", "$", ...
Fire the attempting event. @param string $username @param string $password @return void
[ "Fire", "the", "attempting", "event", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Auth/Guard.php#L195-L200
Adldap2/Adldap2
src/Auth/Guard.php
Guard.firePassedEvent
protected function firePassedEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Passed($this->connection, $username, $password)); } }
php
protected function firePassedEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Passed($this->connection, $username, $password)); } }
[ "protected", "function", "firePassedEvent", "(", "$", "username", ",", "$", "password", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "events", ")", ")", "{", "$", "this", "->", "events", "->", "fire", "(", "new", "Passed", "(", "$", "this", ...
Fire the passed event. @param string $username @param string $password @return void
[ "Fire", "the", "passed", "event", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Auth/Guard.php#L210-L215
Adldap2/Adldap2
src/Auth/Guard.php
Guard.fireFailedEvent
protected function fireFailedEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Failed($this->connection, $username, $password)); } }
php
protected function fireFailedEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Failed($this->connection, $username, $password)); } }
[ "protected", "function", "fireFailedEvent", "(", "$", "username", ",", "$", "password", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "events", ")", ")", "{", "$", "this", "->", "events", "->", "fire", "(", "new", "Failed", "(", "$", "this", ...
Fire the failed event. @param string $username @param string $password @return void
[ "Fire", "the", "failed", "event", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Auth/Guard.php#L225-L230
Adldap2/Adldap2
src/Auth/Guard.php
Guard.fireBindingEvent
protected function fireBindingEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Binding($this->connection, $username, $password)); } }
php
protected function fireBindingEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Binding($this->connection, $username, $password)); } }
[ "protected", "function", "fireBindingEvent", "(", "$", "username", ",", "$", "password", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "events", ")", ")", "{", "$", "this", "->", "events", "->", "fire", "(", "new", "Binding", "(", "$", "this"...
Fire the binding event. @param string $username @param string $password @return void
[ "Fire", "the", "binding", "event", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Auth/Guard.php#L240-L245
Adldap2/Adldap2
src/Auth/Guard.php
Guard.fireBoundEvent
protected function fireBoundEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Bound($this->connection, $username, $password)); } }
php
protected function fireBoundEvent($username, $password) { if (isset($this->events)) { $this->events->fire(new Bound($this->connection, $username, $password)); } }
[ "protected", "function", "fireBoundEvent", "(", "$", "username", ",", "$", "password", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "events", ")", ")", "{", "$", "this", "->", "events", "->", "fire", "(", "new", "Bound", "(", "$", "this", ...
Fire the bound event. @param string $username @param string $password @return void
[ "Fire", "the", "bound", "event", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Auth/Guard.php#L255-L260
Adldap2/Adldap2
src/Configuration/DomainConfiguration.php
DomainConfiguration.set
public function set($key, $value) { if($this->validate($key, $value)) { $this->options[$key] = $value; } }
php
public function set($key, $value) { if($this->validate($key, $value)) { $this->options[$key] = $value; } }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "this", "->", "validate", "(", "$", "key", ",", "$", "value", ")", ")", "{", "$", "this", "->", "options", "[", "$", "key", "]", "=", "$", "value", ";"...
Sets a configuration option. Throws an exception if the specified option does not exist, or if it's an invalid type. @param string $key @param mixed $value @throws ConfigurationException When an option value given is an invalid type.
[ "Sets", "a", "configuration", "option", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Configuration/DomainConfiguration.php#L93-L98
Adldap2/Adldap2
src/Configuration/DomainConfiguration.php
DomainConfiguration.validate
protected function validate($key, $value) { $default = $this->get($key); if (is_array($default)) { $validator = new Validators\ArrayValidator($key, $value); } elseif (is_int($default)) { $validator = new Validators\IntegerValidator($key, $value); } elseif (is...
php
protected function validate($key, $value) { $default = $this->get($key); if (is_array($default)) { $validator = new Validators\ArrayValidator($key, $value); } elseif (is_int($default)) { $validator = new Validators\IntegerValidator($key, $value); } elseif (is...
[ "protected", "function", "validate", "(", "$", "key", ",", "$", "value", ")", "{", "$", "default", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "is_array", "(", "$", "default", ")", ")", "{", "$", "validator", "=", "new", ...
Validates the new configuration option against its default value to ensure it's the correct type. If an invalid type is given, an exception is thrown. @param string $key @param mixed $value @return bool @throws ConfigurationException When an option value given is an invalid type.
[ "Validates", "the", "new", "configuration", "option", "against", "its", "default", "value", "to", "ensure", "it", "s", "the", "correct", "type", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Configuration/DomainConfiguration.php#L145-L162
Adldap2/Adldap2
src/Models/Concerns/HasUserProperties.php
HasUserProperties.addProxyAddress
public function addProxyAddress($address) { $addresses = $this->getProxyAddresses(); $addresses[] = $address; return $this->setAttribute($this->schema->proxyAddresses(), $addresses); }
php
public function addProxyAddress($address) { $addresses = $this->getProxyAddresses(); $addresses[] = $address; return $this->setAttribute($this->schema->proxyAddresses(), $addresses); }
[ "public", "function", "addProxyAddress", "(", "$", "address", ")", "{", "$", "addresses", "=", "$", "this", "->", "getProxyAddresses", "(", ")", ";", "$", "addresses", "[", "]", "=", "$", "address", ";", "return", "$", "this", "->", "setAttribute", "(", ...
Add's a single proxy address to the user. @param string $address @return $this
[ "Add", "s", "a", "single", "proxy", "address", "to", "the", "user", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Models/Concerns/HasUserProperties.php#L261-L268
Adldap2/Adldap2
src/Query/Builder.php
Builder.newInstance
public function newInstance($baseDn = null) { // We'll set the base DN of the new Builder so // developers don't need to do this manually. $dn = is_null($baseDn) ? $this->getDn() : $baseDn; return (new static($this->connection, $this->grammar, $this->schema)) ->setDn($dn...
php
public function newInstance($baseDn = null) { // We'll set the base DN of the new Builder so // developers don't need to do this manually. $dn = is_null($baseDn) ? $this->getDn() : $baseDn; return (new static($this->connection, $this->grammar, $this->schema)) ->setDn($dn...
[ "public", "function", "newInstance", "(", "$", "baseDn", "=", "null", ")", "{", "// We'll set the base DN of the new Builder so", "// developers don't need to do this manually.", "$", "dn", "=", "is_null", "(", "$", "baseDn", ")", "?", "$", "this", "->", "getDn", "(...
Returns a new Query Builder instance. @param string $baseDn @return Builder
[ "Returns", "a", "new", "Query", "Builder", "instance", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L192-L200
Adldap2/Adldap2
src/Query/Builder.php
Builder.newNestedInstance
public function newNestedInstance(Closure $closure = null) { $query = $this->newInstance()->nested(); if ($closure) { call_user_func($closure, $query); } return $query; }
php
public function newNestedInstance(Closure $closure = null) { $query = $this->newInstance()->nested(); if ($closure) { call_user_func($closure, $query); } return $query; }
[ "public", "function", "newNestedInstance", "(", "Closure", "$", "closure", "=", "null", ")", "{", "$", "query", "=", "$", "this", "->", "newInstance", "(", ")", "->", "nested", "(", ")", ";", "if", "(", "$", "closure", ")", "{", "call_user_func", "(", ...
Returns a new nested Query Builder instance. @param Closure|null $closure @return $this
[ "Returns", "a", "new", "nested", "Query", "Builder", "instance", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L209-L218
Adldap2/Adldap2
src/Query/Builder.php
Builder.getQuery
public function getQuery() { // We need to ensure we have at least one filter, as // no query results will be returned otherwise. if (count(array_filter($this->filters)) === 0) { $this->whereHas($this->schema->objectClass()); } return $this->grammar->compile($thi...
php
public function getQuery() { // We need to ensure we have at least one filter, as // no query results will be returned otherwise. if (count(array_filter($this->filters)) === 0) { $this->whereHas($this->schema->objectClass()); } return $this->grammar->compile($thi...
[ "public", "function", "getQuery", "(", ")", "{", "// We need to ensure we have at least one filter, as", "// no query results will be returned otherwise.", "if", "(", "count", "(", "array_filter", "(", "$", "this", "->", "filters", ")", ")", "===", "0", ")", "{", "$",...
Compiles and returns the current query string. @return string
[ "Compiles", "and", "returns", "the", "current", "query", "string", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L237-L246
Adldap2/Adldap2
src/Query/Builder.php
Builder.setDn
public function setDn($dn = null) { $this->dn = $dn instanceof Model ? $dn->getDn() : $dn; return $this; }
php
public function setDn($dn = null) { $this->dn = $dn instanceof Model ? $dn->getDn() : $dn; return $this; }
[ "public", "function", "setDn", "(", "$", "dn", "=", "null", ")", "{", "$", "this", "->", "dn", "=", "$", "dn", "instanceof", "Model", "?", "$", "dn", "->", "getDn", "(", ")", ":", "$", "dn", ";", "return", "$", "this", ";", "}" ]
Sets the DN to perform searches upon. @param string|Model|null $dn @return Builder
[ "Sets", "the", "DN", "to", "perform", "searches", "upon", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L295-L300
Adldap2/Adldap2
src/Query/Builder.php
Builder.query
public function query($query) { $results = $this->connection->{$this->type}( $this->getDn(), $query, $this->getSelects(), $onlyAttributes = false, $this->limit ); return $this->newProcessor()->process($results); }
php
public function query($query) { $results = $this->connection->{$this->type}( $this->getDn(), $query, $this->getSelects(), $onlyAttributes = false, $this->limit ); return $this->newProcessor()->process($results); }
[ "public", "function", "query", "(", "$", "query", ")", "{", "$", "results", "=", "$", "this", "->", "connection", "->", "{", "$", "this", "->", "type", "}", "(", "$", "this", "->", "getDn", "(", ")", ",", "$", "query", ",", "$", "this", "->", "...
Performs the specified query on the current LDAP connection. @param string $query @return \Adldap\Query\Collection|array
[ "Performs", "the", "specified", "query", "on", "the", "current", "LDAP", "connection", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L335-L346
Adldap2/Adldap2
src/Query/Builder.php
Builder.paginate
public function paginate($perPage = 50, $currentPage = 0, $isCritical = true) { $this->paginated = true; $pages = []; $cookie = ''; do { $this->connection->controlPagedResult($perPage, $isCritical, $cookie); // Run the search. $resource = @$thi...
php
public function paginate($perPage = 50, $currentPage = 0, $isCritical = true) { $this->paginated = true; $pages = []; $cookie = ''; do { $this->connection->controlPagedResult($perPage, $isCritical, $cookie); // Run the search. $resource = @$thi...
[ "public", "function", "paginate", "(", "$", "perPage", "=", "50", ",", "$", "currentPage", "=", "0", ",", "$", "isCritical", "=", "true", ")", "{", "$", "this", "->", "paginated", "=", "true", ";", "$", "pages", "=", "[", "]", ";", "$", "cookie", ...
Paginates the current LDAP query. @param int $perPage @param int $currentPage @param bool $isCritical @return Paginator
[ "Paginates", "the", "current", "LDAP", "query", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L357-L388
Adldap2/Adldap2
src/Query/Builder.php
Builder.first
public function first($columns = []) { $results = $this->select($columns)->limit(1)->get(); // Since results may be returned inside an array if `raw()` // is specified, then we'll use our array helper // to retrieve the first result. return Arr::get($results, 0); }
php
public function first($columns = []) { $results = $this->select($columns)->limit(1)->get(); // Since results may be returned inside an array if `raw()` // is specified, then we'll use our array helper // to retrieve the first result. return Arr::get($results, 0); }
[ "public", "function", "first", "(", "$", "columns", "=", "[", "]", ")", "{", "$", "results", "=", "$", "this", "->", "select", "(", "$", "columns", ")", "->", "limit", "(", "1", ")", "->", "get", "(", ")", ";", "// Since results may be returned inside ...
Returns the first entry in a search result. @param array|string $columns @return Model|array|null
[ "Returns", "the", "first", "entry", "in", "a", "search", "result", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L397-L405
Adldap2/Adldap2
src/Query/Builder.php
Builder.firstOrFail
public function firstOrFail($columns = []) { $record = $this->first($columns); if (! $record) { throw (new ModelNotFoundException()) ->setQuery($this->getUnescapedQuery(), $this->getDn()); } return $record; }
php
public function firstOrFail($columns = []) { $record = $this->first($columns); if (! $record) { throw (new ModelNotFoundException()) ->setQuery($this->getUnescapedQuery(), $this->getDn()); } return $record; }
[ "public", "function", "firstOrFail", "(", "$", "columns", "=", "[", "]", ")", "{", "$", "record", "=", "$", "this", "->", "first", "(", "$", "columns", ")", ";", "if", "(", "!", "$", "record", ")", "{", "throw", "(", "new", "ModelNotFoundException", ...
Returns the first entry in a search result. If no entry is found, an exception is thrown. @param array|string $columns @throws ModelNotFoundException @return Model|array
[ "Returns", "the", "first", "entry", "in", "a", "search", "result", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L418-L428
Adldap2/Adldap2
src/Query/Builder.php
Builder.findBy
public function findBy($attribute, $value, $columns = []) { try { return $this->findByOrFail($attribute, $value, $columns); } catch (ModelNotFoundException $e) { return false; } }
php
public function findBy($attribute, $value, $columns = []) { try { return $this->findByOrFail($attribute, $value, $columns); } catch (ModelNotFoundException $e) { return false; } }
[ "public", "function", "findBy", "(", "$", "attribute", ",", "$", "value", ",", "$", "columns", "=", "[", "]", ")", "{", "try", "{", "return", "$", "this", "->", "findByOrFail", "(", "$", "attribute", ",", "$", "value", ",", "$", "columns", ")", ";"...
Finds a record by the specified attribute and value. @param string $attribute @param string $value @param array|string $columns @return Model|array|false
[ "Finds", "a", "record", "by", "the", "specified", "attribute", "and", "value", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L439-L446
Adldap2/Adldap2
src/Query/Builder.php
Builder.findByOrFail
public function findByOrFail($attribute, $value, $columns = []) { return $this->whereEquals($attribute, $value)->firstOrFail($columns); }
php
public function findByOrFail($attribute, $value, $columns = []) { return $this->whereEquals($attribute, $value)->firstOrFail($columns); }
[ "public", "function", "findByOrFail", "(", "$", "attribute", ",", "$", "value", ",", "$", "columns", "=", "[", "]", ")", "{", "return", "$", "this", "->", "whereEquals", "(", "$", "attribute", ",", "$", "value", ")", "->", "firstOrFail", "(", "$", "c...
Finds a record by the specified attribute and value. If no record is found an exception is thrown. @param string $attribute @param string $value @param array|string $columns @throws ModelNotFoundException @return Model|array
[ "Finds", "a", "record", "by", "the", "specified", "attribute", "and", "value", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L461-L464
Adldap2/Adldap2
src/Query/Builder.php
Builder.find
public function find($value, $columns = []) { if (is_array($value)) { return $this->findMany($value, $columns); } // If we're not using ActiveDirectory, we can't use ANR. We'll make our own query. if (! is_a($this->schema, ActiveDirectory::class)) { return $t...
php
public function find($value, $columns = []) { if (is_array($value)) { return $this->findMany($value, $columns); } // If we're not using ActiveDirectory, we can't use ANR. We'll make our own query. if (! is_a($this->schema, ActiveDirectory::class)) { return $t...
[ "public", "function", "find", "(", "$", "value", ",", "$", "columns", "=", "[", "]", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "return", "$", "this", "->", "findMany", "(", "$", "value", ",", "$", "columns", ")", ";", "...
Finds a record using ambiguous name resolution. @param string|array $value @param array|string $columns @return Model|array|null
[ "Finds", "a", "record", "using", "ambiguous", "name", "resolution", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L474-L486
Adldap2/Adldap2
src/Query/Builder.php
Builder.findMany
public function findMany(array $values = [], $columns = []) { $this->select($columns); if (! is_a($this->schema, ActiveDirectory::class)) { $query = $this; foreach ($values as $value) { $query->prepareAnrEquivalentQuery($value); } re...
php
public function findMany(array $values = [], $columns = []) { $this->select($columns); if (! is_a($this->schema, ActiveDirectory::class)) { $query = $this; foreach ($values as $value) { $query->prepareAnrEquivalentQuery($value); } re...
[ "public", "function", "findMany", "(", "array", "$", "values", "=", "[", "]", ",", "$", "columns", "=", "[", "]", ")", "{", "$", "this", "->", "select", "(", "$", "columns", ")", ";", "if", "(", "!", "is_a", "(", "$", "this", "->", "schema", ",...
Finds multiple records using ambiguous name resolution. @param array $values @param array $columns @return \Adldap\Query\Collection|array
[ "Finds", "multiple", "records", "using", "ambiguous", "name", "resolution", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L496-L511
Adldap2/Adldap2
src/Query/Builder.php
Builder.prepareAnrEquivalentQuery
protected function prepareAnrEquivalentQuery($value) { return $this->orFilter(function (Builder $query) use ($value) { $locateBy = [ $this->schema->name(), $this->schema->email(), $this->schema->userId(), $this->schema->lastName(), ...
php
protected function prepareAnrEquivalentQuery($value) { return $this->orFilter(function (Builder $query) use ($value) { $locateBy = [ $this->schema->name(), $this->schema->email(), $this->schema->userId(), $this->schema->lastName(), ...
[ "protected", "function", "prepareAnrEquivalentQuery", "(", "$", "value", ")", "{", "return", "$", "this", "->", "orFilter", "(", "function", "(", "Builder", "$", "query", ")", "use", "(", "$", "value", ")", "{", "$", "locateBy", "=", "[", "$", "this", ...
Creates an ANR equivalent query for LDAP distributions that do not support ANR. @param string $value @return Builder
[ "Creates", "an", "ANR", "equivalent", "query", "for", "LDAP", "distributions", "that", "do", "not", "support", "ANR", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L520-L537
Adldap2/Adldap2
src/Query/Builder.php
Builder.findManyBy
public function findManyBy($attribute, array $values = [], $columns = []) { $query = $this->select($columns); foreach ($values as $value) { $query->orWhere([$attribute => $value]); } return $query->get(); }
php
public function findManyBy($attribute, array $values = [], $columns = []) { $query = $this->select($columns); foreach ($values as $value) { $query->orWhere([$attribute => $value]); } return $query->get(); }
[ "public", "function", "findManyBy", "(", "$", "attribute", ",", "array", "$", "values", "=", "[", "]", ",", "$", "columns", "=", "[", "]", ")", "{", "$", "query", "=", "$", "this", "->", "select", "(", "$", "columns", ")", ";", "foreach", "(", "$...
Finds many records by the specified attribute. @param string $attribute @param array $values @param array $columns @return \Adldap\Query\Collection|array
[ "Finds", "many", "records", "by", "the", "specified", "attribute", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L548-L557
Adldap2/Adldap2
src/Query/Builder.php
Builder.findOrFail
public function findOrFail($value, $columns = []) { $entry = $this->find($value, $columns); // Make sure we check if the result is an entry or an array before // we throw an exception in case the user wants raw results. if (! $entry instanceof Model && !is_array($entry)) { ...
php
public function findOrFail($value, $columns = []) { $entry = $this->find($value, $columns); // Make sure we check if the result is an entry or an array before // we throw an exception in case the user wants raw results. if (! $entry instanceof Model && !is_array($entry)) { ...
[ "public", "function", "findOrFail", "(", "$", "value", ",", "$", "columns", "=", "[", "]", ")", "{", "$", "entry", "=", "$", "this", "->", "find", "(", "$", "value", ",", "$", "columns", ")", ";", "// Make sure we check if the result is an entry or an array ...
Finds a record using ambiguous name resolution. If a record is not found, an exception is thrown. @param string $value @param array|string $columns @throws ModelNotFoundException @return Model|array
[ "Finds", "a", "record", "using", "ambiguous", "name", "resolution", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L571-L583
Adldap2/Adldap2
src/Query/Builder.php
Builder.findByDn
public function findByDn($dn, $columns = []) { try { return $this->findByDnOrFail($dn, $columns); } catch (ModelNotFoundException $e) { return false; } }
php
public function findByDn($dn, $columns = []) { try { return $this->findByDnOrFail($dn, $columns); } catch (ModelNotFoundException $e) { return false; } }
[ "public", "function", "findByDn", "(", "$", "dn", ",", "$", "columns", "=", "[", "]", ")", "{", "try", "{", "return", "$", "this", "->", "findByDnOrFail", "(", "$", "dn", ",", "$", "columns", ")", ";", "}", "catch", "(", "ModelNotFoundException", "$"...
Finds a record by its distinguished name. @param string $dn @param array|string $columns @return bool|Model
[ "Finds", "a", "record", "by", "its", "distinguished", "name", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L593-L600
Adldap2/Adldap2
src/Query/Builder.php
Builder.findByDnOrFail
public function findByDnOrFail($dn, $columns = []) { // Since we're setting our base DN to be able to retrieve a model // by its distinguished name, we need to set it back to // our configured base so it is not overwritten. $base = $this->getDn(); $model = $this->setDn($dn) ...
php
public function findByDnOrFail($dn, $columns = []) { // Since we're setting our base DN to be able to retrieve a model // by its distinguished name, we need to set it back to // our configured base so it is not overwritten. $base = $this->getDn(); $model = $this->setDn($dn) ...
[ "public", "function", "findByDnOrFail", "(", "$", "dn", ",", "$", "columns", "=", "[", "]", ")", "{", "// Since we're setting our base DN to be able to retrieve a model", "// by its distinguished name, we need to set it back to", "// our configured base so it is not overwritten.", ...
Finds a record by its distinguished name. Fails upon no records returned. @param string $dn @param array|string $columns @throws ModelNotFoundException @return Model|array
[ "Finds", "a", "record", "by", "its", "distinguished", "name", "." ]
train
https://github.com/Adldap2/Adldap2/blob/a6089f508b2a94cb7ff8c98ab381ff983d5f0347/src/Query/Builder.php#L614-L633