private function writeClassHeader(): void
  {
    $p = strrpos($this->wrapperClassName, '\\');
    if ($p!==false)
    {
      $namespace  = ltrim(substr($this->wrapperClassName, 0, $p), '\\');
      $class_name = substr($this->wrapperClassName, $p + 1);
    }
    else
    {
      $namespace  = null;
      $class_name = $this->wrapperClassName;
    }

    // Write PHP tag.
    $this->codeStore->append('<?php');

    // Write strict types.
    if ($this->strictTypes)
    {
      $this->codeStore->append('declare(strict_types=1);');
    }

    // Write name space of the wrapper class.
    if ($namespace!==null)
    {
      $this->codeStore->append('');
      $this->codeStore->append(sprintf('namespace %s;', $namespace));
      $this->codeStore->append('');
    }

    // If the child class and parent class have different names import the parent class. Otherwise use the fully
    // qualified parent class name.
    $parent_class_name = substr($this->parentClassName, strrpos($this->parentClassName, '\\') + 1);
    if ($class_name!=$parent_class_name)
    {
      $this->imports[]       = $this->parentClassName;
      $this->parentClassName = $parent_class_name;
    }

    // Write use statements.
    if (!empty($this->imports))
    {
      $this->imports = array_unique($this->imports, SORT_REGULAR);
      foreach ($this->imports as $import)
      {
        $this->codeStore->append(sprintf('use %s;', $import));
      }
      $this->codeStore->append('');
    }

    // Write class name.
    $this->codeStore->append('/**');
    $this->codeStore->append(' * The data layer.', false);
    $this->codeStore->append(' */', false);
    $this->codeStore->append(sprintf('class %s extends %s', $class_name, $this->parentClassName));
    $this->codeStore->append('{');
  }
private function writeClassHeader(): void
  {
    $p = strrpos($this->wrapperClassName, '\\');
    if ($p!==false)
    {
      $namespace  = ltrim(substr($this->wrapperClassName, 0, $p), '\\');
      $class_name = substr($this->wrapperClassName, $p + 1);
    }
    else
    {
      $namespace  = null;
      $class_name = $this->wrapperClassName;
    }

    // Write PHP tag.
    $this->codeStore->append('<?php');

    // Write strict types.
    if ($this->strictTypes)
    {
      $this->codeStore->append('declare(strict_types=1);');
    }

    // Write name space of the wrapper class.
    if ($namespace!==null)
    {
      $this->codeStore->append('');
      $this->codeStore->append(sprintf('namespace %s;', $namespace));
      $this->codeStore->append('');
    }

    // If the child class and parent class have different names import the parent class. Otherwise use the fully
    // qualified parent class name.
    $parent_class_name = substr($this->parentClassName, strrpos($this->parentClassName, '\\') + 1);
    if ($class_name!=$parent_class_name)
    {
      $this->imports[]       = $this->parentClassName;
      $this->parentClassName = $parent_class_name;
    }

    // Write use statements.
    if (!empty($this->imports))
    {
      $this->imports = array_unique($this->imports, SORT_REGULAR);
      foreach ($this->imports as $import)
      {
        $this->codeStore->append(sprintf('use %s;', $import));
      }
      $this->codeStore->append('');
    }

    // Write class name.
    $this->codeStore->append('/**');
    $this->codeStore->append(' * The data layer.', false);
    $this->codeStore->append(' */', false);
    $this->codeStore->append(sprintf('class %s extends %s', $class_name, $this->parentClassName));
    $this->codeStore->append('{');
  }
private function writeClassHeader ( ) : void { $ p = strrpos ( $ this -> wrapperClassName , '\\' ) ; if ( $ p !== false ) { $ namespace = ltrim ( substr ( $ this -> wrapperClassName , 0 , $ p ) , '\\' ) ; $ class_name = substr ( $ this -> wrapperClassName , $ p + 1 ) ; } else { $ namespace = null ; $ class_name = $ this -> wrapperClassName ; } // Write PHP tag. $ this -> codeStore -> append ( '<?php' ) ; // Write strict types. if ( $ this -> strictTypes ) { $ this -> codeStore -> append ( 'declare(strict_types=1);' ) ; } // Write name space of the wrapper class. if ( $ namespace !== null ) { $ this -> codeStore -> append ( '' ) ; $ this -> codeStore -> append ( sprintf ( 'namespace %s;' , $ namespace ) ) ; $ this -> codeStore -> append ( '' ) ; } // If the child class and parent class have different names import the parent class. Otherwise use the fully // qualified parent class name. $ parent_class_name = substr ( $ this -> parentClassName , strrpos ( $ this -> parentClassName , '\\' ) + 1 ) ; if ( $ class_name != $ parent_class_name ) { $ this -> imports [ ] = $ this -> parentClassName ; $ this -> parentClassName = $ parent_class_name ; } // Write use statements. if ( ! empty ( $ this -> imports ) ) { $ this -> imports = array_unique ( $ this -> imports , SORT_REGULAR ) ; foreach ( $ this -> imports as $ import ) { $ this -> codeStore -> append ( sprintf ( 'use %s;' , $ import ) ) ; } $ this -> codeStore -> append ( '' ) ; } // Write class name. $ this -> codeStore -> append ( '/**' ) ; $ this -> codeStore -> append ( ' * The data layer.' , false ) ; $ this -> codeStore -> append ( ' */' , false ) ; $ this -> codeStore -> append ( sprintf ( 'class %s extends %s' , $ class_name , $ this -> parentClassName ) ) ; $ this -> codeStore -> append ( '{' ) ; }
Generate a class header for stored routine wrapper.
Generate a class header for stored routine wrapper .