Skip to content

Commit 4304d8a

Browse files
committed
corrections
1 parent c428b0a commit 4304d8a

File tree

8 files changed

+35
-27
lines changed

8 files changed

+35
-27
lines changed

micro/cache/CacheManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static function initCache(&$config, $type="all",$silent=false) {
107107
self::initRestCache($config,$silent);
108108
}
109109

110-
private static function _getFiles(&$config,$type,$silent=false){
110+
protected static function _getFiles(&$config,$type,$silent=false){
111111
$typeNS=$config["mvcNS"][$type];
112112
$typeDir=ROOT . DS . str_replace("\\", DS, $typeNS);
113113
if(!$silent)

micro/cache/parser/ControllerParser.php

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static function parseRouteArray(&$result, $controllerClass, $routeArray,
135135

136136
public static function addParamsPath($path, \ReflectionMethod $method) {
137137
$parameters=[ ];
138-
$hasOptionnal=false;
138+
$hasOptional=false;
139139
preg_match_all('@\{(\.\.\.|\~)?(.+?)\}@s', $path, $matches);
140140
if (isset($matches[2]) && \sizeof($matches[2]) > 0) {
141141
$path=\preg_quote($path);
@@ -144,33 +144,37 @@ public static function addParamsPath($path, \ReflectionMethod $method) {
144144
foreach ( $matches[2] as $paramMatch ) {
145145
$find=\array_search($paramMatch, $params);
146146
if ($find !== false) {
147-
if(isset($matches[1][$index])){
148-
if($matches[1][$index]==="..."){
149-
$parameters[]="*";
150-
$path=\str_replace("\{\.\.\." . $paramMatch . "\}", "(.*?)", $path);
151-
}elseif($matches[1][$index]==="~"){
152-
$parameters[]="~".$find;
153-
$path=\str_replace("\{~" . $paramMatch . "\}", "", $path);
154-
$hasOptionnal=true;
155-
}else{
156-
$parameters[]=$find;
157-
$path=\str_replace("\{" . $paramMatch . "\}", "(.+?)", $path);
158-
}
159-
}else{
160-
$parameters[]=$find;
161-
$path=\str_replace("\{" . $paramMatch . "\}", "(.+?)", $path);
162-
}
147+
self::scanParam($parameters, $hasOptional, $matches, $index, $paramMatch, $find, $path);
163148
} else {
164149
throw new \Exception("{$paramMatch} is not a parameter of the method " . $method->name);
165150
}
166151
$index++;
167152
}
168153
}
169-
if($hasOptionnal)
154+
if($hasOptional)
170155
$path.="/(.*?)";
171156
return [ "path" => $path,"parameters" => $parameters ];
172157
}
173158

159+
private static function scanParam(&$parameters,&$hasOptional,$matches,$index,$paramMatch,$find,&$path){
160+
if(isset($matches[1][$index])){
161+
if($matches[1][$index]==="..."){
162+
$parameters[]="*";
163+
$path=\str_replace("\{\.\.\." . $paramMatch . "\}", "(.*?)", $path);
164+
}elseif($matches[1][$index]==="~"){
165+
$parameters[]="~".$find;
166+
$path=\str_replace("\{~" . $paramMatch . "\}", "", $path);
167+
$hasOptional=true;
168+
}else{
169+
$parameters[]=$find;
170+
$path=\str_replace("\{" . $paramMatch . "\}", "(.+?)", $path);
171+
}
172+
}else{
173+
$parameters[]=$find;
174+
$path=\str_replace("\{" . $paramMatch . "\}", "(.+?)", $path);
175+
}
176+
}
177+
174178
private static function createRouteMethod(&$result, $controllerClass, $path, $httpMethods, $method, $parameters, $name, $cache, $duration) {
175179
foreach ( $httpMethods as $httpMethod ) {
176180
$result[$path][$httpMethod]=[ "controller" => $controllerClass,"action" => $method,"parameters" => $parameters,"name" => $name,"cache" => $cache,"duration" => $duration ];

micro/cache/traits/ModelsCacheTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* @static array $cache
1010
*/
1111
trait ModelsCacheTrait{
12+
abstract protected static function _getFiles(&$config,$type,$silent=false);
1213

1314
public static function createOrmModelCache($classname) {
1415
$key=self::getModelCacheKey($classname);

micro/cache/traits/RestCacheTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ public static function getRestCacheController($controllerClass){
6363
}
6464
return null;
6565
}
66-
}
66+
}

micro/cache/traits/RouterCacheTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*/
1515
trait RouterCacheTrait{
16-
16+
abstract protected static function _getFiles(&$config,$type,$silent=false);
1717
private static $expiredRoutes=[ ];
1818

1919
private static function addControllerCache($classname) {

micro/controllers/admin/UbiquityMyAdminViewer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public function getModelsStructureDataTable($datas){
297297
$de->setFields($fields);
298298
$de->setCaptions($fields);
299299
foreach ($fields as $key){
300-
$de->setValueFunction($key, function($value) use ($key){
300+
$de->setValueFunction($key, function($value){
301301
if($value instanceof \stdClass){
302302
$value=(array) $value;
303303
}

micro/controllers/admin/popo/Route.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,5 +153,12 @@ public function getMessages() {
153153
return $this->messages;
154154
}
155155

156+
public function getMethods() {
157+
return $this->methods;
158+
}
156159

160+
public function setMethods($methods) {
161+
$this->methods=$methods;
162+
return $this;
163+
}
157164
}

micro/utils/yuml/ClassesToYuml.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ public function __construct($displayProperties=true,$displayAssociations=true,$d
2121
$this->displayMethodsParams=$displayMethodsParams;
2222
$this->displayPropertiesTypes=$displayPropertiesTypes;
2323
}
24+
2425
/**
25-
* @param boolean $displayProperties
26-
* @param boolean $displayAssociations
27-
* @param boolean $displayMethods
28-
* @param boolean $displayMethodsParams
29-
* @param boolean $displayPropertiesTypes
3026
* @return ClassParser[]|string[]
3127
*/
3228
public function parse(){

0 commit comments

Comments
 (0)