Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- class StringArray Extends ArrayList implements System\iDataTypeString{ use System\tDataTypeStringDelegate; }
- class DecimalArray Extends ArrayList implements System\iDataTypeDecimal{ use System\tDataTypeDecimalDelegate; }
- $array = (new StringArray())->push('The')->push('quick')->push('brown')->push('fox')->toUpper();
- var_dump($array);
- ?>
- object(localhost\illiFW\dev\StringArray)#2 (1) {
- ["__value":protected]=>
- object(ILLI\System\DataTypeStringArray)#4 (8) {
- ["__offsets":"ILLI\System\DataTypeArray":private]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- ["__indexes":"ILLI\System\DataTypeArray":private]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- ["__itIndex":"ILLI\System\DataTypeArray":private]=>
- int(4)
- ["__lastOffsetUpdate":"ILLI\System\DataTypeArray":private]=>
- NULL
- ["__lastOffsetInsert":"ILLI\System\DataTypeArray":private]=>
- NULL
- ["__BITS":"ILLI\System\DataTypeArray":private]=>
- object(ILLI\System\Bits)#3 (1) {
- ["__bits":"ILLI\System\Bits":private]=>
- int(0)
- }
- ["__value":protected]=>
- array(4) {
- [0]=>
- object(ILLI\System\DataTypeString)#6 (5) {
- ["__isMultibyte":"ILLI\System\DataTypeString":private]=>
- bool(false)
- ["__width":"ILLI\System\DataTypeString":private]=>
- NULL
- ["__length":"ILLI\System\DataTypeString":private]=>
- NULL
- ["__value":protected]=>
- string(3) "THE"
- ["__initialValue":"ILLI\System\DataType":private]=>
- string(3) "The"
- }
- [1]=>
- object(ILLI\System\DataTypeString)#7 (5) {
- ["__isMultibyte":"ILLI\System\DataTypeString":private]=>
- bool(false)
- ["__width":"ILLI\System\DataTypeString":private]=>
- NULL
- ["__length":"ILLI\System\DataTypeString":private]=>
- NULL
- ["__value":protected]=>
- string(5) "QUICK"
- ["__initialValue":"ILLI\System\DataType":private]=>
- string(5) "quick"
- }
- [2]=>
- object(ILLI\System\DataTypeString)#8 (5) {
- ["__isMultibyte":"ILLI\System\DataTypeString":private]=>
- bool(false)
- ["__width":"ILLI\System\DataTypeString":private]=>
- NULL
- ["__length":"ILLI\System\DataTypeString":private]=>
- NULL
- ["__value":protected]=>
- string(5) "BROWN"
- ["__initialValue":"ILLI\System\DataType":private]=>
- string(5) "brown"
- }
- [3]=>
- object(ILLI\System\DataTypeString)#9 (5) {
- ["__isMultibyte":"ILLI\System\DataTypeString":private]=>
- bool(false)
- ["__width":"ILLI\System\DataTypeString":private]=>
- NULL
- ["__length":"ILLI\System\DataTypeString":private]=>
- NULL
- ["__value":protected]=>
- string(3) "FOX"
- ["__initialValue":"ILLI\System\DataType":private]=>
- string(3) "fox"
- }
- }
- ["__initialValue":"ILLI\System\DataType":private]=>
- array(0) {
- }
- }
- }
- <?PHP
- /**
- * ILLI
- *
- * @category ILLI_System_Collection
- * @package ILLI
- * @subpackage SystemCollection
- * @link http://illi.be
- * @license http://l.illi.be
- * @copyright ILLI Conference
- */
- NAMESPACE ILLI\System\Collection;
- USE ILLI\System as System;
- /**
- * ILLI System Collection ArrayList
- *
- * @category ILLI_System_Collection
- * @package ILLI
- * @subpackage SystemCollection
- * @namespace ILLI\System\Collection
- * @link http://illi.be
- * @license http://l.illi.be
- * @copyright ILLI Conference
- * @since 2.0.0-1
- * @version 2.0.0-1
- * @abstract
- */
- CLASS ArrayList IMPLEMENTS System\iSerializable, System\iIterator
- {
- USE System\tSerializable;
- /**
- * DataTypeArray prototype
- */
- protected $__value = NULL;
- private static $__serializable =
- [
- '__value'
- ];
- public function __construct($array = [], System\Bits $BITS = NULL)
- {
- switch(TRUE):
- case ($this instanceOf System\iDataTypeChar):
- $this->__value = new System\DataTypeCharArray($array, $BITS);
- break;
- case ($this instanceOf System\iDataTypeDecimal):
- $this->__value = new System\DataTypeDecimalArray($array, $BITS);
- break;
- case ($this instanceOf System\iDataTypeString):
- $this->__value = new System\DataTypeStringArray($array, $BITS);
- break;
- default:
- $this->__value = new System\DataTypeArray($array, $BITS);
- endswitch;
- self::$__tSerializableProperties = self::$__serializable;
- }
- public function clear()
- {
- $this->__value->clear();
- return $this;
- }
- public function pop()
- {
- return $this->__value->pop();
- }
- public function push($value)
- {
- $this->__value->push($value);
- return $this;
- }
- public function current()
- {
- return $this->__value->current();
- }
- public function next()
- {
- $this->__value->next();
- return $this;
- }
- public function key()
- {
- return $this->__value->key();
- }
- public function valid()
- {
- return $this->__value->valid();
- }
- public function rewind()
- {
- $this->__value->rewind();
- return $this;
- }
- public function peek()
- {
- return $this->__value->peekValueByOffset($this->__value->lastOffset());
- }
- }
- CLASS Queue EXTENDS ArrayList
- {
- public function __construct($array = [])
- {
- parent::__construct($array, new System\Bits(System\DataTypeArray::IT_MODE_FIFO));
- }
- public function peek()
- {
- return $this->__value->peekValueByOffset($this->__value->firstOffset());
- }
- public function pop()
- {
- return $this->__value->shift();
- }
- }
- CLASS Stack EXTENDS ArrayList
- {
- public function __construct($array = [])
- {
- parent::__construct($array, new System\Bits(System\DataTypeArray::IT_MODE_LIFO));
- }
- public function rewind()
- {
- $this->__value->setIteratorIndex($this->__value->lastIndex());
- return $this;
- }
- public function next()
- {
- $this->__value->prev();
- return $this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement