Example #1
0
 /**
  * Retrieves the settings grouped by modules. The returned value is an array, where
  * the key is the module name, and value a sub-array with individual settings for
  * this module. The settings are sorted by keys.
  * 
  * @return array
  */
 public function getOrganized()
 {
     $organized = array();
     foreach ($this->settings as $setting) {
         if ($this->project->supports($setting)) {
             if (!isset($organized[$setting->getModule()])) {
                 $organized[$setting->getModule()] = array();
             }
             $organized[$setting->getModule()][] = $setting;
         }
     }
     ksort($organized);
     foreach ($organized as &$moduleSettings) {
         usort($moduleSettings, function ($a, $b) {
             return strcmp($a->getKey(), $b->getKey());
         });
     }
     return $organized;
 }