PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

API | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

API

API – How to use PHP_UML from its API?

Principles

PHP_UML is structured in 4 packages:

  • The host package, which contains the main class (PHP_UML) and some utility classes

  • The Input package, where the PHP parser resides

  • The Metamodel package, which contains the data structures that PHP_UML is using to modelize the code parsed

  • The Output package, which contains all the stuff to transform a metamodel stored into memory into an output format (like XMI, HTML, or PHP)

Unless you want to develop your own output format, the only single class you need to know about is PHP_UML. Since the first release of PHP_UML, the API of that class has changed, and you might find several methods doing more or less the same job.

Examples

Parsing of a single file test.php, and generation of its XMI file:

<?php
require_once 'PHP/UML.php';

$uml = new PHP_UML();   
$uml->setInput('test.php');
$uml->parse('foo');           // parses, and sets the name of the root package
$uml->generateXMI(1);         // generates XMI in version 1
$uml->saveXMI('test.xmi');
?>

Parsing of two directories, ignoring the CSV folders, and generation of HTML documentation

<?php
require_once 'PHP/UML.php';

$uml = new PHP_UML(); 
$uml->setInput(array('C:\Inetpub\foo''C:\Inetpub\libraries'));
$uml->parse();
$uml->export('html''C:\Inetpub\api');
?>

Import of an XMI file, and generation of PHP code templates

<?php
require_once 'PHP/UML.php';

$uml = new PHP_UML();   
$uml->xmiExporter->readXMIFile('foo.xmi'); 
$uml->export('php''C:\Inetpub\foo');
?>
忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「API」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | API」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: