compared with
Version 5 by Jeannie BOFFEL
on Dec 08, 2010 02:29.

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

Changes (12)

View Page History
{zone-data:use-cases}

Use case in future.

||UC-01||

...
Definition of one simple type and call its extended test method.
{code}
... /**
* @xsd simpleType
* @xsd restriction array('base' => 'xsd:string')
*/
class FilterTypeString extends SimpleTypeValuesValidator
{
/**
* @xsd enumeration array('value' => 'test1')
* @xsd enumeration array('value' => 'test2')
* @xsd enumeration array('value' => 'test3')
*/
public $restriction;
}

var_dump(FilterTypeString::getInstance()->test('test1'));
var_dump(FilterTypeString::getInstance()->test('anything'));
{code}
Output should be like:
boolean true
boolean false

||UC-02||

...
Again with an union of simple type.
{code}
... /**
* @xsd simpleType
* @xsd restriction array('base' => 'xsd:string')
*/
class FilterTypeString extends SimpleTypeValuesValidator
{
/**
* @xsd enumeration array('value' => 'test1')
* @xsd enumeration array('value' => 'test2')
* @xsd enumeration array('value' => 'test3')
*/
public $restriction;
}
/**
* @xsd simpleType
* @xsd restriction array('base' => 'xsd:integer')
*/
class FilterTypeInteger extends SimpleTypeValuesValidator
{
/**
* @xsd enumeration array('value' => '1')
* @xsd enumeration array('value' => '2')
* @xsd enumeration array('value' => '3')
*/
public $restriction;
}
/**
* @xsd simpleType
* @xsd union
*/
class FilterType extends SimpleTypeValuesValidator
{
/**
* @xsd simpleType FilterTypeString
* @xsd simpleType FilterTypeInteger
*/
public $union;
}

var_dump(FilterType::getInstance()->test(1));
var_dump(FilterType::getInstance()->test('test1'));
var_dump(FilterType::getInstance()->test('anything'));
{code}
Output should be like:
boolean true
boolean true
boolean false

||UC-03||

Again with a list of simple type (using previous union definition too).
{code}
/**
* @xsd simpleType
* @xsd list
*/
class FilterListType extends SimpleTypeValuesValidator
{
/**
* @xsd itemType FilterType
*/
public $list;
}

var_dump(FilterTypeString::getInstance()->test('test1 1
test2'));
var_dump(FilterTypeString::getInstance()->test('anything else'));
{code}
Output should be like:
boolean true
boolean false

{zone-data}