Ouzo\Utilities\Objects::getValueOrCallMethod PHP Method

getValueOrCallMethod() public static method

public static getValueOrCallMethod ( mixed $object, string $field, mixed $default, boolean $accessPrivate = false ) : mixed | null
$object mixed
$field string
$default mixed
$accessPrivate boolean
return mixed | null
    public static function getValueOrCallMethod($object, $field, $default, $accessPrivate = false)
    {
        $value = self::getValue($object, $field, null, $accessPrivate);
        if ($value !== null) {
            return $value;
        }
        return self::callMethod($object, $field, $default);
    }