source: trunk/library/Zend/Ldap/Node/Schema/AttributeType/OpenLdap.php @ 5146

Revision 5146, 3.2 KB checked in by wmerlotto, 12 years ago (diff)

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus. Library: adicionando arquivos.

Line 
1<?php
2/**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category   Zend
16 * @package    Zend_Ldap
17 * @subpackage Schema
18 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license    http://framework.zend.com/license/new-bsd     New BSD License
20 * @version    $Id: OpenLdap.php 20096 2010-01-06 02:05:09Z bkarwin $
21 */
22
23/**
24 * @see Zend_Ldap_Node_Schema_Item
25 */
26require_once 'Zend/Ldap/Node/Schema/Item.php';
27/**
28 * @see Zend_Ldap_Node_Schema_AttributeType_Interface
29 */
30require_once 'Zend/Ldap/Node/Schema/AttributeType/Interface.php';
31
32/**
33 * Zend_Ldap_Node_Schema_AttributeType_OpenLdap provides access to the attribute type
34 * schema information on an OpenLDAP server.
35 *
36 * @category   Zend
37 * @package    Zend_Ldap
38 * @subpackage Schema
39 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
40 * @license    http://framework.zend.com/license/new-bsd     New BSD License
41 */
42class Zend_Ldap_Node_Schema_AttributeType_OpenLdap extends Zend_Ldap_Node_Schema_Item
43    implements Zend_Ldap_Node_Schema_AttributeType_Interface
44{
45    /**
46     * Gets the attribute name
47     *
48     * @return string
49     */
50    public function getName()
51    {
52        return $this->name;
53    }
54
55    /**
56     * Gets the attribute OID
57     *
58     * @return string
59     */
60    public function getOid()
61    {
62        return $this->oid;
63    }
64
65    /**
66     * Gets the attribute syntax
67     *
68     * @return string
69     */
70    public function getSyntax()
71    {
72        if ($this->syntax === null) {
73            $parent = $this->getParent();
74            if ($parent === null) return null;
75            else return $parent->getSyntax();
76        } else {
77            return $this->syntax;
78        }
79    }
80
81    /**
82     * Gets the attribute maximum length
83     *
84     * @return int|null
85     */
86    public function getMaxLength()
87    {
88        $maxLength = $this->{'max-length'};
89        if ($maxLength === null) {
90            $parent = $this->getParent();
91            if ($parent === null) return null;
92            else return $parent->getMaxLength();
93        } else {
94            return (int)$maxLength;
95        }
96    }
97
98    /**
99     * Returns if the attribute is single-valued.
100     *
101     * @return boolean
102     */
103    public function isSingleValued()
104    {
105        return $this->{'single-value'};
106    }
107
108    /**
109     * Gets the attribute description
110     *
111     * @return string
112     */
113    public function getDescription()
114    {
115        return $this->desc;
116    }
117
118    /**
119     * Returns the parent attribute type in the inhertitance tree if one exists
120     *
121     * @return Zend_Ldap_Node_Schema_AttributeType_OpenLdap|null
122     */
123    public function getParent()
124    {
125        if (count($this->_parents) === 1) {
126            return $this->_parents[0];
127        }
128    }
129}
Note: See TracBrowser for help on using the repository browser.