@@ -46,6 +46,9 @@ discard block |
||
46 | 46 | unset(self::$creationStack[$class]); |
47 | 47 | } |
48 | 48 | |
49 | + /** |
|
50 | + * @param boolean $target |
|
51 | + */ |
|
49 | 52 | private function checkTargetConstraints($target) { |
50 | 53 | $reflection = new ReflectionAnnotatedClass($this); |
51 | 54 | if($reflection->hasAnnotation('Target')) { |
@@ -75,6 +78,9 @@ discard block |
||
75 | 78 | } |
76 | 79 | } |
77 | 80 | |
81 | + /** |
|
82 | + * @param boolean $target |
|
83 | + */ |
|
78 | 84 | protected function checkConstraints($target) {} |
79 | 85 | } |
80 | 86 | |
@@ -180,6 +186,9 @@ discard block |
||
180 | 186 | $this->annotations = $this->createAnnotationBuilder()->build($this); |
181 | 187 | } |
182 | 188 | |
189 | + /** |
|
190 | + * @param string $class |
|
191 | + */ |
|
183 | 192 | public function hasAnnotation($class) { |
184 | 193 | return $this->annotations->hasAnnotation($class); |
185 | 194 | } |
@@ -200,6 +209,9 @@ discard block |
||
200 | 209 | return $this->createReflectionAnnotatedMethod(parent::getConstructor()); |
201 | 210 | } |
202 | 211 | |
212 | + /** |
|
213 | + * @param string $name |
|
214 | + */ |
|
203 | 215 | public function getMethod($name) { |
204 | 216 | return $this->createReflectionAnnotatedMethod(parent::getMethod($name)); |
205 | 217 | } |
@@ -212,6 +224,9 @@ discard block |
||
212 | 224 | return $result; |
213 | 225 | } |
214 | 226 | |
227 | + /** |
|
228 | + * @param string $name |
|
229 | + */ |
|
215 | 230 | public function getProperty($name) { |
216 | 231 | return $this->createReflectionAnnotatedProperty(parent::getProperty($name)); |
217 | 232 | } |
@@ -249,6 +264,9 @@ discard block |
||
249 | 264 | return ($method !== null) ? new ReflectionAnnotatedMethod($this->getName(), $method->getName()) : null; |
250 | 265 | } |
251 | 266 | |
267 | + /** |
|
268 | + * @param ReflectionProperty $property |
|
269 | + */ |
|
252 | 270 | private function createReflectionAnnotatedProperty($property) { |
253 | 271 | return ($property !== null) ? new ReflectionAnnotatedProperty($this->getName(), $property->getName()) : null; |
254 | 272 | } |
@@ -257,15 +275,24 @@ discard block |
||
257 | 275 | class ReflectionAnnotatedMethod extends ReflectionMethod { |
258 | 276 | private $annotations; |
259 | 277 | |
278 | + /** |
|
279 | + * @param string $class |
|
280 | + */ |
|
260 | 281 | public function __construct($class, $name) { |
261 | 282 | parent::__construct($class, $name); |
262 | 283 | $this->annotations = $this->createAnnotationBuilder()->build($this); |
263 | 284 | } |
264 | 285 | |
286 | + /** |
|
287 | + * @param string $class |
|
288 | + */ |
|
265 | 289 | public function hasAnnotation($class) { |
266 | 290 | return $this->annotations->hasAnnotation($class); |
267 | 291 | } |
268 | 292 | |
293 | + /** |
|
294 | + * @param string $annotation |
|
295 | + */ |
|
269 | 296 | public function getAnnotation($annotation) { |
270 | 297 | return $this->annotations->getAnnotation($annotation); |
271 | 298 | } |
@@ -296,6 +323,9 @@ discard block |
||
296 | 323 | $this->annotations = $this->createAnnotationBuilder()->build($this); |
297 | 324 | } |
298 | 325 | |
326 | + /** |
|
327 | + * @param string $class |
|
328 | + */ |
|
299 | 329 | public function hasAnnotation($class) { |
300 | 330 | return $this->annotations->hasAnnotation($class); |
301 | 331 | } |
@@ -28,6 +28,9 @@ discard block |
||
28 | 28 | $this->matchers[] = $matcher; |
29 | 29 | } |
30 | 30 | |
31 | + /** |
|
32 | + * @param string $string |
|
33 | + */ |
|
31 | 34 | public function matches($string, &$value) { |
32 | 35 | if(!$this->wasConstructed) { |
33 | 36 | $this->build(); |
@@ -97,6 +100,9 @@ discard block |
||
97 | 100 | $this->regex = $regex; |
98 | 101 | } |
99 | 102 | |
103 | + /** |
|
104 | + * @param string $string |
|
105 | + */ |
|
100 | 106 | public function matches($string, &$value) { |
101 | 107 | if(preg_match("/^{$this->regex}/", $string, $matches)) { |
102 | 108 | $value = $this->process($matches); |
@@ -106,6 +112,9 @@ discard block |
||
106 | 112 | return false; |
107 | 113 | } |
108 | 114 | |
115 | + /** |
|
116 | + * @param string[] $matches |
|
117 | + */ |
|
109 | 118 | protected function process($matches) { |
110 | 119 | return $matches[0]; |
111 | 120 | } |
@@ -146,6 +155,9 @@ discard block |
||
146 | 155 | class ConstantMatcher extends RegexMatcher { |
147 | 156 | private $constant; |
148 | 157 | |
158 | + /** |
|
159 | + * @param string $regex |
|
160 | + */ |
|
149 | 161 | public function __construct($regex, $constant) { |
150 | 162 | parent::__construct($regex); |
151 | 163 | $this->constant = $constant; |
@@ -22,12 +22,18 @@ discard block |
||
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | + /** |
|
26 | + * @param ReflectionClass $reflection |
|
27 | + */ |
|
25 | 28 | public function forClass($reflection) { |
26 | 29 | $this->process($reflection->getFileName()); |
27 | 30 | $name = $reflection->getName(); |
28 | 31 | return isset(self::$classes[$name]) ? self::$classes[$name] : false; |
29 | 32 | } |
30 | 33 | |
34 | + /** |
|
35 | + * @param ReflectionMethod $reflection |
|
36 | + */ |
|
31 | 37 | public function forMethod($reflection) { |
32 | 38 | $this->process($reflection->getDeclaringClass()->getFileName()); |
33 | 39 | $class = $reflection->getDeclaringClass()->getName(); |
@@ -35,6 +41,9 @@ discard block |
||
35 | 41 | return isset(self::$methods[$class][$method]) ? self::$methods[$class][$method] : false; |
36 | 42 | } |
37 | 43 | |
44 | + /** |
|
45 | + * @param ReflectionProperty $reflection |
|
46 | + */ |
|
38 | 47 | public function forProperty($reflection) { |
39 | 48 | $this->process($reflection->getDeclaringClass()->getFileName()); |
40 | 49 | $class = $reflection->getDeclaringClass()->getName(); |
@@ -110,6 +119,9 @@ discard block |
||
110 | 119 | } |
111 | 120 | } |
112 | 121 | |
122 | + /** |
|
123 | + * @param integer $max |
|
124 | + */ |
|
113 | 125 | private function getString($tokens, &$i, $max) { |
114 | 126 | do { |
115 | 127 | $token = $tokens[$i]; |
@@ -347,6 +347,9 @@ |
||
347 | 347 | $this->assertNotIdentical($value, false); |
348 | 348 | } |
349 | 349 | |
350 | + /** |
|
351 | + * @param string $string |
|
352 | + */ |
|
350 | 353 | private function assertMatcherResult($matcher, $string, $expected) { |
351 | 354 | $this->assertNotIdentical($matcher->matches($string, $value), false); |
352 | 355 | $this->assertIdentical($value, $expected); |
@@ -33,6 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Ajoute $code à la liste des codes à exécuter |
36 | + * @param string $code |
|
36 | 37 | */ |
37 | 38 | private static function addToCodes($code){ |
38 | 39 | $codeObject=new JsCode($code); |
@@ -40,11 +41,17 @@ discard block |
||
40 | 41 | return $codeObject; |
41 | 42 | } |
42 | 43 | |
44 | + /** |
|
45 | + * @param string $code |
|
46 | + */ |
|
43 | 47 | private static function addScript($code){ |
44 | 48 | $code="$( document ).ready(function() {\n".$code."}\n);"; |
45 | 49 | return preg_filter("/(\<script[^>]*?\>)?(.*)(\<\/script\>)?/si", "<script>$2 </script>\n", $code,1); |
46 | 50 | } |
47 | 51 | |
52 | + /** |
|
53 | + * @param string $url |
|
54 | + */ |
|
48 | 55 | protected static function _getAjaxUrl($url,$attr){ |
49 | 56 | $url=self::_correctAjaxUrl($url); |
50 | 57 | $retour="url='".$url."';\n"; |
@@ -84,6 +91,9 @@ discard block |
||
84 | 91 | } |
85 | 92 | /** |
86 | 93 | * Associe du code javascript à exécuter sur l'évènement $event d'un élément DOM $element |
94 | + * @param string $element |
|
95 | + * @param string $event |
|
96 | + * @param string $jsCode |
|
87 | 97 | */ |
88 | 98 | public static function bindToElement($element,$event,$jsCode,$parameters=array()){ |
89 | 99 | $preventDefault=JArray::getDefaultValue($parameters, "preventDefault", true); |
@@ -114,7 +124,7 @@ discard block |
||
114 | 124 | * @param String $script |
115 | 125 | * @param String $event |
116 | 126 | * @param String $element |
117 | - * @return mixed |
|
127 | + * @return JsCode |
|
118 | 128 | */ |
119 | 129 | public static function executeOn($element,$event,$script,$parameters=array("preventDefault"=>false,"stopPropagation"=>false)){ |
120 | 130 | return self::bindToElement($element, $event, $script,$parameters); |
@@ -123,7 +133,7 @@ discard block |
||
123 | 133 | /** |
124 | 134 | * Exécute le script passé en paramètre |
125 | 135 | * @param String $script |
126 | - * @return mixed |
|
136 | + * @return JsCode |
|
127 | 137 | */ |
128 | 138 | public static function execute($script){ |
129 | 139 | return self::addToCodes($script); |
@@ -251,6 +261,9 @@ discard block |
||
251 | 261 | return self::addToCodes(self::_setVal($element, $value,$jsCallback)); |
252 | 262 | } |
253 | 263 | |
264 | + /** |
|
265 | + * @param string $element |
|
266 | + */ |
|
254 | 267 | public static function _setHtml($element,$html="",$jsCallback=""){ |
255 | 268 | return "$(".self::_prep_element($element).").html('".$html."');\n".$jsCallback; |
256 | 269 | } |
@@ -264,6 +277,10 @@ discard block |
||
264 | 277 | return self::addToCodes(self::_setHtml($element, $html,$jsCallback)); |
265 | 278 | } |
266 | 279 | |
280 | + /** |
|
281 | + * @param string $element |
|
282 | + * @param string $attr |
|
283 | + */ |
|
267 | 284 | private static function _setAttr($element,$attr,$value="",$jsCallback=""){ |
268 | 285 | return "$('".$element."').attr('".$attr."',".$value.");\n".$jsCallback; |
269 | 286 | } |
@@ -283,7 +300,7 @@ discard block |
||
283 | 300 | * @param string $element |
284 | 301 | * @param string $someThing |
285 | 302 | * @param string $param |
286 | - * @return mixed |
|
303 | + * @return string |
|
287 | 304 | */ |
288 | 305 | public static function _doJquery($element,$someThing,$param="",$jsCallback=""){ |
289 | 306 | return "$(".self::_prep_element($element).").".$someThing."(".self::_prep_value($param).");\n".$jsCallback; |
@@ -294,7 +311,7 @@ discard block |
||
294 | 311 | * @param string $element |
295 | 312 | * @param string $someThing |
296 | 313 | * @param string $param |
297 | - * @return mixed |
|
314 | + * @return JsCode |
|
298 | 315 | */ |
299 | 316 | public static function doJquery($element,$someThing,$param="",$jsCallback=""){ |
300 | 317 | return self::addToCodes(self::_doJquery($element, $someThing,$param,$jsCallback)); |
@@ -347,7 +364,7 @@ discard block |
||
347 | 364 | * @param string $elementToModify |
348 | 365 | * @param string $value |
349 | 366 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL) |
350 | - * @return mixed |
|
367 | + * @return JsCode |
|
351 | 368 | */ |
352 | 369 | public static function setOn($event,$element,$elementToModify,$value="",$parameters=array("preventDefault"=>false,"stopPropagation"=>false)){ |
353 | 370 | $jsCallback=JArray::getDefaultValue($parameters, "jsCallback", null); |
@@ -360,8 +377,7 @@ discard block |
||
360 | 377 | * @param string $element |
361 | 378 | * @param string $elementToModify |
362 | 379 | * @param string $value |
363 | - * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL) |
|
364 | - * @return mixed |
|
380 | + * @return JsCode |
|
365 | 381 | */ |
366 | 382 | public static function setHtmlOn($event,$element,$elementToModify,$value="",$jsCallback=""){ |
367 | 383 | return self::bindToElement($element, $event,self::_setHtml($elementToModify, $value,$jsCallback)); |
@@ -47,6 +47,9 @@ discard block |
||
47 | 47 | self::$objects[self::getInstanceIdInObjects($instance)]=$instance; |
48 | 48 | } |
49 | 49 | |
50 | + /** |
|
51 | + * @param string $className |
|
52 | + */ |
|
50 | 53 | private static function getInstanceInObjects($className,$keyValue){ |
51 | 54 | $objects=self::getObjects(); |
52 | 55 | $condition=self::getCondition($keyValue); |
@@ -131,7 +134,7 @@ discard block |
||
131 | 134 | /** |
132 | 135 | * @param object $instance |
133 | 136 | * @param ManyToManyParser $parser |
134 | - * @return PDOStatement |
|
137 | + * @return \PDOStatement |
|
135 | 138 | */ |
136 | 139 | private static function getSQLForJoinTable($instance,ManyToManyParser $parser){ |
137 | 140 | $accessor="get".ucfirst($parser->getPk()); |
@@ -51,6 +51,9 @@ discard block |
||
51 | 51 | return $ret; |
52 | 52 | } |
53 | 53 | |
54 | + /** |
|
55 | + * @param string $annotation |
|
56 | + */ |
|
54 | 57 | public static function getAnnotationClass($class,$annotation){ |
55 | 58 | $rac=new \ReflectionAnnotatedClass($class); |
56 | 59 | $annot=$rac->getAnnotation($annotation); |
@@ -64,6 +67,9 @@ discard block |
||
64 | 67 | return $annot; |
65 | 68 | } |
66 | 69 | |
70 | + /** |
|
71 | + * @param string $annotation |
|
72 | + */ |
|
67 | 73 | public static function getMembersWithAnnotation($class,$annotation){ |
68 | 74 | $props=Reflexion::getProperties(new $class()); |
69 | 75 | $ret=array(); |
@@ -8,10 +8,17 @@ |
||
8 | 8 | * @package utils |
9 | 9 | */ |
10 | 10 | class StrUtils { |
11 | + |
|
12 | + /** |
|
13 | + * @param string $needle |
|
14 | + */ |
|
11 | 15 | public static function startswith($hay, $needle) { |
12 | 16 | return substr($hay, 0, strlen($needle)) === $needle; |
13 | 17 | } |
14 | 18 | |
19 | + /** |
|
20 | + * @param string $needle |
|
21 | + */ |
|
15 | 22 | public static function endswith($hay, $needle) { |
16 | 23 | return substr($hay, -strlen($needle)) === $needle; |
17 | 24 | } |
@@ -10,6 +10,9 @@ discard block |
||
10 | 10 | private static $indexContent="\n\t\$this->loadView('index.html');\n"; |
11 | 11 | private static $mainViewTemplate="index.html"; |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $url |
|
15 | + */ |
|
13 | 16 | public static function downloadZip($url,$zipFile="tmp/tmp.zip"){ |
14 | 17 | $f = file_put_contents($zipFile, fopen($url, 'r'), LOCK_EX); |
15 | 18 | if(FALSE === $f) |
@@ -25,6 +28,9 @@ discard block |
||
25 | 28 | self::writeFile("composer.json", $composer); |
26 | 29 | } |
27 | 30 | |
31 | + /** |
|
32 | + * @param string $zipFile |
|
33 | + */ |
|
28 | 34 | public static function unzip($zipFile,$extractPath="."){ |
29 | 35 | $zip = new \ZipArchive(); |
30 | 36 | if (! $zip) { |
@@ -39,6 +45,10 @@ discard block |
||
39 | 45 | $zip->close(); |
40 | 46 | } |
41 | 47 | |
48 | + /** |
|
49 | + * @param string $source |
|
50 | + * @param string $dest |
|
51 | + */ |
|
42 | 52 | public static function xcopy($source, $dest, $permissions = 0755) |
43 | 53 | { |
44 | 54 | // Check for symlinks |
@@ -73,6 +83,9 @@ discard block |
||
73 | 83 | return true; |
74 | 84 | } |
75 | 85 | |
86 | + /** |
|
87 | + * @param string $dir |
|
88 | + */ |
|
76 | 89 | public static function delTree($dir) { |
77 | 90 | $files = array_diff(scandir($dir), array('.','..')); |
78 | 91 | foreach ($files as $file) { |
@@ -92,17 +105,27 @@ discard block |
||
92 | 105 | return file_put_contents($filename,$data); |
93 | 106 | } |
94 | 107 | |
108 | + /** |
|
109 | + * @param string|false $subject |
|
110 | + */ |
|
95 | 111 | public static function replaceAll($array,$subject){ |
96 | 112 | array_walk($array, function(&$item){if(is_array($item)) $item=implode("\n", $item);}); |
97 | 113 | return str_replace(array_keys($array), array_values($array), $subject); |
98 | 114 | } |
99 | 115 | |
116 | + /** |
|
117 | + * @param string $source |
|
118 | + */ |
|
100 | 119 | public static function openReplaceWrite($source,$destination,$keyAndValues){ |
101 | 120 | $str=self::openFile($source); |
102 | 121 | $str=self::replaceAll($keyAndValues,$str); |
103 | 122 | return self::writeFile($destination,$str); |
104 | 123 | } |
105 | 124 | |
125 | + /** |
|
126 | + * @param string $option |
|
127 | + * @param string $longOption |
|
128 | + */ |
|
106 | 129 | private static function getOption($options,$option,$longOption,$default=NULL){ |
107 | 130 | if(array_key_exists($option, $options)){ |
108 | 131 | $option=$options[$option]; |
@@ -247,6 +270,9 @@ discard block |
||
247 | 270 | echo $output."\n"; |
248 | 271 | } |
249 | 272 | |
273 | + /** |
|
274 | + * @param string $indexContent |
|
275 | + */ |
|
250 | 276 | public static function createController($controllerName,$indexContent=null,$force=false){ |
251 | 277 | $controllerName=ucfirst($controllerName); |
252 | 278 | self::safeMkdir("app/controllers"); |
@@ -266,6 +292,9 @@ discard block |
||
266 | 292 | return mkdir($dir,0777,true); |
267 | 293 | } |
268 | 294 | |
295 | + /** |
|
296 | + * @param string $dir |
|
297 | + */ |
|
269 | 298 | private static function setDir($dir=null){ |
270 | 299 | if(file_exists($dir) && is_dir($dir)){ |
271 | 300 | $microDir=$dir.DIRECTORY_SEPARATOR.".micro"; |