HTTPWatch::populate PHP Method

populate() public method

$islist should be TRUE if $o is a collection/list and provides Count and Item()
public populate ( $o, $classname, $islist = false ) : array
return array of properties
    function populate($o, $classname, $islist = false)
    {
        if (!is_array($this->api)) {
            return false;
        }
        $count = $islist ? $o->Count : 1;
        $populateme = array();
        for ($i = 0; $i < $count; $i++) {
            $item = $islist ? $o->Item($i) : $o;
            $populateme[$i] = array();
            foreach ($this->api[$classname] as $prop => $value) {
                // skip restricted properties in the basic (free) HTTPWatch edition
                if ($classname === 'Entry') {
                    if ($item->isRestrictedURL && $this->paidproperties[$prop]) {
                        continue;
                    }
                } else {
                    if ($this->hasRestrictions() && $this->paidproperties[$prop]) {
                        continue;
                    }
                }
                if (is_array($value)) {
                    $populateme[$i][$prop] = $this->populate($item->{$prop}, $value[0], true);
                } else {
                    if (is_string($value)) {
                        $populateme[$i][$prop] = $this->populate($item->{$prop}, $value, false);
                    } else {
                        if ($value === 1) {
                            $val = $item->{$prop};
                            if (gettype($val) === "object") {
                                $type = variant_get_type($val);
                                if ($type === 8209) {
                                    $val = $this->getStream($val);
                                }
                                if ($type === VT_DATE) {
                                    $val = variant_date_to_timestamp($val);
                                }
                            }
                            $populateme[$i][$prop] = $val;
                        }
                    }
                }
            }
        }
        return $islist ? $populateme : $populateme[0];
    }