| 1 |
|
<?php |
| 2 |
|
|
| 3 |
|
/** |
| 4 |
|
* Xyster Framework |
| 5 |
|
* |
| 6 |
|
* This source file is subject to the new BSD license that is bundled |
| 7 |
|
* with this package in the file LICENSE.txt. |
| 8 |
|
* It is also available through the world-wide-web at this URL: |
| 9 |
|
* http://www.opensource.org/licenses/bsd-license.php |
| 10 |
|
* |
| 11 |
|
* @category Xyster |
| 12 |
|
* @package Xyster_Collection |
| 13 |
|
* @copyright Copyright LibreWorks, LLC (http://libreworks.net) |
| 14 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 15 |
|
*/ |
| 16 |
|
namespace Xyster\Collection; |
| 17 |
|
/** |
| 18 |
|
* Abstract class for no-duplicate collections |
| 19 |
|
* |
| 20 |
|
* @category Xyster |
| 21 |
|
* @package Xyster_Collection |
| 22 |
|
* @copyright Copyright LibreWorks, LLC (http://libreworks.net) |
| 23 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 24 |
|
*/ |
| 25 |
|
abstract class AbstractSet extends AbstractCollection implements ISet |
| 26 |
|
{ |
| 27 |
|
/** |
| 28 |
|
* Adds an item to the set |
| 29 |
|
* |
| 30 |
|
* @param mixed $item The item to add |
| 31 |
|
* @return boolean Whether the set changed as a result of this method |
| 32 |
|
*/ |
| 33 |
|
public function add($item) |
| 34 |
|
{ |
| 35 |
93 |
if (!$this->contains($item)) { |
| 36 |
93 |
return parent::add($item); |
| 37 |
|
} |
| 38 |
2 |
return false; |
| 39 |
|
} |
| 40 |
1 |
} |