Author: dr
Date: Fri Aug 10 15:29:41 2007
New Revision: 5876
Log:
- Renamed the ezcTreeNodeList->getNodes() method to the nodes property of the
same class.
- Fixed documentation - property docs should go after everything
Modified:
trunk/Tree/src/stores/xml_internal.php
trunk/Tree/src/tree.php
trunk/Tree/src/tree_node.php
trunk/Tree/src/tree_node_list.php
trunk/Tree/src/tree_node_list_iterator.php
trunk/Tree/tests/files/test_classes.php
trunk/Tree/tests/tree.php
trunk/Tree/tests/tree_node_list.php
trunk/TreeDatabaseTiein/src/backends/db_materialized_path.php
trunk/TreeDatabaseTiein/src/backends/db_nested_set.php
trunk/TreeDatabaseTiein/src/backends/db_parent_child.php
trunk/TreeDatabaseTiein/src/stores/db_external.php
trunk/TreePersistentObjectTiein/src/stores/persistent_object.php
Modified: trunk/Tree/src/stores/xml_internal.php
==============================================================================
--- trunk/Tree/src/stores/xml_internal.php [iso-8859-1] (original)
+++ trunk/Tree/src/stores/xml_internal.php [iso-8859-1] Fri Aug 10 15:29:41 2007
@@ -71,7 +71,7 @@
*/
public function fetchDataForNodes( ezcTreeNodeList $nodeList )
{
- foreach ( $nodeList->getNodes() as $node )
+ foreach ( $nodeList->nodes as $node )
{
if ( $node->dataFetched === false )
{
Modified: trunk/Tree/src/tree.php
==============================================================================
--- trunk/Tree/src/tree.php [iso-8859-1] (original)
+++ trunk/Tree/src/tree.php [iso-8859-1] Fri Aug 10 15:29:41 2007
@@ -10,12 +10,6 @@
/**
* ezcTree is an abstract class from which all the tree implementations
* inherit.
- *
- * @property-read ezcTreeXmlDataStore $store
- * The data store that is used for retrieving/storing data.
- * @property string $nodeClassName
- * Which class is used as tree node - this class *must* inherit
- * the ezcTreeNode class.
*
* Example:
* <code>
@@ -46,6 +40,12 @@
* $tree->isSiblingOf( 'Lion', 'Leopard' );
* ?>
* </code>
+ *
+ * @property-read ezcTreeXmlDataStore $store
+ * The data store that is used for retrieving/storing data.
+ * @property string $nodeClassName
+ * Which class is used as tree node - this class *must* inherit
+ * the ezcTreeNode class.
*
* @package Tree
* @version //autogentag//
Modified: trunk/Tree/src/tree_node.php
==============================================================================
--- trunk/Tree/src/tree_node.php [iso-8859-1] (original)
+++ trunk/Tree/src/tree_node.php [iso-8859-1] Fri Aug 10 15:29:41 2007
@@ -13,16 +13,6 @@
* The methods that operate on nodes (fetchChildren, fetchPath, ...,
* isSiblingOf) are all marshalled to calls on the tree (that is stored in the
* $tree private variable) itself.
- *
- * @property-read string $id The ID that uniquely identifies a node
- * @property-read ezcTree $tree The tree object that this node belongs
to
- * @property mixed $data The data belonging to a node
- * @property bool $dataFetched Whether the data for this node has been
- * fetched. Should *only* be modified by
- * data store implementations.
- * @property bool $dataStored Whether the data for this node has been
- * stored. Should *only* be modified by
- * data store implementations.
*
* Example:
* <code>
@@ -35,6 +25,16 @@
* ?>
* </code>
*
+ * @property-read string $id The ID that uniquely identifies a node
+ * @property-read ezcTree $tree The tree object that this node belongs
to
+ * @property mixed $data The data belonging to a node
+ * @property bool $dataFetched Whether the data for this node has been
+ * fetched. Should *only* be modified by
+ * data store implementations.
+ * @property bool $dataStored Whether the data for this node has been
+ * stored. Should *only* be modified by
+ * data store implementations.
+ *
* @package Tree
* @version //autogentag//
* @mainclass
@@ -153,7 +153,7 @@
public function accept( ezcTreeVisitor $visitor )
{
$visitor->visit( $this );
- foreach ( $this->fetchChildren()->getNodes() as $childNode )
+ foreach ( $this->fetchChildren()->nodes as $childNode )
{
$childNode->accept( $visitor );
}
Modified: trunk/Tree/src/tree_node_list.php
==============================================================================
--- trunk/Tree/src/tree_node_list.php [iso-8859-1] (original)
+++ trunk/Tree/src/tree_node_list.php [iso-8859-1] Fri Aug 10 15:29:41 2007
@@ -47,7 +47,10 @@
*
* @see ezcTreeNodeListIterator
*
- * @property-read string $size The number of nodes in the list.
+ * @property-read string $size
+ * The number of nodes in the list.
+ * @property-read array(string=>ezcTreeNode) $nodes
+ * The nodes belonging to this list.
*
* @package Tree
* @version //autogentag//
@@ -62,13 +65,6 @@
private $nodes;
/**
- * Holds the properties of this class.
- *
- * @var array(string=>mixed)
- */
- //private $properties = array();
-
- /**
* Constructs a new ezcTreeNode object
*/
public function __construct()
@@ -86,6 +82,9 @@
{
switch ( $name )
{
+ case 'nodes':
+ return $this->nodes;
+
case 'size':
return count( $this->nodes );
@@ -106,6 +105,7 @@
{
switch ( $name )
{
+ case 'nodes':
case 'size':
throw new ezcBasePropertyPermissionException( $name,
ezcBasePropertyPermissionException::READ );
@@ -193,16 +193,6 @@
}
/**
- * Returns all nodes in the list
- *
- * @return array(string=>ezcTreeNode)
- */
- public function getNodes()
- {
- return $this->nodes;
- }
-
- /**
* Fetches data for all nodes in the node list
*
* @param ezcTreeNodeList $nodeList
Modified: trunk/Tree/src/tree_node_list_iterator.php
==============================================================================
--- trunk/Tree/src/tree_node_list_iterator.php [iso-8859-1] (original)
+++ trunk/Tree/src/tree_node_list_iterator.php [iso-8859-1] Fri Aug 10 15:29:41
2007
@@ -86,7 +86,7 @@
{
$this->tree->store->fetchDataForNodes( $nodeList );
}
- $this->nodeList = $nodeList->getNodes();
+ $this->nodeList = $nodeList->nodes;
}
/**
Modified: trunk/Tree/tests/files/test_classes.php
==============================================================================
--- trunk/Tree/tests/files/test_classes.php [iso-8859-1] (original)
+++ trunk/Tree/tests/files/test_classes.php [iso-8859-1] Fri Aug 10 15:29:41
2007
@@ -28,7 +28,7 @@
public function fetchDataForNodes( ezcTreeNodeList $nodeList )
{
- foreach( $nodeList->getNodes() as $node )
+ foreach( $nodeList->nodes as $node )
{
$this->fetchDataForNode( $node );
}
Modified: trunk/Tree/tests/tree.php
==============================================================================
--- trunk/Tree/tests/tree.php [iso-8859-1] (original)
+++ trunk/Tree/tests/tree.php [iso-8859-1] Fri Aug 10 15:29:41 2007
@@ -878,7 +878,7 @@
'Eastern Lowland Gorilla'
);
$list = $tree->fetchSubtreeDepthFirst( 'Gorilla' );
- $nodes = $list->getNodes();
+ $nodes = $list->nodes;
self::assertSame( 7, $list->size );
self::assertSame( 7, count( $nodes ) );
@@ -911,7 +911,7 @@
'Mountain Gorilla', 'Eastern Lowland Gorilla'
);
$list = $tree->fetchSubtreeBreadthFirst( 'Gorilla' );
- $nodes = $list->getNodes();
+ $nodes = $list->nodes;
self::assertSame( 7, $list->size );
self::assertSame( 7, count( $nodes ) );
Modified: trunk/Tree/tests/tree_node_list.php
==============================================================================
--- trunk/Tree/tests/tree_node_list.php [iso-8859-1] (original)
+++ trunk/Tree/tests/tree_node_list.php [iso-8859-1] Fri Aug 10 15:29:41 2007
@@ -33,7 +33,7 @@
$node42->data = 'tweeenveertig';
$list->addNode( $node42 );
- self::assertSame( array( '5' => $node5, '42' => $node42 ),
$list->getNodes() );
+ self::assertSame( array( '5' => $node5, '42' => $node42 ),
$list->nodes );
}
public function testGetSize()
@@ -190,14 +190,14 @@
$list->addNode( $node = new ezcTreeNode( $tree, 'Taurus' ) );
$list->addNode( $node = new ezcTreeNode( $tree, 'Gemini' ) );
$list->addNode( $node = new ezcTreeNode( $tree, 'Cancer' ) );
- foreach( $list->getNodes() as $node )
+ foreach( $list->nodes as $node )
{
self::assertSame( false, $node->dataFetched );
}
$list->fetchDataForNodes();
- foreach( $list->getNodes() as $node )
+ foreach( $list->nodes as $node )
{
self::assertSame( true, $node->dataFetched );
}
Modified: trunk/TreeDatabaseTiein/src/backends/db_materialized_path.php
==============================================================================
--- trunk/TreeDatabaseTiein/src/backends/db_materialized_path.php [iso-8859-1]
(original)
+++ trunk/TreeDatabaseTiein/src/backends/db_materialized_path.php [iso-8859-1]
Fri Aug 10 15:29:41 2007
@@ -423,7 +423,7 @@
$q = $db->createDeleteQuery();
$nodeIdList = array();
- foreach ( array_keys( $list->getNodes() ) as $nodeId )
+ foreach ( array_keys( $list->nodes ) as $nodeId )
{
$nodeIdList[] = (string) $nodeId;
}
Modified: trunk/TreeDatabaseTiein/src/backends/db_nested_set.php
==============================================================================
--- trunk/TreeDatabaseTiein/src/backends/db_nested_set.php [iso-8859-1]
(original)
+++ trunk/TreeDatabaseTiein/src/backends/db_nested_set.php [iso-8859-1] Fri Aug
10 15:29:41 2007
@@ -140,7 +140,7 @@
public function getPathLength( $nodeId )
{
$path = $this->fetchPath( $nodeId );
- return count( $path->getNodes() ) - 1;
+ return count( $path->nodes ) - 1;
}
/**
@@ -410,7 +410,7 @@
// Get the nodes that are gonne be moved in the subtree
$nodeIds = array();
- foreach( $this->fetchSubtreeDepthFirst( $nodeId )->getNodes() as $node
)
+ foreach( $this->fetchSubtreeDepthFirst( $nodeId )->nodes as $node )
{
$nodeIds[] = $node->id;
}
Modified: trunk/TreeDatabaseTiein/src/backends/db_parent_child.php
==============================================================================
--- trunk/TreeDatabaseTiein/src/backends/db_parent_child.php [iso-8859-1]
(original)
+++ trunk/TreeDatabaseTiein/src/backends/db_parent_child.php [iso-8859-1] Fri
Aug 10 15:29:41 2007
@@ -393,7 +393,7 @@
$q = $db->createDeleteQuery();
$nodeIdList = array();
- foreach ( array_keys( $list->getNodes() ) as $nodeId )
+ foreach ( array_keys( $list->nodes ) as $nodeId )
{
$nodeIdList[] = (string) $nodeId;
}
Modified: trunk/TreeDatabaseTiein/src/stores/db_external.php
==============================================================================
--- trunk/TreeDatabaseTiein/src/stores/db_external.php [iso-8859-1] (original)
+++ trunk/TreeDatabaseTiein/src/stores/db_external.php [iso-8859-1] Fri Aug 10
15:29:41 2007
@@ -87,7 +87,7 @@
public function deleteDataForNodes( ezcTreeNodeList $nodeList )
{
$nodeIdsToDelete = array();
- foreach ( array_keys( $nodeList->getNodes() ) as $id )
+ foreach ( array_keys( $nodeList->nodes ) as $id )
{
$nodeIdsToDelete[] = (string) $id;
}
@@ -166,7 +166,7 @@
public function fetchDataForNodes( ezcTreeNodeList $nodeList )
{
$nodeIdsToFetch = array();
- foreach ( $nodeList->getNodes() as $node )
+ foreach ( $nodeList->nodes as $node )
{
if ( $node->dataFetched === false )
{
Modified: trunk/TreePersistentObjectTiein/src/stores/persistent_object.php
==============================================================================
--- trunk/TreePersistentObjectTiein/src/stores/persistent_object.php
[iso-8859-1] (original)
+++ trunk/TreePersistentObjectTiein/src/stores/persistent_object.php
[iso-8859-1] Fri Aug 10 15:29:41 2007
@@ -89,7 +89,7 @@
$session = $this->session;
$nodeIdsToDelete = array();
- foreach ( array_keys( $nodeList->getNodes() ) as $id )
+ foreach ( array_keys( $nodeList->nodes ) as $id )
{
$nodeIdsToDelete[] = (string) $id;
}
@@ -144,7 +144,7 @@
$session = $this->session;
$nodeIdsToFetch = array();
- foreach ( $nodeList->getNodes() as $node )
+ foreach ( $nodeList->nodes as $node )
{
if ( $node->dataFetched === false )
{
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components