original_string: protected function getFileParts($filename)
      {
          if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) {
              $name = $matches[1];
              $extension = $matches[3];
              $extra = (int) $matches[2];
              $type = 'alternative';
  
              if ($extra === 1) {
                  $type = 'base';
                  $extra = null;
              }
          } else {
              $fileParts = explode('.', $filename);
  
              $name = array_shift($fileParts);
              $extension = null;
              $extra = null;
              $type = 'base';
  
              while (($part = array_shift($fileParts)) !== null) {
                  if ($part !== 'meta' && $part !== 'thumb') {
                      if (null !== $extension) {
                          $name .= '.' . $extension;
                      }
                      $extension = $part;
                  } else {
                      $type = $part;
                      $extra = '.' . $part . '.' . implode('.', $fileParts);
                      break;
                  }
              }
          }
  
          return array($name, $extension, $type, $extra);
      }
code: protected function getFileParts($filename)
      {
          if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) {
              $name = $matches[1];
              $extension = $matches[3];
              $extra = (int) $matches[2];
              $type = 'alternative';
  
              if ($extra === 1) {
                  $type = 'base';
                  $extra = null;
              }
          } else {
              $fileParts = explode('.', $filename);
  
              $name = array_shift($fileParts);
              $extension = null;
              $extra = null;
              $type = 'base';
  
              while (($part = array_shift($fileParts)) !== null) {
                  if ($part !== 'meta' && $part !== 'thumb') {
                      if (null !== $extension) {
                          $name .= '.' . $extension;
                      }
                      $extension = $part;
                  } else {
                      $type = $part;
                      $extra = '.' . $part . '.' . implode('.', $fileParts);
                      break;
                  }
              }
          }
  
          return array($name, $extension, $type, $extra);
      }
code_tokens: protected function getFileParts ( $ filename ) { if ( preg_match ( '/(.*)@(\d+)x\.(.*)$/' , $ filename , $ matches ) ) { $ name = $ matches [ 1 ] ; $ extension = $ matches [ 3 ] ; $ extra = ( int ) $ matches [ 2 ] ; $ type = 'alternative' ; if ( $ extra === 1 ) { $ type = 'base' ; $ extra = null ; } } else { $ fileParts = explode ( '.' , $ filename ) ; $ name = array_shift ( $ fileParts ) ; $ extension = null ; $ extra = null ; $ type = 'base' ; while ( ( $ part = array_shift ( $ fileParts ) ) !== null ) { if ( $ part !== 'meta' && $ part !== 'thumb' ) { if ( null !== $ extension ) { $ name .= '.' . $ extension ; } $ extension = $ part ; } else { $ type = $ part ; $ extra = '.' . $ part . '.' . implode ( '.' , $ fileParts ) ; break ; } } } return array ( $ name , $ extension , $ type , $ extra ) ; }
docstring: Get filename, extension and meta part.
  
  @param  string $filename
  @return array
docstring_tokens: Get filename extension and meta part .