/** * Factory method to create a detached Zend\Ldap\Node from array data. * * @param array $data * @param boolean $fromDataSource * @return Node * @throws Exception\LdapException */ public static function fromArray(array $data, $fromDataSource = false) { if (!array_key_exists('dn', $data)) { throw new Exception\LdapException(null, '\'dn\' key is missing in array.'); } if (is_string($data['dn']) || is_array($data['dn'])) { $dn = Dn::factory($data['dn']); } elseif ($data['dn'] instanceof Dn) { $dn = clone $data['dn']; } else { throw new Exception\LdapException(null, '\'dn\' key is of a wrong data type.'); } $fromDataSource = $fromDataSource === true ? true : false; $new = new self($dn, $data, $fromDataSource, null); $new->ensureRdnAttributeValues(); return $new; }