diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-12-21 22:50:10 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-12-21 22:50:10 +0300 |
commit | d86707ec5d56e704ed6d5a0c9f936218df85cc30 (patch) | |
tree | 36d4ea6ecd0c8ea8427e2bd9ae099ccb2037217a | |
parent | b22864ae0f11d473ddf8e3c5263c355871a885e3 (diff) |
Remove parameters completely and move into GET
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | src/Visitor/PublicFunctionVisitor.php | 2 |
2 files changed, 5 insertions, 2 deletions
@@ -10,7 +10,7 @@ a `$_GET` on code related to the Nextcloud appframework. So the original code wo use OCP\AppFramework\Controller; class Foo extends Controller { - public function list($index) { + public function list($index, $bar) { // Logic of the code } } @@ -24,8 +24,9 @@ the resulting code would look like: use OCP\AppFramework\Controller; class Foo extends Controller { - public function list($index) { + public function list() { $index = $_GET['index']; + $bar = $_GET['bar']; // Logic of the code } } diff --git a/src/Visitor/PublicFunctionVisitor.php b/src/Visitor/PublicFunctionVisitor.php index 4ad3157..bdeb388 100644 --- a/src/Visitor/PublicFunctionVisitor.php +++ b/src/Visitor/PublicFunctionVisitor.php @@ -40,6 +40,8 @@ class PublicFunctionVisitor extends NodeVisitorAbstract { array_unshift($node->stmts, new Node\Expr\Assign($var, $expr)); } + $node->params = []; + } return $node; |