Returns the enabled provider for the given area.

@param AreaContract $area
@return Provider | null
494693
public function getEnabledInArea(AreaContract $area)
    {
        $providers = $this->providers->filterByArea($area->getId());

        foreach ($providers as $provider) {
            if ($provider->isEnabled()) {
                return $provider;
            }
        }

        return null;
    }
145911
public function getAreaForCountry(Country $country)
    {
        $area = null;

        if (null !== $areaDeliveryModule = AreaDeliveryModuleQuery::create()->findByCountryAndModule(
            $country,
            $this->getModuleModel()
        )) {
            $area = $areaDeliveryModule->getArea();
        }

        return $area;
    }
780748
private function getAccessControlProvider($type)
    {
        foreach ($this->accessControlProviders as $accessControlProvider) {
            if ($accessControlProvider->supports($type)) {
                return $accessControlProvider;
            }
        }
    }
462284
public function index($area = null, $locale = null)
    {
        return $this->processor->index($this, !is_null($area) ? $area : area(), $locale);
    }
378272
public function getAvailable($context = null)
    {
        $enabledPlugins = $this->pluginManager->getEnabled(true);

        return $this->widgetRepository->findAllAvailable($enabledPlugins, $context);
    }
1197509
private static function getProvider($query, array $providers, Provider $currentProvider = null): Provider
    {
        if (null !== $currentProvider) {
            return $currentProvider;
        }

        if (0 === count($providers)) {
            throw ProviderNotRegistered::noProviderRegistered();
        }

        // Take first
        $key = key($providers);

        return $providers[$key];
    }
836171
public function enable(User $user, $area)
    {
        $area = app(AreaManager::class)->getById($area);
        request()->session()->set('return_url', request()->headers->get('referer'));
        return $this->processor->enable($this, $user, $area);
    }
994846
public function get($area = '')
    {
        $area = $area ?: $this->workingArea ?: $this->defaultArea;
        $messages = (array)Session::get($this->id . '.' . $area);
        Session::clear($this->id . '.' . $area);
        $this->clearWorking();

        if ($this->unique) {
            $content = [];
            $messages = array_filter($messages, function ($message) use (&$content) {
                if (in_array($message['content'], $content)) {
                    return false;
                } else {
                    array_push($content, $message['content']);

                    return true;
                }
            });
        }

        $messages = array_filter($messages, function($message) use($area) {
            $params = $message;
            $params['area'] = $area;
            return !$this->blocker()->isBlocked($params);
        });

        // Sorting is handled in JS
//        return usort($messages, function($a, $b) {
//            return $a['priority'] - $b['priority'];
//        });

        return $messages;
    }
852794
public function reset_config($areaid = false) {

        if (!empty($areaid)) {
            $searchareas = array();
            if (!$searchareas[$areaid] = static::get_search_area($areaid)) {
                throw new \moodle_exception('errorareanotavailable', 'search', '', $areaid);
            }
        } else {
            // Only the enabled ones.
            $searchareas = static::get_search_areas_list(true);
        }

        foreach ($searchareas as $searcharea) {
            list($componentname, $varname) = $searcharea->get_config_var_name();
            $config = $searcharea->get_config();

            foreach ($config as $key => $value) {
                // We reset them all but the enable/disabled one.
                if ($key !== $varname . '_enabled') {
                    set_config($key, 0, $componentname);
                }
            }
        }
    }
46241
static function LastAreaModLog(Area $area, Interfaces\IContainerReferenceResolver $resolver)
    {
        $lastLog = $this->LastAreaLog($area);
        $areaContents = LayoutContent::Schema()->FetchByArea(false, $area);
        foreach ($areaContents as $areaContent)
        {
            $content = $areaContent->GetContent();
            $contentLog = self::LastContentModLog($content, $resolver);
            if (self::IsAfter($contentLog, $lastLog))
            {
                $lastLog = $contentLog;
            }
        }
        return $lastLog;
    }
206762
public function setAreaServed($areaServed)
    {
        ObjectHelper::isInstanceOf($areaServed, [Place::class, TextValue::class]);

        $this->_areaServed = $areaServed;
        return $this;
    }
534474
public function getEB($region, $credential)
    {
        if (!$config = $this->getConfigWithCredentials($region, $credential)) {
            return null;
        }

        return $this->aws->createElasticBeanstalk($config);
    }
949619
public function getArea($name)
    {
        foreach ($this->areas as $area) {
            /** @var Area $area */
            if ($area->getName() == $name) {
                return $area;
            }
        }

        return;
    }
1188480
public function enabled() {
		$enabled = parent::enabled();

		if($enabled) {
			$enabled = ($this->client && $this->client->enabled());
		}

		return $enabled;
	}
42099
public function getEnabledProviders()
    {
        $social = $this->getSocial();
        $enabled = array();
        if (isset($social['providers'])) {
            $providers = $social['providers'];
            if (!empty($providers) && is_array($providers)) {
                foreach ($providers as $provider => $config) {
                    if ($config['enabled']) {
                        $enabled[] = strtolower($provider);
                    }
                }
            }
        }

        return $enabled;
    }
961128
public function getBlockCachedOutput($area)
    {
        $db = Loader::db();

        $arHandle = $this->getAreaHandle();
        if ($this->isBlockInStack() && is_object($area)) {
            $arHandle = $area->getAreaHandle();
            $cx = Page::getCurrentPage();
            $cID = $cx->getCollectioniD();
            $cvID = $cx->getVersionID();
        } else {
            $c = $this->getBlockCollectionObject();
            $cID = $c->getCollectionID();
            $cvID = $c->getVersionID();
        }

        $r = $db->GetRow(
            'select btCachedBlockOutput, btCachedBlockOutputExpires from CollectionVersionBlocksOutputCache where cID = ? and cvID = ? and bID = ? and arHandle = ? ',
            [
                $cID,
                $cvID,
                $this->getBlockID(),
                $arHandle,
            ]
            );

        if (array_get($r, 'btCachedBlockOutputExpires') < time()) {
            return false;
        }

        return $r['btCachedBlockOutput'];
    }
544254
protected function NextArea()
    {
        $area = $this->area;
        $this->area = $this->listProvider->NextOf($this->area);
        return $area;
    }