PEAR\PHP_UML Abstraction Internal PHP interface.Internal PHP interface.Internal PHP class.A subclass for PHP_UML_ExceptionConstructorFilter 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.We must override that method to pass the ignored/allowed arraysSpecialized iterator for the filesystem scan. It can accept/stop the recursive scan, according to allow/ignore file patternsList of directories to scanList of files to scanAllowed path-/file-names (possible wildcards are ? and *)Ignored directories (possible wildcards are ? and *)ConstructorThis 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.Starts the scanCan be overriden to treat unknown folder exceptionA 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. Reference to a PHP_UML_Input_PHP_Parser objectConstructorImplementation of tickFile() : we parse every file met.The PHP_UML implementation of a FileScanner class. If true, the IDs contained in the XMI code will be very deterministic. This is useful for running the PHP_UML test suite. Most of the time, you will want to have more unique IDs, so leave that property to false (the generation will then rely on uniqid()).Accessor for getting the UIDReset the deterministic generatorA class for generating unique IDs, in two possible ways. Almost every XMI element contains a UID. This class can generate both globally unique IDs, and deterministic unique IDs (ie. the IDs are the same every time the parser is run again). We need such deterministic IDs because of the PHP_UML test suite, which would report errors otherwise (because of different IDs !) You select which one by setting the boolean property $determinisic to true/falseThe $stack to read.Adds a warning message to the pileClears the pileMaintains a stack of warning messages. Worth being checked after a parsing, especially if several classes share common names, in the PHP filesCharacter used to separate the patterns passed to setIgnorePattern() and setMatchPattern().If true, a UML logical view is created.If true, a UML deployment view is created. Each file produces an artifact.If true, a component view is created. file system. Each file produces an componentIf true, the docblocks content is parsed. All possible information is retrieved : general comments, @package, @param...If true, the elements (class, function) are included in the API only if their comments contain explicitly a docblock "@api"If true, only classes and namespaces are retrieved. If false, procedural functions and constants are also includedIf true, the empty namespaces (inc. no classes nor interfaces) are ignoredIf true, the PHP variable prefix $ is keptA reference to a PHP_UML_Metamodel_Superstructure object.List of directories to scanList of files to scanAllowed filenames (possible wildcards are ? and *)Ignored directories (possible wildcards are ? and *)Base XMI Exporter objectConstructor. We create an Xmi_Exporter object to store the XMI that may be generatedParses 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()Read the content of an existing XMI file. If the file is UML/XMI 1, a conversion to version 2 is automatically applied.Set the input elements (files and/or directories) to parseSetter for the filename patterns. Usage: $phpuml->setFilePatterns(array('*.php', '*.php5')); Or: $phpuml->setFilePatterns('*.php, *.php5');Set a list of files / directories to ignore during parsing Usage: $phpuml->setIgnorePatterns(array('examples', '.svn')); Or: $phpuml->setIgnorePatterns('examples .svn');Converts a path pattern to the format expected by FileScanner (separator can only be / ; must not start by any separator)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()Parse the directories and the files (depending on what the $directories and $files properties have been set to with setInput())Runs the XMI generator on the PHP model stored in $this->model. After the PHP parsing, parseDirectory() (or parseFile()) will have filled $this->model for you. Note that it is now unnecessary to call this method if you intent to call the method export('xmi') later (the generation will be done implicitely, in version 2) If you want to use the XMI generator without doing any prior PHP parsing, simply set $this->model to a proper PHP_UML_Metamodel_Superstructure objectSaves the previously generated XMI to a file You must run that method to get your XMI, or you can access the XMI propertyGenerates 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.Some data required by xmiExporter bas to be copied from the one contained in PHP_UML before any method is called on xmiExporter This method copies the necessary informationPublic accessor to the XMI codeAutoloaderThe main class to use, through its methods: - setInput(), parse(), parseFile() and/or parseDirectory() - generateXMI() - saveXMI() (deprecated) - export() For example: <code> $t = new PHP_UML(); $t->setInput('PHP_UML/'); $t->export('xmi', '/home/wwww/'); </code> 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.Reference to a PHP_UML_Metamodel_Superstructure (where the parser stores all the program elements it finds)Current PHP_UML_Metamodel_ArtifactIf true, all docblocks are interpreted, especially @package and the types of the properties/function parameters (if given).If true, the elements (class, function) are included in the API only if their comments contain explicitly a docblock "@api"If true, the symbol $ is kept along with the variable namesCurrent package index (which does not necessary match the last one put over $packages stack). This index refers to the array $structure->packagesCurrent docblock commentCurrent class features (abstract, final)Current element (property or function) features (abstract, public, static...)Current namespace, as defined by the PHP "namespace" instructionPHP namespace aliases ("use <value> as <key>")Strict object oriented modeParse a PHP fileTemplate matching T_CLASSTemplate matching T_INTERFACESpecific template for T_CLASS/T_INTERFACE Normally preceded by a tClass or tInterfaceTemplate for the attributes (properties)Specific template for matching a list of T_STRING, separated by a commaSpecific template for T_FUNCTIONSpecific template for T_CONST outside of a classSpecific template for matching the parameters of a functionTemplate for matching a scalar/static data (eg: $a = -14.5) Stopping characters: , ; )Template for matching T_NAMESPACESpecific template for matching the first T_STRINGSpecific template for matching a qualified name, after a namespace instrTemplate for matching T_USEBase template It loops over PHP code, either in the global space, either inside functions, or class functionsTemplate for matching doc-comment (the docblocks) We do some forward-tracking to see the instruction that comes next. We must "remember" the comment only for certain instructions (class, const, function, etc). If we don't get one of these instructions, we forget it.Specific template for T_DOC_COMMENT. Returns at the first T_DOC_COMMENT found. Used to get the file-level doc-commentSpecific template for dealing with the "define" instructionAdds a package to the metamodel ($packages)Adds a deployment package to the metamodelReturn the index of the current package, depending on the @package in the last parsed docblock, and/or the potential presence of a package path in the class name. Adds new packages to the $packages stack if necessary. Normally used at each new class/interface insertion.Adds an alias to the list of namespace aliasesResolve a class path into a qualified name - first by searching/replacing aliases (previously set by "use ... as...") - then by prefixing with the current namespace, if the path is not absolute (and if it contains a separator)Find a @package declaration in a (filtered) doc-commentReturn the docblocks of a doc-commentReturn the description part in a doc-comment It is found before the first docblock.Stores the description/comments (in self::$curDocComment) about an element It is directly added as an object Stereotype to the $structure->stereotypes array Note that the link between a stereotype and its element is bidirectional (element->description and stereotype->element)Removes the leading/trailing comment marksReturns a unique IDFilter a variable names (removes $ according to _keepDollar property)Sets the nesting package of a typeSets the nesting package of an isolated operationSets the nesting package of an isolated attribute (the PHP "const")Sets the features (abstract, final) to a classifierSet the features (static, private...) in a given class property/functionSet the type of a given element (class property or function)Return a type (as a string) according to a given token/default valueReturn a type (as a string), from the docblocks of a doc commentThe PHP parser. It stores all the program elements of a PHP file in a PHP_UML_Metamodel_Superstructure object. It relies the PHP instruction token_get_all(). Most navigabilities between associated elements are bidirectional (the packages know their owned elements, and the classes know their nesting package) In a first step, relations (extends, implements) use strings. It means that the namespace of a class is memorized through a string. Once the parsing is done, the method finalize() must be called, so that all the named references be replaced by PHP references (&$xxx). Array of classes/interfaces declarations contained in that fileMeta-File Meta-Class Metaclass for classifier Datatype metaclass PHP datatypesMain file types. Used as stereotypes for qualifying the artifacts.Meta-Enumeration Enumerates some basic PHP classifiers. PHP_UML (MOF-like metamodel of language PHP) PHP version 5 Unique identifierNameReference to a "documention" stereotypeThe NamedElement class PHP_UML (MOF-like metamodel of language PHP) PHP version 5 PHP_UML (MOF-like metamodel of language PHP) PHP version 5 PHP_UML (MOF-like metamodel of language PHP) PHP version 5 PHP_UML (MOF-like metamodel of language PHP) PHP version 5 The stereotype class The root package for a logical UML modelThe root package for a deployment (physical) modelStack of all stereotypes TODO: when real stereotypes will be implemented, deleting that array, and reading the stereotypes from the $packages insteadConstructorAdds the internal PHP metatypes, metaclasses, metainterfaces...Creates a stereotype and the necessary Tag objects for a given elementRecursively 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)Deletes all empty packagesChecks if a package is emptySearches in a given package for a typed element (likely, a class)Searches if an operation already exists in a given pkgSearches if an attribute already exists in a given pkgRetrieves the stereotype (named $name) associated to the element $element If not found, returns null.Creates a stereotype in a given profile, and binds it to a given element Returns the stereotype that was createdRetrieves a particular tag in a given stereotypeSearches recursively in a given package for a package, knowing its name Works with position numbers, not variable references.Does the type resolution for a given element in a given packageResolution error. Might later be isolated in a specific class.Splits a package path into its first/last element, and the rest Allows for the two different versions of package delimiterRetrieve 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)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)Initialize the structure before use (we just instantiate the top objects in the logical and deployment models)A superstructure to gather program elements A PHP_UML_Metamodel_Superstructure object reflects the structure of some existing PHP code (like the one parsed by the parser), in termes of packages, classes, functions, etc. Once such an object is built, we just need to "serialize" it to get the XMI code. This is the job of PHP_UML->generateXMI() Normally, such a PHP_UML_Metamodel_Superstructure object is built and passed to the PHP_UML_Input_PHP_Parser by an instance of PHP_UML. PHP_UML (MOF-like metamodel of language PHP) PHP version 5 PHP_UML (MOF-like metamodel of language PHP) PHP version 5 PHP_UML (MOF-like metamodel of language PHP) PHP version 5 A superstructure (= a PHP_UML metamodel)Exportation format (eg. xmi)If true, all the stereotypes related to the UML model (currently, these are data retrieved from the PHP docblocks) will be added to the XMI fileThis class is a set of various data/switches that can be used by the implementations of the exporter Factory method to retrieve an implementation of an exporterStarts the generation of the output format, and all actions relatedThis 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. Generates output data by applying a transformation on a given XMI fileGenerates ouput data by applying a transformation on some provided XMIGenerates output data by applying a transformation on the XMI stored in the property $xmiGenerates output data by applying a transformation on a Dom DocumentXMI converterApplies a simple transformation on XML data Used by the UML 1->2 conversionCopy the "resources" folderCreates a folder. Callback function for the XSL templates.Saves a content to a file. Callback function for the XSL templates.An exportation class, that relies on XSL transformations It expects to receive the XMI data, and applies XSL transformations on it The XSL files must be stored in a subfolder named according to the desired formatThis class is a wrapper for data about the current package being processed Implementation of the class renderer Return the type name of the classifierReturn the CSS style name of the classifierReturn the prefix (filename scheme)Return the current objectReturn the next objectReturn the previous objectGenerates and saves the HTML code for a classifierReturn the HTML code for the navigation barImplementation of the HTML renderer for a classifier (class, interface, datatype) Implementation of the datatype renderer Temporary structure to store all the elements (in order to sort them)Generates and saves the HTML code for the Index pageReturn the HTML code for an Index pageSet the elements[] property with the API data of a packageReturn the HTML code for the navigation barImplementation of the HTML renderer for the Index page Implementation of the class renderer Generates and saves the HTML menuReturns the HTML content for a whole modelReturns the HTML content for a given packageImplementation of the HTML renderer for the treeview menu (on the left panel) Generates and saves the HTML code for a packageReturn the HTML code for the navigation barImplementation of the HTML renderer for a Package HTML main template (we pre-store it to avoid reading repeatedly)Classes that won't appear directly in the main API lists for readability (even though each one has its own detail page)Hidden interfacesHidden classifiersThese docblocks will not be displayed in the docblocks listReference to the Context object, which stores various useful dataGenerates and saves the HTML code for a type of elementReturns the operation's parameters, as a comma-sep list, between bracketsReturns the HTML code for a default valueReturns the content of a template fileReturns a HTML hyperlink towards a given element (since datatypes don't own to a "package", we suppose they are located in the top package)Returns the complete namespace for an elementReturns a HTML code for an unresolved typeReturns the path from the top package to a given packageReturns the return parameter of a functionReturns an HTML list (LI tags) of all the properties of a given stereotype Docblocks in $ignoredTag are not shown, as well as "return" tag with only a typeReturns the array containing all the extended classes of a classifier This array must have been previously set in the Context objectReturns the array containing all the classes that extends a classifierReturns the array containing all the interfaces of a classifierReturns the array containing all the classes that implement a given interfaceSaves a string in a file (in the folder referenced in the context object)Returns the HTML code for the block "Properties" of a package or a classReturns an ID for a propertyReturns an ID to identify a functionReturns the HTML code for the block "Function" of a package or a classifierReturns the HTML for the link "Package" in the navigation barReturns the HTML code for the common items of the navigation barReturns the HTML code for the "File" information tagReplace the template's placeholders with their valueTop-level class for the HTML "renderers"Object storing the contextual data. This object is then passed to the business methodsRecurses into the packages, and generates the detailed file (one file per class/interface/package)Creates the needed various resources for the website (such as images folder)Sets the allInherited/-ing arrays with all the classifiers that a given classifier inherits fromSets the allImplemented/-ing arrays with all the interfaces that a given class implements (including those of the inherited classes)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.This class generates a HTML website from a UML model (a PHP_UML_Metamodel)Generates an ID for an element. A partial identifier can be provided (used for classes and their idrefs)Gets an XML header for the XMI fileFactory method. Retrieves a proper implementation class, matching the XMI version.ConstructorGet all packages, recursively, with all the objects they contain Initially called by PHP_UML->generateXMI() on the root packageGet the different types owned by a packageGet all components, with its provided classes PHP_UML considers each logical package as a component, and each owned class as a provided class.Abstract class to generate UML elements in XMI code. To deal with the two different versions of XMI (1.4 and 2.1), you must use one of the two specialized versions: PHP_UML_Output_Xmi_BuilderImpl1, or PHP_UML_Output_Xmi_BuilderImpl2Retrievesthe XMI headerClosing tag for the XMI headerRetrieves the opening tag for a modelRetrieves the closing tag of a modelRetrieves the opening tag for a packageRetrieves the closing tag of a packageRetrieves the opening namespace tag (XMI 1 only)Retrieves the closing namespace tag (XMI 1 only)Retrieves the opening tag for a sub-system (XMI 1), or a component (XMI 2)Retrieves the closing tag for a subsystem / componentRetrieves the necessary stereotypesRetrieves the XMI code for a given stereotypeRetrieves the XMI declarations of the main PHP typesRetrieves the XMI code for a classRetrieves the XMI code for an interfaceRetrieves the XMI code for an operationRetrieves the XMI code for the paramater of an operationRetrieves the XMI code for an artifactRetrieves the XMI code for a componentRetieves the closing tag for a componentRetrieves the XMI code for a classifier (datatype, class, interface) Required by getParameter(). Adds the default value (if any)Retrieves the XMI code for all the realization (= interface implementations) of a given elementRetrieves the XMI code for all the inherited classes of a given elementAdds a description/comment to a model element The description is given through a stereotype instanceRetrieves the XMI code for a UML2 profile.Retrieves the metadata related to a given tagInterface for the XMI generation Get the structural type of an element (XMI 1.x)Implementation class to create XMI in version 1 See the interface PHP_UML_Output_Xmi_Builder for the comments PHP_UML UML Profile (TODO)Formates a Profile adapted to PHP_UML. TODO. Experimental.Gets all the elements contained in a stereotype Note: the property "documentation" is not discarded (we will have it as an "ownedComent" tag, instead; see getComment())Generates a manifestation element (= the link between a class and the artifact where the class is defined)Implementation class to create XMI in version 2 See the interface PHP_UML_Output_Xmi_Builder for the comments. Builder objectSaves the previously generated XMI to a file You must run that method to get your XMI, or you can access the XMI propertyPublic read accessor to the XMI codePublic write accessor to the XMI codeSerialize the metamodel (contained in the property $structure) into XMI codeInserts the logical view of the modelInserts a component view of the logical systemInserts a deployment view of the scanned file system, through artifacts. A file is viewed as an artifact (artifacts exist from UML 1.4) Filesystem's folders are treated as packages. TODO: use a package-tree, like with logical packagesAdds the instances of stereotypes At the current time, there are only XML metadata, not real UML stereotypesRead the content of an existing XMI file. If the file is UML/XMI 1, a conversion to version 2 is automatically applied.This class generates the XMI from a UML model (PHP_UML_Metamodel)