Fills object value from Array list

@param $arr
@return $this
160488
public function fromArray($arr)
    {
        if (!empty($arr)) {
            // Iterate over each element in array
            foreach ($arr as $k => $v) {
                // If the value is an array, it means, it is an object after conversion
                if (is_array($v)) {
                    // Determine the class of the object
                    if (($clazz = ReflectionUtil::getPropertyClass(get_class($this), $k)) != null) {
                        // If the value is an associative array, it means, its an object. Just make recursive call to it.
                        if (empty($v)) {
                            if (ReflectionUtil::isPropertyClassArray(get_class($this), $k)) {
                                // It means, it is an array of objects.
                                $this->assignValue($k, array());
                                continue;
                            }
                            $o = new $clazz();
                            //$arr = array();
                            $this->assignValue($k, $o);
                        } elseif (ArrayUtil::isAssocArray($v)) {
                            /** @var BlockCypherModel $o */
                            $o = new $clazz();
                            $o->fromArray($v);
                            $this->assignValue($k, $o);
                        } else {
                            // Else, value is an array of object/data
                            $arr = array();
                            // Iterate through each element in that array.
                            foreach ($v as $nk => $nv) {
                                if (is_array($nv)) {
                                    //BlockCypherLoggingManager::getInstance()->debug("new instance of class: $clazz");
                                    if (!class_exists($clazz)) {
                                        BlockCypherLoggingManager::getInstance()->error("Class not found: $clazz");
                                    } else {
                                        try {
                                            $o = new $clazz();
                                            $o->fromArray($nv);
                                            $arr[$nk] = $o;
                                        } catch (\Exception $e) {
                                            BlockCypherLoggingManager::getInstance()->error($e->getMessage());
                                        }
                                    }
                                } else {
                                    $arr[$nk] = $nv;
                                }
                            }
                            $this->assignValue($k, $arr);
                        }
                    } else {
                        $this->assignValue($k, $v);
                    }
                } else {
                    $this->assignValue($k, $v);
                }
            }
        }
        return $this;
    }
397910
public function fill(array $values)
	{
		foreach ($values as $key => $value)
		{
			callback($this, 'fill' . ucfirst($key))->invoke($value);
		}
		return $this;
	}
746639
public function fromArray($arr)
    {
        if (!empty($arr)) {
            // Iterate over each element in array
            foreach ($arr as $k => $v) {
                // If the value is an array, it means, it is an object after conversion
                if (is_array($v)) {
                    // Determine the class of the object
                    if (($clazz = ReflectionHelper::getPropertyClass(get_class($this), $k)) != null) {
                        // If the value is an associative array, it means, its an object. Just make recursive call to it.
                        if (empty($v)) {
                            if (ReflectionHelper::isPropertyClassArray(get_class($this), $k)) {
                                // It means, it is an array of objects.
                                $this->assignValue($k, array());
                                continue;
                            }
                            $o = new $clazz();
                            //$arr = array();
                            $this->assignValue($k, $o);
                        } elseif (ArrayHelper::isAssocArray($v)) {
                            /** @var self $o */
                            $o = new $clazz();
                            $o->fromArray($v);
                            $this->assignValue($k, $o);
                        } else {
                            // Else, value is an array of object/data
                            $arr = array();
                            // Iterate through each element in that array.
                            foreach ($v as $nk => $nv) {
                                if (is_array($nv)) {
                                    $o = new $clazz();
                                    $o->fromArray($nv);
                                    $arr[$nk] = $o;
                                } else {
                                    $arr[$nk] = $nv;
                                }
                            }
                            $this->assignValue($k, $arr);
                        }
                    } else {
                        $this->assignValue($k, $v);
                    }
                } else {
                    $this->assignValue($k, $v);
                }
            }
        }
        return $this;
    }
1036513
public function fromArray( array $list )
	{
		$unknown = array();
		$list = parent::fromArray( $list );

		foreach( $list as $key => $value )
		{
			switch( $key )
			{
				case $this->_prefix . 'refid': $this->setRefId( $value ); break;
				case $this->_prefix . 'position': $this->setPosition( $value ); break;
				default: $unknown[$key] = $value;
			}
		}

		return $unknown;
	}
742487
public function set(array $strs)
    {
        if (!empty($strs)) {
            foreach ($strs as $_str) {
                $this->add($_str);
            }
        }
        return $this;
    }
29281
public static function arrayContainsArrayItems($arr)
    {
        if (!self::isValidArray($arr)) {
            return false;
        }

        foreach ($arr as $item) {
            if (self::isValidArray($item)) {
                return true;
            }
        }

        return false;
    }
321252
public function setOptionArray(array $arr) {
        foreach($arr as $option => $value) {
            CurlOptions::checkOptionValue($option, $value);
        }

        return curl_setopt_array($this->handle, $arr);
    }
