View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Directory and Zend_File
{zone-data}

{zone-data:proposer-list}
[Steven Brown|mailto:steven@yewchube.com]
{zone-data}

{zone-data:liaison}
TBD
{zone-data}

{zone-data:revision}
1.0 - 16 August 2009: Initial Draft.
{zone-data}

{zone-data:overview}
Zend_Directory provides object-oriented functionality for working with filesystem directories. Zend_File does the same for files. At their core they are wrappers for the existing PHP functions, however they can offer more complex functionality.
{zone-data}

{zone-data:references}
* [PHP Filesystem Functions|http://au.php.net/manual/en/ref.filesystem.php]
{zone-data}

{zone-data:requirements}
* This component *will* provide filesystem functionality
{zone-data}

{zone-data:dependencies}
* Zend_Exception
{zone-data}

{zone-data:operation}
The component will provide wrappers for existing PHP functions where possible.
{zone-data}

{zone-data:milestones}
* Milestone 1: Design notes will be published here
* Milestone 2: Working prototype checked into the incubator supporting use cases
* Milestone 3: Unit tests exist, work, and are checked into SVN.
* Milestone 4: Initial documentation exists.
{zone-data}

{zone-data:class-list}
* Zend_Directory
* Zend_Directory_Iterator
* Zend_File
{zone-data}

{zone-data:use-cases}
{composition-setup}

||UC-01||

... (see good use cases book)
{zone-data}

{zone-data:skeletons}
{deck:id=Skeletons}

{card:label=Zend_Directory}
{code}
class Zend_Directory
{
/**
* The directory path
*/
public $path = null;

public $name = null;

/**
* The directory pointer
*/
protected $_pointer = null;

/**
* The contents of the directory
*/
protected $_contents = null;

/**
* The files of the directory
*/
protected $_files = null;

/**
* The folders of the directory
*/
protected $_directories = null;

/**
* Instantiate
*/
public function __construct($path) {}

/**
* Captures properties contents, files and directories for iterating
*/
public function __get($name) {}

public function isDirectory() {}

public function isFile() {}

public function getDirectory($name) {}
}
{code}
{card}

{card:label=Zend_Directory_Iterator}
{code}
class Zend_Directory_Iterator implements SeekableIterator, Countable, ArrayAccess
{
/**
* The directory
*/
protected $_dir = null;

/**
* The converted files and folders
*/
protected $_rows = array();

/**
* The raw files and folders
*/
protected $_data = array();

/**
* The number of rows
*/
protected $_count = 0;

/**
* The iterator pointer
*/
protected $_pointer = 0;

protected $_filter = 3;

const FILTER_FILES = 1;

const FILTER_DIRECTORIES = 2;

const FILTER_ALL = 3;

/**
* Instantiate
*/
public function __construct($dir, $filter = self::FILTER_ALL) {}

/**
* Rewind the pointer, required by Iterator
*/
public function rewind() {}

/**
* Get the current row, required by iterator
*/
public function current() {}

/**
* Return the key of the current row, required by iterator
*/
public function key() {}

/**
* Continue the pointer to the next row, required by iterator
*/
public function next() {}

/**
* Whether or not there is another row, required by iterator
*/
public function valid() {}

/**
* Return the number of rows, required by countable
*/
public function count() {}

public function seek($position) {}

public function offsetExists($offset) {}

public function offsetGet($offset) {}

public function offsetSet($offset, $value) {}

public function offsetUnset($offset) {}

public function getRow($position, $seek = false) {}
}
{code}
{card}

{card:label=Zend_File}
{code}
class Zend_File
{
/**
* The directory path
*/
public $path = null;

public $directory = null;

public $name = null;

public $extension = null;

/**
* Instantiate
*/
public function __construct($path) {}

public function __toString() {}

public function isDirectory() {}

public function isFile() {}

public function delete() {}
}
{code}
{card}

{deck}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>