public function check(string $type, string $context): bool
    {
        /** @var DataSource $dataSource */
        $dataSource = $this->dataSourceRepository->findOneBy(['name' => $type]);
        if (!$dataSource) {
            // unknown data source
            return false;
        }

        if (!in_array($context, $dataSource->getContext())) {
            return false;
        }

        return true;
    }
public function check(string $type, string $context): bool
    {
        /** @var DataSource $dataSource */
        $dataSource = $this->dataSourceRepository->findOneBy(['name' => $type]);
        if (!$dataSource) {
            // unknown data source
            return false;
        }

        if (!in_array($context, $dataSource->getContext())) {
            return false;
        }

        return true;
    }
public function check ( string $ type , string $ context ) : bool { /** @var DataSource $dataSource */ $ dataSource = $ this -> dataSourceRepository -> findOneBy ( [ 'name' => $ type ] ) ; if ( ! $ dataSource ) { // unknown data source return false ; } if ( ! in_array ( $ context , $ dataSource -> getContext ( ) ) ) { return false ; } return true ; }
Checks if a data source exists and is available for the given context.

@param string $type
@param string $context

@return bool
Checks if a data source exists and is available for the given context .