src/Widgets/ReportWidget.php
public function getReportInstance(array $options = []) : ?ReportGraphsInterface
    {
        if (empty($options['config'])) {
            $options['config'] = $this->getReport($options);
        }

        if (empty($options['config'])) {
            return null;
        }

        $renderAs = $options['config']['info']['renderAs'];
        if (empty($renderAs)) {
            return null;
        }

        $className = __NAMESPACE__ . '\\Reports\\' . Inflector::camelize($renderAs) . self::WIDGET_REPORT_SUFFIX;
        if (! class_exists($className)) {
            return null;
        }

        if (! in_array(__NAMESPACE__ . '\\Reports\\' . 'ReportGraphsInterface', class_implements($className))) {
            return null;
        }

        return new $className($options);
    }
public function getReportInstance(array $options = []) : ?ReportGraphsInterface
    {
        if (empty($options['config'])) {
            $options['config'] = $this->getReport($options);
        }

        if (empty($options['config'])) {
            return null;
        }

        $renderAs = $options['config']['info']['renderAs'];
        if (empty($renderAs)) {
            return null;
        }

        $className = __NAMESPACE__ . '\\Reports\\' . Inflector::camelize($renderAs) . self::WIDGET_REPORT_SUFFIX;
        if (! class_exists($className)) {
            return null;
        }

        if (! in_array(__NAMESPACE__ . '\\Reports\\' . 'ReportGraphsInterface', class_implements($className))) {
            return null;
        }

        return new $className($options);
    }
public function getReportInstance ( array $ options = [ ] ) : ? ReportGraphsInterface { if ( empty ( $ options [ 'config' ] ) ) { $ options [ 'config' ] = $ this -> getReport ( $ options ) ; } if ( empty ( $ options [ 'config' ] ) ) { return null ; } $ renderAs = $ options [ 'config' ] [ 'info' ] [ 'renderAs' ] ; if ( empty ( $ renderAs ) ) { return null ; } $ className = __NAMESPACE__ . '\\Reports\\' . Inflector :: camelize ( $ renderAs ) . self :: WIDGET_REPORT_SUFFIX ; if ( ! class_exists ( $ className ) ) { return null ; } if ( ! in_array ( __NAMESPACE__ . '\\Reports\\' . 'ReportGraphsInterface' , class_implements ( $ className ) ) ) { return null ; } return new $ className ( $ options ) ; }
Initialize Report instance

ReportWidgetHandler operates via $_instance variable
that we set based on the renderAs parameter of the report.

@param mixed[] $options containing reports
@return \Search\Widgets\Reports\ReportGraphsInterface|null
Initialize Report instance