コード例 #1
0
 /**
  * Get profile list to display in admin-user select list.
  *
  * @return array
  */
 public function getSettings()
 {
     $profiles = $this->profileManager->getProfiles();
     $settings = [];
     foreach ($profiles as $profile) {
         $profileId = 'ongr_settings_profile_' . UnderscoreEscaper::escape($profile['profile']);
         $settings[$profileId] = ['name' => $profile['profile'], 'category' => 'ongr_settings_profiles'];
     }
     return $settings;
 }
コード例 #2
0
 /**
  * On kernel request.
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     $settings = $this->generalSettingsManager->getSettings();
     foreach ($settings as $id => $value) {
         $prefix = 'ongr_settings_profile_';
         if (strpos($id, $prefix) === 0 && $value === true) {
             $escapedProfile = mb_substr($id, strlen($prefix), null, 'UTF-8');
             $profile = UnderscoreEscaper::unescape($escapedProfile);
             $this->settingsContainer->addProfile($profile);
             $this->settingsContainer->addProvider($this->buildProvider($profile));
         }
     }
 }
コード例 #3
0
 /**
  * Tests unsescape method.
  *
  * @param string $expectedOutput
  * @param string $input
  *
  * @dataProvider getUnescapeCases
  */
 public function testUnescape($expectedOutput, $input)
 {
     $output = UnderscoreEscaper::unescape($input);
     $this->assertSame($expectedOutput, $output);
 }