Pheal\Core\RowSet::toArray PHP Method

toArray() public method

returns the Object as associated array
public toArray ( ) : array
return array
    public function toArray()
    {
        $return = array();
        foreach ($this as $row) {
            if ($row instanceof CanConvertToArray) {
                $return[] = $row->toArray();
            }
        }
        return $return;
    }

Usage Example

 /**
  * returns the Object as associated array
  * @return array
  */
 public function toArray()
 {
     if ($this->rootElement instanceof CanConvertToArray) {
         return array('currentTime' => $this->request_time, 'cachedUntil' => $this->cached_until, 'result' => $this->rootElement->toArray());
     } else {
         return array();
     }
 }