Initial Commit

This commit is contained in:
Riley Schneider
2025-12-03 16:38:10 +01:00
parent c5e26bf594
commit b732d8d4b5
17680 changed files with 5977495 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
<?php
/**
* PHP Parser and UML/XMI generator. Reverse-engineering tool.
*
* A package to scan PHP files and directories, and get an UML/XMI representation
* of the parsed classes/packages.
*
* 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: 97 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.baptisteautin.com/projects/PHP_UML/
* @since $Date: 2009-01-04 21:57:08 +0100 (dim., 04 janv. 2009) $
*/
/**
* A subclass for PHP_UML_Exception
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @link http://pear.php.net/package/PHP_UML
*/
class PHP_UML_Exception extends PEAR_Exception
{
}
?>

View File

@@ -0,0 +1,96 @@
<?php
/**
* PHP Parser and UML/XMI generator. Reverse-engineering tool.
*
* A package to scan PHP files and directories, and get an UML/XMI representation
* of the parsed classes/packages.
*
* 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: 118 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.baptisteautin.com/projects/PHP_UML/
* @since $Date: 2009-07-11 20:48:51 +0200 (sam., 11 juil. 2009) $
*/
/**
* Specialized iterator for the filesystem scan.
* It can accept/stop the recursive scan, according to allow/ignore file patterns
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @link http://pear.php.net/package/PHP_UML
*/
class PHP_UML_FilePatternFilterIterator extends RecursiveFilterIterator
{
protected $ignored;
protected $allowed;
/**
* Constructor
*
* @param Iterator $iterator Iterator object
* @param array $ignored Ignore pattern(s)
* @param array $allowed Match pattern(s)
*/
public function __construct(Iterator $iterator, $ignored, $allowed)
{
parent::__construct($iterator);
$this->ignored = $ignored;
$this->allowed = $allowed;
}
/**
* Filter files and folders.
* If the element is a file or a folder, it must not be among the ingored elts.
* If it a file, it must match the file patterns.
*
* @return boolean True if the element is acceptable
*/
public function accept()
{
$ptr = $this->getInnerIterator()->current();
$filename = $ptr->getFilename();
$pathname = $ptr->getPathname();
// it must not be ignored:
foreach ($this->ignored as $pattern) {
$pregPattern = '/'.
str_replace(array('\*', '\?'), array('.*', '.'), preg_quote(DIRECTORY_SEPARATOR.$pattern, '/')).
'$/i';
if (preg_match($pregPattern, $pathname)>0) {
return false;
}
}
// and it must match:
if ($ptr->isFile()) {
foreach ($this->allowed as $pattern) {
$pregPattern = '/^'.
str_replace(array('\*', '\?'), array('.*', '.'), preg_quote($pattern, '/')).
'$/i';
if (preg_match($pregPattern, $filename)>0) {
return true;
}
}
return false;
}
return true;
}
/**
* We must override that method to pass the ignored/allowed arrays
*
* @return PHP_UML_FilterIterator
*/
public function getChildren()
{
return new self($this->getInnerIterator()->getChildren(), $this->ignored, $this->allowed);
}
}
?>

View File

@@ -0,0 +1,155 @@
<?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: 105 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.baptisteautin.com/projects/PHP_UML/
* @since $Date: 2009-06-04 19:48:27 +0200 (jeu., 04 juin 2009) $
*/
/**
* A superclass for scanning files and folders. It does nothing but browsing
* recursively the file system tree, given a list of entry folders. At least
* one folder must be provided.
* It can be seen as an extension of RecursiveDirectoryIterator, upon which
* it is based.
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*
*/
abstract class PHP_UML_FileScanner
{
/**
* List of directories to scan
*
* @var array
*/
protected $directories = array();
/**
* List of files to scan
*
* @var array
*/
protected $files = array();
/**
* Allowed path-/file-names (possible wildcards are ? and *)
*
* @var array
*/
protected $matchPatterns = array('*.php');
/**
* Ignored directories (possible wildcards are ? and *)
*
* @var array();
*/
protected $ignorePatterns = array();
/**
* Constructor
*
*/
public function __construct()
{
}
/**
* This function will be called every time the scanner meets
* a new file (while it looks into the folders), as well as for
* each file defined in the property $files.
* It's up to the subclass to define the treatment to be done.
*
* @param mixed $basedir Directory path
*
* @param string $filename File name
*/
abstract function tickFile($basedir, $filename);
/**
* Starts the scan
*
*/
public function scan()
{
// We parse the directories
foreach ($this->directories as $pathItem) {
$baseDir = realpath($pathItem);
$trailing = substr($baseDir, -1);
if ($baseDir != false && is_dir($baseDir) && is_readable($baseDir)) {
if ($trailing != '/' && $trailing != '\\')
$baseDir .= DIRECTORY_SEPARATOR;
$objects = new RecursiveIteratorIterator(
new PHP_UML_FilePatternFilterIterator(
new RecursiveDirectoryIterator($baseDir), $this->ignorePatterns, $this->matchPatterns
)
);
$baseDirPos = strlen($baseDir);
foreach ($objects as $ptr) {
$relativePath = substr($ptr->getPathname(), $baseDirPos);
$this->tickFile($baseDir, $relativePath);
}
}
else
$this->raiseUnknownFolderException($pathItem);
}
// We parse the files
foreach ($this->files as $filenameItem) {
$filenameItem = realpath($filenameItem);
$baseDir = dirname($filenameItem).DIRECTORY_SEPARATOR;
$baseName = basename($filenameItem);
if ($filenameItem != false)
$this->tickFile($baseDir, $baseName);
}
}
/**
* Can be overriden to treat unknown folder exception
*
* @param string $basedir Directory name
*/
public function raiseUnknownFolderException($basedir)
{
}
public function setFiles(array $files)
{
$this->files = $files;
}
public function setDirectories(array $directories)
{
$this->directories = $directories;
}
public function setMatchPatterns(array $patterns)
{
$this->matchPatterns = $patterns;
}
public function setIgnorePatterns(array $patterns)
{
$this->ignorePatterns = $patterns;
}
}
?>

View File

@@ -0,0 +1,41 @@
<?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: 178 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 03:08:06 +0200 (lun., 19 sept. 2011) $
*/
/**
* Defines a way to import external data, and to get the result as a UML model
* (as a superstructure)
*
* @category PHP
* @package PHP_UML
* @subpackage Input
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
interface PHP_UML_Input_Importer
{
/**
* Get the resulting, final model
*
* @return PHP_UML_Metamodel_Superstructure
*/
public function getModel();
/**
* Import data
*
*/
public function import();
}
?>

View File

@@ -0,0 +1,74 @@
<?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: 178 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 03:08:06 +0200 (lun., 19 sept. 2011) $
*/
/**
* Defines a way to import data by relying on a scan of a set of files/folders,
* and then get the result as a UML model (as a superstructure).
* Implements PHP_UML_Input_Importer.
*
* @category PHP
* @package PHP_UML
* @subpackage Input
* @abstract
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Input_ImporterFileScanner extends PHP_UML_FileScanner
{
/**
* Superstructure (model) to fill
*
* @var PHP_UML_Metamodel_Superstructure
*/
protected $model;
public function __construct(PHP_UML_Metamodel_Superstructure $model = null)
{
if (!isset($model)) {
$this->model = new PHP_UML_Metamodel_Superstructure();
$this->model->initModel();
} else {
$this->model = $model;
}
}
/**
* Get the resulting, final model
*
* @return PHP_UML_Metamodel_Superstructure
*/
public function getModel()
{
return $this->model;
}
public abstract function import();
/**
* Set an initial model
*
* @param PHP_UML_Metamodel_Superstructure $model New model
*/
public function setModel(PHP_UML_Metamodel_Superstructure $model)
{
$this->model = $model;
}
public function raiseUnknownFolderException($basedir)
{
throw new PHP_UML_Exception($basedir.': unknown folder.');
}
}
?>

View File

@@ -0,0 +1,79 @@
<?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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.baptisteautin.com/projects/PHP_UML/
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* A PHP implementation of a FileScanner.
*
* @category PHP
* @package PHP_UML
* @subpackage Input
* @subpackage PHP
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*
*/
class PHP_UML_Input_PHP_FileScanner extends PHP_UML_Input_ImporterFileScanner
{
/**
* Parser to use for the next parsing
*
* @var PHP_UML_Input_PHP_Parser
*/
private $parser;
/**
* ParserOptions to use for the next parsing
*
* @var PHP_UML_Input_PHP_ParserOptions
*/
private $parserOptions;
public function setParserOptions(PHP_UML_Input_PHP_ParserOptions $options)
{
$this->parserOptions = $options;
}
public function getParserOptions()
{
return $this->parserOptions;
}
public function import()
{
if (empty($this->parser)) {
$this->parser = new PHP_UML_Input_PHP_ParserImpl($this->model, $this->parserOptions);
}
parent::scan();
$resolver = PHP_UML_Input_PHP_ParserImpl::getResolver();
$resolver->resolve($this->model->packages, array($this->model->packages));
}
/**
* Implementation of tickFile() : we parse every file met.
*
* @param string $basedir Directory path
* @param string $filename File name
*
* @see PHP_UML/UML/FileScanner#tickFile()
*/
public function tickFile($basedir, $filename)
{
$this->parser->parse($basedir, $filename);
}
}
?>

View File

@@ -0,0 +1,55 @@
<?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: 175 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-15 17:07:58 +0200 (jeu., 15 sept. 2011) $
*/
/**
* The PHP parser.
* It stores all the program elements of a PHP file in
* a PHP_UML_Metamodel_Superstructure object.
*
* @category PHP
* @package PHP_UML
* @subpackage Input
* @subpackage PHP
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Input_PHP_Parser
{
const T_NS_SEPARATOR = '\\';
const T_NS_SEPARATOR2 = '::'; // for backward compat
/**
* Constructor
*
* @param PHP_UML_Metamodel_Superstructure &$struct An empty instance of metamodel (superstructure)
* @param bool $docblocks Set to true to interpret docblocks (@package, types)
* @param bool $dollar Set to true to keep the symbol $ in variable names
* @param bool $internal Set to true to skip elements tagged with @internal
* @param bool $onlyApi Set to true to include only the elements tagged with @api
* @param bool $pureObj Set to true to discard procedural code
*/
abstract public function __construct(PHP_UML_Metamodel_Superstructure &$struct, $docblocks = true, $dollar = true, $internal = true, $onlyApi = false, $pureObj = false);
/**
* Parse a PHP file
*
* @param string $fileBase Full path, or base directory
* @param string $filePath Pathfile (relative to $fileBase)
*/
abstract public function parse($fileBase, $filePath);
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
<?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: 175 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.baptisteautin.com/projects/PHP_UML/
* @since $Date: 2011-09-15 17:07:58 +0200 (jeu., 15 sept. 2011) $
*/
/**
* Defines the settings and options selected for a parsing
*
* @category PHP
* @package PHP_UML
* @subpackage Input
* @subpackage PHP
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*
*/
class PHP_UML_Input_PHP_ParserOptions
{
public $keepDocblocks = true;
public $keepDollar = true;
public $skipInternal = true;
public $onlyApi = false;
public $strict = false;
}
?>

View File

@@ -0,0 +1,361 @@
<?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: 178 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.baptisteautin.com/projects/PHP_UML/
* @since $Date: 2011-09-19 03:08:06 +0200 (lun., 19 sept. 2011) $
*/
/**
* Builder class to build a Superstructure from XMI 2.1.2
*
* @category PHP
* @package PHP_UML
* @subpackage Input
* @subpackage XMI
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*
*/
class PHP_UML_Input_XMI_Builder
{
/**
* Current XPath object
*
* @var DOMXPath
*/
protected $xpath;
/**
* Package to build
*
* @var PHP_UML_Metamodel_Package
*/
protected $package;
/**
* Reference to a Superstructure. Needed when comments have to be added
* through Tags and Stereotypes.
*
* @var PHP_UML_Metamodel_Superstructure
*/
protected $model;
/**
* Constructor
*
*/
public function __construct()
{
}
public function setModel(PHP_UML_Metamodel_Superstructure $model)
{
$this->model = $model;
$this->package = &$model->packages;
}
public function getModel()
{
return $this->model;
}
/**
* Retrieve an implementation of TypeResolver
*
* @return PHP_UML_Metamodel_TypeResolver
*/
public static function getResolver()
{
return new PHP_UML_Metamodel_TypeResolverById();
}
/**
* Set the initial package to build
*
* @param PHP_UML_Metamodel_Package $package Starting package
*/
public function setPackage(PHP_UML_Metamodel_Package $package)
{
$this->package = $package;
}
/**
* Return the current package
*
* @return PHP_UML_Metamodel_Package
*/
public function getPackage()
{
return $this->package;
}
/**
* Build the package from an XMI document, provided as a DOM document
*
* @param DOMDocument $doc DOM document to use as source for the build
*/
public function buildDom(DOMDocument $doc)
{
$this->xpath = new DOMXPath($doc);
$this->xpath->registerNamespace('php', 'http://pear.php.net/package/PHP_UML');
// to avoid error "Undefined namespace prefix" when the ns declaration
// is in the node uml:Model, we have to query like this:
$entries = $this->xpath->query('//*[local-name()="Model"]');
foreach ($entries as $entry) {
$this->package = $this->addPackage($entry);
}
}
protected function addPackage(DOMElement $package, PHP_UML_Metamodel_Package &$nestingPackage = null)
{
$p = new PHP_UML_Metamodel_Package;
$p->id = $package->getAttribute('xmi:id');
$p->name = $package->getAttribute('name');
$p->nestedPackage = array();
if (!is_null($nestingPackage))
$nestingPackage->nestedPackage[] = $p;
$p->nestingPackage = $nestingPackage;
$classifiers = $this->xpath->query('packagedElement[@xmi:type="uml:Class" or @xmi:type="uml:AssociationClass"]', $package);
$this->addClasses($classifiers, $p);
$classifiers = $this->xpath->query('packagedElement[@xmi:type="uml:Interface"]', $package);
$this->addInterfaces($classifiers, $p);
$classifiers = $this->xpath->query('packagedElement[@xmi:type="uml:DataType"]', $package);
$this->addDatatypes($classifiers, $p);
$this->addComment($package, $p);
$packages = $this->xpath->query('packagedElement[@xmi:type="uml:Package"]', $package);
foreach ($packages as $item) {
$this->addPackage($item, $p);
}
return $p;
}
protected function addClasses(DOMNodeList $entries, PHP_UML_Metamodel_Package $package)
{
foreach ($entries as $entry) {
$this->addClass($entry, $package);
}
}
protected function addInterfaces(DOMNodeList $entries, PHP_UML_Metamodel_Package $package)
{
foreach ($entries as $entry) {
$this->addInterface($entry, $package);
}
}
protected function addDatatypes(DOMNodeList $element, PHP_UML_Metamodel_Package $package)
{
foreach ($element as $item) {
$this->addDatatype($item, $package);
}
}
protected function addDatatype(DOMElement $element, PHP_UML_Metamodel_Package $package)
{
$c = new PHP_UML_Metamodel_Datatype();
$c->name = $element->getAttribute('name');
$c->id = $element->getAttribute('xmi:id');
$c->package = $package;
$package->ownedType[] = $c;
}
protected function addClass(DOMElement $element, PHP_UML_Metamodel_Package $package)
{
$c = new PHP_UML_Metamodel_Class();
$c->name = $element->getAttribute('name');
$c->id = $element->getAttribute('xmi:id');
$parameters = $this->xpath->query('//packagedElement[@xmi:type="uml:Realization" and @client="'.$c->id.'"]');
foreach ($parameters as $item) {
$tgId = $item->getAttribute('realizingClassifier');
if (empty($tgId))
$tgId = $item->getAttribute('supplier');
if (!empty($tgId))
$c->implements[] = $tgId;
}
$this->addClassifierFeatures($element, $c);
$this->addProperties($element, $c);
$this->addOperations($element, $c);
$this->addComment($element, $c);
$c->package = $package;
$package->ownedType[] = $c;
}
protected function addComment(DOMElement $element, PHP_UML_Metamodel_NamedElement $c)
{
$description = '';
$parameters = $this->xpath->query('ownedComment', $element);
foreach ($parameters as $item) {
$description = trim($item->getAttribute('body').$item->nodeValue);
}
if ($description=='') {
$parameters = $this->xpath->query('//packagedComment[@annotatedElement="'.$c->id.'"]|//*[@xmi:type="uml:Comment" and @annotatedElement="'.$c->id.'"]');
foreach ($parameters as $item) {
$description = trim($item->getAttribute('body').$item->nodeValue);
}
}
$parameters = $this->xpath->query('//php:docblock[@base_Element="'.$c->id.'"]');
$docblocks = array();
foreach ($parameters as $item) {
foreach ($item->childNodes as $item) {
$docblock = array();
$nodeName = $item->nodeName;
$pos = strpos($nodeName, ':');
$docblock[] = ($pos===false ? $nodeName : substr($nodeName, $pos+1));
$docblock[] = $docblock[0]; // see how tags were initially set in Parser
$docblock[] = $item->nodeValue;
$docblocks[] = $docblock;
}
}
if ((!empty($description)) || count($docblocks)>0) {
$this->model->addDocTags($c, $description, $docblocks);
}
}
protected function addInterface(DOMElement $element, PHP_UML_Metamodel_Package $package)
{
$c = new PHP_UML_Metamodel_Interface();
$c->name = $element->getAttribute('name');
$c->id = $element->getAttribute('xmi:id');
$this->addClassifierFeatures($element, $c);
$this->addProperties($element, $c);
$this->addOperations($element, $c);
$this->addComment($element, $c);
$c->package = $package;
$package->ownedType[] = $c;
}
protected function addProperties(DOMElement $element, PHP_UML_Metamodel_Classifier $class)
{
$attributes = $this->xpath->query('ownedAttribute', $element);
foreach ($attributes as $item) {
$this->addProperty($item, $class);
}
}
protected function addOperations(DOMElement $element, PHP_UML_Metamodel_Classifier $class)
{
$operations = $this->xpath->query('ownedOperation', $element);
foreach ($operations as $item) {
$this->addOperation($item, $class);
}
}
protected function addOperation(DOMElement $element, PHP_UML_Metamodel_Classifier $class)
{
$a = new PHP_UML_Metamodel_Operation;
$a->name = $element->getAttribute('name');
$a->id = $element->getAttribute('xmi:id');
$parameters = $this->xpath->query('ownedParameter', $element);
foreach ($parameters as $item) {
$this->addParameter($item, $a);
}
$a->isInstantiable = !($element->getAttribute('isStatic') == 'true');
$a->isReadOnly = ($element->getAttribute('isReadOnly') == 'true');
$a->visibility = $element->getAttribute('visibility');
$this->addComment($element, $a);
$a->class = $class;
$class->ownedOperation[] = $a;
}
protected function addParameter(DOMElement $element, PHP_UML_Metamodel_Operation $o)
{
$a = new PHP_UML_Metamodel_Parameter();
$a->name = $element->getAttribute('name');
$a->id = $element->getAttribute('xmi:id');
$a->direction = $element->getAttribute('direction');
$this->addDefaultValueAndType($element, $a);
$o->ownedParameter[] = $a;
$a->operation = $o;
}
protected function addProperty(DOMElement $element, PHP_UML_Metamodel_Class $class)
{
$a = new PHP_UML_Metamodel_Property();
$a->name = $element->getAttribute('name');
if ($a->name=='')
return;
$a->id = $element->getAttribute('xmi:id');
$this->addDefaultValueAndType($element, $a);
$a->isInstantiable = !($element->getAttribute('isStatic') == 'true');
$a->isReadOnly = ($element->getAttribute('isReadOnly') == 'true');
$a->visibility = $element->getAttribute('visibility');
$this->addComment($element, $a);
$a->class = $class;
$class->ownedAttribute[] = $a;
}
protected function addClassifierFeatures(DOMElement $element, PHP_UML_Metamodel_Classifier &$c)
{
$parameters = $this->xpath->query('generalization|*[@type="uml:Generalization"]', $element);
foreach ($parameters as $item) {
$c->superClass[] = $item->getAttribute('general');
}
$c->isAbstract = ($element->getAttribute('isAbstract')=='true');
$c->isReadOnly = ($element->getAttribute('isReadOnly')=='true');
}
protected function addDefaultValueAndType($element, PHP_UML_Metamodel_TypedElement $a)
{
$type = $this->xpath->query('type', $element);
if ($type->length>0) {
$a->type = $type->item(0)->getAttribute('xmi:idref');
if ($a->type=='')
$a->type = $type->item(0)->getAttribute('href');
}
$dv = $this->xpath->query('defaultValue', $element);
if ($dv->length>0) {
$v = $dv->item(0)->getAttribute('value');
if ($v=='') {
$v = $dv->item(0)->nodeValue;
}
$a->default = $v;
}
}
}
?>

View File

@@ -0,0 +1,70 @@
<?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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.baptisteautin.com/projects/PHP_UML/
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* An XMI implementation of an ImporterFileScanner.
*
* @category PHP
* @package PHP_UML
* @subpackage Input
* @subpackage XMI
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*
*/
class PHP_UML_Input_XMI_FileScanner extends PHP_UML_Input_ImporterFileScanner
{
public function import()
{
parent::scan();
$this->model->addInternalPhpTypes();
$resolver = PHP_UML_Input_XMI_Builder::getResolver();
$resolver->resolve($this->model->packages, array($this->model->packages));
}
/**
* Implementation of tickFile(): we update the model with the information
* found in the XMI file.
*
* @param string $fileBase Directory path
* @param string $filePath File name
*
* @see PHP_UML/UML/FileScanner#tickFile()
*/
public function tickFile($fileBase, $filePath)
{
$filename = $fileBase.$filePath;
if (!(file_exists($filename) && is_readable($filename))) {
throw new PHP_UML_Exception('Could not read '.$filename.'.');
}
$doc = new DOMDocument();
if (!$doc->load($filename))
return;
if (PHP_UML_Output_XmiDocument::isVersion1($doc)) {
$xmi = PHP_UML_Output_ExporterXSL::convertTo2($doc->saveXML());
$doc->loadXML($xmi);
}
$builder = new PHP_UML_Input_XMI_Builder();
$builder->setModel($this->model);
$builder->buildDom($doc);
$this->model = $builder->getModel();
}
}
?>

View File

@@ -0,0 +1,32 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 136 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2009-12-10 01:35:58 +0100 (jeu., 10 déc. 2009) $
*/
/**
* Meta-File
*
*/
class PHP_UML_Metamodel_Artifact extends PHP_UML_Metamodel_NamedElement
{
/**
* Array of classes/interfaces declarations contained in that file
*
* @var array
*/
public $manifested = array();
public $package;
}
?>

