protected function generateTemplate()
    {
        $st_annotations = $this->extractAnnotations();

        $template = array();
        $counter = 0;
        $section = null;
        $partial_template = $this->loadPartialTemplate('main');

        foreach ($st_annotations as $class => $methods) {
            foreach ($methods as $name => $docs) {
                if (isset($docs['ApiDescription'][0]['section'])) {
                  $section = $docs['ApiDescription'][0]['section'];
                }elseif(isset($docs['ApiSector'][0]['name'])){
                    $section = $docs['ApiSector'][0]['name'];
                }else{
                    $section = $class;
                }
                if (0 === count($docs)) {
                    continue;
                }

                $sampleOutput = $this->generateSampleOutput($docs, $counter);

                $tr = array(
                    '{{ elt_id }}'                  => $counter,
                    '{{ method }}'                  => $this->generateBadgeForMethod($docs),
                    '{{ route }}'                   => $docs['ApiRoute'][0]['name'],
                    '{{ description }}'             => $docs['ApiDescription'][0]['description'],
                    '{{ headers }}'                 => $this->generateHeadersTemplate($counter, $docs),
                    '{{ parameters }}'              => $this->generateParamsTemplate($counter, $docs),
                    '{{ body }}'                    => $this->generateBodyTemplate($counter, $docs),
                    '{{ sandbox_form }}'            => $this->generateSandboxForm($docs, $counter),
                    '{{ sample_response_headers }}' => $sampleOutput[0],
                    '{{ sample_response_body }}'    => $sampleOutput[1]
                );

                $template[$section][] = strtr($partial_template, $tr);
                $counter++;
            }
        }

        $output = '';

        foreach ($template as $key => $value) {
          array_unshift($value, '<h2>' . $key . '</h2>');
          $output .= implode(PHP_EOL, $value);
        }

        $this->saveTemplate($output, $this->_output_file);

        return true;
    }
protected function generateTemplate()
    {
        $st_annotations = $this->extractAnnotations();

        $template = array();
        $counter = 0;
        $section = null;
        $partial_template = $this->loadPartialTemplate('main');

        foreach ($st_annotations as $class => $methods) {
            foreach ($methods as $name => $docs) {
                if (isset($docs['ApiDescription'][0]['section'])) {
                  $section = $docs['ApiDescription'][0]['section'];
                }elseif(isset($docs['ApiSector'][0]['name'])){
                    $section = $docs['ApiSector'][0]['name'];
                }else{
                    $section = $class;
                }
                if (0 === count($docs)) {
                    continue;
                }

                $sampleOutput = $this->generateSampleOutput($docs, $counter);

                $tr = array(
                    '{{ elt_id }}'                  => $counter,
                    '{{ method }}'                  => $this->generateBadgeForMethod($docs),
                    '{{ route }}'                   => $docs['ApiRoute'][0]['name'],
                    '{{ description }}'             => $docs['ApiDescription'][0]['description'],
                    '{{ headers }}'                 => $this->generateHeadersTemplate($counter, $docs),
                    '{{ parameters }}'              => $this->generateParamsTemplate($counter, $docs),
                    '{{ body }}'                    => $this->generateBodyTemplate($counter, $docs),
                    '{{ sandbox_form }}'            => $this->generateSandboxForm($docs, $counter),
                    '{{ sample_response_headers }}' => $sampleOutput[0],
                    '{{ sample_response_body }}'    => $sampleOutput[1]
                );

                $template[$section][] = strtr($partial_template, $tr);
                $counter++;
            }
        }

        $output = '';

        foreach ($template as $key => $value) {
          array_unshift($value, '<h2>' . $key . '</h2>');
          $output .= implode(PHP_EOL, $value);
        }

        $this->saveTemplate($output, $this->_output_file);

        return true;
    }
protected function generateTemplate ( ) { $ st_annotations = $ this -> extractAnnotations ( ) ; $ template = array ( ) ; $ counter = 0 ; $ section = null ; $ partial_template = $ this -> loadPartialTemplate ( 'main' ) ; foreach ( $ st_annotations as $ class => $ methods ) { foreach ( $ methods as $ name => $ docs ) { if ( isset ( $ docs [ 'ApiDescription' ] [ 0 ] [ 'section' ] ) ) { $ section = $ docs [ 'ApiDescription' ] [ 0 ] [ 'section' ] ; } elseif ( isset ( $ docs [ 'ApiSector' ] [ 0 ] [ 'name' ] ) ) { $ section = $ docs [ 'ApiSector' ] [ 0 ] [ 'name' ] ; } else { $ section = $ class ; } if ( 0 === count ( $ docs ) ) { continue ; } $ sampleOutput = $ this -> generateSampleOutput ( $ docs , $ counter ) ; $ tr = array ( '{{ elt_id }}' => $ counter , '{{ method }}' => $ this -> generateBadgeForMethod ( $ docs ) , '{{ route }}' => $ docs [ 'ApiRoute' ] [ 0 ] [ 'name' ] , '{{ description }}' => $ docs [ 'ApiDescription' ] [ 0 ] [ 'description' ] , '{{ headers }}' => $ this -> generateHeadersTemplate ( $ counter , $ docs ) , '{{ parameters }}' => $ this -> generateParamsTemplate ( $ counter , $ docs ) , '{{ body }}' => $ this -> generateBodyTemplate ( $ counter , $ docs ) , '{{ sandbox_form }}' => $ this -> generateSandboxForm ( $ docs , $ counter ) , '{{ sample_response_headers }}' => $ sampleOutput [ 0 ] , '{{ sample_response_body }}' => $ sampleOutput [ 1 ] ) ; $ template [ $ section ] [ ] = strtr ( $ partial_template , $ tr ) ; $ counter ++ ; } } $ output = '' ; foreach ( $ template as $ key => $ value ) { array_unshift ( $ value , '<h2>' . $ key . '</h2>' ) ; $ output .= implode ( PHP_EOL , $ value ) ; } $ this -> saveTemplate ( $ output , $ this -> _output_file ) ; return true ; }
Generate the content of the documentation

@return boolean
Generate the content of the documentation