Пример #1
0
 /**
  * (non-PHPdoc)
  *
  * @see \Symfony\Component\Console\Command\Command::execute()
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $source = $input->getArgument('input');
     $dest = $input->getArgument('dest');
     $name = $input->getArgument('name');
     try {
         require_once 'PHP/UML.php';
         $uml = new \PHP_UML();
         $uml->setInput($source);
         $uml->parse($name);
         $uml->export('xmi', $dest);
     } catch (Exception $e) {
         $output->writeln('Error!');
         $output->writeln($e->getMessage());
     }
 }
Пример #2
0
 public function testAllFormatsCall()
 {
     $output = self::TEMP_DIR . 'new_variousapi.xmi';
     $version = 2.1;
     $modelName = 'Foo';
     $encoding = 'iso-8859-1';
     $errorLevel = 1;
     $uml = new PHP_UML();
     $uml->parseFile(self::SUITE_DIR . 'test1.php', $modelName);
     chdir(dirname(__FILE__));
     echo $uml->export('xmi', $output);
     $this->assertTrue(file_exists($output));
     // now, we test the other output formats:
     $uml->export('html', self::TEMP_DIR);
     $uml->export('php', self::TEMP_DIR);
     $uml->export('HtmlNew', self::TEMP_DIR);
     $uml->export('Eclipse', self::TEMP_DIR);
 }
Пример #3
0
<?php

require_once 'PHP/UML.php';
$uml = new PHP_UML();
$uml->setInput(array('./app/models', './app/controllers', './app/repositories', './app/repositories/interfaces'));
$uml->parse();
$uml->export('html', './document');
Пример #4
0
 /**
  * Return a PHP_UML object to test
  *
  * @return PHP_UML
  */
 static function getPhpUmlObject()
 {
     PHP_UML_SimpleUID::$deterministic = true;
     PHP_UML_SimpleUID::reset();
     $uml = new PHP_UML();
     $uml->setIgnorePatterns(self::$IGNORED_DIR);
     $uml->docblocks = true;
     $uml->dollar = false;
     $uml->componentView = false;
     $uml->deploymentView = true;
     $uml->pureObject = false;
     return $uml;
 }
Пример #5
0
<?php

require_once 'PHP/UML.php';
$uml = new PHP_UML();
$uml->setInput('./');
// this defines which files/folders to parse (here, the folder "tests")
$uml->parse('seweb');
// this starts the parser, and gives the name "myApp" to the generated metamodel
$uml->export('xmi', 'seweb.xmi');
// this serializes the metamodel in XMI code, and saves it to a file "myApp.xmi"
Пример #6
0
$t->setInput('test1.php.txt, test2.php.txt');
// We want only "test1.php.txt" and "test2.php.txt"
$t->parse('testModel');
// The files are parsed, and a UML model named "testModel" is built
// we retrieve an XMI implementation of an Exporter object, and set the model:
$e = new PHP_UML_Output_Xmi_Exporter();
$e->setModel($t->getModel());
// we set the XMI version (2.1 being the default if not set)
$e->setXmiVersion(1);
// we set the encoding (iso-8859-1 being the default if not set):
$e->setEncoding('UTF-8');
// and we export XMI to a file:
$e->export('test_example2.xmi');
// we can also print the serialized XMI by retrieving an XmiDocument from the exporter object:
echo htmlentities($e->getXmiDocument()->dump());
/**
 * Example 3 : Example with a whole directory of PHP files to parse. We just want to
 * generate the API documentation in HTML.
 */
$t = new PHP_UML();
$t->setMatchPatterns(array('*.php', '*.txt'));
// We want to parse every file with an extension "php" or "txt"
$t->setIgnorePatterns('.svn');
// We want all directories to be scanned, except the ".svn"
$t->setInput('./');
// ... in the current directory
$t->parse();
// Starts parsing
$t->export('htmlnew', 'doc/');
// And the HTML API is exported into the folder "doc/"
echo '<br/>Done !!';