jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Annotation.php] - Blame information for rev 2

 

Line No. Rev Author Line
12simandl<?php
2 
3namespace Phem;
4 
5use Phem\Core\Collection;
6 
7/**
8 * Description of Annotation
9 *
10 * @author kubapet
11 */
12class Annotation
13{
14 
15 /** @return array */
16 static function parse($docComment)
17 {
18 preg_match_all("/\\@(form|textbox|selectbox|datebox|checkbox|xmlelement|xmlattribute|xmlobject|xmlvalue)\\s*(?:\\((.*?)\\))?/is", $docComment, $matches, PREG_SET_ORDER);
19 $result = new Collection();
20 foreach ($matches as $match)
21 {
22 $annotation = new Annotation;
23 $annotation->name = strtolower($match[1]);
24 if (count($match) > 2)
25 $annotation->params = preg_split("/\\s*\\,\\s*/", trim($match[2]), -1, PREG_SPLIT_NO_EMPTY);
26 $result->put($annotation->name,$annotation);
27 }
28 return $result;
29 }
30 
31 private $name;
32 private $params;
33 
34 protected function __construct()
35 {
36 
37 }
38 
39 function getName()
40 {
41 return $this->name;
42 }
43 
44 function getParamCount()
45 {
46 return count($this->params);
47 }
48 
49 function getParam($index)
50 {
51 return $this->params[$index];
52 }
53 
54 public function getParams()
55 {
56 return $this->params;
57 }
58 
59}

Powered by WebSVN 2.2.1