src/Concerns/GetsAttributes.php
protected function getVisibleAttribute(string $name, $default = null)
    {
        $method = "get" . ucfirst($name);
        if (method_exists($this, $method)) {
            return $this->$method($default);

        } elseif (PublicReflection::hasAttribute(get_class($this), $name)) {
            return $this->getAttribute($name, $default);

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

        } elseif (PublicReflection::hasAttribute(get_class($this), $name)) {
            return $this->getAttribute($name, $default);

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

@param string $name
@param null $default
@return mixed