Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6
System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64
User : User ( 0)
PHP Version : 7.4.6
Disable Function : NONE
Directory :  C:/xampp/php/pear/PHP/UML/Output/Php/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : C:/xampp/php/pear/PHP/UML/Output/Php/Exporter.php
<?php
/**
 * PHP_UML
 *
 * PHP version 5
 *
 * @category PHP
 * @package  PHP_UML
 * @author   Baptiste Autin <ohlesbeauxjours@yahoo.fr> 
 * @license  http://www.gnu.org/licenses/lgpl.html LGPL License 3
 * @version  SVN: $Revision: 167 $
 * @link     http://pear.php.net/package/PHP_UML
 * @since    $Date: 2011-09-08 02:23:25 +0200 (jeu., 08 sept. 2011) $
 */

/**
 * This class generates a HTML website from a UML model (a PHP_UML_Metamodel)
 *
 * @category   PHP
 * @package    PHP_UML
 * @subpackage Output
 * @subpackage Php
 * @author     Baptiste Autin <ohlesbeauxjours@yahoo.fr> 
 * @license    http://www.gnu.org/licenses/lgpl.html LGPL License 3
 */
class PHP_UML_Output_Php_Exporter extends PHP_UML_Output_ExporterAPI
{
    private $docClass;
    private $docInterface;

    private $docblocks = true;
    
    /**
     * Option to add time/id information as comments
     * @param boolean $value
     */
    /*public function setStamp($value)
    {
        $this->stamp = $value;
    }
    
    public function getStamp()
    {
        return $this->stamp;
    }*/
    
    /**
     * Option to add docblocks
     * 
     * @param boolean $value Set to true to include docblocks
     */
    public function setDocblocks($value)
    {
        $this->docblocks = $value;
    }
    
    public function getDocblocks()
    {
        return $this->docblocks;
    }
    
    public function export($outDir)
    {
        $userCurrentDir = getcwd();
        
        if (substr($outDir, -1) != DIRECTORY_SEPARATOR)
            $outDir .= DIRECTORY_SEPARATOR;
        parent::export($outDir);
        
        $this->ctx = new PHP_UML_Output_ApiContextPackage();

        $this->docClass     = new PHP_UML_Output_Php_DocClass($this);
        $this->docInterface = new PHP_UML_Output_Php_DocInterface($this);

        chdir($outDir);
        
        // we analyse the inheritance/impl relations beforehand:
        $this->setAllSuperClassifiers($this->structure->packages);
        $this->treatPackage($this->structure->packages);
        
        chdir($userCurrentDir);
    }
    
    /**
     * Recurses into the packages, and generates the detailed files (one file
     * per class/interface/package)
     * 
     * @param PHP_UML_Metamodel_Package $pkg Starting package
     * @param string                    $dir Filepath leading to the current package
     * @param string                    $rpt Relative filepath to the top package
     */
    private function treatPackage(PHP_UML_Metamodel_Package $pkg, $dir='', $rpt='')
    {
        $this->initContextPackage($pkg, $dir, $rpt);
 
        $nbc = count($this->ctx->classes);
        $nbi = count($this->ctx->interfaces);

        for ($i=0; $i<$nbc; $i++)
            $this->docClass->render($i);
 
        for ($i=0; $i<$nbi; $i++)
            $this->docInterface->render($i);

        foreach ($pkg->nestedPackage as $np) {
            $npDir = $dir.$np->name;
            if (!file_exists($npDir))
                mkdir($npDir);
            $this->treatPackage($np, $npDir.DIRECTORY_SEPARATOR, '../'.$rpt);
        }
    }
}
?>