original_string: protected function mergeMediaTypes($type1, $type2)
      {
          if (empty($type1)) {
              return $type2;
          }
  
          if (empty($type2)) {
              return $type1;
          }
  
          $m1 = '';
          $t1 = '';
  
          if (count($type1) > 1) {
              $m1= strtolower($type1[0]);
              $t1= strtolower($type1[1]);
          } else {
              $t1 = strtolower($type1[0]);
          }
  
          $m2 = '';
          $t2 = '';
  
          if (count($type2) > 1) {
              $m2 = strtolower($type2[0]);
              $t2 = strtolower($type2[1]);
          } else {
              $t2 = strtolower($type2[0]);
          }
  
          if (($m1 === Type::T_NOT) ^ ($m2 === Type::T_NOT)) {
              if ($t1 === $t2) {
                  return null;
              }
  
              return [
                  $m1 === Type::T_NOT ? $m2 : $m1,
                  $m1 === Type::T_NOT ? $t2 : $t1,
              ];
          }
  
          if ($m1 === Type::T_NOT && $m2 === Type::T_NOT) {
              // CSS has no way of representing "neither screen nor print"
              if ($t1 !== $t2) {
                  return null;
              }
  
              return [Type::T_NOT, $t1];
          }
  
          if ($t1 !== $t2) {
              return null;
          }
  
          // t1 == t2, neither m1 nor m2 are "not"
          return [empty($m1)? $m2 : $m1, $t1];
      }
code: protected function mergeMediaTypes($type1, $type2)
      {
          if (empty($type1)) {
              return $type2;
          }
  
          if (empty($type2)) {
              return $type1;
          }
  
          $m1 = '';
          $t1 = '';
  
          if (count($type1) > 1) {
              $m1= strtolower($type1[0]);
              $t1= strtolower($type1[1]);
          } else {
              $t1 = strtolower($type1[0]);
          }
  
          $m2 = '';
          $t2 = '';
  
          if (count($type2) > 1) {
              $m2 = strtolower($type2[0]);
              $t2 = strtolower($type2[1]);
          } else {
              $t2 = strtolower($type2[0]);
          }
  
          if (($m1 === Type::T_NOT) ^ ($m2 === Type::T_NOT)) {
              if ($t1 === $t2) {
                  return null;
              }
  
              return [
                  $m1 === Type::T_NOT ? $m2 : $m1,
                  $m1 === Type::T_NOT ? $t2 : $t1,
              ];
          }
  
          if ($m1 === Type::T_NOT && $m2 === Type::T_NOT) {
              // CSS has no way of representing "neither screen nor print"
              if ($t1 !== $t2) {
                  return null;
              }
  
              return [Type::T_NOT, $t1];
          }
  
          if ($t1 !== $t2) {
              return null;
          }
  
          // t1 == t2, neither m1 nor m2 are "not"
          return [empty($m1)? $m2 : $m1, $t1];
      }
code_tokens: protected function mergeMediaTypes ( $ type1 , $ type2 ) { if ( empty ( $ type1 ) ) { return $ type2 ; } if ( empty ( $ type2 ) ) { return $ type1 ; } $ m1 = '' ; $ t1 = '' ; if ( count ( $ type1 ) > 1 ) { $ m1 = strtolower ( $ type1 [ 0 ] ) ; $ t1 = strtolower ( $ type1 [ 1 ] ) ; } else { $ t1 = strtolower ( $ type1 [ 0 ] ) ; } $ m2 = '' ; $ t2 = '' ; if ( count ( $ type2 ) > 1 ) { $ m2 = strtolower ( $ type2 [ 0 ] ) ; $ t2 = strtolower ( $ type2 [ 1 ] ) ; } else { $ t2 = strtolower ( $ type2 [ 0 ] ) ; } if ( ( $ m1 === Type :: T_NOT ) ^ ( $ m2 === Type :: T_NOT ) ) { if ( $ t1 === $ t2 ) { return null ; } return [ $ m1 === Type :: T_NOT ? $ m2 : $ m1 , $ m1 === Type :: T_NOT ? $ t2 : $ t1 , ] ; } if ( $ m1 === Type :: T_NOT && $ m2 === Type :: T_NOT ) { // CSS has no way of representing "neither screen nor print" if ( $ t1 !== $ t2 ) { return null ; } return [ Type :: T_NOT , $ t1 ] ; } if ( $ t1 !== $ t2 ) { return null ; } // t1 == t2, neither m1 nor m2 are "not" return [ empty ( $ m1 ) ? $ m2 : $ m1 , $ t1 ] ; }
docstring: Merge media types
  
  @param array $type1
  @param array $type2
  
  @return array|null
docstring_tokens: Merge media types