42 \preg_match_all(
'@(?:.*?)\$this\->loadView\([\'\"](.+?)[\'\"](?:.*?)@s', $code, $matches);
43 if (isset($matches[1]) && \
sizeof($matches[1]) > 0) {
44 $result = array_merge($result, $matches[1]);
46 \preg_match_all(
'@(?:.*?)\$this\->jquery\->renderView\([\'\"](.+?)[\'\"](?:.*?)@s', $code, $matches);
47 if (isset($matches[1])) {
48 $result = array_merge($result, $matches[1]);
50 if (\strpos($code,
'$this->loadDefaultView') !==
false || strpos($code,
'$this->jquery->renderDefaultView') !==
false) {
51 $result[] = DDDManager::getViewNamespace() . $r->getDeclaringClass()->getShortName() .
'/' . $r->getName() .
'.html';
58 $count = \count($lines);
59 $sLine = $r->getStartLine() - 1;
60 $eLine = $r->getEndLine();
62 return $lines[$sLine];
63 $min = \min($eLine, $count);
64 for ($l = $sLine; $l < $min; $l++) {
71 $tokens = \token_get_all($code);
76 foreach ($tokens as $tokenArray) {
77 if (\is_array($tokenArray)) {
78 if ($tokenArray[0] === T_STRING && $tokenArray[1] === $methodName) {
80 } elseif ($status ===
'open') {
81 $current .= $tokenArray[1];
83 } elseif (\is_string($tokenArray)) {
84 if ($tokenArray ===
'(' && $status ===
'find') {
88 } elseif ($status ===
'open') {
89 if ($tokenArray ===
'(') {
90 $current .= $tokenArray;
92 } elseif ($tokenArray ===
',' && $parenthesis === 1) {
93 $result[] = \trim($current);
95 } elseif ($tokenArray ===
')') {
97 if ($parenthesis === 0) {
99 $result[] = \trim($current);
103 $current .= $tokenArray;
105 $current .= $tokenArray;
120 $r = new \ReflectionFunction($c);
122 foreach ($r->getParameters() as $p) {
124 $type = $p->getType();
125 $isArray = $type && $type->getName() ===
'array';
129 $class = !$type->isBuiltin() ? new \ReflectionClass($type->getName()) :
null;
130 if ($class !=
null) {
134 if ($p->isPassedByReference()) {
137 $s .=
'$' . $p->name;
138 if ($p->isOptional()) {
139 $s .=
' = ' . \var_export($p->getDefaultValue(),
true);
143 $str .= \implode(
', ', $params);
145 $lines = file($r->getFileName());
146 $sLine = $r->getStartLine();
147 $eLine = $r->getEndLine();
148 if ($sLine < count($lines)) {
149 if ($eLine === $sLine) {
150 $match = \strstr($lines[$sLine - 1],
"function");
151 $str .= \strstr(\strstr($match,
"{"),
"}",
true) .
"}";
153 $str .= \strrchr($lines[$sLine - 1],
"{");
154 for ($l = $sLine; $l < $eLine - 1; $l++) {
157 $str .= \strstr($lines[$eLine - 1],
"}",
true) .
"}";
160 $vars = $r->getStaticVariables();
162 foreach ($vars as $k => $v) {
163 $str = \str_replace(
'$' . $k, \var_export($v,
true), $str);