View File

@@ -0,0 +1,28 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 135 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-11-30 01:21:11 +0100 (lun., 30 nov. 2009) $
*/
/**
* Meta-Class
*
*/
class PHP_UML_Metamodel_Class extends PHP_UML_Metamodel_Classifier
{
public $ownedAttribute = array();
public $isInstantiable;
public $implements = array();
}
?>

View File

@@ -0,0 +1,35 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* 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: 138 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-12-13 04:23:11 +0100 (dim., 13 déc. 2009) $
*
*/
/**
* Metaclass for classifier
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
*/
abstract class PHP_UML_Metamodel_Classifier extends PHP_UML_Metamodel_Type
{
public $superClass = array();
public $ownedOperation = array();
public $file;
public $package;
public $isAbstract;
public $isReadOnly;
}
?>

View File

@@ -0,0 +1,29 @@
<?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: 138 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-12-13 04:23:11 +0100 (dim., 13 déc. 2009) $
*
*/
/**
* Datatype metaclass
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
*/
class PHP_UML_Metamodel_Datatype extends PHP_UML_Metamodel_Classifier
{
}
?>

View File

@@ -0,0 +1,40 @@
<?php
/**
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 136 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2009-12-10 01:35:58 +0100 (jeu., 10 déc. 2009) $
*
*/
/**
* Meta-Enumeration
* Enumerates some basic PHP classifiers.
*
*/
class PHP_UML_Metamodel_Enumeration
{
/**
* PHP datatypes
*
* @var array
*/
static public $datatypes = array('mixed', 'array', 'string', 'int', 'integer',
'bool', 'boolean', 'float', 'void', 'null', 'object', 'resource');
static public $interfaces = array('Iterator', 'Countable');
static public $classes = array('Exception');
/**
* Main file types. Used as stereotypes for qualifying the artifacts.
*
* @var array
*/
static public $filetype = array('PHP File');
}
?>

View File

@@ -0,0 +1,244 @@
<?php
/**
* PHP_UML (PHP/MOF program elements classes)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 175 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2011-09-15 17:07:58 +0200 (jeu., 15 sept. 2011) $
*
*/
/**
* Helper class to deal with Metamodel elements.
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Metamodel_Helper
{
const META_INTERFACE = 'PHP_UML_Metamodel_Interface';
const META_CLASS = 'PHP_UML_Metamodel_Class';
const META_DATATYPE = 'PHP_UML_Metamodel_Datatype';
const META_OPERATION = 'PHP_UML_Metamodel_Operation';
const META_PROPERTY = 'PHP_UML_Metamodel_Property';
const PHP_PROFILE_NAME = 'php';
const PHP_STEREOTYPE_DOCBLOCK = 'docblock';
/**
* Deletes all empty packages
*
* @param PHP_UML_Metamodel_Package &$ns Top package
*/
static public function deleteEmptyPackages(PHP_UML_Metamodel_Package &$ns)
{
if (!is_null($ns->nestedPackage)) {
foreach ($ns->nestedPackage as $key => &$pkg) {
if (self::isEmpty($pkg)) {
unset($ns->nestedPackage[$key]);
} else {
if (self::deleteEmptyPackages($pkg)) {
unset($ns->nestedPackage[$key]);
}
}
}
if (self::isEmpty($ns)) {
return true;
}
}
return false;
}
/**
* Checks if a package is empty
*
* @param PHP_UML_Metamodel_Package $p Top package
*/
static private function isEmpty(PHP_UML_Metamodel_Package $p)
{
return empty($p->nestedPackage) && empty($p->ownedType) && empty($p->ownedOperation) && empty($p->ownedAttribute);
}
/**
* Searches in a given package for a typed element (likely, a class)
*
* @param PHP_UML_Metamodel_Package $ns A package element
* @param string $value A name
*
* @return mixed Either FALSE if not found, or the element
*/
public static function searchTypeIntoPackage(PHP_UML_Metamodel_Package $ns, $value)
{
foreach ($ns->ownedType as $key => &$o) {
if (strcasecmp($o->name, $value)==0) {
return $o;
}
}
return false;
}
/**
* Searches if an operation already exists in a given pkg
*
* @param PHP_UML_Metamodel_Package $ns A package element
* @param string $value A name
*
* @return mixed Either FALSE if not found, or the element
*/
static public function searchOperationIntoPackage(PHP_UML_Metamodel_Package $ns, $value)
{
foreach ($ns->ownedOperation as $key => &$o) {
if (strcasecmp($o->name, $value)==0) {
return $o;
}
}
return false;
}
/**
* Searches if an attribute already exists in a given pkg
*
* @param PHP_UML_Metamodel_Package $ns A package element
* @param string $value A name
*
* @return mixed Either FALSE if not found, or the element
*/
public static function searchAttributeIntoPackage(PHP_UML_Metamodel_Package $ns, $value)
{
foreach ($ns->ownedAttribute as $key => &$o) {
if (strcasecmp($o->name, $value)==0) {
return $o;
}
}
return false;
}
/**
* Retrieves a particular tag in a given stereotype
*
* @param PHP_UML_Metamodel_Stereotype $s The stereotype
* @param string $tagName The tag name (eg "description")
*
* @return PHP_UML_Metamodel_Tag
*/
public static function getStereotypeTag(PHP_UML_Metamodel_Stereotype $s, $tagName)
{
if (!empty($s)) {
foreach ($s->ownedAttribute as $tag) {
if ($tag->name == $tagName)
return $tag;
}
}
return null;
}
/**
* Searches recursively in a given package for an element, knowing its ID
*
* @param PHP_UML_Metamodel_Package $np A package element (context)
* @param string $value An ID
*
* @return mixed Either FALSE if not found, or the position in the stack
*/
public static function findTypeById(PHP_UML_Metamodel_Package $np, $value)
{
if ($np->id == $value)
return $np;
foreach ($np->ownedType as $item) {
if ($item->id == $value)
return $item;
}
foreach ($np->ownedAttribute as $item) {
if ($item->id == $value)
return $item;
}
foreach ($np->ownedOperation as $item) {
if ($item->id == $value)
return $item;
}
foreach ($np->nestedPackage as $item) {
$ret = self::findTypeById($item, $value);
if (!($ret === false))
return $ret;
}
return false;
}
/**
* Searches recursively in a given package for a package, knowing its name
* Works with position numbers, not variable references.
*
* @param PHP_UML_Metamodel_Package $np A package element (context)
* @param string $value A package name (to find)
*
* @return mixed Either FALSE if not found, or the position in the stack
*/
public static function findSubpackageByName(PHP_UML_Metamodel_Package $np, $value)
{
foreach ($np->nestedPackage as $pkg) {
if (strcasecmp($pkg->name, $value)==0) {
return $pkg;
}
}
return false;
}
/**
* Splits a package path into its first/last element, and the rest
* Allows for the two different versions of package delimiter
*
* @param string $path A path to split
* @param bool $modeFirst If true, splits into 1st and the rest
* If false, splits into last and the rest
* @param string $alt Alternate separator (eg, /, or ::)
*
* @return array Results array
*/
static public function getPackagePathParts($path, $modeFirst = true, $alt=PHP_UML_Input_PHP_Parser::T_NS_SEPARATOR2)
{
$first = '';
$last = '';
if ($modeFirst) {
$pos1 = strpos($path, PHP_UML_Input_PHP_Parser::T_NS_SEPARATOR);
$pos2 = strpos($path, $alt);
if ($pos1!==false && ($pos1<$pos2 || $pos2===false)) {
$pos = $pos1;
$len = strlen(PHP_UML_Input_PHP_Parser::T_NS_SEPARATOR);
} else {
$pos = $pos2;
$len = strlen($alt);
}
} else {
$pos1 = strrpos($path, PHP_UML_Input_PHP_Parser::T_NS_SEPARATOR);
$pos2 = strrpos($path, $alt);
if ($pos1!==false && ($pos1>$pos2 || $pos2===false)) {
$pos = $pos1;
$len = strlen(PHP_UML_Input_PHP_Parser::T_NS_SEPARATOR);
} else {
$pos = $pos2;
$len = strlen($alt);
}
}
if ($pos===false)
$first = $path;
else {
$first = substr($path, 0, $pos);
$last = substr($path, $pos+$len);
}
return array($pos, $first, $last);
}
}
?>

View File

@@ -0,0 +1,22 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 135 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-11-30 01:21:11 +0100 (lun., 30 nov. 2009) $
*
*/
class PHP_UML_Metamodel_Interface extends PHP_UML_Metamodel_Classifier
{
}
?>

View File

@@ -0,0 +1,57 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* This is a PHP metamodel, inspired by the MOF Metamodel.
* It defines the various elements of the PHP language that have been parsed
* by the parser, and that we want to reverse-engineer.
*
* For more information on language metamodels, see :
* - The OMG website, and its MOF standard
* - Ceejay, a Java/C++ Code Generation Metamodel for ULF-Ware (M. Piefel)
*
* @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: 138 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-12-13 04:23:11 +0100 (dim., 13 déc. 2009) $
*/
/**
* The NamedElement class
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Metamodel_NamedElement
{
/**
* Unique identifier
*
* @var string
*/
public $id;
/**
* Name
*
* @var string
*/
public $name;
/**
* Reference to a "documention" stereotype
*
* @var PHP_UML_Metamodel_Stereotype
*/
public $description;
}
?>

View File

@@ -0,0 +1,29 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 133 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-11-15 23:46:39 +0100 (dim., 15 nov. 2009) $
*
*/
class PHP_UML_Metamodel_Operation extends PHP_UML_Metamodel_NamedElement
{
public $isAbstract;
public $isInstantiable;
public $ownedParameter = array();
public $class;
public $package;
public $visibility;
public $file;
}
?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 133 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-11-15 23:46:39 +0100 (dim., 15 nov. 2009) $
*
*/
class PHP_UML_Metamodel_Package extends PHP_UML_Metamodel_NamedElement
{
public $nestingPackage;
public $nestedPackage = array();
public $ownedType = array();
public $ownedOperation = array();
public $ownedAttribute = array();
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 73 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2008-12-17 01:30:18 +0100 (mer., 17 déc. 2008) $
*
*/
class PHP_UML_Metamodel_Parameter extends PHP_UML_Metamodel_TypedElement
{
public $default;
public $operation;
public $direction;
}
?>

View File

@@ -0,0 +1,29 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 133 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-11-15 23:46:39 +0100 (dim., 15 nov. 2009) $
*
*/
class PHP_UML_Metamodel_Property extends PHP_UML_Metamodel_TypedElement
{
public $isReadOnly;
public $isInstantiable;
public $visibility;
public $default;
public $class;
public $package;
public $file;
}
?>

View File

@@ -0,0 +1,33 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 97 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-01-04 21:57:08 +0100 (dim., 04 janv. 2009) $
*/
/**
* The stereotype class
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Metamodel_Stereotype extends PHP_UML_Metamodel_NamedElement
{
public $element;
public $ownedAttribute = array();
public $profile;
}
?>

View File

@@ -0,0 +1,287 @@
<?php
/**
* PHP_UML (PHP/MOF program elements classes)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 175 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2011-09-15 17:07:58 +0200 (jeu., 15 sept. 2011) $
*
*/
/**
* A superstructure is a set composed of a UML model, a physical model,
* and some stereotypes associated to the UML model.
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Metamodel_Superstructure
{
const META_INTERFACE = 'PHP_UML_Metamodel_Interface';
const META_CLASS = 'PHP_UML_Metamodel_Class';
const META_DATATYPE = 'PHP_UML_Metamodel_Datatype';
const META_OPERATION = 'PHP_UML_Metamodel_Operation';
const META_PROPERTY = 'PHP_UML_Metamodel_Property';
const PHP_PROFILE_NAME = 'php';
const PHP_STEREOTYPE_DOCBLOCK = 'docblock';
/**
* The root package for a logical UML model
*
* @var PHP_UML_Metamodel_Package
*/
public $packages;
/**
* The root package for a deployment (physical) model
*
* @var PHP_UML_Metamodel_Package
*/
public $deploymentPackages;
/**
* Stack of all stereotypes
* TODO: when real stereotypes will be implemented, deleting that array, and
* reading the stereotypes from the $packages instead
*
* @var array
*/
public $stereotypes = array();
/**
* Constructor
*
*/
public function __construct()
{
}
/**
* Adds the internal PHP metatypes, metaclasses, metainterfaces...
*
*/
public function addInternalPhpTypes()
{
foreach (PHP_UML_Metamodel_Enumeration::$datatypes as $d) {
$type = new PHP_UML_Metamodel_Datatype;
$type->id = PHP_UML_SimpleUID::getUID();
$type->name = $d;
$this->addRootType($type, 'Internal PHP type.');
}
foreach (PHP_UML_Metamodel_Enumeration::$interfaces as $i) {
$type = new PHP_UML_Metamodel_Interface;
$type->id = PHP_UML_SimpleUID::getUID();
$type->name = $i;
$this->addRootType($type, 'Internal PHP interface.');
}
foreach (PHP_UML_Metamodel_Enumeration::$classes as $c) {
$type = new PHP_UML_Metamodel_Class;
$type->id = PHP_UML_SimpleUID::getUID();
$type->name = $c;
$this->addRootType($type, 'Internal PHP class.');
}
}
private function addRootType(PHP_UML_Metamodel_NamedElement $type, $desc)
{
if (!PHP_UML_Metamodel_Helper::searchTypeIntoPackage($this->packages, $type->name)) {
$this->packages->ownedType[] = $type;
$this->addDocTags($type, $desc);
}
}
/**
* Creates a stereotype and the necessary Tag objects for a given element
*
* @param PHP_UML_Metamodel_NamedElement &$element The element to document
* @param string $desc A textual description
* @param array $docs An array containing docblocks
*/
public function addDocTags(PHP_UML_Metamodel_NamedElement &$element, $desc, array $docs = array())
{
$stereotype = $this->createStereotype($element, self::PHP_PROFILE_NAME, self::PHP_STEREOTYPE_DOCBLOCK);
if ($desc != '') {
$tag = new PHP_UML_Metamodel_Tag;
$tag->id = PHP_UML_SimpleUID::getUID();;
$tag->name = 'description';
$tag->value = $desc;
$stereotype->ownedAttribute[] = $tag;
}
foreach ($docs as $doc) {
$tag = new PHP_UML_Metamodel_Tag;
$tag->id = PHP_UML_SimpleUID::getUID();;
$tag->name = $doc[1];
$tag->value = trim(implode(' ', array_slice($doc, 2)));
$stereotype->ownedAttribute[] = $tag;
}
$element->description = $stereotype;
}
/**
* Recursively replaces all the "named types" by a proper "reference" to a
* typed element. This impacts:
* - the extended classes and implemented classes (through their
* EMOF-"superClass" and "implements" relations)
* - the function parameters (through their EMOF-"type" attribute)
* - the properties in classes (through their EMOF-"type" attribute)
*
* @param PHP_UML_Metamodel_Package &$ns Package to resolve the elements of
* @param array &$_oDef Default packages to look for
* orphaned elements
*/
private function resolveReferences(PHP_UML_Metamodel_Package &$ns, array &$_oDef)
{
if (!is_null($ns->nestedPackage)) {
foreach ($ns->nestedPackage as $key => &$pkg) {
$this->resolveReferences($pkg, $_oDef);
}
}
if (!is_null($ns->ownedType))
foreach ($ns->ownedType as &$elt) {
if (isset($elt->superClass) && !is_null($elt->superClass)) {
foreach ($elt->superClass as &$className) {
$this->resolveType($ns, $className, $_oDef, $elt);
}
}
if (isset($elt->implements) && !is_null($elt->implements)) {
foreach ($elt->implements as &$className) {
$this->resolveType($ns, $className, $_oDef, $elt);
}
}
if (isset($elt->ownedOperation)) {
foreach ($elt->ownedOperation as &$function) {
foreach ($function->ownedParameter as &$parameter) {
$this->resolveType($ns, $parameter->type, $_oDef, $elt);
}
}
}
if (isset($elt->ownedAttribute)) {
foreach ($elt->ownedAttribute as &$attribute) {
$this->resolveType($ns, $attribute->type, $_oDef, $elt);
}
}
}
if (isset($ns->ownedOperation)) {
foreach ($ns->ownedOperation as &$function) {
foreach ($function->ownedParameter as &$parameter) {
$this->resolveType($ns, $parameter->type, $_oDef, $function);
}
}
}
if (isset($ns->ownedAttribute)) {
foreach ($ns->ownedAttribute as &$attribute) {
$this->resolveType($ns, $attribute->type, $_oDef, $attribute);
}
}
}
/**
* Retrieves the stereotype (named $name) associated to the element $element
* If not found, returns null.
*
* @param PHP_UML_Metamodel_NamedElement $element Related object
* @param string $profileName Profile name
* @param string $stereotypeName Stereotype name
*
* @return PHP_UML_Metamodel_Stereotype
*/
public function getStereotype(PHP_UML_Metamodel_NamedElement $element, $profileName, $stereotypeName)
{
foreach ($this->stereotypes->getIterator() as $s) {
if ($s->element == $element && $s->name == $stereotypeName && $s->profile == $profileName) {
return $s;
}
}
return null;
}
/**
* Creates a stereotype in a given profile, and binds it to a given element
* Returns the stereotype that was created
*
* @param PHP_UML_Metamodel_NamedElement &$element The element
* @param string $profileName The profile name
* @param string $stereotypeName The stereotype name
*
* @return PHP_UML_Metamodel_Stereotype
*/
public function createStereotype(PHP_UML_Metamodel_NamedElement &$element, $profileName, $stereotypeName)
{
$stereotype = new PHP_UML_Metamodel_Stereotype;
$stereotype->profile = $profileName;
$stereotype->name = $stereotypeName;
$stereotype->element = $element;
$this->stereotypes[] = $stereotype;
return $stereotype;
}
/**
* Finalizes the main object structure that the Parser has built.
* Launches the resolution of the references for all stacks from the root pkg
*
* Every reference (a temporary string) is replaced by a PHP reference
* to the corresponding type (that is, a class or a datatype)
* Must be run once the model is complete (= once PHP parsing is done)
*
* @param bool $noEmptyPkg True to force removal of empty packages
* @param array $defPkg Array of PHP_UML_Metamodel_Package where to look into,
* in order to resolve the orphaned elements.
* By default, it will look in the root package. This is,
* by the way, where the PHP datatypes are.
*/
public function finalizeAll($noEmptyPkg = true, $defPkg = array())
{
if ($noEmptyPkg)
PHP_UML_Metamodel_Helper::deleteEmptyPackages($this->packages);
$resolver = new PHP_UML_Metamodel_TypeResolverByName();
$resolver->package = $this->packages;
if (empty($defPkg))
$defPkg = array($this->packages);
else
$defPkg[] = &$this->packages;
$resolver->resolveReferences($this->packages, $defPkg);
}
/**
* Initialize the structure before use (we just instantiate the top objects in
* the logical and deployment models)
*
* @param string $modelName Model name
*/
public function initModel($modelName = 'default')
{
$this->packages = new PHP_UML_Metamodel_Package;
$this->packages->name = $modelName;
$this->packages->id = PHP_UML_SimpleUID::getUID();
$this->addInternalPhpTypes();
$this->deploymentPackages = new PHP_UML_Metamodel_Package;
$this->deploymentPackages->name = 'Deployment View';
$this->deploymentPackages->id = PHP_UML_SimpleUID::getUID();
}
}
?>

View File

@@ -0,0 +1,22 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 97 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-01-04 21:57:08 +0100 (dim., 04 janv. 2009) $
*/
class PHP_UML_Metamodel_Tag extends PHP_UML_Metamodel_NamedElement
{
public $value;
}
?>

View File

@@ -0,0 +1,22 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 135 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2009-11-30 01:21:11 +0100 (lun., 30 nov. 2009) $
*
*/
abstract class PHP_UML_Metamodel_Type extends PHP_UML_Metamodel_NamedElement
{
}
?>

View File

@@ -0,0 +1,99 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 175 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2011-09-15 17:07:58 +0200 (jeu., 15 sept. 2011) $
*
*/
/**
* A TypeResolver is a class designed to correct a Metamodel_Package whose
* relationships between elements are not realized by direct references (nut
* by means of a qualified name, or an ID...)
* Such a tool is particularly needed when building a UML model, as during the
* iteration process, some of the referenced elements may have not yet been met.
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Metamodel_TypeResolver
{
/**
* A reference of the top package of the model to resolve
*
* @var PHP_UML_Metamodel_Package
*/
protected $topPackage;
/**
* List of default packages where to look for orphaned elements
*
* @var array
*/
protected $defaultRepo = array();
/**
* Recursively replaces all the "named types" by a proper "reference" to a
* typed element. This impacts:
* - the extended classes and implemented classes (through their
* EMOF-"superClass" and "implements" relations)
* - the function parameters (through their EMOF-"type" attribute)
* - the properties in classes (through their EMOF-"type" attribute)
*
* @param PHP_UML_Metamodel_Package &$ns Package to resolve the elements of
* @param array $default Default packages where to look for
* orphaned elements
*/
abstract public function resolve(PHP_UML_Metamodel_Package &$ns, array $default);
/**
* Resolution error. Might later be isolated in a specific class.
*
* @param string $element Element
* @param PHP_UML_Metamodel_NamedElement $na NamedElement
*/
static protected function resolutionWarning($element, $na)
{
PHP_UML_Warning::add('Could not resolve '.$element.
(empty($na->file) ? '' : ' in '.$na->file->name));
}
/**
* Retrieve the PHP_UML_Metamodel_Package object related to a package path
* (ie, to a qualified name, like A\B\C).
* Relies on the model->$packages, when references are still named
* (= before their resolution)
*
* @param string $path The path to find
*
* @return PHP_UML_Metamodel_Package The package to find. Null if not found.
*/
protected function getPackageByPath($path)
{
$pkg = $this->topPackage;
do {
list($pos, $first, $path) = PHP_UML_Metamodel_Helper::getPackagePathParts($path);
if ($first!='')
$pkg = PHP_UML_Metamodel_Helper::findSubpackageByName($pkg, $first);
if ($pkg===false)
return false;
} while (!($pos===false));
return $pkg;
}
}
?>

View File

