Ejemplo n.º 1
0
 public function __get($asserter)
 {
     switch (strtolower($asserter)) {
         case 'keys':
             return $this->getKeysAsserter();
         case 'size':
             return $this->getSizeAsserter();
         case 'isempty':
             return $this->isEmpty();
         case 'isnotempty':
             return $this->isNotEmpty();
         case 'child':
             $asserter = new phpArray\child($this);
             $this->resetInnerAsserter();
             return $asserter->setWith($this->value);
         default:
             $asserter = parent::__get($asserter);
             if ($asserter instanceof variable === false) {
                 $this->resetInnerAsserter();
                 return $asserter;
             } else {
                 if ($this->innerAsserter === null || $this->innerAsserterUsed === true) {
                     $this->innerValue = $this->value;
                     $this->innerAsserterUsed = false;
                 }
                 $this->innerAsserter = $asserter;
                 return $this;
             }
     }
 }
Ejemplo n.º 2
0
 public function offsetGet($key)
 {
     $asserter = new child($this);
     return $asserter->setWith($this->valueIsSet()->value[$key]);
 }