Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
DocFormater.php
Go to the documentation of this file.
1
<?php
2
6
namespace
Ubiquity\annotations\parser
;
7
17
class
DocFormater
{
18
protected
$types
= [
"boolean"
,
"string"
,
"int"
,
"mixed"
,
"array"
];
19
protected
$replacements
= [
"types"
=>
"<span style='font-weight:bold;color: green;'>$1</span>"
,
"variables"
=>
"<span style='font-weight:bold;color: brown;'>$1</span>"
];
20
21
public
function
__construct
() {
22
}
23
24
public
function
getReplacement
($part) {
25
return
$this->replacements [$part];
26
}
27
28
protected
function
getTypesRegex
() {
29
$items = \array_map (
function
($item) {
30
return
"("
. $item .
")"
;
31
},
$this->types
);
32
return
'^('
. \implode (
'|'
, $items ) .
').*?'
;
33
}
34
35
protected
function
getVariablesRegex
() {
36
return
'(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)'
;
37
}
38
39
protected
function
_replaceAll
($search, $replacement, $subject) {
40
return \preg_replace (
'@'
. $search .
'@i'
, $replacement, $subject );
41
}
42
43
public
function
replaceTypes
($str) {
44
return
$this->
_replaceAll
( $this->
getTypesRegex
(), $this->replacements [
"types"
], $str );
45
}
46
47
public
function
replaceVariables
($str) {
48
return
$this->
_replaceAll
( $this->
getVariablesRegex
(), $this->replacements [
"variables"
], $str );
49
}
50
51
public
function
replaceAll
($str) {
52
$str = $this->
replaceTypes
( $str );
53
return
$this->
replaceVariables
( $str );
54
}
55
}
Ubiquity\annotations\parser\DocFormater
Definition
DocFormater.php:17
Ubiquity\annotations\parser\DocFormater\replaceTypes
replaceTypes($str)
Definition
DocFormater.php:43
Ubiquity\annotations\parser\DocFormater\getReplacement
getReplacement($part)
Definition
DocFormater.php:24
Ubiquity\annotations\parser\DocFormater\__construct
__construct()
Definition
DocFormater.php:21
Ubiquity\annotations\parser\DocFormater\$types
$types
Definition
DocFormater.php:18
Ubiquity\annotations\parser\DocFormater\$replacements
$replacements
Definition
DocFormater.php:19
Ubiquity\annotations\parser\DocFormater\replaceVariables
replaceVariables($str)
Definition
DocFormater.php:47
Ubiquity\annotations\parser\DocFormater\_replaceAll
_replaceAll($search, $replacement, $subject)
Definition
DocFormater.php:39
Ubiquity\annotations\parser\DocFormater\getTypesRegex
getTypesRegex()
Definition
DocFormater.php:28
Ubiquity\annotations\parser\DocFormater\getVariablesRegex
getVariablesRegex()
Definition
DocFormater.php:35
Ubiquity\annotations\parser\DocFormater\replaceAll
replaceAll($str)
Definition
DocFormater.php:51
Ubiquity\annotations\parser
Documentation parser.
Definition
DocFormater.php:6
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity-dev
src
Ubiquity
annotations
parser
DocFormater.php
Generated on Sun Dec 10 2023 15:04:07 for
Ubiquity
by
doxygen
1.9.8