OpenSkill\Datatable\Columns\ColumnConfigurationBuilder::checkCallable PHP Method

checkCallable() private method

Will check if the callable is set and is executable, if not a sensible default will be set.
private checkCallable ( )
    private function checkCallable()
    {
        if (is_null($this->callable) || !is_callable($this->callable)) {
            $this->callable = function ($data) {
                $name = $this->name;
                if (is_array($data) && array_key_exists($name, $data)) {
                    return $data[$name];
                }
                if (is_object($data) && property_exists($data, $name)) {
                    return $data->{$name};
                }
                if (is_object($data) && method_exists($data, $name)) {
                    return $data->{$name}();
                }
                return "";
            };
        }
    }