src/Concerns/SetsAttributes.php
protected function setVisibleAttribute(string $name, $value)
    {
        $method = "set" . ucfirst($name);
        if (method_exists($this, $method)) {
            $value = $this->$method($value);

        } elseif (PublicReflection::hasAttribute(get_class($this), $name)) {
            $value = $this->setAttribute($name, $value);

        } elseif ($this->triggerUndefinedAttributeNotice) {
            $className = get_class($this);
            trigger_error("The property {$className}::\${$name} is not accessible.", E_USER_NOTICE);
        }
        return $value;
    }
protected function setVisibleAttribute(string $name, $value)
    {
        $method = "set" . ucfirst($name);
        if (method_exists($this, $method)) {
            $value = $this->$method($value);

        } elseif (PublicReflection::hasAttribute(get_class($this), $name)) {
            $value = $this->setAttribute($name, $value);

        } elseif ($this->triggerUndefinedAttributeNotice) {
            $className = get_class($this);
            trigger_error("The property {$className}::\${$name} is not accessible.", E_USER_NOTICE);
        }
        return $value;
    }
Checks the visibility of the given attribute before setting it to the given value.

@param string $name
@param $value
@return $this