@@ -0,0 +1,146 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 175 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2011-09-15 17:07:58 +0200 (jeu., 15 sept. 2011) $
*
*/
/**
* An implementation of TypeResolver that complete the relationships between the
* elements of a superstructure on the base of the elements ID.
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Metamodel_TypeResolverById extends PHP_UML_Metamodel_TypeResolver
{
public function resolve(PHP_UML_Metamodel_Package &$ns, array $default)
{
$this->topPackage = $ns;
$this->defaultRepo = $default;
$this->resolvePackage($ns);
}
/**
* Recursively replaces all the "named types" by a proper "reference" to a
* typed element. This impacts:
* - the extended classes and implemented classes (through their
* EMOF-"superClass" and "implements" relations)
* - the function parameters (through their EMOF-"type" attribute)
* - the properties in classes (through their EMOF-"type" attribute)
*
* @param PHP_UML_Metamodel_Package &$ns Package to resolve the elements of
*/
private function resolvePackage(PHP_UML_Metamodel_Package &$ns)
{
if (!is_null($ns->nestedPackage)) {
foreach ($ns->nestedPackage as $key => &$pkg) {
$this->resolvePackage($pkg);
}
}
if (!is_null($ns->ownedType))
foreach ($ns->ownedType as &$elt) {
if (isset($elt->superClass) && !is_null($elt->superClass)) {
foreach ($elt->superClass as &$className) {
$this->resolveType($ns, $className, $elt);
}
}
if (isset($elt->implements) && !is_null($elt->implements)) {
foreach ($elt->implements as &$className) {
$this->resolveType($ns, $className, $elt);
}
}
if (isset($elt->ownedOperation)) {
foreach ($elt->ownedOperation as &$function) {
foreach ($function->ownedParameter as &$parameter) {
$this->resolveType($ns, $parameter->type, $elt);
}
}
}
if (isset($elt->ownedAttribute)) {
foreach ($elt->ownedAttribute as &$attribute) {
$this->resolveType($ns, $attribute->type, $elt);
}
}
}
if (isset($ns->ownedOperation)) {
foreach ($ns->ownedOperation as &$function) {
foreach ($function->ownedParameter as &$parameter) {
$this->resolveType($ns, $parameter->type, $function);
}
}
}
if (isset($ns->ownedAttribute)) {
foreach ($ns->ownedAttribute as &$attribute) {
$this->resolveType($ns, $attribute->type, $attribute);
}
}
}
/**
* Does the type resolution for a given element in a given package
*
* @param PHP_UML_Metamodel_Package $pkg The nesting package
* @param string &$element The element to resolve, provided as a name
* @param PHP_UML_Metamodel_Type $context The context (the nesting class/interface, which
* is the only element to know the nesting file)
*/
private function resolveType(PHP_UML_Metamodel_Package $pkg, &$element, PHP_UML_Metamodel_NamedElement $context)
{
if (empty($element)) {
$targetElement = PHP_UML_Metamodel_Helper::searchTypeIntoPackage($this->topPackage, 'mixed');
} else {
$targetElement = PHP_UML_Metamodel_Helper::findTypeById($this->topPackage, $element);
}
if ($targetElement === false)
$targetElement = $this->resolveTypeByUri($element);
if ($targetElement === false) {
self::resolutionWarning($element, $context);
} else {
$element = $targetElement;
}
}
/**
* Resolve a URI type reference by grasping a type name in the URI itself
* (eg. href="http://schema.omg.org/spec/UML/2.1/uml.xml#Integer")
*
* @param string $uri URI to resolve
*/
private function resolveTypeByUri($uri)
{
if (self::isNsUri($uri)) {
foreach ($this->defaultRepo as $itemPkg) {
foreach ($itemPkg->ownedType as $item) {
if (stripos($uri, $item->name) !== false) {
return $item;
}
}
}
}
return false;
}
private static function isNsUri($text)
{
return (strncasecmp($text, 'http://', 7) == 0);
}
}
?>

View File

@@ -0,0 +1,147 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 175 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2011-09-15 17:07:58 +0200 (jeu., 15 sept. 2011) $
*
*/
/**
* An implementation of TypeResolver that completes the relationships between the
* elements of a superstructure by using the elements name.
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Metamodel_TypeResolverByName extends PHP_UML_Metamodel_TypeResolver
{
public function resolve(PHP_UML_Metamodel_Package &$ns, array $default)
{
$this->topPackage = $ns;
$this->defaultRepo = $default;
$this->resolvePackage($ns);
}
/**
* Recursively replaces all the "named types" by a proper reference to a
* typed element. This impacts:
* - the extended classes and implemented classes (through their
* EMOF-"superClass" and "implements" relations)
* - the function parameters (through their EMOF-"type" attribute)
* - the properties in classes (through their EMOF-"type" attribute)
*
* @param PHP_UML_Metamodel_Package &$ns Package to resolve the elements of
*/
private function resolvePackage(PHP_UML_Metamodel_Package &$ns)
{
if (!is_null($ns->nestedPackage)) {
foreach ($ns->nestedPackage as $key => &$pkg) {
$this->resolvePackage($pkg);
}
}
if (!is_null($ns->ownedType))
foreach ($ns->ownedType as &$elt) {
if (isset($elt->superClass) && !is_null($elt->superClass)) {
foreach ($elt->superClass as &$className) {
$this->resolveType($ns, $className, $elt);
}
}
if (isset($elt->implements) && !is_null($elt->implements)) {
foreach ($elt->implements as &$className) {
$this->resolveType($ns, $className, $elt);
}
}
if (isset($elt->ownedOperation)) {
foreach ($elt->ownedOperation as &$function) {
foreach ($function->ownedParameter as &$parameter) {
$this->resolveType($ns, $parameter->type, $elt);
}
}
}
if (isset($elt->ownedAttribute)) {
foreach ($elt->ownedAttribute as &$attribute) {
$this->resolveType($ns, $attribute->type, $elt);
}
}
}
if (isset($ns->ownedOperation)) {
foreach ($ns->ownedOperation as &$function) {
foreach ($function->ownedParameter as &$parameter) {
$this->resolveType($ns, $parameter->type, $function);
}
}
}
if (isset($ns->ownedAttribute)) {
foreach ($ns->ownedAttribute as &$attribute) {
$this->resolveType($ns, $attribute->type, $attribute);
}
}
}
/**
* Does the type resolution for a given element in a given package
*
* @param PHP_UML_Metamodel_Package $pkg The nesting package
* @param string &$element The element to resolve, provided as a name
* @param PHP_UML_Metamodel_Type $context The context (the nesting class/interface, which
* is the only element to know the nesting file)
*/
private function resolveType(PHP_UML_Metamodel_Package $pkg, &$element, PHP_UML_Metamodel_NamedElement $context)
{
// Is there a ns separator (\) in it ?
list($pos, $first, $last) = PHP_UML_Metamodel_Helper::getPackagePathParts($element, false);
if (!($pos===false)) {
$tmpPkg = $this->getPackageByPath($first);
if ($tmpPkg===false) {
self::resolutionWarning($element, $context);
$element = null;
} else {
// Do we know that type?
$_o = PHP_UML_Metamodel_Helper::searchTypeIntoPackage($tmpPkg, $last);
if (!($_o===false)) {
$element = $_o;
} else {
self::resolutionWarning($element, $context);
//$element = null;
}
}
} else {
// Is it in the current package?
$_o = PHP_UML_Metamodel_Helper::searchTypeIntoPackage($pkg, $element);
if (!($_o===false)) {
$element = $_o;
} else {
// Is it in one of the "default" packages?
$found = false;
foreach ($this->defaultRepo as $itemPkg) {
$_o = PHP_UML_Metamodel_Helper::searchTypeIntoPackage($itemPkg, $element);
if (!($_o===false)) {
$element = $_o;
$found = true;
break;
}
}
if (!$found) {
self::resolutionWarning($element, $context);
//$element = null;
}
}
}
}
}
?>

View File

@@ -0,0 +1,23 @@
<?php
/**
* PHP_UML (MOF-like metamodel of language PHP)
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @subpackage Metamodel
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 73 $
* @link http://pear.php.net/package/PHP_UML
* @link http://www.omg.org/mof/
* @since $Date: 2008-12-17 01:30:18 +0100 (mer., 17 déc. 2008) $
*
*/
class PHP_UML_Metamodel_TypedElement extends PHP_UML_Metamodel_NamedElement
{
public $type;
}
?>

View File

@@ -0,0 +1,65 @@
<?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: 136 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2009-12-10 01:35:58 +0100 (jeu., 10 déc. 2009) $
*/
/**
* This class is a contextual wrapper around a "current" package being
* processed. It is used during the traversal of all the packages of
* a model, especially to store temporarily a complete view about all
* the relationships between the contained types.
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_ApiContextPackage
{
/**
* Filepath to the current package
* @var string
*/
public $dir = '';
/**
* Relative filepath to go to the top package
* @var string
*/
public $rpt = '';
/**
* Classes of the package
* @var array
*/
public $classes;
/**
* Interfaces of the package
* @var array
*/
public $interfaces;
/**
* Datatpyes of the package
* @var array
*/
public $datatypes;
public $allImplemented = array();
public $allImplementing = array();
public $allInherited = array();
public $allInheriting = array();
}
?>

View File

@@ -0,0 +1,373 @@
<?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: -1 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: $
*/
/**
* Top class for the API "renderers" used by the ExporterAPI implementations
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Output_ApiRenderer
{
const PACKAGE_FILENAME = 'package-summary';
const CLASS_PREFIX = 'class-';
const INTERFACE_PREFIX = 'interface-';
const DATATYPE_PREFIX = 'datatype-';
const META_INTERFACE = PHP_UML_Metamodel_Superstructure::META_INTERFACE;
const META_CLASS = PHP_UML_Metamodel_Superstructure::META_CLASS;
const META_DATATYPE = PHP_UML_Metamodel_Superstructure::META_DATATYPE;
const META_OPERATION = PHP_UML_Metamodel_Superstructure::META_OPERATION;
const META_PROPERTY = PHP_UML_Metamodel_Superstructure::META_PROPERTY;
const T_NAMESPACE = '\\';
/**
* Main template (we pre-store it to avoid reading repeatedly)
* @var string
*/
protected $mainTpl;
/**
* Classes that won't appear directly in the main API lists
* for readability (even though each one has its own detail page)
* @var array
*/
protected $hiddenClasses = array();
/**
* Hidden interfaces
* @var array
*/
protected $hiddenInterfaces = array();
/**
* Hidden classifiers
* @var array
*/
protected $hiddenClassifiers = array();
/**
* These docblocks will not be displayed in the docblocks list
* @var array
*/
protected $ignoredTag = array();
/**
* Reference to the Exporter object (giving access to the ApiContextPackage)
* @var PHP_UML_Output_ExporterAPI
*/
protected $exporter;
/**
* Render globally a package
*
* @param PHP_UML_Metamodel_Package $p Starting package (model)
*/
abstract function render($p);
/**
* Constructor for an ApiRenderer.
*
* @param PHP_UML_Output_ExporterAPI $exporter Reference to an exporter
*/
public function __construct(PHP_UML_Output_ExporterAPI $exporter)
{
$this->hiddenClasses = array_merge($this->hiddenClasses, PHP_UML_Metamodel_Enumeration::$classes);
$this->hiddenInterfaces = array_merge($this->hiddenInterfaces, PHP_UML_Metamodel_Enumeration::$interfaces);
$this->hiddenClassifiers = array_merge($this->hiddenClassifiers, $this->hiddenClasses);
$this->hiddenClassifiers = array_merge($this->hiddenClassifiers, $this->hiddenInterfaces);
$this->hiddenClassifiers = array_merge($this->hiddenClassifiers, PHP_UML_Metamodel_Enumeration::$datatypes);
$this->exporter = $exporter;
}
abstract protected function getDescription(PHP_UML_Metamodel_Stereotype $s, $annotatedElement='');
/**
* Renders the operation's parameters
*
* @param PHP_UML_Metamodel_Operation $operation The operation
* @param bool $withType If true, adds an hyperlink
*
* @return string
*/
abstract protected function getParameterList(PHP_UML_Metamodel_Operation $operation, $withType = false);
/**
* Renders a default value
*
* @param PHP_UML_Metamodel_TypedElement $obj A property or a parameter
*
* @return string
*/
abstract protected function getDefaultValue(PHP_UML_Metamodel_TypedElement $obj);
/**
* Returns the content of a template file
*
* @param string $str Template filename
*
* @return string The content of the template
*/
protected function getTemplate($str)
{
$baseSrc = $this->getTemplateDirectory();
return file_get_contents($baseSrc.DIRECTORY_SEPARATOR.$str);
}
/**
* Return the current ApiContextPackage object
*
* @return PHP_UML_Output_ApiContextPackage
*/
protected function getContextPackage()
{
return $this->exporter->getContextPackage();
}
static protected function getObjPrefix(PHP_UML_Metamodel_NamedElement $x)
{
switch (get_class($x)) {
case self::META_INTERFACE:
return self::INTERFACE_PREFIX;
case self::META_DATATYPE:
return self::DATATYPE_PREFIX;
case self::META_OPERATION:
return self::PACKAGE_FILENAME;
case self::META_PROPERTY:
return self::PACKAGE_FILENAME;
}
return self::CLASS_PREFIX;
}
static protected function getObjStyle(PHP_UML_Metamodel_NamedElement $x)
{
switch (get_class($x)) {
case self::META_INTERFACE:
return 'interface';
case self::META_DATATYPE:
return 'datatype';
case self::META_OPERATION:
return 'method';
case self::META_PROPERTY:
return 'property';
}
return 'class';
}
/**
* Renders a link to an element
* (since datatypes don't own to a "package", we suppose they are located in
* the top package)
*
* @param PHP_UML_Metamodel_Classifier $t The element
* @param string $cssStyle CSS style to use
*
* @return string
*/
//abstract protected function getLinkTo(PHP_UML_Metamodel_Classifier $t, $cssStyle='link');
/**
* Returns the complete namespace for an element
*
* @param PHP_UML_Metamodel_Classifier $t The classifier
*
* @return string
*/
protected function getQualifiedName(PHP_UML_Metamodel_Classifier $t)
{
$ns = isset($t->package) ? $this->getAbsPath($t->package, self::T_NAMESPACE) : '';
return $ns.$t->name;
}
/**
* Renders an unresolved type
*
* @param string $type Type, provided as a string
*
* @return string
*/
abstract protected function displayUnresolved($type);
/**
* Returns the path from the top package to a given package
*
* @param PHP_UML_Metamodel_Package $p The package
* @param string $delimiter Delimiter
*
* @return string
*/
protected function getAbsPath(PHP_UML_Metamodel_Package $p, $delimiter='/')
{
if (!empty($p->nestingPackage)) {
return $this->getAbsPath($p->nestingPackage, $delimiter).$p->name.$delimiter;
}
else
return '';
}
/**
* Returns the return parameter of a function
*
* @param PHP_UML_Metamodel_Operation $operation The function
*
* @return PHP_UML_Metamodel_Parameter The parameter
*/
protected function getReturnParam(PHP_UML_Metamodel_Operation $operation)
{
foreach ($operation->ownedParameter as $p) {
if ($p->direction=='return') {
return $p;
}
}
return null;
}
/**
* Renders the properties of a given stereotype
*
* @param PHP_UML_Metamodel_Stereotype $s A stereotype
*
* @return string
*/
abstract protected function getTagsAsList(PHP_UML_Metamodel_Stereotype $s);
/**
* Returns the array containing all the extended classes of a classifier
* This array must have been previously set in the Context object
*
* @param PHP_UML_Metamodel_NamedElement $c A classifier or a package
*
* @return array
*/
protected function getAllInherited(PHP_UML_Metamodel_NamedElement $c)
{
return array_key_exists($c->id, $this->getContextPackage()->allInherited) ? $this->getContextPackage()->allInherited[$c->id] : array();
}
/**
* Returns the array containing all the classes that extends a classifier
*
* @param PHP_UML_Metamodel_NamedElement $c A classifier or a package
*
* @return array
*/
protected function getAllInheriting(PHP_UML_Metamodel_NamedElement $c)
{
return array_key_exists($c->id, $this->getContextPackage()->allInheriting) ? $this->getContextPackage()->allInheriting[$c->id] : array();
}
/**
* Returns the array containing all the interfaces of a classifier
*
* @param PHP_UML_Metamodel_NamedElement $c A classifier or a package
*
* @return array
*/
protected function getAllImplemented(PHP_UML_Metamodel_NamedElement $c)
{
return array_key_exists($c->id, $this->getContextPackage()->allImplemented) ? $this->getContextPackage()->allImplemented[$c->id] : array();
}
/**
* Returns the array containing all the classes that implement a given interface
*
* @param PHP_UML_Metamodel_NamedElement $c A classifier or a package
*
* @return array
*/
protected function getAllImplementing(PHP_UML_Metamodel_NamedElement $c)
{
return array_key_exists($c->id, $this->getContextPackage()->allImplementing) ? $this->getContextPackage()->allImplementing[$c->id] : array();
}
/**
* Saves a string in a file (in the folder referenced in the context object)
*
* @param string $elementName Filename (without the extension)
* @param string $str Content
*/
abstract protected function save($elementName, $str);
/**
* Renders the block "Properties" of a package or a class
*
* @param PHP_UML_Metamodel_NamedElement $p A classifier/a package
*
* @return string
*/
abstract protected function getPropertyBlock(PHP_UML_Metamodel_NamedElement $p);
/**
* Returns an ID for a property
*
* @param PHP_UML_Metamodel_Property $o Element
*
* @return string
*/
protected function generatePropertyId(PHP_UML_Metamodel_Property $o)
{
return str_replace('$', '', $o->name);
}
/**
* Returns an ID to identify a function
*
* @param PHP_UML_Metamodel_Operation $o Element
*
* @return string
*/
protected function generateFunctionId(PHP_UML_Metamodel_Operation $o)
{
return 'f'.$o->id;
}
/**
* Renders the block "Function" of a package or a classifier
*
* @param PHP_UML_Metamodel_NamedElement $p A classifier or a package
*
* @return string
*/
abstract protected function getFunctionBlock(PHP_UML_Metamodel_NamedElement $p);
/**
* Renders the "File" information tag
*
* @param PHP_UML_Metamodel_NamedElement $p An element
*
* @return string
*/
abstract protected function getFileInfo(PHP_UML_Metamodel_NamedElement $p);
/**
* Replace the template's placeholders with their value
*
* @param string $main Main content (generated by PHP_UML)
* @param string $nav Navigation content (navig bar)
* @param string $tit Title content
* @param string $name Element name
*
* @return string
*/
abstract protected function replaceInTpl($main, $nav, $tit, $name);
}
?>

View File

@@ -0,0 +1,44 @@
<?php
/**
* PHP_UML (PHP_UML_Output_Eclipse_AbstractBuilder)
*
* 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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* Extended abstract class to generate a UML model that can be imported into Eclipse
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage Eclipse
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Output_Eclipse_AbstractBuilder extends PHP_UML_Output_Xmi_AbstractBuilder
{
/**
* Factory method. Retrieves a proper implementation class,
* matching the XMI version.
*
* @param float $version XMI version
*
* @return PHP_UML_Output_Xmi_Builder An XMI builder object
*/
static function getInstance($version)
{
if ($version < 2)
return new PHP_UML_Output_Xmi_BuilderImpl1($xmlEncoding);
else
return new PHP_UML_Output_Eclipse_BuilderImpl2($xmlEncoding);
}
}
?>

View File

@@ -0,0 +1,68 @@
<?php
/**
* PHP_UML (PHP_UML_Output_Eclipse_BuilderImpl2)
*
* 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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* Implementation class to create XMI in version 2, adapted for importation into Eclipse
*
* See the interface PHP_UML_Output_Eclipse_Builder for the comments.
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage Xmi
* @see PHP_UML_Output_Xmi_Builder
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_Eclipse_BuilderImpl2 extends PHP_UML_Output_Xmi_BuilderImpl2
{
const XMI_VERSION = '2.1';
const UML_VERSION = '2.1.2';
const DEFAULT_CLASSIFIER_ATT = ' visibility="public" ';
public function getXmiHeaderOpen()
{
return '';
}
public function getModelOpen(PHP_UML_Metamodel_Package $model)
{
return '<uml:Model xmi:type="uml:Model" name="'.$model->name.'"
xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
xmi:id="'.$model->id.'" '.self::DEFAULT_CLASSIFIER_ATT.'>';
}
public function getXmiHeaderClose()
{
return '';
}
public function getRealizations(PHP_UML_Metamodel_Class $client)
{
$str = '';
foreach ($client->implements as &$rclass) {
if (is_object($rclass)) {
$str .= '<packagedElement xmi:type="uml:Realization" '.
'xmi:id="'.self::getUID().'" '.
'client="'.$client->id.'" '.
'supplier="'.$rclass->id.'" />';
}
}
return $str;
}
}
?>

View File

@@ -0,0 +1,44 @@
<?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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* This class generates a specific XMI file that can be imported into Eclipse
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage Xmi
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_Eclipse_Exporter extends PHP_UML_Output_Xmi_Exporter
{
/**
* Getter for the XMI factory. Overrides the parent.
*
*/
protected function getXmiBuilder()
{
$builder = PHP_UML_Output_Eclipse_AbstractBuilder::getInstance($this->xmiVersion);
$builder->setEncoding($this->encoding);
$builder->setLogicalView($this->logicalView);
$builder->setComponentView($this->componentView);
$builder->setDeploymentView($this->deploymentView);
$builder->setStereotypes(false);
return $builder;
}
}
?>

View File

@@ -0,0 +1,93 @@
<?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: 179 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 16:09:54 +0200 (lun., 19 sept. 2011) $
*/
/**
* This class is a set of various data/switches that can be used by the
* implementations of the exporter
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Output_Exporter
{
const APP_NAME = 'PHP_UML';
/**
* A UML model
* @var PHP_UML_Metamodel_Superstructure
*/
protected $structure;
/**
* Constructor
*
* @param string $format Usual format name
*/
public function __construct()
{
}
/**
* Setter for the model.
*
* @param PHP_UML_Metamodel_Superstructure $model A UML model
*/
public function setModel(PHP_UML_Metamodel_Superstructure $model)
{
$this->structure = $model;
}
/**
* Export the current model to a particular output format.
*
* @param string $outDir Directory where the resulting output must be stored
*/
abstract public function export($outDir);
/**
* Factory method to retrieve an implementation of an exporter, given the "common name" of
* a format.
*
* @param string $format Common name of the desired export format
*
* @return PHP_UML_Output_Exporter
*/
static function getInstance($format)
{
if (empty($format))
$format = 'xmi';
$format = strtolower($format);
$ucf = ucfirst($format);
if ($ucf == "Htmlnew")
$ucf = "HtmlNew";
$className = 'PHP_UML_Output_'.$ucf.'_Exporter';
if (!class_exists($className)) {
throw new PHP_UML_Exception('Unknown export format: "'.$format.'"');
}
$instance = new $className();
return $instance;
}
}
?>

View File

