Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / libraries / properties / options / OptionsPropertyGroup.class.php
blobebff9b321b9d0f300f2bcdad7c8771ae85edc817
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Superclass for the Property Group classes.
6 * @package PhpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /* This class extends the OptionsPropertyItem class */
13 require_once 'OptionsPropertyItem.class.php';
15 /**
16 * Parents group property items and provides methods to manage groups of
17 * properties.
19 * @todo modify descriptions if needed, when the options are integrated
20 * @package PhpMyAdmin
22 abstract class OptionsPropertyGroup extends OptionsPropertyItem
24 /**
25 * Holds a group of properties (OptionsPropertyItem instances)
27 * @var array
29 private $_properties;
31 /**
32 * Adds a property to the group of properties
34 * @param OptionsPropertyItem $property the property instance to be added
35 * to the group
37 * @return void
39 public function addProperty($property)
41 if (! $this->getProperties() == null
42 && in_array($property, $this->getProperties(), true)
43 ) {
44 return;
46 $this->_properties [] = $property;
49 /**
50 * Removes a property from the group of properties
52 * @param OptionsPropertyItem $property the property instance to be removed
53 * from the group
55 * @return void
57 public function removeProperty($property)
59 $this->_properties = array_udiff(
60 $this->getProperties(),
61 array($property),
62 // for PHP 5.2 compability
63 create_function(
64 '$a, $b',
65 'return ($a === $b ) ? 0 : 1'
71 /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
74 /**
75 * Gets the instance of the class
77 * @return array
79 public function getGroup()
81 return $this;
84 /**
85 * Gets the group of properties
87 * @return array
89 public function getProperties()
91 return $this->_properties;
94 /**
95 * Gets the number of properties
97 * @return int
99 public function getNrOfProperties()
101 return count($this->_properties);