@@ -57,6 +57,9 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param string $key |
|
| 62 | + */ |
|
| 60 | 63 | public static function expired($key, $duration) { |
| 61 | 64 | return self::$cache->expired("controllers/" . $key, $duration) === true || \array_key_exists($key, self::$expiredRoutes); |
| 62 | 65 | } |
@@ -69,6 +72,9 @@ discard block |
||
| 69 | 72 | return true; |
| 70 | 73 | } |
| 71 | 74 | |
| 75 | + /** |
|
| 76 | + * @param string $routePath |
|
| 77 | + */ |
|
| 72 | 78 | public static function setExpired($routePath, $expired=true) { |
| 73 | 79 | $key=self::getRouteKey($routePath); |
| 74 | 80 | self::setKeyExpired($key, $expired); |
@@ -88,6 +94,10 @@ discard block |
||
| 88 | 94 | return self::storeRouteResponse($key, $response); |
| 89 | 95 | } |
| 90 | 96 | |
| 97 | + /** |
|
| 98 | + * @param string $key |
|
| 99 | + * @param string $response |
|
| 100 | + */ |
|
| 91 | 101 | private static function storeRouteResponse($key, $response) { |
| 92 | 102 | self::setKeyExpired($key, false); |
| 93 | 103 | self::$cache->store("controllers/" . $key, $response, false); |
@@ -123,6 +133,9 @@ discard block |
||
| 123 | 133 | } |
| 124 | 134 | } |
| 125 | 135 | |
| 136 | + /** |
|
| 137 | + * @return string |
|
| 138 | + */ |
|
| 126 | 139 | public static function getModelCacheKey($classname){ |
| 127 | 140 | return \str_replace("\\", DIRECTORY_SEPARATOR, $classname); |
| 128 | 141 | } |
@@ -134,6 +147,9 @@ discard block |
||
| 134 | 147 | return false; |
| 135 | 148 | } |
| 136 | 149 | |
| 150 | + /** |
|
| 151 | + * @param string $classname |
|
| 152 | + */ |
|
| 137 | 153 | private static function addControllerCache($classname) { |
| 138 | 154 | $parser=new ControllerParser(); |
| 139 | 155 | try { |
@@ -167,6 +183,9 @@ discard block |
||
| 167 | 183 | return [ "annotations" => $annotationCacheDir,"models" => $modelsCacheDir,"controllers" => $controllersCacheDir,"queries" => $queriesCacheDir ,"views"=>$viewsCacheDir]; |
| 168 | 184 | } |
| 169 | 185 | |
| 186 | + /** |
|
| 187 | + * @param string $dir |
|
| 188 | + */ |
|
| 170 | 189 | private static function safeMkdir($dir) { |
| 171 | 190 | if (!is_dir($dir)) |
| 172 | 191 | return mkdir($dir, 0777, true); |
@@ -180,6 +199,10 @@ discard block |
||
| 180 | 199 | } |
| 181 | 200 | } |
| 182 | 201 | |
| 202 | + /** |
|
| 203 | + * @param string $type |
|
| 204 | + * @param string $typeRef |
|
| 205 | + */ |
|
| 183 | 206 | private static function _clearCache($cacheDirectories,$type,$typeRef){ |
| 184 | 207 | if ($type === "all" || $type === $typeRef) |
| 185 | 208 | FsUtils::deleteAllFilesFromFolder($cacheDirectories[$typeRef]); |
@@ -216,6 +239,9 @@ discard block |
||
| 216 | 239 | return self::_getFiles($config, "controllers",$silent); |
| 217 | 240 | } |
| 218 | 241 | |
| 242 | + /** |
|
| 243 | + * @param string $type |
|
| 244 | + */ |
|
| 219 | 245 | private static function _getFiles(&$config,$type,$silent=false){ |
| 220 | 246 | $typeNS=$config["mvcNS"][$type]; |
| 221 | 247 | $typeDir=ROOT . DS . str_replace("\\", DS, $typeNS); |
@@ -280,6 +306,9 @@ discard block |
||
| 280 | 306 | return $result; |
| 281 | 307 | } |
| 282 | 308 | |
| 309 | + /** |
|
| 310 | + * @param string $controllerClass |
|
| 311 | + */ |
|
| 283 | 312 | public static function getRestResource($controllerClass){ |
| 284 | 313 | $cache=self::getRestCache(); |
| 285 | 314 | if(isset($cache[$controllerClass])){ |
@@ -288,6 +317,9 @@ discard block |
||
| 288 | 317 | return null; |
| 289 | 318 | } |
| 290 | 319 | |
| 320 | + /** |
|
| 321 | + * @param string $controllerClass |
|
| 322 | + */ |
|
| 291 | 323 | public static function getRestCacheController($controllerClass){ |
| 292 | 324 | $cache=self::getRestCache(); |
| 293 | 325 | if(isset($cache[$controllerClass])){ |
@@ -67,6 +67,9 @@ discard block |
||
| 67 | 67 | return "/".\implode("/", $pathParts); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | + /** |
|
| 71 | + * @param string $prefix |
|
| 72 | + */ |
|
| 70 | 73 | private static function cleanpath($prefix, $path="") { |
| 71 | 74 | if (!StrUtils::endswith($prefix, "/")) |
| 72 | 75 | $prefix=$prefix . "/"; |
@@ -163,6 +166,9 @@ discard block |
||
| 163 | 166 | return [ "path" => $path,"parameters" => $parameters ]; |
| 164 | 167 | } |
| 165 | 168 | |
| 169 | + /** |
|
| 170 | + * @param string $path |
|
| 171 | + */ |
|
| 166 | 172 | private static function createRouteMethod(&$result, $controllerClass, $path, $httpMethods, $method, $parameters, $name, $cache, $duration) { |
| 167 | 173 | foreach ( $httpMethods as $httpMethod ) { |
| 168 | 174 | $result[$path][$httpMethod]=[ "controller" => $controllerClass,"action" => $method,"parameters" => $parameters,"name" => $name,"cache" => $cache,"duration" => $duration ]; |
@@ -78,9 +78,9 @@ |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * @param string $name |
|
| 82 | - * @param number $length |
|
| 83 | - * @param number $duration |
|
| 81 | + * @param integer $length |
|
| 82 | + * @param integer $duration |
|
| 83 | + * @param string $folder |
|
| 84 | 84 | * @return ApiTokens |
| 85 | 85 | */ |
| 86 | 86 | public static function getFromCache($folder,$key="_apiTokens",$length=78,$duration=3600){ |
@@ -79,6 +79,9 @@ |
||
| 79 | 79 | echo $this->responseFormatter->formatException($e); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | + /** |
|
| 83 | + * @param integer $value |
|
| 84 | + */ |
|
| 82 | 85 | public function _setResponseCode($value){ |
| 83 | 86 | \http_response_code($value); |
| 84 | 87 | } |
@@ -74,6 +74,11 @@ |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | + /** |
|
| 78 | + * @param string $header |
|
| 79 | + * |
|
| 80 | + * @return string |
|
| 81 | + */ |
|
| 77 | 82 | public function _getHeader($header){ |
| 78 | 83 | $headers=getallheaders(); |
| 79 | 84 | if(isset($headers[$header])){ |
@@ -22,11 +22,6 @@ |
||
| 22 | 22 | $this->displayPropertiesTypes=$displayPropertiesTypes; |
| 23 | 23 | } |
| 24 | 24 | /** |
| 25 | - * @param boolean $displayProperties |
|
| 26 | - * @param boolean $displayAssociations |
|
| 27 | - * @param boolean $displayMethods |
|
| 28 | - * @param boolean $displayMethodsParams |
|
| 29 | - * @param boolean $displayPropertiesTypes |
|
| 30 | 25 | * @return ClassParser[]|string[] |
| 31 | 26 | */ |
| 32 | 27 | public function parse(){ |
@@ -122,6 +122,9 @@ |
||
| 122 | 122 | return $this->_getYumlRelationsType($this->oneToManys,"1-0..*"); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | + /** |
|
| 126 | + * @param string $branche |
|
| 127 | + */ |
|
| 125 | 128 | protected function _getYumlRelationsType($relations,$branche){ |
| 126 | 129 | $myClass=$this->getShortClassName($this->class); |
| 127 | 130 | $yumlRelations=[]; |
@@ -3,8 +3,6 @@ |
||
| 3 | 3 | namespace micro\utils\yuml; |
| 4 | 4 | |
| 5 | 5 | use micro\orm\OrmUtils; |
| 6 | -use micro\orm\parser\Reflexion; |
|
| 7 | -use micro\utils\StrUtils; |
|
| 8 | 6 | |
| 9 | 7 | /** |
| 10 | 8 | * @author jc |