Version 1 by Thomas Weidner
on May 14, 2010 00:33.

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (35)

View Page History
{info:title=New Proposal Template}
This page has been created from a template that uses "zones." To proceed:

# Edit the page
# Replace sample content within each zone-data tag with your own content
# Remove this notice
# Save the page
# When you are ready for community review, move this page to the [Ready for Review] section on the edit page.

{note:title=No placeholders allowed!}
Please do not create placeholders. Wait until you have sufficient content to replace all sample data in the proposal template before creating your proposal document.
{note}
{info}

{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Magic
Zend_Filter_StringAppend & Zend_Filter_StringPrepend
{zone-data}

{zone-data:proposer-list}
[My Name|mailto:noreply@zend.com]
[~thomas]
{zone-data}


{zone-data:revision}
1.0 - 1 January 2008: Initial Draft.
1.0 - 14 May 2010: Initial
{zone-data}

{zone-data:overview}
Zend_Magic is a simple component that reads my mind and generates code dynamically to do what I want.
Zend_Filter_StringAppend and Zend_Filter_StringPrepend are filters which allow to append or prepend a string with a certain content to a given string.
{zone-data}

{zone-data:references}
* [Harry Houdini Wikipedia Entry|http://en.wikipedia.org/wiki/Harry_Houdini]
* [MagicTricks.com|http://www.magictricks.com/]
{zone-data}

{zone-data:requirements}
Most requirements take the form of "foo will do ...." or "foo will not support ...", although different words and sentence structure might be used. Adding functionality to your proposal is requirements creep (bad), unless listed below. Discuss major changes with your team first, and then open a "feature improvement" issue against this component.

* This component *will* correctly reads a developers mind for intent and generate the right configuration file.
* The generated config file *will not* support XML, but will provide an extension point in the API.
* This component *will* use no more memory than twice the size of all data it contains.
* This component *will* include a factory method. append and prepend strings.
* This component *will not* allow subclassing. (i.e. when reviewed, we expect to see "final" keyword in code)
* This component *will* only generate data exports strictly complying with RFC 12345.
* This component *will* validate input data against formats supported by ZF component Foo.
* This component *will not* save any data using Zend_Cache or the filesystem. All transient data *will be* saved using Zend_Session.
* This component *will not* work on resources like files.
{zone-data}

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

{zone-data:operation}
The component is instantiated with a mind-link that ...
Zend_Filter_StringAppend can append a string to a string. It can be used to detect if the given string is already appended (per option). In this case, if set, no string will be appended. Zend_Filter_StringPrepend works reverse.
{zone-data}

{zone-data:milestones}
Describe some intermediate state of this component in terms of design notes, additional material added to this page, and / code. Note any significant dependencies here, such as, "Milestone #3 can not be completed until feature Foo has been added to ZF component XYZ." Milestones will be required for acceptance of future proposals. They are not hard, and many times you will only need to think of the first three below.
* Milestone 1: [design notes will be published here|http://framework.zend.com/wiki/x/sg]
* Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, ...
* Milestone 3: Working prototype checked into the incubator supporting use cases #3 and #4.
* Milestone 1: \[DONE\] Proposal finished
* Milestone 2: Proposal accepted
* Milestone 3: Working implementation
* Milestone 4: Unit tests exist, work, and are checked into SVN.
* Milestone 5: Initial documentation exists. Documentation

If a milestone is already done, begin the description with "\[DONE\]", like this:
* Milestone #: \[DONE\] Unit tests ...
* Milestone 6: Moved to core
{zone-data}

{zone-data:class-list}
* Zend_Magic_Exception Zend_Filter_StringAppend
* Zend_Magic (factory class)
* Zend_Magic_MindProbe Zend_Filter_StringPrepend
* Zend_Magic_MindProbe_Intent
* Zend_Magic_Action
* Zend_Magic_CodeGen
{zone-data}

{zone-data:use-cases}
||UC-01||
Prepend a string
{code}
$filter = new Zend_Filter_StringPrepend('http://');
{code}
INPUT: "www.example.com"
OUTPUT: "http://www.example.com"

... (see good use cases book)
||UC-02||
Prepend a string but only if it does not already exist
{code}
$filter = new Zend_Filter_StringPrepend(array('content' => 'http://', 'single' => true);
{code}
INPUT: "http://www.example.com"
OUTPUT: "http://www.example.com"

||UC-03||
Append a string but only if a collection of strings does not already exist
{code}
$filter = new Zend_Filter_StringAppend(array('content' => '.com', 'single' => array('.com', '.gov', '.net'));
{code}
INPUT: "http://www.example.gov"
OUTPUT: "http://www.example.gov"

INPUT: "http://www.example"
OUTPUT: "http://www.example.com"
{zone-data}

{zone-data:skeletons}
{code}
class Zend_Magic_Exception extends Zend_Exception {}
class Zend_Filter_Append{
public function __construct();
public function getContent();
public function setContent($content);
public function getSingle();
public function setSingle($single);
public function filter($filter);
}

class Zend_Magic {
class Zend_Filter_Prepend{
public function __construct();
public function getContent();
public function setContent($content);
public function getSingle();
public function setSingle($single);
public function filter($filter);
... }
{code}
{zone-data}