pageRenderer = $pageRenderer; $this->listingPageLimit = $listingPageLimit; $this->installation = $installation; $this->userFlags = $userFlags; $this->wp = $wp; $this->settings = $settings; } public function render() { $data = []; $data['items_per_page'] = $this->listingPageLimit->getLimitPerPage('forms'); $data['segments'] = Segment::findArray(); $data['is_new_user'] = $this->installation->isNewInstallation(); $data = $this->getNPSSurveyData($data); $this->pageRenderer->displayPage('forms.html', $data); } public function getNPSSurveyData($data) { $data['display_nps_survey'] = false; if ($this->userFlags->get('display_new_form_editor_nps_survey')) { $data['current_wp_user'] = $this->wp->wpGetCurrentUser()->to_array(); $data['site_url'] = $this->wp->siteUrl(); $data['premium_plugin_active'] = License::getLicense(); $data['current_wp_user_firstname'] = $this->wp->wpGetCurrentUser()->user_firstname; $installedAtDiff = (new \DateTime($this->settings->get('installed_at')))->diff(new \DateTime()); $data['installed_days_ago'] = $installedAtDiff instanceof \DateInterval ? (int)$installedAtDiff->format('%a') : null; $data['display_nps_survey'] = true; $this->userFlags->set('display_new_form_editor_nps_survey', false); } return $data; } }