1 | <?php |
||
11 | class ShowAllService |
||
12 | { |
||
13 | /** |
||
14 | * @var array $comments, all comments. |
||
15 | */ |
||
16 | protected $comments; |
||
17 | protected $sess; |
||
18 | protected $users; |
||
19 | protected $user; |
||
20 | |||
21 | /** |
||
22 | * Constructor injects with DI container and the id to update. |
||
23 | * |
||
24 | * @param Anax\DI\DIInterface $di a service container |
||
25 | */ |
||
26 | public function __construct(DIInterface $di) |
||
38 | |||
39 | /** |
||
40 | * Get details on all comments. |
||
41 | * |
||
42 | * @return Comm |
||
43 | */ |
||
44 | public function getAll() |
||
50 | |||
51 | |||
52 | /** |
||
53 | * Sets the callable to use for creating routes. |
||
54 | * |
||
55 | * @param callable $urlCreate to create framework urls. |
||
56 | * |
||
57 | * @return void |
||
58 | */ |
||
59 | public function setUrlCreator($route) |
||
64 | |||
65 | |||
66 | /** |
||
67 | * Returns link for gravatar img |
||
68 | * |
||
69 | * @param object $item |
||
70 | * |
||
71 | * @return string htmlcode |
||
72 | */ |
||
73 | public function getGravatar($item) |
||
79 | |||
80 | |||
81 | /** |
||
82 | * Returns text if updated |
||
83 | * |
||
84 | * @param object $item |
||
85 | * @return string htmlcode |
||
86 | */ |
||
87 | public function getExtra($item) |
||
95 | |||
96 | |||
97 | /** |
||
98 | * Returns correct loginlink |
||
99 | * |
||
100 | * @param boolean $isadmin |
||
101 | * @param string $create |
||
102 | * @param string $del |
||
103 | * |
||
104 | * @return string htmlcode |
||
105 | */ |
||
106 | public function getLoginLink($isadmin, $create, $del) |
||
117 | |||
118 | |||
119 | /** |
||
120 | * Returns html for each item |
||
121 | * |
||
122 | * @param object $item |
||
123 | * @param boolean $isadmin |
||
124 | * @param string $viewone |
||
125 | * |
||
126 | * @return string htmlcode |
||
127 | */ |
||
128 | public function getValHtml(Comm $item, $isadmin, $viewone) |
||
141 | |||
142 | |||
143 | /** |
||
144 | * Returns all text for the view |
||
145 | * |
||
146 | * @return string htmlcode |
||
147 | */ |
||
148 | public function getHTML() |
||
176 | } |
||
177 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: