code: private function generatePartForPreferredIdentity()
      {
          if ($this->preferredIdentity === null) {
              return '';
          }
          if (!function_exists('posix_getpwnam')) {
              throw new Exception\LogicException('The POSIX extension must be installed to be able to set a preferred identity');
          }
          $pw = posix_getpwnam($this->preferredIdentity);
          if ($pw === false) {
              throw new Exception\LogicException('The preferred identity is one of a non-existent user');
          }
  
          return 'posix_setgid('.self::exportPhpValue($pw['gid']).');'.PHP_EOL.
              'posix_initgroups('.self::exportPhpValue($pw['name']).', '.self::exportPhpValue($pw['gid']).');'.PHP_EOL.
              'posix_setuid('.self::exportPhpValue($pw['uid']).');'.PHP_EOL;
      }
docs: @throws Exception\LogicException
  
  @return string