Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
BaseArray.php
Go to the documentation of this file.
1<?php
2
4
6
7abstract class BaseArray {
8 protected $messages=[];
9
10 public function hasMessages(){
11 return sizeof($this->messages)>0;
12 }
13
17 public function getMessages() {
18 return $this->messages;
19 }
20
21 protected function parseArray($value,$iFields=null){
22 $result=[];
23 foreach ($value as $k=>$v){
24 if(is_int($k) || !is_array($iFields) || array_search($k, $iFields)!==false){
25 $prefix="";
26 if(!is_int($k)){
27 $prefix=$k." : ";
28 }
29 if(is_array($v)){
30 $v=$this->parseInlineArray($v);
31 }elseif($v instanceof \stdClass){
32 $v=$this->parseInlineArray((array)$v);
33 }elseif($v instanceof \Closure){
34 $v=UIntrospection::closure_dump($v);
35 }elseif(is_object($v)){
36 $v='{o}';
37 }else{
38 $v=var_export($v,true);
39 }
40 $result[]=" ยท ".$prefix.$v;
41 }
42
43 }
44 return implode("\n",$result);
45 }
46
47 protected function parseInlineArray($value){
48 $result=[];
49 foreach ($value as $k=>$v){
50 $prefix="";
51 if(!is_int($k)){
52 $prefix=$k.": ";
53 }
54 if(is_array($v)){
55 $v=$this->parseInlineArray($v);
56 }elseif($v instanceof \stdClass){
57 $v=$this->parseInlineArray((array)$v);
58 }elseif($v instanceof \Closure){
59 $v=UIntrospection::closure_dump($v);
60 }elseif(is_object($v)){
61 $v='{.}';
62 }else{
63 $v=var_export($v,true);
64 }
65 $result[]=$prefix.$v;
66 }
67 return '['.implode(",",$result).']';
68 }
69
70}
71
Ubiquity\utils\base$UIntrospection This class is part of Ubiquity.