PHP_UML
[ class tree: PHP_UML ] [ index: PHP_UML ] [ all elements ]

Class: PHP_UML

Source Location: /PHP_UML-1.0.1/UML.php

Class Overview


The main class to use, through its methods:


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 54]
The main class to use, through its methods:

  • setInput(), parse(), parseFile() and/or parseDirectory()
  • generateXMI()
  • saveXMI()
For example:
  1.  $t = new PHP_UML();
  2.  $t->parseDirectory('PHP_UML/');
  3.  $t->generateXMI(2);
  4.  $t->saveXMI('PHP_UML2.xmi');

If you want to produce XMI without using the PHP parser, please refer to the file /examples/test_with_api.php; it will show how you can build a model by yourself, with the PHP_UML_Metamodel package.



[ Top ]


Class Variables

$componentView =  false

[line 81]

If true, a component view is created.

file system. Each file produces an component

  • Access: public

Type:   boolean


[ Top ]

$deploymentView =  true

[line 74]

If true, a UML deployment view is created.

Each file produces an artifact.

  • Access: public

Type:   boolean


[ Top ]

$docblocks =  true

[line 88]

If true, the docblocks content is parsed.

All possible information is retrieved : general comments, @package, @param...

  • Access: public

Type:   boolean


[ Top ]

$dollar =  true

[line 107]

If true, the PHP variable prefix $ is kept
  • Access: public

Type:   boolean


[ Top ]

$logicalView =  true

[line 67]

If true, a UML logical view is created.
  • Access: public

Type:   boolean


[ Top ]

$model =

[line 113]

A reference to a PHP_UML_Metamodel_Superstructure object.
  • Access: public

Type:   PHP_UML::Metamodel::PHP_UML_Metamodel_Superstructure


[ Top ]

$onlyApi =  false

[line 95]

If true, the elements (class, function) are included in the API only if their

comments contain explicitly a docblock "@api"

  • Access: public

Type:   boolean


[ Top ]

$showInternal =  false

[line 101]

If true, the elements marked with @internal are included in the API.
  • Access: public

Type:   boolean


[ Top ]



Method Detail

__construct (Constructor)   [line 158]

PHP_UML __construct( )

Constructor
  • Access: public

[ Top ]

autoload   [line 515]

void autoload( string $class)

Autoloader

Parameters:

string   $class     Class name

[ Top ]

cleanPattern   [line 266]

void cleanPattern( string $p)

Converts a path pattern to the format expected by FileScanner (separator can only be / ; must not start by any separator)
  • See: accept()
  • Access: public

Parameters:

string   $p     Pattern

[ Top ]

export   [line 434]

void export( [string $format = 'xmi'], [string $outputDir = '.'])

Generates the output data

The default format is XMI. But PHP_UML comes with two additional formats:

  • HTML (an API documentation, very similar to Javadoc)
  • PHP code generation (a simple PHP code skeleton)
The templates are stored under /Output/<format_name>/ You are free to develop your owns. Except for XMI (which is internally generated), the generation is done through a complex XSLT transformation, applied to XMI data. PHP_UML will look for a "main.xsl" file, in the folder of the desired format.

Since the generation rely on XMI data, an XMI generation will be performed in all cases.

  • Access: public

Parameters:

string   $format     Desired format ("xmi", "html", "php")
string   $outputDir     Output directory

[ Top ]

generateXMI   [line 355]

void generateXMI( [float $version = 2.1], [string $encoding = 'iso-8859-1'])

Runs the XMI generator on the PHP model stored in $this->model.

After their PHP parsing, parseDirectory() or parseFile() will have set $this->model for you.

If you need to use the XMI generator without any previous PHP parsing, simply set $this->model with a proper PHP_UML_Metamodel_Superstructure object

  • Access: public

Parameters:

float   $version     XMI Version For XMI 1.x, any value below 2. For XMI 2.x, any value above or equal to 2.
string   $encoding     XML Encoding (iso-8859-1 or utf-8)

[ Top ]

getXMI   [line 456]

string getXMI( )

Public accessor to the XMI code
  • Return: The XMI code
  • Access: public

[ Top ]

parse   [line 315]

void parse( [string $modelName = 'default'])

Parse the directories and the files (depending on what the $directories and $files properties have been set to with setInput())
  • Access: public

Parameters:

string   $modelName     A model name (e.g., the name of your application)

[ Top ]

parseDirectory   [line 303]

void parseDirectory( mixed $directories, [string $model = 'default'])

Parses a PHP folder, and builds a PHP_UML_Metamodel_Superstructure object corresponding to what has been parsed.

To get the XMI serialization of that object, run generateXMI()

  • Access: public

Parameters:

mixed   $directories     Directory path(es). Can be a single path, or an array of pathes.
string   $model     Model name

[ Top ]

parseFile   [line 171]

void parseFile( mixed $files, [string $model = 'default'])

Parses a PHP file, and builds a PHP_UML_Metamodel_Superstructure object corresponding to what has been found in the file.

To get the XMI serialization of that object, run generateXMI()

  • Access: public

Parameters:

mixed   $files     File(s) to parse. Can be a single file, or an array of files.
string   $model     Model name

[ Top ]

readXMIFile   [line 183]

void readXMIFile( string $filepath)

Read the content of an existing XMI file.

If the file is UML/XMI 1, a conversion to version 2 is automatically applied.

  • Access: public

Parameters:

string   $filepath     Filename

[ Top ]

saveXMI   [line 402]

void saveXMI( string $outputFile)

Saves the previously generated XMI to a file You must run that method to get your XMI, or you can access the XMI property
  • Access: public

Parameters:

string   $outputFile     Filename

[ Top ]

setIgnorePatterns   [line 248]

void setIgnorePatterns( mixed $patterns)

Set a list of files / directories to ignore during parsing Usage: $phpuml->setIgnorePatterns(array('examples', '.svn')); Or: $phpuml->setIgnorePatterns('examples .svn');
  • Access: public

Parameters:

mixed   $patterns     List of patterns (string or array)

[ Top ]

setInput   [line 206]

void setInput( mixed $pathes)

Set the input elements (files and/or directories) to parse
  • Access: public

Parameters:

mixed   $pathes     Array, or string of comma-separated-values

[ Top ]

setMatchPatterns   [line 231]

void setMatchPatterns( mixed $patterns)

Setter for the filename patterns.

Usage: $phpuml->setFilePatterns(array('*.php', '*.php5')); Or: $phpuml->setFilePatterns('*.php, *.php5');

  • Access: public

Parameters:

mixed   $patterns     List of patterns (string or array)

[ Top ]


Documentation generated on Thu, 27 Aug 2009 17:30:10 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.