Return what changed

@param boolean $attrs if true, return old and current values

@return changes
12527
public function changed($attrs=false) 
    {
        $changes = array();
        $cls     = get_called_class();

        foreach (self::$_columns[$cls] as $column) {
            // if is the primary key or one of the automatic columns, skip
            if ($cls::getPK() == $column || in_array(strtolower($column), array("created_at","updated_at"))) {
                continue;
            }

            $cur = $this->get($column);         // current value
            $old = $this->get($column, false);  // old value

            // if same value, didn't change
            if ($cur == $old) {
                continue;
            }

            // set the value as the changed column name
            $value = $column;

            // if checking the attributes, return an array with both values
            if ($attrs) {
                $value = array($old, $cur);
                $changes[$column] = $value;
            } else {
                array_push($changes, $value);
            }
        }
        return $changes;
    }
663458
function updated($new = null)
    {
        if (isset($new) && ($this->_attributes['updated'] != $new)){
            $this->change('updated', (int)$new);
        }
        return $this->_attributes['updated'];
    }
384069
public function setAttrs(array $attrs) {
		foreach ($attrs as $attr => $value) {
			$this->setAttr($attr, $value);
		}
		
		return $this;
	}
1220135
protected function getAttrAlias(Attr $attr) {
		//check if join is already created
		$stringPath = $attr->getStringPath();
		if (array_key_exists($stringPath, $this->joins))
			return [$this->joins[$stringPath]->getAlias(), $this->joins[$stringPath]->getProfile()];
		
		//
		$path = $attr->getPath();
		$current = $this->profile;
		$parent = null;
		
		for ($i = 0; $i < count($path); $i++) {
			//build join name
			$joinPath = array_slice($path, 0, $i + 1);
			$name = implode('__', $joinPath);
			
			//check association
			if (!$current->hasAssociation($path[$i]))
				throw new \RuntimeException(sprintf("Association '%s' not found in class %s", $path[$i], $current->getReflectionClass()->getName()));
			
			//build join instance
			$association = $current->getAssociation($path[$i]);
			$related = Profiler::getClassProfile($association->getEntityClass());
			
			if (!array_key_exists($name, $this->joins))
				$this->joins[$name] = new Join($association, $related, $this->getJoinAlias(), $parent);
			
			//prepare next iteration
			$current = $related;
			$parent = $name;
		}
		
		return [$this->joins[$parent]->getAlias(), $this->joins[$parent]->getProfile()];
	}
771951
protected function getRecordedChanges()
    {
        $recorded_changes = [];

        foreach ($this->getChanges() as $value_changed_event) {
            $attribute = $this->getType()->getAttribute($value_changed_event->getAttributeName());
            if ($attribute instanceof EmbeddedEntityListAttribute) {
                continue;
            }
            $recorded_changes[$attribute->getName()] = $value_changed_event->getNewValue();
        }

        return $recorded_changes;
    }
533397
function(attrs, options) {
    if (typeof attrs === 'object') {
      for(var k in attrs) {
        this.set(k, attrs[k], options);
      }
    } else {
      var value = options, name = attrs;
      options = arguments[2];
      if (this[name] && this[name] === value) return this;
      this._previous[name] = this[name];
      this[name] = value;
      this.trigger('change');
    }
    return this;
  }
607305
public function setAttrs($attrs)
    {
        $oldAttrs = $this->attributes;
        $oldClasses = $this->classes;

        $this->attributes = $attrs;
        $this->attributes = Generator::parseAtts($this);

        $this->attributes = array_merge($oldAttrs, $this->attributes);
        $this->classes = null;
        $this->update('classes');

        if (!empty($oldClasses) && !empty($this->classes)) {
            $this->attributes['class'] = implode(' ', array_merge($oldClasses, $this->classes));
        }
        $this->classes = null;

        if (!empty($oldAttrs['style']) && !empty($this->attributes['style'])) {
            $this->attributes['style'] = Generator::mergeStyles($this->attributes['style'], $oldAttrs['style']);
        }

        $this->update();
    }
636654
static public function update($id, array $attrs)
    {
        if (is_array($id)) {
            foreach ($id as $k => $i) {
                static::update($i, $attrs[$k]);
            }
        } else {
            $object = static::find($id);
            $object->updateAttributes($attrs);
            return $object;
        }
    }
834134
public function changes()
    {
        $changes = [];
        foreach ($this->changedAttributes as $attrName => $originalValue) {
            $changes[$attrName] = [$originalValue, $this->attributes->get($attrName)];
        }
        return $changes;
    }
438185
function is_changed($attr_name = null)
    {
        if (isset($attr_name)){
            return array_key_exists($attr_name, $this->_changes);
        }
        return !empty($this->_changes);
    }
1360313
function getAttributes($asString = false)
    {
        if ($asString) {
            return $this->_getAttrString($this->_attributes);
        } else {
            return $this->_attributes;
        }
    }
557625
protected function getAvailableChangeSets()
    {
        return ChangeSet::get()
            ->filter('State', ChangeSet::STATE_OPEN)
            ->filterByCallback(function ($item) {
                /** @var ChangeSet $item */
                return $item->canView();
            });
    }
213667
private function getChanges($latest_release = false, $pulls)
	{
		$changes = array();

		foreach ($pulls as $pull)
		{
			if (!$latest_release || strtotime($pull->merged_at) > strtotime($latest_release->published_at))
			{
				if ($this->getJConfig()->github->changelog_source == "pr")
				{
					$changes[] = $pull->title;
				}

				$message   = explode(PHP_EOL, $pull->commit->message);
				$changes[] = $message[0];
			}
		}

		return $changes;
	}
1317454
def old_attributes
      (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|
        attrs[attr] = Array(values).first

        attrs
      end
    end
74553
function getAttribute($attr)
    {
        $attr = strtolower($attr);
        if (isset($this->_attributes[$attr])) {
            return $this->_attributes[$attr];
        }
        return null;
    }
172167
public function calculateChangeSet()
    {
        $set = [];
        foreach ($this->current as $key => $current) {
            $original = isset($this->original[$key]) ? $this->original[$key] : null;
            $set[$key]['old'] = $original;
            $set[$key]['new'] = $current;
        }
        foreach ($this->remove as $key) {
            $set[$key]['old'] = $this->original[$key];
            $set[$key]['new'] = null;
        }
        ksort($set);
        return $set;
    }
425020
private static function getAttributes($attr)
    {
        $html = "";
        foreach ($attr as $key => $value) {
            $html .= $key . '="' . $value . '" ';
        }

        return $html;
    }