Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
Yuml.php
Go to the documentation of this file.
1<?php
2
3namespace Ubiquity\utils\yuml;
4
5class Yuml {
6 public static $classMask='[{classContent}]';
7 public static $classSeparator='|';
8 public static $memberSeparator=';';
9 public static $parameterSeparator='‚';
10 public static $parameterTypeSeparator=':';
11 public static $groupeSeparator=",";
12 public static $propertyMask='{access}{primary}{name}{type}';
13 public static $methodMask='{access}{name}({parameters}){type}';
14 public static $public='+';
15 public static $protected='#';
16 public static $private='-';
17 public static $primary='«pk» ';
18
19 public static function parseMask($element,$variable,$value) {
20 $result=preg_replace('/(\{)'.$variable.'(\})/sim', $value, $element);
21 return $result;
22 }
23
24 public static function parseMaskArray($element,$variables,$values) {
25 $result=$element;
26 $countValues=\count($values);
27 $maxVariables=\count($variables)-1;
28 for($i=0;$i<$countValues;$i++){
29 $j=\min($maxVariables,$i);
30 $result=self::parseMask($result, $variables[$j], $values[$i]);
31 }
32 return $result;
33 }
34
35 public static function getNamesInMask($mask){
36 \preg_match_all('@\{(.*?)\}@sim', $mask,$matches);
37 if(isset($matches[1]))
38 return $matches[1];
39 return [];
40 }
41
42 private static function replaceMaskValues($mask,$values){
43 return self::parseMaskArray($mask, self::getNamesInMask($mask), $values);
44 }
45
46 public static function setPropertyVariables($values){
47 return self::replaceMaskValues(self::$propertyMask, $values);
48 }
49
50 public static function setMethodVariables($values){
51 return self::replaceMaskValues(self::$methodMask, $values);
52 }
53
54 public static function setClassContent($content){
55 return self::parseMask(self::$classMask, 'classContent', $content);
56 }
57}
static setMethodVariables($values)
Definition Yuml.php:50
static setClassContent($content)
Definition Yuml.php:54
static getNamesInMask($mask)
Definition Yuml.php:35
static setPropertyVariables($values)
Definition Yuml.php:46
static parseMaskArray($element, $variables, $values)
Definition Yuml.php:24
static parseMask($element, $variable, $value)
Definition Yuml.php:19
static replaceMaskValues($mask, $values)
Definition Yuml.php:42
static $parameterSeparator
Definition Yuml.php:9
static $parameterTypeSeparator
Definition Yuml.php:10
static $memberSeparator
Definition Yuml.php:8