http://phing.info/

Source Code Coverage

Designed for use with PHPUnit2, Xdebug and Phing.

Methods: 2 LOC: 60 Statements: 6

Source file Statements Methods Total coverage
Set.php 100.0% 100.0% 100.0%
 
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 (c) 2007-2008 Irrational Logic (http://irrationallogic.net)
13
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
14
 */
15
/**
16
 * @see Xyster_Collection
17
 */
18 1
require_once 'Xyster/Collection.php';
19
/**
20
 * @see Xyster_Collection_Set_Interface
21
 */
22 1
require_once 'Xyster/Collection/Set/Interface.php';
23
/**
24
 * Simple implementation of the no-duplicate collection
25
 *
26
 * @category  Xyster
27
 * @package   Xyster_Collection
28
 * @copyright Copyright (c) 2007-2008 Irrational Logic (http://irrationallogic.net)
29
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
30
 */
31
class Xyster_Collection_Set extends Xyster_Collection implements Xyster_Collection_Set_Interface
32
{
33
	/**
34
	 * Creates a new set
35
	 *
36
	 * @param Xyster_Collection_Interface $set The values to add to this set
37
	 * @param boolean $immutable Whether the set can be changed
38
	 */
39
	public function __construct( Xyster_Collection_Interface $c = null, $immutable = false )
40
	{
41 319
		parent::__construct($c, $immutable);
42
	}
43
44
	/**
45
	 * Adds an item to the set
46
	 *
47
	 * This collection doesn't accept duplicate values, and will return false
48
	 * if the provided value is already in the collection.
49
	 *
50
	 * @param mixed $item The item to add
51
	 * @return boolean Whether the set changed as a result of this method
52
	 * @throws Xyster_Collection_Exception if the collection cannot be modified
53
	 */
54
	public function add( $item )
55
	{
56 101
		if ( !$this->contains($item) ) {
57 101
			return parent::add($item);
58 1
		} return false;
59
	}
60
}


Report generated at 2008-01-20T12:13:39-05:00