/**
  * Choose maximum protection type from given array.
  * 
  * @param array $types
  * @return string
  */
 static function getMaximumProtectionType(array $types)
 {
     $availableProtectionTypes = array_flip(RublonRolesProtection::getAvailableProtectionTypes());
     $result = RublonHelper::PROTECTION_TYPE_NONE;
     $maxTypeWeight = 0;
     foreach ($types as $type) {
         if (isset($availableProtectionTypes[$type]) and $availableProtectionTypes[$type] > $maxTypeWeight) {
             $maxTypeWeight = $availableProtectionTypes[$type];
             $result = $type;
         }
     }
     return $result;
 }