mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-24 17:52:25 +01:00
40 lines
630 B
PHP
40 lines
630 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Iterator;
|
|
|
|
/**
|
|
* class File
|
|
*
|
|
* THIS EXAMPLE ALSO APPLIES THE COMPOSITE PATTERN
|
|
*/
|
|
class File
|
|
{
|
|
/**
|
|
* @var RowSet
|
|
*/
|
|
protected $rowSet;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $pathName;
|
|
|
|
/**
|
|
* @param string $pathName
|
|
*/
|
|
public function __construct($pathName)
|
|
{
|
|
$this->rowSet = new Rowset($this);
|
|
}
|
|
|
|
/**
|
|
* processes the rowSet
|
|
*/
|
|
public function process()
|
|
{
|
|
// this is the place to show how using an iterator, with foreach
|
|
// See the CardGame.php file
|
|
$this->rowSet->process();
|
|
}
|
|
}
|