original_string: public function toArray(int $mode = self::ARRAY_ASSOC): array
      {
          switch ($mode) {
              case self::ARRAY_MULTI_PART:
                  $caseHelper = CaseHelperFactory::make(CaseHelperFactory::INPUT_TYPE_CAMEL_CASE);
                  $keyVals = $this->toArray(self::ARRAY_ASSOC);
                  $multiPart = [];
  
                  foreach ($keyVals as $key => $val) {
                      $multiPart[] = ['name' => $caseHelper->toSnakeCase($key), 'contents' => "$val"];
                  }
  
                  $array = $multiPart;
                  break;
              default:
                  $array = array_filter((array)$this); // removes empty values
                  break;
          }
  
          return $array;
      }
code: public function toArray(int $mode = self::ARRAY_ASSOC): array
      {
          switch ($mode) {
              case self::ARRAY_MULTI_PART:
                  $caseHelper = CaseHelperFactory::make(CaseHelperFactory::INPUT_TYPE_CAMEL_CASE);
                  $keyVals = $this->toArray(self::ARRAY_ASSOC);
                  $multiPart = [];
  
                  foreach ($keyVals as $key => $val) {
                      $multiPart[] = ['name' => $caseHelper->toSnakeCase($key), 'contents' => "$val"];
                  }
  
                  $array = $multiPart;
                  break;
              default:
                  $array = array_filter((array)$this); // removes empty values
                  break;
          }
  
          return $array;
      }
code_tokens: public function toArray ( int $ mode = self :: ARRAY_ASSOC ) : array { switch ( $ mode ) { case self :: ARRAY_MULTI_PART : $ caseHelper = CaseHelperFactory :: make ( CaseHelperFactory :: INPUT_TYPE_CAMEL_CASE ) ; $ keyVals = $ this -> toArray ( self :: ARRAY_ASSOC ) ; $ multiPart = [ ] ; foreach ( $ keyVals as $ key => $ val ) { $ multiPart [ ] = [ 'name' => $ caseHelper -> toSnakeCase ( $ key ) , 'contents' => "$val" ] ; } $ array = $ multiPart ; break ; default : $ array = array_filter ( ( array ) $ this ) ; // removes empty values break ; } return $ array ; }
docstring: Return instance as array
  
  @param int $mode Array mode
  
  @return array
  @throws \Exception
docstring_tokens: Return instance as array