/** * Formats attributes value * * @param Attribute $attribute * * @return mixed|Expr */ protected function formatAttributeValue(Attribute $attribute) { $value = $attribute->getValue(); if ($attribute->getType() === Attribute::TYPE_FUNCTION && strlen($value)) { return new Expr($value); } return $value; }
/** * Adds new element attribute to collection * * @param Attribute $attribute */ public function add(Attribute $attribute) { $this->items[$attribute->getName()] = $attribute; }