/**
  * Globs template packs installed in core and returns the template pack collection with all installed template packs
  * in it.
  *
  * @since 4.9.0
  *
  * @return EE_Messages_Template_Pack_Collection
  */
 public static function get_template_pack_collection()
 {
     $new_collection = false;
     if (!self::$_template_pack_collection instanceof EE_Messages_Template_Pack_Collection) {
         self::$_template_pack_collection = new EE_Messages_Template_Pack_Collection();
         $new_collection = true;
     }
     //glob the defaults directory for messages
     $templates = glob(EE_LIBRARIES . 'messages/defaults/*', GLOB_ONLYDIR);
     foreach ($templates as $template_path) {
         //grab folder name
         $template = basename($template_path);
         if (!$new_collection) {
             //already have it?
             if (self::$_template_pack_collection->get_by_name($template) instanceof EE_Messages_Template_Pack) {
                 continue;
             }
         }
         //setup classname.
         $template_pack_class_name = 'EE_Messages_Template_Pack_' . str_replace(' ', '_', ucwords(str_replace('_', ' ', $template)));
         if (!class_exists($template_pack_class_name)) {
             continue;
         }
         self::$_template_pack_collection->add(new $template_pack_class_name());
     }
     /**
      * Filter for plugins to add in any additional template packs
      * Note the filter name here is for backward compat, this used to be found in EED_Messages.
      */
     $additional_template_packs = apply_filters('FHEE__EED_Messages__get_template_packs__template_packs', array());
     foreach ((array) $additional_template_packs as $template_pack) {
         if (!self::$_template_pack_collection->contains($template_pack)) {
             self::$_template_pack_collection->add($template_pack);
         }
     }
     return self::$_template_pack_collection;
 }