Version 1 by Thomas Schaaf
on Oct 18, 2010 15:14.

compared with
Version 2 by Thomas Schaaf
on Oct 18, 2010 15:42.

This line was removed.
This word was removed. This word was added.
This line was added.

Changes (27)

View Page History

Zend_Magic Zend_Vcard

[My Name|]
[Thomas Schaaf|]
[Sebastian Hoitz|]

1.0 - 1 January 2008: 19 October 2010: Initial Draft.

Zend_Magic is a simple component that reads my mind and generates code dynamically to do what I want.
Zend_Vcard is a class which has the capability to Generate and Parse Vcards.

* [Harry Houdini Wikipedia Entry|]
* [|]
* [Vcard Wikipedia Entry|]
* [Official specs for Vcard 2.1|]

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.
* 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* extract all the information it can get out of a given Vcard string or Vcard file.
* This component *will* generate Vcards either by the Vcard 2.1 or 3.0 standard.

* Zend_Exception
* Zend_Date
* Zend_Mime

The component is instantiated with a mind-link that ...
You can give it any Vcard and it will make a PHP Object.
You can give it a PHP Object and it will generate a Vcard.

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|]
* 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 4: Unit tests exist, work, and are checked into SVN.
* Milestone 5: Initial documentation exists.

If a milestone is already done, begin the description with "\[DONE\]", like this:
* Milestone #: \[DONE\] Unit tests ...
* Milestone 1: \[DONE\]Write unit tests.
* Milestone 2: \[DONE\]Write code.
* Milestone 3: Get feedback and get approved.
* Milestone 4: Create documentation.

* Zend_Magic_Exception Zend_Vcard
* Zend_Magic (factory class)
* Zend_Magic_MindProbe Zend_Vcard_Parser
* Zend_Magic_MindProbe_Intent Zend_Vcard_Generator
* Zend_Magic_Action
* Zend_Magic_CodeGen

Just a simple example.
$vcardString = "BEGIN:VCARD\r\nVERSION:3.0\r\nN:Lastname;Firstname\r\nFN:Firstname Lastname\r\nX-SKYPE:skypeAccount\r\nEND:VCARD";
$parser = new App_Data_Vcard_Parser($vcardString);
$vcardObject = $parser->parse();

... (see good use cases book)
$vcardObject = new App_Data_Vcard();
->setFullname("Firstname Lastname")
->addInstantmessenger('skypeAccount', App_Data_Vcard::IMSKYPE);
$outputString = App_Data_Vcard_Generator::generate($vcardObject);

class Zend_Magic_Exception Zend_Vcard_Exception extends Zend_Exception {}

class Zend_Magic Zend_Vcard {
... //constants
public function __call($function, $args){}
public function __get($name){}
public function __set($name, $value){}
public function addPhonenumber($phonenumberArray, $type = null){}
public function addEmail($emailArray, $type = null){}
public function addUrl($urlArray, $type = null){}
public function addAddress($addressArray){}
public function addInstantmessenger($imArray, $messenger = null, $type = null){}

class Zend_Vcard_Generator {
protected static function _renderName($vcardObject) {
protected static function _renderFullname($vcardObject) {
protected static function _render...($vcardObject) {
public static function generate($vcardObjects , $version = App_Data_Vcard::VERSION30)
return $vcardString;

class Zend_Vcard_Parser {
public function __construct($filename)

protected static function _parseName($vcardObject) {
protected static function _parseFullname($vcardObject) {
protected static function _parse...($vcardObject) {
public static function parse()
return $vcardObjectsArray;