@@ -0,0 +1,143 @@
<?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: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* This is the exportation class relying on the API (= on the full hierarchy of
* metaclasses stored in the model). Note that another way to export a model would
* be to use ExporterXSL, which is based on an XSL transformation of XMI.
* A class implementing ExporterAPI must reside in a subfolder containing a class
* named PHP_UML_<name of the output format>_Exporter. This class must also have a
* public method "generate", which is used to start the serialization process.
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Output_ExporterAPI extends PHP_UML_Output_Exporter
{
/**
* Object storing some contextual data
*
* @var PHP_UML_Output_ApiContextPackage
*/
protected $ctx;
public function export($outDir)
{
if (!file_exists($outDir))
throw new PHP_UML_Exception('Export directory ('.$outDir.') does not exist.');
if (empty($this->structure) || empty($this->structure->packages)) {
throw new PHP_UML_Exception('No model to export');
}
}
/**
* Return the ApiContextPackage currently associated to the rendering
*
* @return PHP_UML_Output_ApiContextPackage
*/
public function getContextPackage()
{
return $this->ctx;
}
/**
* Sets the allInherited/-ing arrays with all the classifiers that a given
* classifier inherits from
*
* @param PHP_UML_Metamodel_Classifier $s The initial reference classifier
* @param PHP_UML_Metamodel_Classifier $t The current classifier to check
*/
protected function setAllInherited(PHP_UML_Metamodel_Classifier $s, PHP_UML_Metamodel_Classifier $t)
{
if (!empty($t->superClass) && is_object($t->superClass[0])) {
$h = $t->superClass[0];
$this->setAllInherited($s, $h);
$this->ctx->allInherited[$s->id][] = $h;
$this->ctx->allInheriting[$h->id][] = $s;
}
}
/**
* Sets the allImplemented/-ing arrays with all the interfaces that a given
* class implements (including those of the inherited classes)
*
* @param PHP_UML_Metamodel_Class $s The initial reference class
* @param PHP_UML_Metamodel_Classifier $t The current classifier to check
*/
protected function setAllImplemented(PHP_UML_Metamodel_Class $s, PHP_UML_Metamodel_Classifier $t)
{
if (!empty($t->superClass) && is_object($t->superClass[0])) {
$this->setAllImplemented($s, $t->superClass[0]);
}
if (isset($t->implements) && is_array($t->implements)) {
foreach ($t->implements as $impl) {
if (is_object($impl)) {
$this->setAllImplemented($s, $impl);
$this->ctx->allImplemented[$s->id][] = $impl;
$this->ctx->allImplementing[$impl->id][] = $s;
}
}
}
}
/**
* Recurses into all the packages to build a list of all the generalizations
* and realizations between elements.
* We normally do this before creating the detailed files.
*
* @param PHP_UML_Metamodel_Package $pkg Starting package
*/
protected function setAllSuperClassifiers(PHP_UML_Metamodel_Package $pkg)
{
foreach ($pkg->ownedType as $type) {
switch (get_class($type)) {
case PHP_UML_Metamodel_Superstructure::META_CLASS:
$this->setAllImplemented($type, $type);
case PHP_UML_Metamodel_Superstructure::META_INTERFACE:
$this->setAllInherited($type, $type);
}
}
foreach ($pkg->nestedPackage as $np) {
$this->setAllSuperClassifiers($np);
}
}
protected function initContextPackage(PHP_UML_Metamodel_Package $pkg, $dir, $rpt)
{
$this->ctx->classes = array();
$this->ctx->interfaces = array();
$this->ctx->datatypes = array();
$this->ctx->dir = $dir;
$this->ctx->rpt = $rpt;
foreach ($pkg->ownedType as $type) {
switch (get_class($type)) {
case PHP_UML_Metamodel_Superstructure::META_INTERFACE:
$this->ctx->interfaces[] = $type;
break;
case PHP_UML_Metamodel_Superstructure::META_DATATYPE:
$this->ctx->datatypes[] = $type;
break;
default:
$this->ctx->classes[] = $type;
}
}
}
}
?>

View File

@@ -0,0 +1,317 @@
<?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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* An exportation class, that relies on XSL transformations.
*
* It does its export by transforming the XMI data contained in the object
* $xmiDocument.
* Various transformations are available: they are all stored in separate subfolders
* (php, html). To get an ExporterXSL for a given format, call the constructor
* with the name of the format as first parameter:
* new PHP_UML_Output_ExporterXSL("php")
* This format name must be equal to the folder name where the desired XSL files are.
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @link http://pear.php.net/package/PHP_UML
*/
abstract class PHP_UML_Output_ExporterXSL extends PHP_UML_Output_Exporter
{
const RESOURCES_FOLDER = 'resources';
const STARTING_TPL = 'main.xsl';
protected $saveToFileCallback;
protected $createFolderCallback;
/**
* XmiDocument object containing the XMI to transform
*
* @var PHP_UML_Output_XmiDocument
*/
protected $xmiDocument;
public function __construct()
{
parent::__construct();
$this->saveToFileCallback = __CLASS__.'::saveToFile';
$this->createFolderCallback = __CLASS__.'::createFolder';
}
public function setSaveToFileCallback($function)
{
$this->saveToFileCallback = $function;
}
public function setCreateFolderCallback($function)
{
$this->createFolderCallback = $function;
}
/**
* Generates output data by applying a transformation on a given XMI file
*
* @param string $outputDir Output directory
* @param string $xslFile XSL file (template file)
* @param string $xmlFile XMI file
*/
protected function exportFromFile($outputDir, $xslFile, $xmlFile)
{
if (is_file($xmlFile) && is_readable($xmlFile)) {
$xmlDom = new DomDocument;
$xmlDom->load($xmlFile);
return $this->transform($outputDir, $xslFile, $xmlDom);
} else {
throw new PHP_UML_Exception(
'Could not read file '.$xmlFile
);
}
}
/**
* Generates ouput data by applying a transformation on some provided XMI
*
* @param string $outputDir Output directory
* @param string $xslFile XSL file (template file)
* @param string $xmlData The XMI data
*/
protected function exportFromXml($outputDir, $xslFile, $xmlData)
{
if (empty($xmlData))
throw new PHP_UML_Exception(
'No XMI data was available for transformation.'
);
$xmlDom = new DomDocument;
$xmlDom->loadXML($xmlData);
return $this->transform($outputDir, $xslFile, $xmlDom);
}
/**
* Return the absolute location of the XSL file
*
* @return string Filepath
*/
abstract function getXslFilepath();
/**
* Generates output data by applying a transformation on the XMI stored in the
* property $xmi
*
* @param string $outputDir Output folder
*
* @return DOMDocument A DOM document containing the result of the XSLT
*/
public function export($outputDir)
{
$xslFile = $this->getXslFilepath();
if (empty($this->xmiDocument)) {
$temp = new PHP_UML_Output_Xmi_Exporter();
/*
* Component views and deployment views don't mean anything
* for output formats other than XMI. Yet, since ExporterXSL is
* a subclass of ExportXMI, we must force these options to
* false, otherwise they will appear in the output produced by
* the XSL transformation:
*/
$temp->setComponentView(false);
$temp->setDeploymentView(false);
$temp->setModel($this->structure);
$temp->generateXmi();
$this->xmiDocument = $temp->getXmiDocument();
}
if (file_exists($xslFile))
return $this->exportFromXml($outputDir, $xslFile, $this->xmiDocument->dump());
else {
throw new PHP_UML_Exception(
'Could not find the XSL template file. It must be named '.
self::STARTING_TPL.', under Format/YourTemplate/'
);
}
}
/**
* Generates output data by applying a transformation on a Dom Document
*
* @param string $outputDir Output folder
* @param string $xslFile XSL file (template file)
* @param DomDocument $xmlDom XMI data (Dom)
*
* @return string (possible) messages raised during XSLT
*/
private function transform($outputDir, $xslFile, DomDocument $xmlDom)
{
clearstatcache();
$userCurrentDir = getcwd(); // we memorize the current working dir
chdir(dirname(__FILE__)); // ... swap to the /Output dir
if ($xslFile=='')
$xslFile = 'html/'.self::STARTING_TPL;
if (!(file_exists($xslFile) && is_readable($xslFile)))
throw new PHP_UML_Exception(
'Could not read file '.$xslFile
);
$xslDom = new DomDocument;
$xslDom->load($xslFile); // ... load the XSLT starting file
chdir($userCurrentDir); // ... and change back to the user dir
// so that we can check the output dir (counted from the user dir)
if ($outputDir=='')
throw new PHP_UML_Exception(
'No output directory was given.'
);
if (!file_exists($outputDir))
throw new PHP_UML_Exception(
'Directory '.$outputDir.' does not exist.'
);
chdir($outputDir);
self::copyResources(dirname($xslFile));
$xslProc = new XSLTProcessor;
$xslProc->registerPHPFunctions();
$xslProc->importStylesheet($xslDom);
$xslProc->setParameter('', 'phpSaveToFile', $this->saveToFileCallback);
$xslProc->setParameter('', 'phpCreateFolder', $this->createFolderCallback);
$xslProc->setParameter('', 'appName', self::APP_NAME);
$xslProc->setParameter('', 'genDate', date('r'));
$out = $xslProc->transformToDoc($xmlDom);
chdir($userCurrentDir); // ... and back again to the original user dir
return $out;
}
const XMLNS_UML1 = 'http://www.omg.org/spec/UML/1.4';
/**
* XMI converter
*
* @param string $xmi XMI (in version 1)
*
* @return string XMI (in version 2)
*/
static public function convertTo2($xmi)
{
return self::simpleTransform('xmi1to2.xsl', $xmi);
}
/**
* Applies a simple transformation on XML data
* Used by the UML 1->2 conversion
*
* @param string $xsl XSL file
* @param string $xmi XML data
*
* @return string XML
*/
static private function simpleTransform($xsl, $xmi)
{
//we must set the xmlns:UML to the same value as the XSLT stylesheet
//(otherwise transfomations don't work)
$xmi = preg_replace('/xmlns:(UML)\s*=\s*["\'](.*)["\']/i', 'xmlns:$1="'.self::XMLNS_UML1.'"', $xmi, 1);
$xslDom = new DomDocument;
$xslDom->load(dirname(__FILE__).DIRECTORY_SEPARATOR.$xsl);
$xmlDom = new DomDocument;
$xmlDom->loadXML($xmi);
/* $xmiTag = &$xmlDom->getElementsByTagName('XMI')->item(0);
if ($xmiTag->getAttribute('xmlns:UML') != '') {
$xmlDom->getElementsByTagName('XMI')->item(0)->setAttribute('verified', 'http://www.omg.org/spec/UML/1.4');
} */
$xslProc = new XSLTProcessor;
$xslProc->importStylesheet($xslDom);
$xslProc->setParameter('', 'appName', self::APP_NAME);
return $xslProc->transformToXML($xmlDom);
}
/**
* Copy the "resources" folder
*
* @param string $path Path to the folder that contains the XSL templates
*/
static private function copyResources($path)
{
$dir = $path.DIRECTORY_SEPARATOR.self::RESOURCES_FOLDER;
if (file_exists($dir)) {
$iterator = new DirectoryIterator($dir);
foreach ($iterator as $file) {
if($file->isFile())
copy($file->getPathname(), $file->getFilename());
}
}
}
/**
* Create a folder. This is a callback function for the XSL templates
* (that's why it is public), and you should not have to use it.
*
* @param string $path Folder name
*/
static public function createFolder($path)
{
if (substr(getcwd(), -1)==DIRECTORY_SEPARATOR)
$k = getcwd().utf8_decode($path);
else
$k = getcwd().DIRECTORY_SEPARATOR.utf8_decode($path);
if (!file_exists($k)) {
mkdir($k);
}
chdir($k);
}
/**
* Save a content to a file. This is a callback function for the XSL templates
* (that's why it is public), and you should not have to use it.
*
* @param string $name File name
* @param mixed $content Content (can be either a string, or a node-set)
*/
static public function saveToFile($name, $content)
{
$file = fopen(utf8_decode($name), 'w');
if (is_string($content)) {
fwrite($file, utf8_decode($content));
} else {
$dom = new DomDocument();
$node = $dom->importNode($content[0], true);
$dom->appendChild($node);
fwrite($file, $dom->saveHTML());
}
fclose($file);
}
}
?>

View File