12744
public function fillByArray(array $types)
    {
        foreach ($types as $mimeType => $extensions) {
            $this->extensionsByType[$mimeType] = $extensions;
            foreach ($extensions as $extension) {
                $this->typeByExtension[$extension] = $mimeType;
            }
        }

        return $this;
    }
131712
public function setParams($arr = [])
    {
        foreach ($arr  as $key => $value) {
            $this->params[$key] = $value;
        }
    }
1209777
public static function _arrayToObjects ($arr, $key = FALSE)
	{
		
		// Set object array
		
		$objs	=  new Resource\Model\Collection;
		
		// If no data

		if (!$arr)
		{
			return $objs;
		}
		
		// For each row
		
		foreach ($arr as $row)
		{

			// Create the object

			$obj	= new static;

			// Set each attribute value

			foreach ($row as $name => $val)
			{

				if ($obj->attributeExists ($name))
				{
					$obj->iset ($name, $val, FALSE, TRUE);
				}

			}
			
			// Add to the array
			
			if ($key && isset ($row[$key]))
			{
				$objs[$row[$key]]	= $obj;
			}
			else
			{
				$objs[]	= $obj;
			}

		}
		
		// Return the objects
		
		return $objs;
		
	}
281570
public function fill($fields = [])
    {
        $url = self::resolveFullUrl([$this->id]);

        if(isset($this->properties['fillable_fields'])) {
            $fields = $this->properties['fillable_fields'];
        }

        foreach ($fields as $index => $field) {
            if (!is_array($field)) {
                continue;
            }

            unset($fields[$index]);

            if (!isset($field['name']) || !isset($field['value'])) {
                continue;
            }

            $name = $field['name'];
            $value = $field['value'];
            $type = isset($field['type']) ? $field['type'] : '';

            if ($type === self::TYPE_CHECKBOX) {
                $value = intval(boolval($value));
            }

            $fields[$name] = $value;
        }

        return static::post($this->client, $url, [
            'json' => [
                'fillable_fields' => $fields
            ]
        ]);
    }
1129994
public function setItems(array $value) {
    if (isset($value[0]) &&
        is_object($value[0]) &&
        !$value[0] instanceof GalleryItem
    ) {
      $this->triggerError('Object not of type GalleryItem');
    }
    else {
      $this->items = $value;
    }
    return $this;
  }
227168
public function fill(array $data)
    {
        foreach ($data as $key => &$row) {
            $this->original = $value = Arr::get($row, $this->name);

            $value = $this->htmlEntityEncode($value);

            Arr::set($row, $this->name, $value);

            if ($this->isDefinedColumn()) {
                $this->useDefinedColumn();
            }

            if ($this->hasDisplayCallbacks()) {
                $value = $this->callDisplayCallbacks($this->original, $key);
                Arr::set($row, $this->name, $value);
            }
        }

        return $data;
    }
1160041
public static function from_array($arr)
    {
        $obj = new rcube_message_header;
        foreach ($arr as $k => $v)
            $obj->set($k, $v);

        return $obj;
    }
1286241
public function import(array $arr, $prefix = null)
    {
        $imports = [];
        foreach ($arr as $key => $node) {
            if (strpos($key, 'import') === 0) {
                $mode = substr($key, 7);
                if ($mode == '' || $mode == $this->mode) {
                    $imports = array_merge($imports, $node);
                }

                continue;
            }

            $this->storage[$key] = $this->merge($this->storage[$key], $this->applyPrefix($node, $prefix));
        }

        foreach ($imports as $node) {
            $this->import($node, $prefix);

        }

        return $this;
    }
500106
public static function set( $key, $value, &$arr ) 
	{	
		if ( strpos( $key, '.' ) === false ) 
		{
			$arr[$key] = $value;

		} 
		else 
		{
			$kp = explode( '.', $key );

			switch ( count( $kp ) ) 
			{
				case 2:
					$arr[$kp[0]][$kp[1]] = $value; break;
				case 3:
					$arr[$kp[0]][$kp[1]][$kp[2]] = $value; break;	
				case 4:
					$arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] = $value; break;

				// if there are more then 4 parts loop trough them
				default:
					$kp = array_reverse( $kp );
					$curr = $value;

					foreach( $kp as $k ) 
					{
						$curr = array( $k => $curr );
					}

					$arr = static::merge( $arr, $curr );
				break;
			}
		}
		return $arr;
	}
985156
public function fromArray($arr)
    {
        $class = $this->getFullyQualifiedModel();
        foreach ($arr as $element) {
            /** @var $obj ActiveRecordInterface */
            $obj = new $class();
            $obj->fromArray($element);
            $this->append($obj);
        }
    }