| 1 |
|
<?php |
| 2 |
|
/** |
| 3 |
|
* Xyster Framework |
| 4 |
|
* |
| 5 |
|
* This source file is subject to the new BSD license that is bundled |
| 6 |
|
* with this package in the file LICENSE.txt. |
| 7 |
|
* It is also available through the world-wide-web at this URL: |
| 8 |
|
* http://www.opensource.org/licenses/bsd-license.php |
| 9 |
|
* |
| 10 |
|
* @category Xyster |
| 11 |
|
* @package Xyster_Collection |
| 12 |
|
* @copyright Copyright LibreWorks, LLC (http://libreworks.net) |
| 13 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 14 |
|
*/ |
| 15 |
|
namespace Xyster\Collection; |
| 16 |
|
/** |
| 17 |
|
* A collection that cannot be changed |
| 18 |
|
* |
| 19 |
|
* @category Xyster |
| 20 |
|
* @package Xyster_Collection |
| 21 |
|
* @copyright Copyright LibreWorks, LLC (http://libreworks.net) |
| 22 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 23 |
|
*/ |
| 24 |
|
class FixedCollection extends Delegate |
| 25 |
1 |
{ |
| 26 |
|
/** |
| 27 |
|
* Adds an item to the collection |
| 28 |
|
* |
| 29 |
|
* @param mixed $item The item to add |
| 30 |
|
* @return boolean Whether the collection changed as a result of this method |
| 31 |
|
* @throws UnmodifiableException if the collection cannot be modified |
| 32 |
|
*/ |
| 33 |
|
public function add( $item ) |
| 34 |
|
{ |
| 35 |
1 |
throw new UnmodifiableException("This collection cannot be changed"); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
/** |
| 39 |
|
* Removes all items from the collection |
| 40 |
|
* |
| 41 |
|
* @throws UnmodifiableException if the collection cannot be modified |
| 42 |
|
*/ |
| 43 |
|
public function clear() |
| 44 |
|
{ |
| 45 |
4 |
throw new UnmodifiableException("This collection cannot be changed"); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
/** |
| 49 |
|
* Removes the specified value from the collection |
| 50 |
|
* |
| 51 |
|
* @param mixed $item The value to remove |
| 52 |
|
* @return boolean If the value was in the collection |
| 53 |
|
* @throws UnmodifiableException if the collection cannot be modified |
| 54 |
|
*/ |
| 55 |
|
public function remove( $item ) |
| 56 |
|
{ |
| 57 |
1 |
throw new UnmodifiableException("This collection cannot be changed"); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
/** |
| 61 |
|
* Removes all of the specified values from the collection |
| 62 |
|
* |
| 63 |
|
* @param ICollection $values The values to remove |
| 64 |
|
* @return boolean Whether the collection changed as a result of this method |
| 65 |
|
* @throws UnmodifiableException if the collection cannot be modified |
| 66 |
|
*/ |
| 67 |
|
public function removeAll( ICollection $values ) |
| 68 |
|
{ |
| 69 |
1 |
throw new UnmodifiableException("This collection cannot be changed"); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
/** |
| 73 |
|
* Removes all values from the collection except for the ones specified |
| 74 |
|
* |
| 75 |
|
* @param ICollection $values The values to keep |
| 76 |
|
* @return boolean Whether the collection changed as a result of this method |
| 77 |
|
* @throws UnmodifiableException if the collection cannot be modified |
| 78 |
|
*/ |
| 79 |
|
public function retainAll( ICollection $values ) |
| 80 |
|
{ |
| 81 |
1 |
throw new UnmodifiableException("This collection cannot be changed"); |
| 82 |
|
} |
| 83 |
1 |
} |