private function generatePhpDocParameters(): void
  {
    $parameters = [];
    foreach ($this->routine['phpdoc']['parameters'] as $parameter)
    {
      $mangledName = $this->nameMangler->getParameterName($parameter['parameter_name']);

      $parameters[] = ['php_name'             => '$'.$mangledName,
                       'description'          => $parameter['description'],
                       'php_type'             => $parameter['php_type'],
                       'data_type_descriptor' => $parameter['data_type_descriptor']];
    }

    $this->enhancePhpDocParameters($parameters);

    if (!empty($parameters))
    {
      // Compute the max lengths of parameter names and the PHP types of the parameters.
      $max_name_length = 0;
      $max_type_length = 0;
      foreach ($parameters as $parameter)
      {
        $max_name_length = max($max_name_length, mb_strlen($parameter['php_name']));
        $max_type_length = max($max_type_length, mb_strlen($parameter['php_type']));
      }

      $this->codeStore->append(' *', false);

      // Generate phpDoc for the parameters of the wrapper method.
      foreach ($parameters as $parameter)
      {
        $format = sprintf(' * %%-%ds %%-%ds %%-%ds %%s', mb_strlen('@param'), $max_type_length, $max_name_length);

        $lines = explode(PHP_EOL, $parameter['description'] ?? '');
        if (!empty($lines))
        {
          $line = array_shift($lines);
          $this->codeStore->append(sprintf($format, '@param', $parameter['php_type'], $parameter['php_name'], $line), false);
          foreach ($lines as $line)
          {
            $this->codeStore->append(sprintf($format, ' ', ' ', ' ', $line), false);
          }
        }
        else
        {
          $this->codeStore->append(sprintf($format, '@param', $parameter['php_type'], $parameter['php_name'], ''), false);
        }

        if ($parameter['data_type_descriptor']!==null)
        {
          $this->codeStore->append(sprintf($format, ' ', ' ', ' ', $parameter['data_type_descriptor']), false);
        }
      }
    }
  }
private function generatePhpDocParameters(): void
  {
    $parameters = [];
    foreach ($this->routine['phpdoc']['parameters'] as $parameter)
    {
      $mangledName = $this->nameMangler->getParameterName($parameter['parameter_name']);

      $parameters[] = ['php_name'             => '$'.$mangledName,
                       'description'          => $parameter['description'],
                       'php_type'             => $parameter['php_type'],
                       'data_type_descriptor' => $parameter['data_type_descriptor']];
    }

    $this->enhancePhpDocParameters($parameters);

    if (!empty($parameters))
    {
      // Compute the max lengths of parameter names and the PHP types of the parameters.
      $max_name_length = 0;
      $max_type_length = 0;
      foreach ($parameters as $parameter)
      {
        $max_name_length = max($max_name_length, mb_strlen($parameter['php_name']));
        $max_type_length = max($max_type_length, mb_strlen($parameter['php_type']));
      }

      $this->codeStore->append(' *', false);

      // Generate phpDoc for the parameters of the wrapper method.
      foreach ($parameters as $parameter)
      {
        $format = sprintf(' * %%-%ds %%-%ds %%-%ds %%s', mb_strlen('@param'), $max_type_length, $max_name_length);

        $lines = explode(PHP_EOL, $parameter['description'] ?? '');
        if (!empty($lines))
        {
          $line = array_shift($lines);
          $this->codeStore->append(sprintf($format, '@param', $parameter['php_type'], $parameter['php_name'], $line), false);
          foreach ($lines as $line)
          {
            $this->codeStore->append(sprintf($format, ' ', ' ', ' ', $line), false);
          }
        }
        else
        {
          $this->codeStore->append(sprintf($format, '@param', $parameter['php_type'], $parameter['php_name'], ''), false);
        }

        if ($parameter['data_type_descriptor']!==null)
        {
          $this->codeStore->append(sprintf($format, ' ', ' ', ' ', $parameter['data_type_descriptor']), false);
        }
      }
    }
  }
private function generatePhpDocParameters ( ) : void { $ parameters = [ ] ; foreach ( $ this -> routine [ 'phpdoc' ] [ 'parameters' ] as $ parameter ) { $ mangledName = $ this -> nameMangler -> getParameterName ( $ parameter [ 'parameter_name' ] ) ; $ parameters [ ] = [ 'php_name' => '$' . $ mangledName , 'description' => $ parameter [ 'description' ] , 'php_type' => $ parameter [ 'php_type' ] , 'data_type_descriptor' => $ parameter [ 'data_type_descriptor' ] ] ; } $ this -> enhancePhpDocParameters ( $ parameters ) ; if ( ! empty ( $ parameters ) ) { // Compute the max lengths of parameter names and the PHP types of the parameters. $ max_name_length = 0 ; $ max_type_length = 0 ; foreach ( $ parameters as $ parameter ) { $ max_name_length = max ( $ max_name_length , mb_strlen ( $ parameter [ 'php_name' ] ) ) ; $ max_type_length = max ( $ max_type_length , mb_strlen ( $ parameter [ 'php_type' ] ) ) ; } $ this -> codeStore -> append ( ' *' , false ) ; // Generate phpDoc for the parameters of the wrapper method. foreach ( $ parameters as $ parameter ) { $ format = sprintf ( ' * %%-%ds %%-%ds %%-%ds %%s' , mb_strlen ( '@param' ) , $ max_type_length , $ max_name_length ) ; $ lines = explode ( PHP_EOL , $ parameter [ 'description' ] ?? '' ) ; if ( ! empty ( $ lines ) ) { $ line = array_shift ( $ lines ) ; $ this -> codeStore -> append ( sprintf ( $ format , '@param' , $ parameter [ 'php_type' ] , $ parameter [ 'php_name' ] , $ line ) , false ) ; foreach ( $ lines as $ line ) { $ this -> codeStore -> append ( sprintf ( $ format , ' ' , ' ' , ' ' , $ line ) , false ) ; } } else { $ this -> codeStore -> append ( sprintf ( $ format , '@param' , $ parameter [ 'php_type' ] , $ parameter [ 'php_name' ] , '' ) , false ) ; } if ( $ parameter [ 'data_type_descriptor' ] !== null ) { $ this -> codeStore -> append ( sprintf ( $ format , ' ' , ' ' , ' ' , $ parameter [ 'data_type_descriptor' ] ) , false ) ; } } } }
Generates the doc block for parameters of stored routine wrapper.
Generates the doc block for parameters of stored routine wrapper .