Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Array Component Proposal

Proposed Component Name Zend_Array
Developer Notes
Proposers Nigel Chapman
Zend Liaison TBD
Revision 1.0 - 03 February 2010: Initial Draft. (wiki revision: 8)

Table of Contents

1. Overview

Zend_Array implements chainable array operations that work well with closures. Working Demo.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will take input in a variety of forms having logical array representations (takeCsv, takeFileLines, takeXml) and offer analogous output (toCsv, joinLines, toXml).
  • This component will function principally as a wrapper for PHP's existing array functions.
  • This component will utilize specialized subclasses.

4. Dependencies on Other Framework Components

  • Zend_Loader

5. Theory of Operation

A Zend_Array operation has three parts:

  • An factory method, beginning with 'take', which creates a Zend_Array object
  • a series of chained processors using methods of the Zend_Array objects,
  • and a terminator, which returns something other than a Zend_Array object.

6. Milestones / Tasks

There is so much scope for extension that deciding on the core functionality will be the main concern. Subclasses can be separate proposals.

  • Milestone 1: [DONE] Publish a proof-of-concept page to solicit feedback; include basic test suite and example of extension class.
  • Milestone 2: Accept submissions on the core Zend_Array set; the lists of Ruby and jQuery array methods (see References) will provide a useful catalogue of possibilities.
  • Milestone 3: Express the desired feature set in a list of Use Cases (this could be LENGTHY).
  • Milestone 3: Check in a working prototype implementing these use cases.
  • Milestone 4: Unit tests exist, work, and are checked into SVN.
  • Milestone 5: Initial documentation exists.

7. Class Index

  • Zend_Array
  • Zend_Array_Exception

8. Use Cases


(See the class skeletons below to get a sense for how many use cases there are.)

9. Class Skeletons



Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 05, 2010

    <p>With all due respect, but I wouldn't be in favour of a component that creates a OO-API around a couple procedural userland methods. At least not in core. And if people want this badly, they can go crazy in ZendX_. <ac:emoticon ac:name="wink" /></p>

    <p>Bottom line, if this kind of thing is really needed, it would be a feature request/patch to PHP's ext/array. Because otherwise Zend_String will be next. <ac:emoticon ac:name="wink" /></p>

    <p>Maybe you could demo your take*() methods. I've never seen this pattern before and I can't decide if they are really object factories, setters or getters. And even if they are factories, what they are supposed to do.</p>

    <p>Your component still includes interesting features, maybe you can refactor them into Zend_Array_Tree, or Zend_Html, I'm not sure about those. Maybe you can add them to existing components as well. In the end I'm all for separation of concerns and I think this component tries to satisfy too many.</p>

  2. Feb 07, 2010

    <p>Hi Nigel,<br />
    i think this is a good proposal. But i think  there are some strange methods on this class. The class try to solve may problems of string substitution, creates HTML tables and other things, which is not "typical" for an array class on the core side. Try to recreate your proposal to a "suite" of many proposals (make proposals on other classes by contacting owner/maintainer).</p>

  3. Feb 16, 2010

    <p>Hi Nigel,</p>

    <p>There's quite an impressive amount of functionality in this. Indeed, this would IMHO make working with arrays a lot more convenient than the traditional procedural PHP ways. There's enough here that the name "Zend_Array" implies a deceptively narrow scope. I only took a quick look at the demo page (again, impressive!) but I do get the feeling there might be a brewing cohesion problem, if all of this various and sundry functionality lives in a single class.</p>

  4. Feb 05, 2011

    <p>Archiving this proposal, feel free to recover it when you want to work on it again. For more details see <a href="">this email</a>.</p>