File modules/dsl/standard/Data.class.php
Last commit: Fri Jul 1 19:30:30 2022 +0200 Jan Dankert New: Data Object for accessing data trees
1 <?php 2 namespace dsl\standard; 3 4 use dsl\context\BaseScriptableObject; 5 6 class Data extends BaseScriptableObject 7 { 8 /** 9 * @var mixed|null 10 */ 11 private $value; 12 13 /** 14 * StandardArray constructor. 15 * @param $value 16 */ 17 public function __construct($value=null) 18 { 19 $this->value = $value; 20 } 21 22 public function getData() { 23 24 return array_map( 25 26 function( $val ) { 27 if ( is_array($val) ) 28 return new Data( $val ); 29 else 30 return $val; 31 } 32 ,$this->value); 33 } 34 35 36 public function __toString() 37 { 38 return '['.implode(',',array_map( 39 40 function( $val ) { 41 if ( is_object($val) ) 42 return (new Data( get_object_vars($val) ))->__toString(); 43 if ( is_array($val) ) 44 return (new Data( $val ))->__toString(); 45 else 46 return $val; 47 } 48 ,$this->value)).']'; 49 } 50 }
Downloadmodules/dsl/standard/Data.class.php
History Fri, 1 Jul 2022 19:30:30 +0200 Jan Dankert New: Data Object for accessing data trees