AmplitudeProvider.php
2 months ago
AssetsProvider.php
11 months ago
BlocksProvider.php
3 months ago
ClientProvider.php
2 months ago
ContainerProvider.php
11 months ago
DatabaseProvider.php
8 months ago
HostingRoutesProvider.php
2 months ago
IntegrationsProvider.php
5 months ago
JobsProvider.php
7 months ago
MenusProvider.php
11 months ago
NoticesProvider.php
4 months ago
ProviderInterface.php
11 months ago
RedirectsProvider.php
11 months ago
RoutesProvider.php
9 months ago
SurveysProvider.php
2 months ago
TrackingProvider.php
8 months ago
WebhooksProvider.php
8 months ago
WpdbProvider.php
11 months ago
SurveysProvider.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Hostinger\Reach\Providers; |
| 4 | |
| 5 | use Hostinger\Reach\Admin\Surveys\SatisfactionSurvey; |
| 6 | use Hostinger\Reach\Admin\Surveys\Survey; |
| 7 | use Hostinger\Reach\Container; |
| 8 | use Hostinger\Surveys\SurveyManager; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | die; |
| 12 | } |
| 13 | |
| 14 | class SurveysProvider implements ProviderInterface { |
| 15 | public const SURVEY_CLASSES = array( |
| 16 | SatisfactionSurvey::class, |
| 17 | ); |
| 18 | |
| 19 | public function register( Container $container ): void { |
| 20 | foreach ( self::SURVEY_CLASSES as $survey_class ) { |
| 21 | $container->set( |
| 22 | $survey_class, |
| 23 | function () use ( $container, $survey_class ) { |
| 24 | return new $survey_class( $container->get( SurveyManager::class ) ); |
| 25 | } |
| 26 | ); |
| 27 | |
| 28 | /** @var Survey $survey */ |
| 29 | $survey = $container->get( $survey_class ); |
| 30 | $survey->init(); |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 |