@@ -0,0 +1,34 @@
<?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: 178 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 03:08:06 +0200 (lun., 19 sept. 2011) $
*/
/**
* Implementation of an exporter to generate an HTML website (Javadoc look and
* feel)
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage Html
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_Html_Exporter extends PHP_UML_Output_ExporterXSL
{
function getXslFilepath()
{
return dirname(__FILE__).DIRECTORY_SEPARATOR.self::STARTING_TPL;
}
}
?>

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
<!-- Called on the top container. Lists all the "uml:Package" elements, in the left frame. -->
<xsl:template name="allclasses">
<html>
<xsl:call-template name="htmlStartPage"/>
<xsl:call-template name="htmlHead">
<xsl:with-param name="path" />
<xsl:with-param name="title" select="concat(@name,' - All Classes')"/>
</xsl:call-template>
<body>
<div id="contentFrame">
<h1>All Classes</h1>
<ul>
<xsl:for-each select="//packagedElement[@xmi:type='uml:Class' or @xmi:type='uml:Interface' or @xmi:type='uml:DataType']">
<xsl:sort select="@name" data-type="text" case-order="lower-first"/>
<xsl:variable name="prefix">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
<xsl:call-template name="getPrefix">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
</xsl:variable>
<li>
<xsl:if test="@xmi:type='uml:Interface'">
<xsl:attribute name="class">interfaceElement</xsl:attribute>
</xsl:if>
<a href="{concat('./', $prefix, @name, '.html')}" target="classFrame">
<xsl:value-of select="@name"/>
</a>
</li>
</xsl:for-each>
</ul>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,452 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi exslt exslt-set exslt-functions"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:exslt="http://exslt.org/common" xmlns:exslt-set="http://exslt.org/sets"
xmlns:exslt-functions="http://exslt.org/functions">
<!-- Called on every class/interface. One file per class/interface -->
<xsl:template name="classifier">
<xsl:param name="relPathTop"/>
<xsl:param name="entity"/>
<xsl:param name="nestingPackageName"/>
<xsl:param name="ownedAttributeSet"/>
<xsl:param name="ownedOperationSet" />
<xsl:param name="generalization"/>
<xsl:param name="implements"/>
<xsl:param name="prevEntity"/>
<xsl:param name="nextEntity"/>
<xsl:param name="filePrefix"/>
<xsl:param name="relPathClass"/>
<xsl:variable name="path">
<element>
<xsl:attribute name="id"><xsl:value-of select="@xmi:id"/></xsl:attribute>
<xsl:call-template name="getPackageNamePart"/>
<xsl:value-of select="@name"/>
</element>
<xsl:for-each select="generalization">
<xsl:call-template name="generalization"></xsl:call-template>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="allImplementedClasses" select="key('getElementById', key('getRealizations', exslt:node-set($path)/*/@id)/@supplier)"/>
<xsl:variable name="allImplementingClasses" select="key('getElementById',key('getRealizingClasses', @xmi:id)/@client)"/>
<xsl:variable name="allSubClasses" select="key('getSubclasses', @xmi:id)"/>
<xsl:variable name="artifact" select="key('getElementById',key('getManifestation', @xmi:id)/@client)"/>
<xsl:variable name="lcEntityName" select="translate($entity, 'CDI', 'cdi')"/>
<html>
<xsl:call-template name="htmlStartPage"/>
<xsl:call-template name="htmlHead">
<xsl:with-param name="path" select="$relPathTop"/>
<xsl:with-param name="title" select="concat($nestingPackageName, $packageDelimiter, @name)"/>
</xsl:call-template>
<body>
<div id="navigation">
<div id="banner">
<ul class="sections">
<li><a href="{$relPathTop}{$fileOverviewSummary}" title="Summary of all packages">Overview</a></li>
<li><a href="{$filePackageSummary}" title="Summary of {$nestingPackageName}">Package</a></li>
<li class="active"><xsl:value-of select="$entity"/></li>
<li><a href="{$relPathTop}{$fileIndexAll}">Index</a></li>
</ul>
<ul class="navigFrame">
<a href="{concat($relPathTop,$fileIndex,'?',$relPathClass,$filePrefix,@name,'.html')}" class="navigFrameElem" target="_top">FRAMES</a>
<xsl:text>&#32;</xsl:text>
<a href="{concat($filePrefix,@name,'.html')}" class="navigFrameElem" target="_top">NO FRAMES</a>
</ul>
</div>
<ul class="siblingSections">
<xsl:if test="$prevEntity!=''">
<li><a href="{concat($filePrefix,$prevEntity,'.html')}"><xsl:value-of select="concat('Prev ', $entity)" /></a></li>
</xsl:if>
<xsl:if test="$nextEntity!=''">
<li class="last"><a href="{concat($filePrefix,$nextEntity,'.html')}"><xsl:value-of select="concat('Next ', $entity)" /></a></li>
</xsl:if>
</ul>
</div>
<div id="content">
<div class="classSummary">
<!-- Class Name -->
<h3 id="entityPackage"><xsl:value-of select="$nestingPackageName"/></h3>
<h1 id="entityName"><xsl:value-of select="concat($entity, '&#160;', @name)" /></h1>
<!-- Class tree -->
<xsl:call-template name="htmlInheritedClassTree">
<xsl:with-param name="path" select="$path"/>
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
<!-- All Implemented Classes -->
<xsl:if test="count($allImplementedClasses) &gt; 0">
<h3 class="titleSmallList">All Implemented Interfaces:</h3>
<div class="smallList">
<xsl:for-each select="$allImplementedClasses">
<xsl:call-template name="htmlLinkToElement">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="."/>
<xsl:with-param name="style" select="string('linkSimple')"/>
</xsl:call-template>
<xsl:if test="position() &lt; last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:for-each>
</div>
</xsl:if>
<!-- All Implemented Classes -->
<xsl:if test="count($allSubClasses) &gt; 0">
<h3 class="titleSmallList">Direct Known Subclasses:</h3>
<div class="smallList">
<xsl:for-each select="$allSubClasses">
<xsl:call-template name="htmlLinkToElement">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="."/>
<xsl:with-param name="style" select="string('linkSimple')"/>
</xsl:call-template>
<xsl:if test="position() &lt; last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:for-each>
</div>
</xsl:if>
<!-- All Implementing Classes -->
<xsl:if test="count($allImplementingClasses) &gt; 0">
<h3 class="titleSmallList">All Known Implementing Classes:</h3>
<div class="smallList">
<xsl:for-each select="$allImplementingClasses">
<xsl:call-template name="htmlLinkToElement">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="."/>
<xsl:with-param name="style" select="string('linkSimple')"/>
</xsl:call-template>
<xsl:if test="position() &lt; last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:for-each>
</div>
</xsl:if>
<hr/>
<!-- Class details -->
<xsl:text>public&#160;</xsl:text>
<xsl:if test="@isAbstract='true' and $entity!='Interface'">
<xsl:text>abstract&#160;</xsl:text>
</xsl:if>
<xsl:value-of select="concat($lcEntityName, '&#160;')"/>
<strong><xsl:value-of select="@name" /></strong><br/>
<xsl:if test="count($generalization) &gt; 0">
extends <xsl:value-of select="$generalization/@name" /><br/>
</xsl:if>
<xsl:if test="count($implements) &gt; 0">
implements
<xsl:for-each select="$implements">
<xsl:value-of select="@name" />
<xsl:if test="position() &lt; last()">,&#160;</xsl:if>
</xsl:for-each>
</xsl:if>
<p>
<xsl:call-template name="htmlDescription">
<xsl:with-param name="baseElement" select="@xmi:id"/>
</xsl:call-template>
<xsl:if test="count($artifact) &gt; 0">
<b>File: </b>
<xsl:for-each select="exslt:node-set($artifact)/ancestor::*[@xmi:type='uml:Package']">
<xsl:if test="position() &gt; 1"><xsl:value-of select="concat('/',@name)"/></xsl:if>
</xsl:for-each>
<xsl:value-of select="concat('/', $artifact/@name)"/>
</xsl:if>
</p>
<hr/>
</div>
<xsl:if test="count($ownedAttributeSet) &gt; 0">
<div id="fieldSummary">
<h2>Field Summary</h2>
<table border="1" class="tableSummary">
<xsl:for-each select="$ownedAttributeSet">
<xsl:call-template name="class-field-summary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:for-each>
</table>
</div>
</xsl:if>
<xsl:if test="count($ownedOperationSet) &gt; 0">
<div id="methodSummary">
<h2>Method Summary</h2>
<table border="1" class="tableSummary">
<xsl:for-each select="$ownedOperationSet">
<xsl:call-template name="class-method-summary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:for-each>
</table>
</div>
</xsl:if>
<xsl:if test="count($ownedAttributeSet) &gt; 0">
<div id="fieldDetail">
<h2>Field Detail</h2>
<xsl:for-each select="$ownedAttributeSet">
<xsl:call-template name="class-field-detail">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:for-each>
</div>
</xsl:if>
<xsl:if test="count($ownedOperationSet) &gt; 0">
<div id="methodDetail">
<h2>Method Detail</h2>
<xsl:for-each select="$ownedOperationSet">
<xsl:call-template name="class-method-detail">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="specifiedBy" select="exslt:node-set($allImplementedClasses)/ownedOperation[@name=current()/@name]"/>
</xsl:call-template>
</xsl:for-each>
</div>
</xsl:if>
<xsl:variable name="nestedClassSet" select="nestedClassifier[@xmi:type='uml:Class']"/>
<xsl:if test="count($nestedClassSet) &gt; 0">
<div>
<h2>Nested Classes</h2>
<xsl:call-template name="htmlTableSummary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="set" select="$nestedClassSet"/>
<xsl:with-param name="filePrefix" select="string(concat(@name, '/', $fileprefixClass))"/>
</xsl:call-template>
</div>
</xsl:if>
</div>
</body>
</html>
</xsl:template>
<xsl:template name="class-field-summary">
<xsl:param name="relPathTop"/>
<tr>
<td align="right" width="1%" valign="top">
<span class="code">
<xsl:choose>
<xsl:when test="@isReadOnly='true'">const</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@visibility='private'">private</xsl:when>
<xsl:when test="@visibility='protected'">protected</xsl:when>
</xsl:choose>
<xsl:if test="@isStatic='true'">&#160;static</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="count(type) &gt; 0">
<xsl:text>&#160;</xsl:text>
<xsl:call-template name="htmlType">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="."/>
</xsl:call-template>
</xsl:if>
</span>
</td>
<td valign="top">
<span class="code">
<a href="#{@name}" class="linkSummary"><xsl:value-of select="@name" /></a>
</span>
</td>
</tr>
</xsl:template>
<!-- Method summary -->
<xsl:template name="class-method-summary">
<xsl:param name="relPathTop"/>
<tr>
<td align="right" width="1%" valign="top">
<span class="code">
<xsl:if test="@isReadOnly='true'">final</xsl:if>
<xsl:choose>
<xsl:when test="@visibility='private'">&#160;private</xsl:when>
<xsl:when test="@visibility='protected'">&#160;protected</xsl:when>
</xsl:choose>
<xsl:if test="@isAbstract='true'">&#160;abstract</xsl:if>
<xsl:if test="@isStatic='true'">&#160;static</xsl:if>
<xsl:choose>
<xsl:when test="ownedParameter[@direction='return']">
<xsl:text>&#160;</xsl:text>
<xsl:call-template name="htmlType">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="ownedParameter[@direction='return']"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</span>
</td>
<td valign="top">
<span class="code">
<xsl:variable name="parameters">
<xsl:call-template name="htmlParametersBracket">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:variable>
<a href="#{concat(@name,$parameters)}" class="linkSummary"><xsl:value-of select="@name"/></a>
<xsl:copy-of select="$parameters"/>
</span>
</td>
</tr>
</xsl:template>
<!-- Field Detail -->
<xsl:template name="class-field-detail">
<xsl:param name="relPathTop"/>
<div class="detail" id="{@name}">
<h4><xsl:value-of select="@name" /></h4>
<div class="detailContent">
<span class="code">
<xsl:choose>
<xsl:when test="@isReadOnly='true'">const</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@visibility='private'">private</xsl:when>
<xsl:when test="@visibility='protected'">protected</xsl:when>
<xsl:otherwise>public</xsl:otherwise>
</xsl:choose>
<xsl:if test="@isStatic='true'">&#160;static</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="count(type) &gt; 0">
<xsl:text>&#160;</xsl:text>
<xsl:call-template name="htmlType">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="."/>
</xsl:call-template>
</xsl:if>
<b><xsl:value-of select="concat(' ', @name)" /></b>
<xsl:if test="defaultValue">
<xsl:value-of select="concat(' = ', defaultValue/@value)" />
</xsl:if>
</span>
<p>
<xsl:call-template name="htmlDescription">
<xsl:with-param name="baseElement" select="@xmi:id"/>
</xsl:call-template>
</p>
</div>
</div>
<hr/>
</xsl:template>
<!-- Method Detail -->
<xsl:template name="class-method-detail">
<xsl:param name="relPathTop"/>
<xsl:param name="specifiedBy"/>
<xsl:variable name="artifact" select="key('getElementById',key('getManifestation', @xmi:id)/@client)"/>
<xsl:variable name="parameters">
<xsl:call-template name="htmlParametersBracket">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:variable>
<div class="detail" id="{concat(@name,$parameters)}">
<h4><xsl:value-of select="@name"/></h4>
<div class="detailContent">
<span class="code">
<xsl:choose>
<xsl:when test="@visibility='private'">private</xsl:when>
<xsl:when test="@visibility='protected'">protected</xsl:when>
<xsl:otherwise>public</xsl:otherwise>
</xsl:choose>
<xsl:if test="@isAbstract='true'">&#160;abstract</xsl:if>
<xsl:if test="@isStatic='true'">&#160;static</xsl:if>
<xsl:choose>
<xsl:when test="ownedParameter[@direction='return']">
<xsl:text>&#160;</xsl:text>
<xsl:call-template name="htmlType">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="ownedParameter[@direction='return']"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
<b><xsl:value-of select="concat(' ', @name)" /></b>
<xsl:copy-of select="$parameters"/>
</span>
<!-- Description and tags -->
<p>
<xsl:call-template name="htmlDescriptionParam">
<xsl:with-param name="baseElement" select="@xmi:id"/>
</xsl:call-template>
<xsl:if test="count($artifact) &gt; 0">
<b>File: </b>
<xsl:for-each select="exslt:node-set($artifact)/ancestor::*[@xmi:type='uml:Package']">
<xsl:if test="position() &gt; 1"><xsl:value-of select="concat('/',@name)"/></xsl:if>
</xsl:for-each>
<xsl:value-of select="concat('/', $artifact/@name)"/>
</xsl:if>
</p>
<!-- Specified By -->
<xsl:if test="count($specifiedBy) &gt; 0">
<xsl:for-each select="exslt:node-set($specifiedBy)/ownedComment">
<h3 class="titleSmallList">Description Copied From interface:</h3>
<div class="smallList">
<xsl:value-of select="@body"/>
<xsl:call-template name="br-replace">
<xsl:with-param name="str" select="body/text()"/>
</xsl:call-template>
</div>
</xsl:for-each>
<h3 class="titleSmallList">Specified By</h3>
<div class="smallList">
<xsl:for-each select="$specifiedBy">
<xsl:variable name="classParent" select="parent::*"/>
<xsl:variable name="path">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="$classParent"/>
</xsl:call-template>
<xsl:call-template name="getPrefix">
<xsl:with-param name="context" select="$classParent"/>
</xsl:call-template>
</xsl:variable>
<span class="code">
<a href="{concat($relPathTop,$path,$classParent/@name,'.html#',@name,$parameters)}" class="$linkType">
<xsl:value-of select="@name"/>
</a>
</span>
<xsl:text> in </xsl:text>
<span class="code">
<xsl:call-template name="htmlLinkToElement">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="$classParent"/>
<xsl:with-param name="style" select="string('linkSimple')"/>
</xsl:call-template>
</span>
</xsl:for-each>
</div>
</xsl:if>
<xsl:variable name="params" select="ownedParameter[not(@direction) or @direction!='return']"/>
<xsl:if test="count($params) &gt; 0">
<h3 class="titleSmallList">Parameters</h3>
<div class="smallList">
<xsl:variable name="id" select="@xmi:id"/>
<xsl:for-each select="$params">
<xsl:variable name="cnt" select="position()"/>
<span class="code"><xsl:value-of select="@name"/></span>
<xsl:text> - </xsl:text>
<xsl:for-each select="key('getMetadata', $id)/*[local-name()='param'][$cnt]">
<xsl:call-template name="htmlDocblockParam"/>
</xsl:for-each>
<br/>
</xsl:for-each>
</div>
</xsl:if>
</div>
</div>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,239 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi exslt exslt-set exslt-functions"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:exslt="http://exslt.org/common" xmlns:exslt-set="http://exslt.org/sets"
xmlns:exslt-functions="http://exslt.org/functions">
<!-- Common templates required by the documentation exporter -->
<!-- Returns the generalized elements of the current context (through <element> tags)-->
<xsl:template name="generalization">
<xsl:variable name="parent" select="key('getElementById', @general)"/>
<element>
<xsl:attribute name="href">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="$parent"/>
</xsl:call-template>
<xsl:call-template name="getPrefix">
<xsl:with-param name="context" select="$parent"/>
</xsl:call-template>
<xsl:value-of select="concat($parent/@name,'.html')"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$parent/@xmi:id"/>
</xsl:attribute>
<xsl:call-template name="getPackageNamePart">
<xsl:with-param name="context" select="$parent"/>
</xsl:call-template>
<xsl:value-of select="$parent/@name"/>
</element>
<xsl:for-each select="$parent/generalization">
<xsl:call-template name="generalization"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="htmlHead">
<xsl:param name="path"/>
<xsl:param name="title"/>
<xsl:comment><xsl:value-of select="concat('Generated&#32;by&#32;',$appName,'&#32;on&#32;',$genDate)"/></xsl:comment>
<head>
<title><xsl:value-of select="$title"/></title>
<link rel="stylesheet" type="text/css" media="all" href="{concat($path,'style.css')}" />
</head>
</xsl:template>
<xsl:template name="htmlInherit">
<xsl:param name="relPathTop" />
<img src="{concat($relPathTop, 'inherit.gif')}" alt="extended by "/>
</xsl:template>
<!-- Displays the inheritance-tree of the current class -->
<xsl:template name="htmlInheritedClassTree">
<xsl:param name="path"/>
<xsl:param name="relPathTop" />
<xsl:variable name="nbElement" select="count(exslt:node-set($path)/*)"/>
<xsl:if test="$nbElement &gt; 1"> <!-- no display if the class does not inherit from anything -->
<dl class="classTree">
<xsl:for-each select="exslt:node-set($path)/*">
<xsl:sort select="position()" data-type="number" order="descending"/>
<dd>
<xsl:choose>
<xsl:when test="position() &gt; 1">
<xsl:if test="position() = last()">
<xsl:attribute name="class">currentElem</xsl:attribute>
</xsl:if>
<xsl:attribute name="style"><xsl:value-of select="concat('padding-left:',(position()-1)*30,'px')"/></xsl:attribute>
<xsl:call-template name="htmlInherit">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="position() &lt; $nbElement">
<a href="{concat($relPathTop, @href)}"><xsl:value-of select="text()"/></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="text()"/>
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:for-each>
</dl>
</xsl:if>
</xsl:template>
<xsl:template name="htmlStartPage">
<xsl:attribute name="xmlns">http://www.w3.org/1999/xhtml</xsl:attribute>
<xsl:attribute name="xml:lang">en</xsl:attribute>
<xsl:attribute name="lang">en</xsl:attribute>
</xsl:template>
<xsl:template name="htmlTableSummary">
<xsl:param name="relPathTop"/>
<xsl:param name="set" />
<xsl:param name="filePrefix" />
<table border="1" class="tableSummary">
<xsl:for-each select="$set">
<tr>
<td><strong><a href="{concat($filePrefix, @name, '.html')}"><xsl:value-of select="@name"/></a></strong></td>
<td><xsl:call-template name="titleComment"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<!-- Displays the parameters of a function as a bracketed list (<ownedParameter...) -->
<xsl:template name="htmlParametersBracket">
<xsl:param name="relPathTop" />
<xsl:text>(</xsl:text>
<xsl:for-each select="ownedParameter[@direction!='return' or not(@direction)]">
<xsl:call-template name="htmlType">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="."/>
</xsl:call-template>
<xsl:if test="@direction='inout'">&#38;</xsl:if>
<xsl:value-of select="@name" />
<xsl:if test="defaultValue">
<xsl:value-of select="concat('=', defaultValue/@value)"/>
</xsl:if>
<xsl:if test="position() &lt; last()">
<xsl:text>,&#160;</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>)</xsl:text>
</xsl:template>
<!-- Displays a type as a hyperlink (<type xmi:idref="..."/>) -->
<xsl:template name="htmlType">
<xsl:param name="relPathTop" />
<xsl:param name="context" />
<xsl:variable name="idref" select="$context/type/@xmi:idref | $context/@type"/>
<xsl:if test="$idref!=''">
<xsl:variable name="typeElement" select="key('getElementById', $idref)"/>
<xsl:call-template name="htmlLinkToElement">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="context" select="$typeElement"/>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
<!-- Displays the description/docblocks about a given element -->
<xsl:template name="htmlDescription">
<xsl:param name="baseElement"/>
<xsl:variable name="docblocks" select="key('getMetadata', $baseElement)/*[local-name()!='param' and local-name()!='return' and local-name()!='access' and local-name()!='var']"/>
<xsl:for-each select="ownedComment">
<xsl:value-of select="@body"/>
<xsl:call-template name="br-replace">
<xsl:with-param name="str" select="body/text()"/>
</xsl:call-template>
<div>
<xsl:for-each select="$docblocks">
<xsl:call-template name="htmlDocblock"/>
</xsl:for-each>
</div>
</xsl:for-each>
</xsl:template>
<!-- Displays the description/params. Used for method parameters detailing -->
<xsl:template name="htmlDescriptionParam">
<xsl:param name="baseElement"/>
<xsl:variable name="docblocks" select="key('getMetadata', $baseElement)/*[local-name()='param' or local-name()='return']"/>
<xsl:for-each select="ownedComment">
<p>
<xsl:value-of select="@body"/>
<xsl:call-template name="br-replace">
<xsl:with-param name="str" select="body/text()"/>
</xsl:call-template>
</p>
</xsl:for-each>
</xsl:template>
<!-- Displays a docblock element (in general) -->
<xsl:template name="htmlDocblock">
<b>
<xsl:call-template name="toUpperCase">
<xsl:with-param name="str" select="substring(local-name(),1,1)"/>
</xsl:call-template>
<xsl:value-of select="concat(substring(local-name(),2), ':&#32;')"/></b>
<xsl:value-of select="text()"/>
<xsl:copy-of select="*"/><br/>
</xsl:template>
<!-- Displays a docblock param -->
<xsl:template name="htmlDocblockParam">
<xsl:value-of select="substring-after(substring-after(text(), ' '), ' ')"/>
<xsl:copy-of select="*"/>
</xsl:template>
<!-- Replace breaklines by <br/> -->
<xsl:template name="br-replace">
<xsl:param name="str"/>
<xsl:choose>
<xsl:when test="contains($str,$cr)">
<xsl:value-of select="substring-before($str,$cr)"/>
<br/>
<xsl:call-template name="br-replace">
<xsl:with-param name="str" select="substring-after($str,$cr)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="htmlLinkToElement">
<xsl:param name="relPathTop" />
<xsl:param name="context" />
<xsl:param name="style" select="string('linkType')"/>
<xsl:variable name="path">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="$context"/>
</xsl:call-template>
<xsl:call-template name="getPrefix">
<xsl:with-param name="context" select="$context"/>
</xsl:call-template>
</xsl:variable>
<a href="{concat($relPathTop,$path,$context/@name,'.html')}" class="{$style}"><xsl:value-of select="$context/@name"/></a>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi php exslt exslt-set exslt-functions"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:php="http://php.net/xsl"
xmlns:exslt="http://exslt.org/common" xmlns:exslt-set="http://exslt.org/sets"
xmlns:exslt-functions="http://exslt.org/functions">
<xsl:variable name="packageDelimiter">\</xsl:variable>
<xsl:variable name="fileprefixDatatype">datatype-</xsl:variable>
<xsl:variable name="fileprefixClass">class-</xsl:variable>
<xsl:variable name="fileprefixInterface">interface-</xsl:variable>
<xsl:variable name="fileAllclassesFrame">allclasses-frame.html</xsl:variable>
<xsl:variable name="fileOverviewFrame">overview-frame.html</xsl:variable>
<xsl:variable name="fileOverviewSummary">overview-summary.html</xsl:variable>
<xsl:variable name="filePackageFrame">package-frame.html</xsl:variable>
<xsl:variable name="filePackageSummary">package-summary.html</xsl:variable>
<xsl:variable name="fileIndex">index.html</xsl:variable>
<xsl:variable name="fileIndexAll">index-all.html</xsl:variable>
<xsl:variable name="cr" select="'&#xa;'"/>
<xsl:include href="../common.xsl"/>
<xsl:template name="top-container">
<xsl:call-template name="inner-container">
<xsl:with-param name="relPathTop" />
</xsl:call-template>
<xsl:variable name="containerSet" select="//packagedElement[@xmi:type='uml:Package' or @xmi:type='uml:Model']"/>
<!-- Generation of the overview-summary file -->
<xsl:variable name="contentOverviewSummary">
<xsl:call-template name="overview-summary">
<xsl:with-param name="containerSet" select="$containerSet" />
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="php:function($phpSaveToFile, $fileOverviewSummary, exslt:node-set($contentOverviewSummary)/*)" />
<!-- Generation of the overview-frame file -->
<xsl:variable name="contentOverviewFrame">
<xsl:call-template name="overview-frame">
<xsl:with-param name="containerSet" select="$containerSet" />
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="php:function($phpSaveToFile, $fileOverviewFrame, exslt:node-set($contentOverviewFrame)/*)" />
<!-- Generation of the allclasses file -->
<xsl:variable name="contentAllclasses">
<xsl:call-template name="allclasses" />
</xsl:variable>
<xsl:copy-of select="php:function($phpSaveToFile, $fileAllclassesFrame, exslt:node-set($contentAllclasses)/*)" />
<!-- Generation of the index file -->
<xsl:variable name="contentIndex">
<xsl:call-template name="index" />
</xsl:variable>
<xsl:copy-of select="php:function($phpSaveToFile, $fileIndex, exslt:node-set($contentIndex)/*)" />
<!-- Generation of the index-all file -->
<xsl:variable name="contentIndexAll">
<xsl:call-template name="index-all" />
</xsl:variable>
<xsl:copy-of select="php:function($phpSaveToFile, $fileIndexAll, exslt:node-set($contentIndexAll)/*)" />
</xsl:template>
<!-- Tree walking of containers (uml package/model) -->
<xsl:template name="inner-container">
<xsl:param name="relPathTop" /> <!-- relative path to root -->
<!-- Misc initializations -->
<xsl:variable name="interfaceSet" select="packagedElement[@xmi:type='uml:Interface']" />
<xsl:variable name="classSet" select="packagedElement[@xmi:type='uml:Class']"/>
<xsl:variable name="ownedOperationSet" select="ownedOperation"/>
<xsl:variable name="ownedAttributeSet" select="ownedAttribute"/>
<xsl:variable name="packageNamePart">
<xsl:call-template name="getPackageNamePart"/>
</xsl:variable>
<!-- Generation of the package-summary file -->
<xsl:variable name="contentSummary">
<xsl:call-template name="package-summary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="interfaceSet" select="$interfaceSet"/>
<xsl:with-param name="classSet" select="$classSet"/>
<xsl:with-param name="ownedAttributeSet" select="$ownedAttributeSet"/>
<xsl:with-param name="ownedOperationSet" select="$ownedOperationSet"/>
<xsl:with-param name="packageNamePart" select="$packageNamePart"/>
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="php:function($phpSaveToFile, $filePackageSummary, exslt:node-set($contentSummary)/*)" />
<!-- Generation of the package-frame files -->
<xsl:variable name="contentFrame">
<xsl:call-template name="package-frame">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="interfaceSet" select="$interfaceSet"/>
<xsl:with-param name="classSet" select="$classSet"/>
<xsl:with-param name="ownedOperationSet" select="$ownedOperationSet"/>
<xsl:with-param name="ownedAttributeSet" select="$ownedAttributeSet"/>
<xsl:with-param name="packageNamePart" select="$packageNamePart"/>
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="php:function($phpSaveToFile, $filePackageFrame, exslt:node-set($contentFrame)/*)" />
<!-- Generation of the classifier files -->
<xsl:call-template name="generateClassifierFiles">
<xsl:with-param name="relPathTop" select="$relPathTop" />
<xsl:with-param name="setEntities" select="(packagedElement|nestedClassifier)[@xmi:type='uml:Interface' or @xmi:type='uml:Class' or @xmi:type='uml:DataType']"/>
</xsl:call-template>
<!-- Recursion into the owned containers -->
<xsl:for-each select="packagedElement[@xmi:type='uml:Package' or @xmi:type='uml:Model']">
<!-- Creation of folders -->
<xsl:copy-of select="php:function($phpCreateFolder, string(@name))" />
<xsl:call-template name="inner-container">
<xsl:with-param name="relPathTop" select="concat($relPathTop, '../')"/>
</xsl:call-template>
<xsl:copy-of select="php:functionString('chdir', '../')" />
</xsl:for-each>
</xsl:template>
<!-- Classifier entities handler -->
<xsl:template name="generateClassifierFiles">
<xsl:param name="relPathTop"/>
<xsl:param name="setEntities"/>
<xsl:for-each select="$setEntities">
<xsl:variable name="entity" select="substring-after(@xmi:type,':')"/>
<xsl:variable name="xmiType" select="@xmi:type"/>
<xsl:variable name="filePrefix">
<xsl:call-template name="getPrefix"/>
</xsl:variable>
<xsl:variable name="content">
<xsl:call-template name="classifier">
<xsl:with-param name="relPathTop" select="$relPathTop" />
<xsl:with-param name="entity" select="$entity"/>
<xsl:with-param name="nestingPackageName">
<xsl:call-template name="getNestingPackageName">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="ownedAttributeSet" select="ownedAttribute"/>
<xsl:with-param name="ownedOperationSet" select="ownedOperation"/>
<xsl:with-param name="generalization" select="key('getElementById',generalization/@general)"/>
<xsl:with-param name="implements" select="key('getElementById', key('getRealizations', current()/@xmi:id)/@supplier)"/>
<xsl:with-param name="prevEntity" select="preceding-sibling::packagedElement[@xmi:type=$xmiType][1]/@name"/>
<xsl:with-param name="nextEntity" select="following-sibling::packagedElement[@xmi:type=$xmiType][1]/@name"/>
<xsl:with-param name="filePrefix" select="$filePrefix"/>
<xsl:with-param name="relPathClass">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="php:function($phpSaveToFile, string(concat($filePrefix, @name, '.html')), exslt:node-set($content)/*)" />
<!-- nested entities ? -->
<xsl:variable name="setNestedEntities" select="(packagedElement|nestedClassifier)[@xmi:type='uml:Interface' or @xmi:type='uml:Class' or @xmi:type='uml:DataType']"/>
<xsl:if test="count($setNestedEntities) &gt; 0">
<xsl:copy-of select="php:function($phpCreateFolder, string(@name))" />
<xsl:call-template name="generateClassifierFiles">
<xsl:with-param name="relPathTop" select="concat('../', $relPathTop)"/>
<xsl:with-param name="setEntities" select="$setNestedEntities"/>
</xsl:call-template>
<xsl:copy-of select="php:functionString('chdir', '../')" />
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="xmi:Documentation"/>
</xsl:stylesheet>

View File

@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi exslt exslt-set exslt-functions"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:exslt="http://exslt.org/common" xmlns:exslt-set="http://exslt.org/sets"
xmlns:exslt-functions="http://exslt.org/functions">
<!-- Called on the top container. Lists all elements -->
<xsl:template name="index-all">
<html>
<xsl:call-template name="htmlStartPage"/>
<xsl:call-template name="htmlHead">
<xsl:with-param name="path" />
<xsl:with-param name="title" select="concat(@name,' - Overview')"/>
</xsl:call-template>
<body>
<div id="navigation">
<div id="banner">
<ul class="sections">
<li><a href="{$fileOverviewSummary}" title="Summary of all packages">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li class="active">Index</li>
</ul>
<ul class="navigFrame">
<a href="{concat($fileIndex,'?',$fileIndexAll)}" class="navigFrameElem" target="_top">FRAMES</a>
<a href="{$fileIndexAll}" class="navigFrameElem" target="_top">NO FRAMES</a>
</ul>
</div>
</div>
<div id="content">
<ul>
<xsl:variable name="content">
<xsl:call-template name="indexAllInnerContainer" mode="indexAll"/>
</xsl:variable>
<xsl:for-each select="exslt:node-set($content)/*">
<xsl:sort select="text()"/>
<li><a href="{@href}"><xsl:value-of select="text()"/></a>
&#32;-&#32;
<xsl:value-of select="comment/text()"/>
<xsl:copy-of select="comment/a"/>
</li>
</xsl:for-each>
</ul>
</div>
</body>
</html>
</xsl:template>
<xsl:template name="indexAllInnerContainer">
<xsl:for-each select="packagedElement[@xmi:type='uml:Package' or @xmi:type='uml:Model']">
<xsl:variable name="setEntities" select="(packagedElement|nestedClassifier)[@xmi:type='uml:Interface' or @xmi:type='uml:Class' or @xmi:type='uml:DataType']"/>
<xsl:for-each select="$setEntities">
<xsl:variable name="entityName" select="@name"/>
<xsl:variable name="path">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fileName">
<xsl:value-of select="$path"/>
<xsl:call-template name="getPrefix"><xsl:with-param name="context" select="."/></xsl:call-template>
<xsl:value-of select="concat(@name, '.html')"/>
</xsl:variable>
<xsl:variable name="packageName">
<xsl:call-template name="getPackageNamePart"/>
</xsl:variable>
<li>
<xsl:attribute name="href">
<xsl:value-of select="$fileName"/>
</xsl:attribute>
<comment>
Class in
<a href="{concat($path, $filePackageSummary)}"><xsl:value-of select="$packageName"/></a>
<xsl:text>&#32;</xsl:text>
<xsl:call-template name="titleComment"/>
</comment>
<xsl:value-of select="@name"/>
</li>
<xsl:for-each select="ownedAttribute">
<li>
<xsl:attribute name="href">
<xsl:value-of select="concat($fileName, '#', @name)"/>
</xsl:attribute>
<comment>
Variable in
<xsl:value-of select="$packageName"/><a href="{$fileName}"><xsl:value-of select="$entityName"/></a>
<xsl:text>&#32;</xsl:text>
<xsl:call-template name="titleComment"/>
</comment>
<xsl:value-of select="@name"/>
</li>
</xsl:for-each>
<xsl:for-each select="ownedOperation">
<li>
<xsl:variable name="parameters">
<xsl:call-template name="htmlParametersBracket"/>
</xsl:variable>
<xsl:attribute name="href">
<xsl:value-of select="concat($fileName, '#', @name, $parameters)"/>
</xsl:attribute>
<comment>
Method in
<xsl:value-of select="$packageName"/><a href="{$fileName}"><xsl:value-of select="$entityName"/></a>
<xsl:text>&#32;</xsl:text>
<xsl:call-template name="titleComment"/>
</comment>
<xsl:value-of select="@name"/>
</li>
</xsl:for-each>
</xsl:for-each>
<xsl:call-template name="indexAllInnerContainer"/>
</xsl:for-each>
<!-- procedural elements -->
<xsl:variable name="entityName" select="@name"/>
<xsl:variable name="path">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fileName">
<xsl:value-of select="$path"/>
<xsl:choose>
<xsl:when test="@xmi:type='uml:Model'">
<xsl:value-of select="$fileOverviewSummary"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(@name, '/', $filePackageSummary)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="ownedOperation">
<li>
<xsl:variable name="parameters">
<xsl:call-template name="htmlParametersBracket"/>
</xsl:variable>
<xsl:attribute name="href">
<xsl:value-of select="concat($fileName, '#', @name, $parameters)"/>
</xsl:attribute>
<comment>
Method in
<a href="{$fileName}"><xsl:value-of select="$entityName"/></a>
<xsl:text>&#32;</xsl:text>
<xsl:call-template name="titleComment"/>
</comment>
<xsl:value-of select="@name"/>
</li>
</xsl:for-each>
<xsl:for-each select="ownedAttribute">
<li>
<xsl:attribute name="href">
<xsl:value-of select="concat($fileName, '#', @name)"/>
</xsl:attribute>
<comment>
Constant in
<a href="{$fileName}"><xsl:value-of select="$entityName"/></a>
<xsl:text>&#32;</xsl:text>
<xsl:call-template name="titleComment"/>
</comment>
<xsl:value-of select="@name"/>
</li>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
<xsl:template name="index">
<xsl:param name="containerName" select="@name"/>
<html>
<xsl:call-template name="htmlStartPage"/>
<xsl:call-template name="htmlHead">
<xsl:with-param name="path" />
<xsl:with-param name="title" select="concat($containerName, '&#32;API&#32;Documentation')"/>
</xsl:call-template>
<script type="text/javascript">
<![CDATA[
targetPage = "" + window.location.search;
if (targetPage != "" && targetPage != "undefined")
targetPage = targetPage.substring(1);
function loadFrames() {
if (targetPage != "" && targetPage != "undefined")
top.classFrame.location = top.targetPage;
}
]]>
</script>
<frameset cols="20%,80%" title="" onLoad="top.loadFrames()">
<frameset rows="30%,70%" title="" onLoad="top.loadFrames()">
<frame src="overview-frame.html" name="packageListFrame" title="All Packages" />
<frame src="allclasses-frame.html" name="packageFrame" title="All classes and interfaces (except non-static nested types)" />
</frameset>
<frame src="overview-summary.html" name="classFrame" title="Package, class and interface descriptions" scrolling="yes" />
<noframes>
<h2>Frame Alert</h2>
<p>
This document is designed to be viewed using the frames feature.
If you see this message, you are using a non-frame-capable web client.<br/>
Link to<a HREF="overview-summary.html">Non-frame version.</a>
</p>
</noframes>
</frameset>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- The starting template -->
<xsl:include href="documentation-generator.xsl"/>
<!-- Some common templates for documentation generation -->
<xsl:include href="documentation-common.xsl"/>
<!-- The user templates -->
<xsl:include href="classifier.xsl"/>
<xsl:include href="package-summary.xsl"/>
<xsl:include href="overview-summary.xsl"/>
<xsl:include href="overview-frame.xsl"/>
<xsl:include href="allclasses-frame.xsl"/>
<xsl:include href="package-frame.xsl"/>
<xsl:include href="index.xsl"/>
<xsl:include href="index-all.xsl"/>
</xsl:stylesheet>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
<!-- Called on the top container. Lists all the container elements, in the left frame -->
<xsl:template name="overview-frame">
<xsl:param name="containerSet" />
<html>
<xsl:call-template name="htmlStartPage"/>
<xsl:call-template name="htmlHead">
<xsl:with-param name="path" />
<xsl:with-param name="title" select="concat(@name,' - Overview')"/>
</xsl:call-template>
<body>
<div id="contentFrame">
<a href="{$fileAllclassesFrame}" target="packageFrame">All Classes</a>
<h3>Packages</h3>
<ul>
<xsl:for-each select="$containerSet">
<li>
<xsl:variable name="path">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
<xsl:value-of select="@name"/>
</xsl:variable>
<a href="{concat('./', $path, '/', $filePackageFrame)}" target="packageFrame">
<xsl:call-template name="getPackageNamePart"/>
<xsl:value-of select="@name"/>
</a>
</li>
</xsl:for-each>
</ul>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
<!-- Called on the top container. Lists all the container elements (packages) -->
<xsl:template name="overview-summary">
<xsl:param name="containerSet"/>
<html>
<xsl:call-template name="htmlStartPage"/>
<xsl:call-template name="htmlHead">
<xsl:with-param name="path" />
<xsl:with-param name="title" select="concat(@name,' - Overview')"/>
</xsl:call-template>
<body>
<div id="navigation">
<div id="banner">
<ul class="sections">
<li class="active">Overview</li>
<li>Package</li>
<li>Class</li>
<li><a href="{$fileIndexAll}">Index</a></li>
</ul>
<ul class="navigFrame">
<a href="{concat($fileIndex,'?',$fileOverviewSummary)}" class="navigFrameElem" target="_top">FRAMES</a>
<xsl:text>&#32;</xsl:text>
<a href="{$fileOverviewSummary}" class="navigFrameElem" target="_top">NO FRAMES</a>
</ul>
</div>
</div>
<div id="content">
<div class="classSummary">
<h1 id="entityName"><xsl:value-of select="@name" /></h1>
</div>
<p>
<xsl:apply-templates select="ownedComment"/>
</p>
<hr/>
<xsl:if test="count($containerSet) &gt; 0">
<h2>Packages</h2>
<table border="1" class="tableSummary">
<xsl:for-each select="$containerSet">
<tr>
<td>
<xsl:variable name="path">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
<xsl:value-of select="@name"/>
</xsl:variable>
<strong><a href="{concat('./', $path, '/', $filePackageSummary)}">
<xsl:call-template name="getPackageNamePart"/>
<xsl:value-of select="@name"/>
</a></strong></td>
<td>
<xsl:call-template name="titleComment"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:if>
<!-- added for the non-OO ("global") functions -->
<xsl:variable name="interfaceSet" select="packagedElement[@xmi:type='uml:Interface']" />
<xsl:variable name="classSet" select="packagedElement[@xmi:type='uml:Class']"/>
<xsl:variable name="ownedOperationSet" select="ownedOperation"/>
<xsl:variable name="ownedAttributeSet" select="ownedAttribute"/>
<xsl:variable name="relPathTop"/>
<xsl:if test="count($interfaceSet) &gt; 0">
<h2>Interface summary</h2>
<xsl:call-template name="htmlTableSummary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="set" select="$interfaceSet"/>
<xsl:with-param name="filePrefix" select="$fileprefixInterface"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="count($classSet) &gt; 0">
<h2>Class summary</h2>
<xsl:call-template name="htmlTableSummary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="set" select="$classSet"/>
<xsl:with-param name="filePrefix" select="$fileprefixClass"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="count($ownedAttributeSet) &gt; 0">
<div id="fieldSummary">
<h2>Field Summary</h2>
<table border="1" class="tableSummary">
<xsl:for-each select="$ownedAttributeSet">
<xsl:call-template name="class-field-summary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:for-each>
</table>
</div>
</xsl:if>
<xsl:if test="count($ownedOperationSet) &gt; 0">
<div id="methodSummary">
<h2>Method Summary</h2>
<table border="1" class="tableSummary">
<xsl:for-each select="$ownedOperationSet">
<xsl:call-template name="class-method-summary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:for-each>
</table>
</div>
</xsl:if>
<xsl:if test="count($ownedAttributeSet) &gt; 0">
<div id="fieldDetail">
<h2>Field Detail</h2>
<xsl:for-each select="$ownedAttributeSet">
<xsl:call-template name="class-field-detail">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:for-each>
</div>
</xsl:if>
<xsl:if test="count($ownedOperationSet) &gt; 0">
<div id="methodDetail">
<h2>Method Detail</h2>
<xsl:for-each select="$ownedOperationSet">
<xsl:call-template name="class-method-detail">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="specifiedBy" select="no"/>
</xsl:call-template>
</xsl:for-each>
</div>
</xsl:if>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
<xsl:template name="package-frame">
<xsl:param name="relPathTop"/>
<xsl:param name="classSet"/>
<xsl:param name="interfaceSet"/>
<xsl:param name="ownedOperationSet"/>
<xsl:param name="ownedAttributeSet"/>
<xsl:param name="packageNamePart"/>
<html>
<xsl:call-template name="htmlStartPage"/>
<xsl:call-template name="htmlHead">
<xsl:with-param name="path" select="$relPathTop"/>
<xsl:with-param name="title" select="concat($packageNamePart, @name)"/>
</xsl:call-template>
<body>
<div id="contentFrame">
<h1>
<a href="package-summary.html" target="classFrame">
<xsl:value-of select="concat($packageNamePart, @name)" />
</a>
</h1>
<xsl:if test="count($classSet) &gt; 0">
<h3>Classes</h3>
<ul>
<xsl:for-each select="$classSet">
<xsl:sort select="@name" data-type="text"/>
<li>
<a href="{concat($fileprefixClass, @name,'.html')}" target="classFrame"><xsl:value-of select="@name"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:if test="count($interfaceSet) &gt; 0">
<h3>Interfaces</h3>
<ul>
<xsl:for-each select="$interfaceSet">
<xsl:sort select="@name" data-type="text"/>
<li class="interfaceElement">
<a href="{concat($fileprefixInterface, @name, '.html')}" target="classFrame"><xsl:value-of select="@name"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:if test="count($ownedOperationSet) &gt; 0">
<h3>Functions</h3>
<ul>
<xsl:for-each select="$ownedOperationSet">
<xsl:sort select="@name" data-type="text"/>
<xsl:variable name="parameters">
<xsl:call-template name="htmlParametersBracket">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:variable>
<li>
<a href="{concat('package-summary.html#', @name, $parameters)}" target="classFrame"><xsl:value-of select="@name"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:if test="count($ownedAttributeSet) &gt; 0">
<h3>Constants</h3>
<ul>
<xsl:for-each select="$ownedAttributeSet">
<xsl:sort select="@name" data-type="text"/>
<li>
<a href="{concat('package-summary.html#', @name)}" target="classFrame"><xsl:value-of select="@name"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="uml xmi exslt exslt-set exslt-functions"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.2"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:exslt="http://exslt.org/common" xmlns:exslt-set="http://exslt.org/sets"
xmlns:exslt-functions="http://exslt.org/functions">
<xsl:template name="package-summary">
<xsl:param name="relPathTop" />
<xsl:param name="classSet"/>
<xsl:param name="interfaceSet"/>
<xsl:param name="ownedOperationSet" select="$ownedOperationSet"/>
<xsl:param name="ownedAttributeSet" select="$ownedAttributeSet"/>
<xsl:param name="packageNamePart"/>
<xsl:param name="containerName"/>
<xsl:variable name="packageFilePath">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="."></xsl:with-param></xsl:call-template>
</xsl:variable>
<xsl:variable name="previousPreceding" select="(preceding::packagedElement|ancestor::packagedElement)[@xmi:type='uml:Package' or @xmi:type='uml:Model'][last()]"/>
<xsl:variable name="nextFollowing" select="(descendant::packagedElement|following::packagedElement)[@xmi:type='uml:Package' or @xmi:type='uml:Model'][1]"/>
<html>
<xsl:call-template name="htmlStartPage"/>
<xsl:call-template name="htmlHead">
<xsl:with-param name="path" select="$relPathTop"/>
<xsl:with-param name="title" select="concat($packageNamePart, @name)"/>
</xsl:call-template>
<body>
<div id="navigation">
<div id="banner">
<ul class="sections">
<li><a href="{$relPathTop}{$fileOverviewSummary}" title="Summary of all packages">Overview</a></li>
<li class="active">Package</li>
<li>Class</li>
<li><a href="{$relPathTop}{$fileIndexAll}">Index</a></li>
</ul>
<ul class="navigFrame">
<a href="{concat($relPathTop,$fileIndex,'?',$containerName,'/',$packageFilePath,$filePackageSummary)}" class="navigFrameElem" target="_top">FRAMES</a>
<xsl:text>&#32;</xsl:text>
<a href="{$filePackageSummary}" class="navigFrameElem" target="_top">NO FRAMES</a>
</ul>
</div>
<ul class="siblingSections">
<xsl:if test="count($previousPreceding) &gt; 0">
<xsl:variable name="path">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="$previousPreceding/@name"/>
</xsl:call-template>
</xsl:variable>
<li class="last"><a href="{concat($relPathTop, $path, $filePackageSummary)}">Prev Package</a></li>
</xsl:if>
<xsl:if test="count($nextFollowing) &gt; 0">
<xsl:variable name="path">
<xsl:call-template name="getPackageFilePath">
<xsl:with-param name="context" select="$nextFollowing/@name"/>
</xsl:call-template>
</xsl:variable>
<li class="last"><a href="{concat($relPathTop, $path, $filePackageSummary)}">Next Package</a></li>
</xsl:if>
</ul>
</div>
<div id="content">
<div class="classSummary">
<h1 id="entityName">Package <xsl:value-of select="concat($packageNamePart, @name)" /></h1>
</div>
<p>
<xsl:call-template name="htmlDescription">
<xsl:with-param name="baseElement" select="@xmi:id"/>
</xsl:call-template>
</p>
<hr/>
<xsl:if test="count($interfaceSet) &gt; 0">
<h2>Interface summary</h2>
<xsl:call-template name="htmlTableSummary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="set" select="$interfaceSet"/>
<xsl:with-param name="filePrefix" select="$fileprefixInterface"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="count($classSet) &gt; 0">
<h2>Class summary</h2>
<xsl:call-template name="htmlTableSummary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="set" select="$classSet"/>
<xsl:with-param name="filePrefix" select="$fileprefixClass"/>
</xsl:call-template>
</xsl:if>
<!-- added for the non-OO functions -->
<xsl:if test="count($ownedAttributeSet) &gt; 0">
<div id="fieldSummary">
<h2>Field Summary</h2>
<table border="1" class="tableSummary">
<xsl:for-each select="$ownedAttributeSet">
<xsl:call-template name="class-field-summary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:for-each>
</table>
</div>
</xsl:if>
<xsl:if test="count($ownedOperationSet) &gt; 0">
<div id="methodSummary">
<h2>Method Summary</h2>
<table border="1" class="tableSummary">
<xsl:for-each select="$ownedOperationSet">
<xsl:call-template name="class-method-summary">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:for-each>
</table>
</div>
</xsl:if>
<xsl:if test="count($ownedAttributeSet) &gt; 0">
<div id="fieldDetail">
<h2>Field Detail</h2>
<xsl:for-each select="$ownedAttributeSet">
<xsl:call-template name="class-field-detail">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
</xsl:call-template>
</xsl:for-each>
</div>
</xsl:if>
<xsl:if test="count($ownedOperationSet) &gt; 0">
<div id="methodDetail">
<h2>Method Detail</h2>
<xsl:for-each select="$ownedOperationSet">
<xsl:call-template name="class-method-detail">
<xsl:with-param name="relPathTop" select="$relPathTop"/>
<xsl:with-param name="specifiedBy" select="no"/>
</xsl:call-template>
</xsl:for-each>
</div>
</xsl:if>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 B

View File

@@ -0,0 +1,236 @@
body {
margin: 0px;
padding: 4px 3px 3px 3px;
}
/**
* Titles
*/
h1 {
font-size: 145%;
}
h1#entityName {
padding:0px 0px 18px 0px;
margin:0px;
}
h2 {
font-size: 145%;
background-color:#CCCCFF;
padding:3px 4px 5px 4px;
margin:15px 0px 4px 0px;
border:1px solid #333;
}
h3 {
font-size: 95%;
}
h3#entityPackage {
margin: 0px;
padding: 0px;
font-size: 90%;
font-family: monospace;
}
.detail h4 {
margin:15px 3px 4px 3px;
}
/**
* Special for the left frames:
*/
div#contentFrame {
padding:6px 0px 0px 3px;
font-family: Arial,Verdana;
font-size: 85%;
}
div#contentFrame h1 {
font-size: 100%;
margin-bottom:2px;
}
div#contentFrame h3 {
font-size: 100%;
margin-bottom:2px;
font-weight:normal;
}
div#contentFrame ul {
list-style: none;
padding:0px 0px 0px 3px;
margin:0px;
}
/**
* Navigation
*/
#navigation {
margin: 0px 3px 3px 3px;
padding: 0px 0px 8px 0px;
border-color: #ccc;
border-width:0px 0px 1px 0px;
border-style:solid;
}
#banner {
margin: 3px 0px;
padding: 0px;
background-color: #EEEEFF;
height: 26px;
}
ul.sections {
list-style: none;
margin: 2px 0px 4px 2px;
padding: 0px;
width: 300px;
overflow: hidden;
float: left;
}
ul.sections li {
display: inline;
margin: 2px 2px 2px 2px;
padding: 0px 2px;
font-size: 100%;
font-weight: normal;
font-family: Arial,Verdana;
color: #000;
line-height:15pt;
}
ul.sections li a {
color:#000;
font-weight: bold;
}
ul.sections li.active {
background-color: #44a;
color: #fff;
font-weight: bold;
}
.siblingSections {
list-style: none;
margin: 0px;
padding: 0px 3px 2px 1px;
overflow: hidden;
clear: both;
}
.siblingSections li {
display: inline;
margin: 0px;
padding: 0px 3px 4px 3px;
font-size: 65%;
text-transform: uppercase;
font-family:Arial,Verdana;
}
.navigFrame {
display: block;
margin: 6px 0px 0px 0px;
padding: 0px;
float: right;
font-size: 65%;
font-family: Arial,Verdana;
}
a.navigFrameElem {
padding-right:15px;
}
/**
* Main
*/
hr {
border-width:0px 0px 1px 0px;
border-color:#ccc;
border-style:solid;
}
code, pre, .code {
font-family: monospace;
font-size: 90%;
}
sup {
font-size: 60%;
}
dl.classTree {
background-color:#f4f4f4;
padding:5px;
margin:0px 0px 10px 0px;
border:1px solid #ccc;
}
dl.classTree dd {
margin: 0px;
padding: 0px;
font-size: 90%;
font-family: monospace;
}
dl.classTree .currentElem {
font-weight:bold;
}
#content {
clear: both;
padding: 16px 0px 0px 5px;
margin: 0px;
}
.tableSummary {
border:1px solid #aaa;
border-collapse:collapse;
font-size:1em;
}
.tableSummary td {
border:1px solid #aaa;
margin:0px;
padding:2px 3px;
font-size:1em;
}
a.linkSummary, a.linkSummary:visited, a.linkSummary:link {
font-weight:bold;
text-decoration:underline;
}
a.linkType, a.linkType:visited, a.linkType:link {
font-weight:normal;
text-decoration:none;
}
a.linkSimple, a.linkSimple:visited, a.linkSimple:link {
font-weight:normal;
text-decoration:underline;
}
.detailContent {
background-color:#f4f4f4;
padding:5px;
margin:0px;
border:1px solid #ccc;
}
h3.titleSmallList {
font-weight: bold;
padding:0px 0px 0px 0px;
margin:0px;
}
div.smallList {
padding:0px 0px 10px 25px;
margin:0px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,385 @@
html {
font-size: 62.5%
}
body {
background-color: #fff;
color: #000;
margin: 3px 8px 3px 3px;
padding: 0px;
font: 100% Arial, Verdana, Helvetica, sans-serif;
font-size: 1em;
}
/**
* Right panel
*/
h1 {
font-size:1.8em;
background-repeat:no-repeat;
background-position:top left;
padding:0px 0px 5px 28px;
margin:5px 0px 0px 0px;
width:360px;
border-width:0px 0px 1px 0px;
border-style:solid;
border-color:#ccc;
}
h1.class {
background-image: url(class-big.png);
border-color:#1515ff;
}
h1.datatype {
background-image: url(datatype-big.png);
border-color:#1515ff;
}
h1.interface {
background-image: url(interface-big.png);
border-color:#1515ff;
}
h1.model {
background-image: url(model-big.png);
border-color:#005b00;
}
h1.package {
background-image: url(package-big.png);
border-color:#005b00;
}
h1.index {
background-image: url(index-all-big.png);
margin:5px 0px 20px 0px;
}
h1.help {
background-image: url(help-big.png);
margin:5px 0px 20px 0px;
}
h2 {
border-width:0px 0px 1px 0px;
border-style:solid;
border-color:#ccc;
width:200px;
color:#000;
margin:15px 0px 8px 0px;
font-size:1.4em;
}
ul, li {
font-size:1em;
}
p {
margin:0px;
padding:3px 0px 3px 0px;
}
ul.summary {
list-style-type:none;
margin:0px;
padding-left:20px;
font-size:1.2em;
line-height:1.5em;
}
ul.summary li {
margin:0px;
padding:0px 0px 1px 0px;
}
ul.summary li.Expanded ul {
border:1px solid #ccc;
background-color:#f5f5f5;
padding:0px 3px 4px 22px;
margin:5px 0px 6px 12px;
}
ul.description {
margin:0px 0px 5px 15px;
padding:0px;
list-style-image:url(point.png);
}
ul.description li {
margin:0px;
padding:0px;
}
ul.single {
margin:5px 0px 5px 0px;
padding:0px;
list-style:none;
}
ul.indexAll {
list-style: none;
line-height:17px;
font-size:1.1em;
}
/**
* Navigation bar
*/
ul.navig {
display: inline;
list-style: none;
margin: 0px;
padding: 5px 1px 0px 0px;
float:right;
}
ul.navig li {
display: inline;
margin: 0px;
padding: 0px 0px 0px 6px;
font-size: 1em;
text-transform: uppercase;
color:#333;
}
ul.navig a {
text-decoration:underline;
}
ul.navig a.right {
background: url(right.png) no-repeat center left;
padding-left:11px;
color:#1515ff;
}
ul.navig a.left {
background: url(left.png) no-repeat center left;
padding-left:11px;
color:#1515ff;
}
ul.navig a.top {
background: url(top.png) no-repeat center left;
padding-left:11px;
color:#005b00;
}
ul.navig a.expandAllBtn {
background: url(expand-all.png) no-repeat center left;
padding:0px 8px 0px 16px;
color:#333;
}
ul.navig a.helpBtn {
background: url(help.png) no-repeat center left;
padding:0px 8px 0px 18px;
color:#333;
}
ul.navig a.indexAllBtn {
background: url(index-all.png) no-repeat center left;
padding:0px 8px 0px 19px;
color:#333;
}
#footer {
padding:20px 0px 5px 0px;
font-style:italic;
position:relative;
bottom:0px;
text-align:right;
color:#505050;
}
/**
* Inheritance diagram
*/
dl.inheritTree {
background-color:#f5f5f5;
padding:3px 6px 3px 6px;
margin:5px 0px 5px 0px;
border:1px solid #ccc;
}
dl.inheritTree dd {
margin: 0px;
padding: 0px;
font-size: 1.1em;
}
dl.inheritTree .current {
font-family:"Courier New", monospace;
font-size:1.1em;
font-weight:bold;
}
div.description {
font-size:1.2em;
padding:0px 3px 0px 6px;
margin:20px 0px 10px 0px;
border:1px solid #ccc;
}
div.descriptionPkg {
font-size:1.2em;
padding:0px;
margin:20px 0px 15px 0px;
}
a {
color:#383838;
background-repeat:no-repeat;
background-position:center left;
text-decoration:none;
}
.model {
color:#005b00;
}
.package {
color:#005b00;
}
.class {
color:#1515ff;
}
.datatype {
color:#1515ff;
}
.interface {
color:#1515ff;
}
.property {
color:#bd7a0e;
}
.method {
color:#80233d;
}
/**
* Left menu
*/
#MainList {
padding:0px 0px 0px 3px;
}
#MainList a {
padding:0px 0px 0px 20px;
}
#MainList a.link, span.link {
padding:0px;
color:#1515ff;
font-family:"Courier New", monospace;
font-size:1em;
}
#MainList a.link2 {
padding:0px;
color:#1515ff;
/*text-decoration:underline;*/
font-family:"Courier New", monospace;
font-size:1em;
}
.title {
font-weight:bold;
color:#222;
letter-spacing:1px;
}
.smallTitle {
font-weight:bold;
color:#222;
}
.defVal, .abstract, .note {
font-style:italic;
}
.note {
font-style:italic;
font-size:0.8em;
}
li.smaller {
font-size:0.9em;
}
a.model {
background-image: url(model.png);
font-weight:bold;
}
a.package {
background-image: url(package.png);
}
a.class {
background-image: url(class.png);
}
a.interface {
background-image: url(interface.png);
font-style:italic;
}
a.datatype {
background-image: url(datatype.png);
}
a.property {
background-image: url(property.png);
}
a.property-pub {
background-image: url(property-pub.png);
color:#bd7a0e;
}
a.property-pro {
background-image: url(property-pro.png);
color:#bd7a0e;
}
a.property-pri {
background-image: url(property-pri.png);
color:#bd7a0e;
}
a.method {
background-image: url(method.png);
}
a.method-pub {
background-image: url(method-pub.png);
color:#80233d;
}
a.method-pro {
background-image: url(method-pro.png);
color:#70233d;
}
a.method-pri {
background-image: url(method-pri.png);
color:#70233d;
}
/**
* Treeview
*/
.TreeView {
display:block;
line-height:18px;
font-size:1.2em;
cursor:pointer;
font-style:normal;
}
.TreeView li {
margin:0px;
padding:0 0 0 16px;
list-style:none;
}
.TreeView, .TreeView ul {
margin:0;
padding:0;
}
.TreeView li.Expanded {
background: url(minus.gif) no-repeat left top;
}
li.Expanded ul {
display: block;
}
.TreeView li.Collapsed {
background: url(plus.gif) no-repeat left top;
}
li.Collapsed ul {
display: none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

View File

@@ -0,0 +1,165 @@
Array.prototype.indexOf = IndexOf;
//Finds the index of an item in an array
function IndexOf(item) {
for (var i=0; i < this.length; i++) {
if (this[i] == item) {
return i;
}
}
return -1;
}
var toggler = {
//CSS class names
states: Array('Collapsed','Expanded'),
//Caption
statesLib: Array('Collapse', 'Expand'),
//Current state
curState: 1,
//Name of the cookie that stores the current state between pages
cookieName: 'apiTreeviewState',
//Sets all the elements to a new state, and updates the current state variable
toggleAll: function(treeId, btnId)
{
this.curState = 1-this.curState;
this.toggleAllTree(treeId, this.curState)
var btn = document.getElementById(btnId);
btn.innerHTML = this.statesLib[1-this.curState]+' all';
setCookie(this.cookieName, this.curState);
},
//Sets all the elements to a given state
toggleAllTree: function(treeId, stateId)
{
var tree = document.getElementById(treeId);
if(!tree) return;
var treeElements = tree.getElementsByTagName('li');
for (var i=0; i<treeElements.length; i++) {
this.replaceInClass(treeElements[i], this.states[stateId], this.states[1-stateId]);
}
},
//Sets the element to the firstClass given, in place of the second
replaceInClass: function(element, firstClass, secondClass)
{
var classes = element.className.split(" ");
var firstClassIndex = classes.indexOf(firstClass);
var secondClassIndex = classes.indexOf(secondClass);
if (secondClassIndex>-1) {
classes[secondClassIndex] = firstClass;
}
element.className = classes.join(" ");
},
//Toggles between two classes
toggleClass: function(element, firstClass, secondClass, event)
{
event.cancelBubble = true;
var classes = element.className.split(" ");
var firstClassIndex = classes.indexOf(firstClass);
var secondClassIndex = classes.indexOf(secondClass);
if (firstClassIndex == -1 && secondClassIndex == -1) {
classes[classes.length] = firstClass;
}
else if (firstClassIndex != -1) {
classes[firstClassIndex] = secondClass;
}
else {
classes[secondClassIndex] = firstClass;
}
element.className = classes.join(" ");
},
//Toggle event handler for each expandable/collapsable node
toggleNodeStateHandler: function(event)
{
toggler.toggleClass(this, toggler.states[0], toggler.states[1], (event==null) ? window.event : event);
},
//Prevents the onclick event from bubbling up
preventBubbleHandler: function(event)
{
if (!event)
event = window.event;
event.cancelBubble = true;
},
//Adds the relevant onclick handlers for the nodes in the tree view
setupTreeView: function(treeId)
{
var tree = document.getElementById(treeId);
if(!tree) return;
var treeElements = tree.getElementsByTagName("li");
for (var i=0; i<treeElements.length; i++) {
if (treeElements[i].getElementsByTagName("ul").length>0) {
treeElements[i].onclick = toggler.toggleNodeStateHandler;
}
else {
treeElements[i].onclick = toggler.preventBubbleHandler;
}
}
var h = window.location.hash;
if(h!='') {
var s = document.getElementById(h.substring(1));
if(s) {
this.replaceInClass(s, this.states[1], this.states[0]);
}
}
},
backToMemorizedState: function(treeId, btnId)
{
var x = getCookie(this.cookieName);
if (x==0 || x==1) {
this.curState = x;
var btn = document.getElementById(btnId);
btn.innerHTML = this.statesLib[1-this.curState]+' all';
this.toggleAllTree(treeId, this.curState);
}
}
}
function setCookie(name, value, expires, path, domain, secure)
{
var today = new Date();
today.setTime( today.getTime() );
if (expires) {
expires = expires*1000*60*60*24;
}
var expires_date = new Date(today.getTime() + (expires) );
document.cookie = name + "=" +escape(value) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
function getCookie(check_name)
{
var a_all_cookies = document.cookie.split(';');
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = '';
var b_cookie_found = false;
for (i=0; i<a_all_cookies.length; i++) {
a_temp_cookie = a_all_cookies[i].split( '=' );
cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
if (cookie_name == check_name){
b_cookie_found = true;
if (a_temp_cookie.length>1) {
cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
}
return cookie_value;
break;
}
a_temp_cookie = null;
cookie_name = '';
}
if (!b_cookie_found) {
return null;
}
}

View File

@@ -0,0 +1,58 @@
<?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: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the class renderer
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocClass extends PHP_UML_Output_HtmlNew_DocClassifier
{
protected function getTypeName()
{
return 'class';
}
protected function getStyleName()
{
return 'class';
}
protected function getPrefix()
{
return self::CLASS_PREFIX;
}
protected function getCurrentElement($i)
{
return $this->getContextPackage()->classes[$i];
}
protected function getNextElement($i)
{
return $i+1<count($this->getContextPackage()->classes) ? $this->getContextPackage()->classes[$i+1] : null;
}
protected function getPreviousElement($i)
{
return $i>0 ? $this->getContextPackage()->classes[$i-1] : null;
}
}
?>

View File

@@ -0,0 +1,237 @@
<?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: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the HTML renderer for a classifier (class, interface, datatype)
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Output_HtmlNew_DocClassifier extends PHP_UML_Output_HtmlNew_DocElement
{
/**
* Return the type name of the classifier
*
* @return string
*/
abstract protected function getTypeName();
/**
* Return the CSS style name of the classifier
*
* @return string
*/
abstract protected function getStyleName();
/**
* Return the prefix (filename scheme)
*
* @return string
*/
abstract protected function getPrefix();
/**
* Return the current object
*
* @param int $i Current index in all the elements of the package
*
* @return PHP_UML_Metamodel_Classifier
*/
abstract protected function getCurrentElement($i);
/**
* Return the next object
*
* @param int $i Current index in all the elements of the package
*
* @return PHP_UML_Metamodel_Classifier
*/
abstract protected function getNextElement($i);
/**
* Return the previous object
*
* @param int $i Previous index in all the elements of the package
*
* @return PHP_UML_Metamodel_Classifier
*/
abstract protected function getPreviousElement($i);
/**
* Generates and saves the HTML code for a classifier
*
* @param int $i Index of the element (to be found in the Context object)
*/
public function render($i)
{
$p = $this->getCurrentElement($i);
$nav = $this->getNavigationBlock($i);
$tit = $this->getTitleBlock($i);
$this->ignoredTag = array('var'); // we ignore all 'var' docblocks
$str = $this->getDescriptionBlock($p);
$str .= $this->getPropertyBlock($p);
$str .= $this->getFunctionBlock($p);
$str = $this->replaceInTpl($str, $nav, $tit, $p->name);
$this->save($this->getPrefix().$p->name, $str);
}
/**
* Return the HTML code for the navigation bar
*
* @param int $i Index of the current element in the the array containing all
* the elements of the current package
*
* @return string A list of HTML LI
*/
private function getNavigationBlock($i)
{
$prev = $this->getPreviousElement($i);
$next = $this->getNextElement($i);
$type = $this->getTypeName();
$str = $this->getCommonLinks();
if (!empty($prev))
$str .= '<li><a href="'.$this->getPrefix().$prev->name.'.'.self::FILE_EXT.'" class="left">Prev '.$type.'</a></li>';
$str .= $this->getNavigParentPackage();
if (!empty($next))
$str .= '<li><a href="'.$this->getPrefix().$next->name.'.'.self::FILE_EXT.'" class="right">Next '.$type.'</a></li>';
return $str;
}
private function getTitleBlock($i)
{
$elem = $this->getCurrentElement($i);
$str = '<h1 class="'.$this->getStyleName();
if ($elem->isAbstract)
$str .= ' abstract';
return $str.'">'.$elem->name.'</h1>';
}
private function getDescriptionBlock(PHP_UML_Metamodel_Classifier $p)
{
$allInherited = $this->getAllInherited($p);
$nbAllInherited = count($allInherited);
$allImplemented = $this->getAllImplemented($p);
$nbAllImplemented = count($allImplemented);
$allInheriting = $this->getAllInheriting($p);
$nbAllInheriting = count($allInheriting);
$allImplementing = $this->getAllImplementing($p);
$nbAllImplementing = count($allImplementing);
$typeName = $this->getTypeName();
if ($p->isAbstract)
$typeName = 'abstract '.$typeName;
if ($p->isReadOnly)
$typeName = 'final '.$typeName;
$str = '<div class="description"><p>'.ucfirst($typeName).
' <span class="title">'.$this->getQualifiedName($p).'</span>';
$css = 'link2';
if (!empty($p->superClass[0])) {
$str .= ' extends ';
if (is_object($p->superClass[0]))
$str .= $this->getLinkTo($p->superClass[0], $css);
else
$str .= $this->displayUnresolved($p->superClass[0]);
}
if (isset($p->implements)) {
$nbImpl = count($p->implements);
if ($nbImpl>0) {
$str .= ' implements ';
for ($i=0; $i<$nbImpl; $i++) {
if (!empty($p->implements[$i])) {
if (is_object($p->implements[$i]))
$str .= $this->getLinkTo($p->implements[$i], $css);
else
$str .= $this->displayUnresolved($p->implements[$i]);
if ($i<$nbImpl-1)
$str .= ', ';
}
}
}
}
$str .= '</p>';
$str .= '<ul class="description">';
if (!is_null($p->description)) {
$str .= $this->getTagsAsList($p->description);
}
if ($nbAllImplemented>0) {
$str .= '<li>All implemented interfaces: ';
foreach ($allImplemented as $ai) {
$str .= $this->getLinkTo($ai, $css).', ';
}
$str = substr($str, 0, -2);
$str .= '</li>';
}
if ($nbAllInheriting>0) {
$str .= '<li>All subclasses: ';
foreach ($allInheriting as $ai) {
$str .= $this->getLinkTo($ai, $css).', ';
}
$str = substr($str, 0, -2);
$str .= '</li>';
}
if ($nbAllImplementing>0) {
$str .= '<li>All implementing classes: ';
foreach ($allImplementing as $ai) {
$str .= $this->getLinkTo($ai, $css).', ';
}
$str = substr($str, 0, -2);
$str .= '</li>';
}
$str .= $this->getFileInfo($p);
$str .= '</ul></div>';
if ($nbAllInherited>0) {
$str .= '<dl class="inheritTree">';
$sum = -15;
$img = '<img src="'.$this->getContextPackage()->rpt.self::RESOURCES_DIRNAME.'/inherit.gif" alt="extended by "/>';
foreach ($allInherited as $ai) {
$str .= '<dd style="padding-left:'.$sum.'px">';
$fullName = $this->getLinkTo($ai, $css);
if ($sum>0)
$str .= $img;
$sum += 15 + 2*(strlen(strstr($fullName, '>'))-5);
$str .= $fullName.'</dd>';
}
$str .= '<dd style="padding-left:'.$sum.'px" class="current">'.$img;
$str .= $this->getAbsPath($p->package, self::T_NAMESPACE).$p->name.'</dd>';
$str .= '</dl>';
}
return $str;
}
}
?>

View File

@@ -0,0 +1,59 @@
<?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: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the datatype renderer
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocDatatype extends PHP_UML_Output_HtmlNew_DocClassifier
{
protected function getTypeName()
{
return 'datatype';
}
protected function getStyleName()
{
return 'datatype';
}
protected function getPrefix()
{
return self::DATATYPE_PREFIX;
}
protected function getCurrentElement($i)
{
return $this->getContextPackage()->datatypes[$i];
}
protected function getNextElement($i)
{
return $i+1<count($this->getContextPackage()->datatypes) ? $this->getContextPackage()->datatypes[$i+1] : null;
}
protected function getPreviousElement($i)
{
return $i>0 ? $this->getContextPackage()->datatypes[$i-1] : null;
}
}
?>

View File

@@ -0,0 +1,354 @@
<?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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* General class for an renderer in the HtmlNew implementation
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Output_HtmlNew_DocElement extends PHP_UML_Output_ApiRenderer
{
const FILE_EXT = 'htm';
const RESOURCES_DIRNAME = '$resources';
const HELP_FILENAME = 'help';
const INDEX_FILENAME = 'index';
const INDEXALL_FILENAME = 'index-all';
const MENU_FILENAME = 'menu';
const JS_MAIN_NAME = 'MainList';
const TEMPLATES_DIRNAME = 'templates';
/**
* Constructor
*
* @param PHP_UML_Output_ExporterAPI $exporter Reference to an exporter
*/
public function __construct(PHP_UML_Output_ExporterAPI $exporter)
{
parent::__construct($exporter);
$this->mainTpl = $this->getTemplate('main.htm');
}
protected function getDescription(PHP_UML_Metamodel_Stereotype $s, $annotatedElement='')
{
$tag = PHP_UML_Metamodel_Helper::getStereotypeTag($s, 'description');
if (!is_null($tag))
return nl2br(htmlspecialchars($tag->value));
else
return '';
}
/**
* Renders the operation's parameters, as a comma-sep list, between brackets
*
* @param PHP_UML_Metamodel_Operation $operation The operation
* @param bool $withType If true, adds an hyperlink
*
* @return string
*/
protected function getParameterList(PHP_UML_Metamodel_Operation $operation, $withType = false)
{
$n = count($operation->ownedParameter);
$pieces = array();
for ($i=0; $i<$n; $i++) {
$parameter = $operation->ownedParameter[$i];
if (substr($parameter->direction, 0, 2)=='in') {
$str = '';
if ($withType && isset($parameter->type)) {
if (is_object($parameter->type))
$str .= $this->getLinkTo($parameter->type).' ';
else
$str .= $this->displayUnresolved($parameter->type);
}
if ($parameter->direction=='inout') {
$str .= '&#38;';
}
$str .= $parameter->name;
$str .= $this->getDefaultValue($parameter);
$pieces[] = $str;
}
}
return '('.implode(',', $pieces).')';
}
protected function getDefaultValue(PHP_UML_Metamodel_TypedElement $obj)
{
if ($obj->default!='')
return '<span class="defVal"> = '.htmlentities($obj->default, ENT_QUOTES).'</span>';
else
return '';
}
/**
* Renders a HTML hyperlink towards a given element
* (since datatypes don't own to a "package", we suppose they are located in
* the top package)
*
* @param PHP_UML_Metamodel_Classifier $t The element
* @param string $cssStyle CSS style to use
*
* @return string
*/
protected function getLinkTo(PHP_UML_Metamodel_Classifier $t, $cssStyle='link')
{
$loc = '';
$ns = '';
if (isset($t->package)) {
$loc = $this->getAbsPath($t->package);
$ns = $this->getAbsPath($t->package, self::T_NAMESPACE);
}
return '<a href="'.$this->getContextPackage()->rpt.$loc.self::getObjPrefix($t).$t->name.'.'.
self::FILE_EXT.'" class="'.$cssStyle.'">'.$ns.$t->name.'</a>';
}
/**
* Renders an unresolved type as an HTML span
*
* @param string $type Type, provided as a string
*
* @return string
*/
protected function displayUnresolved($type)
{
return '<span class="link">'.$type.'</span> ';
}
/**
* Renders the properties of a given stereotype as an HTML list (LI tags).
* Docblocks in $ignoredTag are not shown, as well as "return" tag with only a type
*
* @param PHP_UML_Metamodel_Stereotype $s A stereotype
*
* @return string
*/
protected function getTagsAsList(PHP_UML_Metamodel_Stereotype $s)
{
$str = '';
foreach ($s->ownedAttribute as $tag) {
if (!(in_array($tag->name, $this->ignoredTag) || ($tag->name=='return' && strpos($tag->value, ' ')===false))) {
if ($tag->name!='description') {
$str .= '<li class="smaller">';
$str .= '@'.$tag->name.' ';
} else {
$str .= '<li>';
}
if (strlen($tag->value)>0)
$str .= nl2br(htmlspecialchars($tag->value));
$str .= '</li>';
}
}
return $str;
}
/**
* Renders the block "Properties" of a package or a class as HTML
*
* @param PHP_UML_Metamodel_NamedElement $p A classifier/a package
*
* @return string
*/
protected function getPropertyBlock(PHP_UML_Metamodel_NamedElement $p)
{
if (empty($p->ownedAttribute))
return '';
$str = '<h2>Properties</h2>';
$str .= '<ul class="summary">';
foreach ($p->ownedAttribute as $o) {
$str .= '<li class="Collapsed" id="'.$this->generatePropertyId($o).'">';
$str .= '<a href="javascript:void(0);" class="'.
$this->getPropertyStyle($o->visibility).'" target="main">'.
$o->name.'</a>';
$str .= '<ul class="description"><li>';
$str .= ucfirst($o->visibility).' ';
if (!$o->isInstantiable)
$str .= 'static ';
if ($o->isReadOnly)
$str .= 'const ';
if (is_object($o->type))
$str .= $this->getLinkTo($o->type).' ';
else
$str .= $this->displayUnresolved($o->type);
$str .= '<span class="smallTitle">'.$o->name.'</span>'.$this->getDefaultValue($o).'</li>';
if (!is_null($o->description)) {
$str .= $this->getTagsAsList($o->description);
}
$str .= $this->getFileInfo($o);
$str .= '</ul>';
$str .= '</li>';
}
$str .= '</ul>';
return $str;
}
/**
* Renders the block "Function" of a package or a classifier as HTML
*
* @param PHP_UML_Metamodel_NamedElement $p A classifier or a package
*
* @return string
*/
protected function getFunctionBlock(PHP_UML_Metamodel_NamedElement $p)
{
if (empty($p->ownedOperation))
return'';
$str = '<h2>Functions</h2>';
$str .= '<ul class="summary">';
foreach ($p->ownedOperation as $o) {
$fullName = $this->getParameterList($o, true);
$str .= '<li class="Collapsed" id="'.$this->generateFunctionId($o).'">';
$str .= '<a href="javascript:void(0);" class="'.$this->getFunctionStyle($o->visibility);
if ($o->isAbstract)
$str .= ' abstract';
$str .= '" target="main">'.$o->name.'</a>'.$fullName;
$str .= '<ul class="description"><li>';
$str .= ucfirst($o->visibility).' ';
if (!$o->isInstantiable)
$str .= 'static ';
if ($o->isAbstract)
$str .= 'abstract ';
$return = $this->getReturnParam($o);
if (!empty($return)) {
if (is_object($return->type))
$str .= $this->getLinkTo($return->type).' ';
else
$str .= $this->displayUnresolved($return->type);
}
$str .= '<span class="smallTitle">'.$o->name.'</span>'.$fullName.'</li>';
if (!is_null($o->description)) {
$str .= $this->getTagsAsList($o->description);
}
foreach ($this->getAllImplemented($p) as $ai) {
foreach ($ai->ownedOperation as $aiO) {
if ($aiO->name == $o->name && !empty($aiO->description)) {
$txt = $this->getDescription($aiO->description, $aiO->id);
if ($txt!='')
$str .= '<li>'.$txt.'<br/><span class="note">(copied from interface '.$this->getLinkTo($ai).')</span></li>';
}
}
}
foreach ($this->getAllInherited($p) as $ai) {
foreach ($ai->ownedOperation as $aiO) {
if ($aiO->name == $o->name && !empty($aiO->description)) {
$txt = $this->getDescription($aiO->description, $aiO->id);
if ($txt!='')
$str .= '<li>'.$txt.'<br/><span class="note">(copied from class '.$this->getLinkTo($ai).')</span></li>';
}
}
}
$str .= $this->getFileInfo($o);
$str .= '</ul>';
$str .= '</li>';
}
$str .= '</ul>';
return $str;
}
/**
* Returns the HTML for the link "Package" in the navigation bar
*
* @param string $rel A prefix to add to the hyperlink (eg: ../)
*
* @return string
*/
protected function getNavigParentPackage($rel='')
{
return '<li><a href="'.$rel.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'" class="top">Package</a></li>';
}
/**
* Returns the HTML code for the common items of the navigation bar
*
* @return string
*/
protected function getCommonLinks()
{
return '<li><a href="javascript:toggler.toggleAll(\''.self::JS_MAIN_NAME.'\', \'btnToggle\')" class="expandAllBtn" id="btnToggle">Expand all</a></li>'.
'<li><a href="'.$this->getContextPackage()->rpt.self::HELP_FILENAME.'.'.self::FILE_EXT.'" class="helpBtn">Help</a></li>'.
'<li><a href="'.$this->getContextPackage()->rpt.self::INDEXALL_FILENAME.'.'.self::FILE_EXT.'" class="indexAllBtn">Index</a></li>';
}
/**
* Returns the HTML code for the "File" information tag
*
* @param PHP_UML_Metamodel_NamedElement $p An element
*
* @return string
*/
protected function getFileInfo(PHP_UML_Metamodel_NamedElement $p)
{
if (!empty($p->file->package))
return '<li>File: '.$this->getAbsPath($p->file->package).$p->file->name.'</li>';
else
return '';
}
protected function getPropertyStyle($visibility)
{
return 'property-'.substr($visibility, 0, 3);
}
protected function getFunctionStyle($visibility)
{
return 'method-'.substr($visibility, 0, 3);
}
/**
* Replace the template's placeholders with their value
*
* @param string $main Main HTML content (generated by PHP_UML)
* @param string $nav Navigation HTML content (navig bar)
* @param string $tit Title content
* @param string $name Element name
*
* @return string
*/
protected function replaceInTpl($main, $nav, $tit, $name)
{
$str = str_replace('#NAVIG', $nav, $this->mainTpl);
$str = str_replace('#TITLE', $tit, $str);
$str = str_replace('#DETAIL', $main, $str);
$str = str_replace('#RELPATHTOP', $this->getContextPackage()->rpt, $str);
$str = str_replace('#NAME', $this->getTypeName().' '.$name, $str);
$str = str_replace('#CURDATE', date("M j, Y, G:i:s O"), $str);
return $str;
}
protected function getTemplateDirectory()
{
return dirname(__FILE__).DIRECTORY_SEPARATOR.self::TEMPLATES_DIRNAME;
}
protected function save($elementName, $str)
{
$fic = $this->getContextPackage()->dir.$elementName.'.'.self::FILE_EXT;
file_put_contents($fic, $str);
}
}
?>

View File

@@ -0,0 +1,159 @@
<?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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* Implementation of the HTML renderer for the Index page
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocIndex extends PHP_UML_Output_HtmlNew_DocMenu
{
/**
* Temporary structure to store all the elements (in order to sort them)
* @var array First index: the element, Second index: filepath to detail page, Third index: true only for operations/attributes of a Package (procedural code)
*/
private $elements = array();
/**
* Generates and saves the HTML code for the Index page
*
* @param PHP_UML_Metamodel_Package $p Package to render
*/
public function render($p)
{
$tpl = $this->getTemplate(self::INDEXALL_FILENAME.'.'.self::FILE_EXT);
$nav = $this->getNavigationBlock();
$str = '<ul id="MainList" class="indexAll">';
$str .= $this->getContent($p);
$str .= '</ul>';
$tmp = str_replace('#NAVIG', $nav, $tpl);
$str = str_replace('#INDEX', $str, $tmp);
$this->save(self::INDEXALL_FILENAME, $str);
}
/**
* Return the HTML code for an Index page
*
* @param PHP_UML_Metamodel_Package $p Starting package
*
* @return string HTML code
*/
private function getContent(PHP_UML_Metamodel_Package $p)
{
$this->readPackage($p);
$str = '';
usort($this->elements, array('self', 'compareElt'));
foreach ($this->elements as $x) {
list($elt, $path, $pkgElt) = $x;
switch(get_class($elt)) {
case self::META_CLASS:
case self::META_INTERFACE:
$str .= $this->getClassifierItem($elt, $path, 0);
break;
case self::META_OPERATION:
if ($pkgElt)
$str .= $this->getPackageOperationItem($elt, $path);
else
$str .= $this->getOperationItem($elt, $path);
break;
case self::META_PROPERTY:
if ($pkgElt)
$str .= $this->getPackagePropertyItem($elt, $path);
else
$str .= $this->getPropertyItem($elt, $path);
break;
}
}
return $str;
}
static private function compareElt($a, $b)
{
return strcasecmp($a[0]->name, $b[0]->name);
}
/**
* Set the elements[] property with the API data of a package
*
* @param PHP_UML_Metamodel_Package $p Package
* @param string $path Relative path to the current package
* @param string $level Recursion level
*
* @return void
*/
private function readPackage(PHP_UML_Metamodel_Package $p, $path='', $level=0)
{
foreach ($p->nestedPackage as $np) {
$npDir = $path.$np->name;
$this->readPackage($np, $npDir.'/', $level+1);
}
foreach ($p->ownedType as $c) {
$this->elements[] = array($c, $path, false);
foreach ($c->ownedOperation as $o) {
$this->elements[] = array($o, $path, false);
}
if (isset($c->ownedAttribute)) {
foreach ($c->ownedAttribute as $a) {
$this->elements[] = array($a, $path, false);
}
}
}
foreach ($p->ownedOperation as $o) {
$this->elements[] = array($o, $path, true);
}
foreach ($p->ownedAttribute as $a) {
$this->elements[] = array($a, $path, true);
}
}
/**
* Return the HTML code for the navigation bar
*
* @return string
*/
private function getNavigationBlock()
{
$str = '<ul class="navig">';
$str .= $this->getCommonLinks();
$str .= '</ul>';
return $str;
}
protected function getPropertyItem(PHP_UML_Metamodel_Property $p, $path)
{
return '<li>'.
'<a href="'.$path.self::getObjPrefix($p->class).$p->class->name.'.'.self::FILE_EXT.'#'.$p->name.
'" class="'.$this->getPropertyStyle($p->visibility).'" target="main">'.$p->name.'</a>'.
'</li>';
}
protected function getOperationItem(PHP_UML_Metamodel_Operation $o, $path)
{
return '<li>'.
'<a href="'.$path.self::getObjPrefix($o->class).$o->class->name.'.'.self::FILE_EXT.'#f'.$o->id.
'" class="'.$this->getFunctionStyle($o->visibility).'" target="main">'.$o->name.$this->getParameterList($o).'</a>'.
'</li>';
}
}
?>

View File

@@ -0,0 +1,59 @@
<?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: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the class renderer
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocInterface extends PHP_UML_Output_HtmlNew_DocClassifier
{
protected function getTypeName()
{
return 'interface';
}
protected function getStyleName()
{
return 'interface';
}
protected function getPrefix()
{
return self::INTERFACE_PREFIX;
}
protected function getCurrentElement($i)
{
return $this->getContextPackage()->interfaces[$i];
}
protected function getNextElement($i)
{
return $i+1<count($this->getContextPackage()->interfaces) ? $this->getContextPackage()->interfaces[$i+1] : null;
}
protected function getPreviousElement($i)
{
return $i>0 ? $this->getContextPackage()->interfaces[$i-1] : null;
}
}
?>

View File

@@ -0,0 +1,126 @@
<?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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* Implementation of the HTML renderer for the treeview menu (on the left panel)
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocMenu extends PHP_UML_Output_HtmlNew_DocElement
{
/**
* Generates and saves the HTML menu
*
* @param PHP_UML_Metamodel_Package $p Starting package
*/
public function render($p)
{
$tpl = $this->getTemplate(self::MENU_FILENAME.'.'.self::FILE_EXT);
$str = '<ul class="TreeView" id="MainList">';
$str .= $this->getContent($p);
$str .= '</ul>';
$str = str_replace('#MENU', $str, $tpl);
$this->save(self::MENU_FILENAME, $str);
}
/**
* Returns the HTML content for a whole model
*
* @param PHP_UML_Metamodel_Package $p Starting package
*
* @return string
*/
private function getContent(PHP_UML_Metamodel_Package $p)
{
return $this->getPackage($p);
}
/**
* Returns the HTML content for a given package
*
* @param PHP_UML_Metamodel_Package $p Package
* @param string $path Relative path to the current package
* @param int $level Recursion level
*
* @return string
*/
private function getPackage(PHP_UML_Metamodel_Package $p, $path='', $level=0)
{
$pt = $level>0 ? 'package' : 'model';
$empty = (count($p->nestedPackage)==0 && count($p->ownedType)==0 && count($p->ownedOperation)==0 && count($p->ownedAttribute)==0);
$str = ($level==0 ? '<li class="Expanded">' : ($empty ? '<li>' : '<li class="Collapsed">'));
$str .= '<a href="'.$path.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'" class="'.$pt.'" target="main">'.$p->name.'</a>';
if (!$empty) {
$str .= '<ul>';
foreach ($p->nestedPackage as $np) {
$npDir = $path.$np->name;
$str .= $this->getPackage($np, $npDir.'/', $level+1);
}
foreach ($p->ownedType as $c) {
$str .= $this->getClassifierItem($c, $path, $level);
}
foreach ($p->ownedAttribute as $a) {
$str .= $this->getPackagePropertyItem($a, $path);
}
foreach ($p->ownedOperation as $o) {
$str .= $this->getPackageOperationItem($o, $path);
}
$str .= '</ul>';
}
$str .= '</li>';
return $str;
}
protected function getPackagePropertyItem(PHP_UML_Metamodel_Property $p, $path)
{
return '<li>'.
'<a href="'.$path.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'#'.$this->generatePropertyId($p).
'" class="property" target="main">'.$p->name.'</a>'.
'</li>';
}
protected function getPackageOperationItem(PHP_UML_Metamodel_Operation $o, $path)
{
return '<li>'.
'<a href="'.$path.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'#'.$this->generateFunctionId($o).
'" class="method" target="main">'.$o->name.$this->getParameterList($o).'</a>'.
'</li>';
}
protected function getClassifierItem(PHP_UML_Metamodel_Classifier $c, $path, $level)
{
$str = '';
if ($level>0 || !in_array($c->name, $this->hiddenClassifiers)) {
$str .= '<li>'.
'<a href="'.$path.self::getObjPrefix($c).$c->name.'.'.self::FILE_EXT.
'" class="'.self::getObjStyle($c);
if ($c->isAbstract)
$str .= ' abstract';
$str .= '" target="main">'.$c->name.'</a></li>';
}
return $str;
}
}
?>

View File

@@ -0,0 +1,144 @@
<?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: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the HTML renderer for a Package
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocPackage extends PHP_UML_Output_HtmlNew_DocElement
{
/**
* Generates and saves the HTML code for a package
*
* @param PHP_UML_Metamodel_Package $p Starting package
*/
public function render($p)
{
if ($this->getContextPackage()->dir=='') {
$fullName = $p->name;
} else {
$fullName = rtrim($this->getAbsPath($p, self::T_NAMESPACE), self::T_NAMESPACE);
}
$nav = $this->getNavigationBlock();
$tit = $this->getTitleBlock($fullName);
$str = $this->getDescriptionBlock($p);
$str .= $this->getPropertyBlock($p);
$str .= $this->getFunctionBlock($p);
$str = $this->replaceInTpl($str, $nav, $tit, $fullName);
$this->save(self::PACKAGE_FILENAME, $str);
}
private function getDescriptionBlock($p)
{
$str = '';
if (!is_null($p->description)) {
$str .= '<div class="descriptionPkg"><p><ul class="single">'.$this->getTagsAsList($p->description).'</ul></p></div>';
}
if (count($p->nestedPackage)>0) {
$str .= '<h2>Packages</h2>';
$str .= '<ul class="summary">';
foreach ($p->nestedPackage as $np) {
$str .= '<li>';
$str .= '<a href="'.$np->name.'/'.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'" class="package" target="main">'.$np->name.'</a>';
$str .= '</li>';
}
$str .= '</ul>';
}
$display = false;
$tmp = '<h2>Classes</h2>';
$tmp .= '<ul class="summary">';
foreach ($this->getContextPackage()->classes as $o) {
if ($this->getContextPackage()->dir!='' || !in_array($o->name, $this->hiddenClasses)) {
$display = true;
$tmp .= '<li>'.
'<a href="'.self::getObjPrefix($o).$o->name.'.'.self::FILE_EXT.'" class="'.self::getObjStyle($o).'" target="main">'.$o->name.'</a>'.
'</li>';
}
}
$tmp .= '</ul>';
if ($display)
$str .= $tmp;
$display = false;
$tmp = '<h2>Interfaces</h2>';
$tmp .= '<ul class="summary">';
foreach ($this->getContextPackage()->interfaces as $o) {
if ($this->getContextPackage()->dir!='' || !in_array($o->name, $this->hiddenInterfaces)) {
$display = true;
$tmp .= '<li>'.
'<a href="'.self::getObjPrefix($o).$o->name.'.'.self::FILE_EXT.'" class="'.self::getObjStyle($o).'" target="main">'.$o->name.'</a>'.
'</li>';
}
}
$tmp .= '</ul>';
if ($display)
$str .= $tmp;
return $str;
}
/**
* Return the HTML code for the navigation bar
*
* @return string
*/
private function getNavigationBlock()
{
$str = $this->getCommonLinks();
if (!empty($this->getContextPackage()->rpt))
$str .= $this->getNavigParentPackage('../');
return $str;
}
private function getTitleBlock($name)
{
return '<h1 class="'.$this->getStyleName().'">'.$name.'</h1>';
}
private function getStyleName()
{
return $this->getContextPackage()->dir=='' ? 'model' : 'package';
}
protected function getTypeName()
{
return $this->getStyleName();
}
protected function getPropertyStyle($visibility)
{
return 'property';
}
protected function getFunctionStyle($visibility)
{
return 'method';
}
}
?>

View File

@@ -0,0 +1,55 @@
<?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: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Rendering of the resources
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocResources extends PHP_UML_Output_HtmlNew_DocElement
{
public function render($p)
{
$dir = $this->getContextPackage()->dir;
$baseSrc = dirname(__FILE__).DIRECTORY_SEPARATOR;
$index = $this->getTemplate(self::INDEX_FILENAME.'.'.self::FILE_EXT);
$modelName = $p->name;
$index = str_replace('#MODELNAME', $modelName, $index);
file_put_contents($dir.self::INDEX_FILENAME.'.'.self::FILE_EXT, $index);
$src = dirname(__FILE__).DIRECTORY_SEPARATOR.self::TEMPLATES_DIRNAME.DIRECTORY_SEPARATOR.self::HELP_FILENAME.'.'.self::FILE_EXT;
copy($src, $dir.self::HELP_FILENAME.'.'.self::FILE_EXT);
$src = $baseSrc.self::RESOURCES_DIRNAME;
$dest = $dir.self::RESOURCES_DIRNAME;
if (!file_exists($dest)) {
mkdir($dest);
}
if (file_exists($src)) {
$iterator = new DirectoryIterator($src);
foreach ($iterator as $file) {
if ($file->isFile())
copy($file->getPathname(), $dest.DIRECTORY_SEPARATOR.$file->getFilename());
}
}
}
}
?>

View File

@@ -0,0 +1,102 @@
<?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: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* This class generates an HTML website from a UML model (a PHP_UML_Metamodel)
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_Exporter extends PHP_UML_Output_ExporterAPI
{
private $docClass;
private $docInterface;
private $docDatatype;
private $docPackage;
private $docMenu;
private $docIndex;
private $docResources;
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_HtmlNew_DocClass($this);
$this->docInterface = new PHP_UML_Output_HtmlNew_DocInterface($this);
$this->docDatatype = new PHP_UML_Output_HtmlNew_DocDatatype($this);
$this->docPackage = new PHP_UML_Output_HtmlNew_DocPackage($this);
$this->docMenu = new PHP_UML_Output_HtmlNew_DocMenu($this);
$this->docIndex = new PHP_UML_Output_HtmlNew_DocIndex($this);
$this->docResources = new PHP_UML_Output_HtmlNew_DocResources($this);
chdir($outDir);
$this->docResources->render($this->structure->packages);
$this->docMenu->render($this->structure->packages);
$this->docIndex->render($this->structure->packages);
// 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 file (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);
$this->docPackage->render($pkg, $this->ctx);
$nbc = count($this->ctx->classes);
$nbi = count($this->ctx->interfaces);
$nbd = count($this->ctx->datatypes);
for ($i=0; $i<$nbc; $i++)
$this->docClass->render($i);
for ($i=0; $i<$nbi; $i++)
$this->docInterface->render($i);
for ($i=0; $i<$nbd; $i++)
$this->docDatatype->render($i);
foreach ($pkg->nestedPackage as $np) {
$npDir = $dir.$np->name;
if (!file_exists($npDir))
mkdir($npDir);
$this->treatPackage($np, $npDir.DIRECTORY_SEPARATOR, '../'.$rpt);
}
}
}
?>

View File

@@ -0,0 +1,67 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>API Help</title>
<link type="text/css" rel="stylesheet" href="$resources/style.css"/>
<script type="text/javascript" language="javascript" src="$resources/treeview.js"></script>
</head>
<body>
<h1 class="help">How this API document is organized</h1>
<div class="description">
<h2>Menu</h2>
<p>The menu in the left panel provides a treeview of all packages, classes and interfaces.
It also contains the procedural functions and global constants (defined with the <i>define</i> keyword).
Click on a item to display its detailed page in the right panel.</p>
<h2>Package</h2>
<p>Each package has a page that contains a list of its classes, interfaces, with a summary for each.</p>
<p>Even if packages don't exist by themselves in PHP, PHP_UML reconstitutes them using the PHP namespaces (from PHP 5.3),
or by using the docblock @package (if the source code has some).<br/>
The top package is showed like a UML Model, and matches the "global namespace" of PHP.</p>
<p>From version 1.5, PHP_UML can display non strictly object-oriented elements, like procedural functions and global
constants. The former appear under "Functions" and the latter under "Properties", inside the Package page that matches the
namespace that these elements belong to.</p>
<h2>Class/Interface</h2>
<p>Each class and interface has its own separate page. Each of these pages starts with a description block.</p>
<p>The description block displays the content of the comment just preceding the class/interface definition in the source code,
followed by a list of the docblocks, as well the source file name.<br/>
It also lists : all inherited classes, all subclasses, all known subinterfaces, and all known implementing classes.</p>
<p>Then the following elements appear:</p>
<ul>
<li>Class inheritance diagram</li>
<li>Function Summary (all the methods of the class/interface)</li>
<li>Property Summary (all the constants and properties of the class)</li>
</ul>
<p>Click on a function/property title to expand it down, and see more detailed information about it (comment, docblocks).</p>
<p>All elements are in the order they appear in the source code.</p>
<h2>Index</h2>
<p>The Index contains an alphabetic list of all classes, interfaces, functions, properties and constants.</p>
<h2>Prev/Next</h2>
<p>These links take you to the next or previous class, interface, package, or related page.</p>
<h2>Expand/Collapse all</h2>
<p>In a class/interface/package page, click on "Expand all" to expand the detailed information about all members (functions, properties...).
The state of the button "Expand all / Collapse all" is preserved between page requests (unless you have cookies disabled in your browser).</p>
<h2>PHP and types</h2>
<p>Even though PHP is not a strong typed language, PHP_UML relies on a set of predefined types (integer, float, string, mixed, etc.)
and tries to use them as much as it can guess. When it had not been able to resolve a type/class/interface
(for example, a class implements an interface whose source code had not been provided), the type is displayed, but is not clickable.</p>
<p>PHP_UML is also aware of a couple of internal PHP classifiers, such as Exception or Iterator.</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>#MODELNAME</title>
<link type="text/css" rel="stylesheet" href="$resources/style.css"/>
<script type="text/javascript" language="javascript" src="$resources/treeview.js"></script>
</head>
<body onload="toggler.setupTreeView('TreeView');">
#NAVIG
<h1 class="index">Index</h1>
#INDEX
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>#MODELNAME API documentation</title>
</head>
<frameset cols="20%,80%">
<frame name="menu" src="menu.htm" frameborder="0"/>
<frame name="main" src="package-summary.htm" frameborder="0"/>
</frameset>
</html>

Some files were not shown because too many files have changed in this diff Show More