| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace internship\controller;
- use n2n\web\http\controller\ControllerAdapter;
- use n2n\reflection\annotation\AnnoInit;
- use n2n\web\http\annotation\AnnoPath;
- use n2n\web\http\annotation\AnnoExt;
- class UserApiController extends ControllerAdapter {
- private static function _annos(AnnoInit $ai): void {
- //$ai->m('doDetail', new AnnoExt('txt'));
- $ai->m('modificationsInt', new AnnoPath('modInt?/paramInts+:#^[0-9]+$#'));
- $ai->m('modificationsString', new AnnoPath('modString?/params+:#^[a-z]+$#'));
- }
- /*
- * http://localhost/php-storm/internship-playground/src-php/public/user
- */
- public function index() {
- echo 'Hallo Welt!';
- }
- /*
- * http://localhost/php-storm/internship-playground/src-php/public/user/detail
- * http://localhost/php-storm/internship-playground/src-php/public/user/detail/Test
- * http://localhost/php-storm/internship-playground/src-php/public/user/detail/a/b/c
- */
- public function doDetail(?string $text1 = null, ?string $text2 = null, ?string $text3 = null) {
- echo "Hallo Welt! Detail Function " . $text1 . " " . $text2 . " " . $text3;
- }
- /*
- * http://localhost/php-storm/internship-playground/src-php/public/user/modInt/1/2/3
- */
- public function modificationsInt(array $paramInts) {
- echo 'params mod ints: ' . implode(', ', $paramInts);
- }
- /*
- * http://localhost/php-storm/internship-playground/src-php/public/user/modString/a/b/c
- */
- public function modificationsString(array $params) {
- echo 'params: ' . implode(', ', $params);
- }
- }
|