File indexing completed on 2025-01-12 05:22:08
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Ldap 0017 * @subpackage Schema 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** 0024 * @see Zend_Ldap_Node_Schema_Item 0025 */ 0026 // require_once 'Zend/Ldap/Node/Schema/Item.php'; 0027 /** 0028 * @see Zend_Ldap_Node_Schema_ObjectClass_Interface 0029 */ 0030 // require_once 'Zend/Ldap/Node/Schema/ObjectClass/Interface.php'; 0031 0032 /** 0033 * Zend_Ldap_Node_Schema_ObjectClass_OpenLdap provides access to the objectClass 0034 * schema information on an OpenLDAP server. 0035 * 0036 * @category Zend 0037 * @package Zend_Ldap 0038 * @subpackage Schema 0039 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0040 * @license http://framework.zend.com/license/new-bsd New BSD License 0041 */ 0042 class Zend_Ldap_Node_Schema_ObjectClass_OpenLdap extends Zend_Ldap_Node_Schema_Item 0043 implements Zend_Ldap_Node_Schema_ObjectClass_Interface 0044 { 0045 /** 0046 * All inherited "MUST" attributes 0047 * 0048 * @var array 0049 */ 0050 protected $_inheritedMust = null; 0051 /** 0052 * All inherited "MAY" attributes 0053 * 0054 * @var array 0055 */ 0056 protected $_inheritedMay = null; 0057 0058 0059 /** 0060 * Gets the objectClass name 0061 * 0062 * @return string 0063 */ 0064 public function getName() 0065 { 0066 return $this->name; 0067 } 0068 0069 /** 0070 * Gets the objectClass OID 0071 * 0072 * @return string 0073 */ 0074 public function getOid() 0075 { 0076 return $this->oid; 0077 } 0078 0079 /** 0080 * Gets the attributes that this objectClass must contain 0081 * 0082 * @return array 0083 */ 0084 public function getMustContain() 0085 { 0086 if ($this->_inheritedMust === null) { 0087 $this->_resolveInheritance(); 0088 } 0089 return $this->_inheritedMust; 0090 } 0091 0092 /** 0093 * Gets the attributes that this objectClass may contain 0094 * 0095 * @return array 0096 */ 0097 public function getMayContain() 0098 { 0099 if ($this->_inheritedMay === null) { 0100 $this->_resolveInheritance(); 0101 } 0102 return $this->_inheritedMay; 0103 } 0104 0105 /** 0106 * Resolves the inheritance tree 0107 * 0108 * @return void 0109 */ 0110 protected function _resolveInheritance() 0111 { 0112 $must = $this->must; 0113 $may = $this->may; 0114 foreach ($this->getParents() as $p) { 0115 $must = array_merge($must, $p->getMustContain()); 0116 $may = array_merge($may, $p->getMayContain()); 0117 } 0118 $must = array_unique($must); 0119 $may = array_unique($may); 0120 $may = array_diff($may, $must); 0121 sort($must, SORT_STRING); 0122 sort($may, SORT_STRING); 0123 $this->_inheritedMust = $must; 0124 $this->_inheritedMay = $may; 0125 } 0126 0127 /** 0128 * Gets the objectClass description 0129 * 0130 * @return string 0131 */ 0132 public function getDescription() 0133 { 0134 return $this->desc; 0135 } 0136 0137 /** 0138 * Gets the objectClass type 0139 * 0140 * @return integer 0141 */ 0142 public function getType() 0143 { 0144 if ($this->structural) { 0145 return Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_STRUCTURAL; 0146 } else if ($this->abstract) { 0147 return Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_ABSTRACT; 0148 } else if ($this->auxiliary) { 0149 return Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_AUXILIARY; 0150 } else { 0151 return Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_UNKNOWN; 0152 } 0153 } 0154 0155 /** 0156 * Returns the parent objectClasses of this class. 0157 * This includes structural, abstract and auxiliary objectClasses 0158 * 0159 * @return array 0160 */ 0161 public function getParentClasses() 0162 { 0163 return $this->sup; 0164 } 0165 0166 /** 0167 * Returns the parent object classes in the inhertitance tree if one exists 0168 * 0169 * @return array of Zend_Ldap_Node_Schema_ObjectClass_OpenLdap 0170 */ 0171 public function getParents() 0172 { 0173 return $this->_parents; 0174 } 0175 }