NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Code navigator - REST or API question


Joined: 13 May 2014
Posts: 11
Reply with quote
Hi PhpEd-ers !

Have a quick question that is irritating me as I'm sure its possible.

Basically I'm developing a REST/API script and its getting to the stage where its getting a bugger to navigate, I find the code navigator useful in my other scripts but it appears that there isn't a way to show switch case in the list, I thought it may be as simple as using PhpDoc block but I couldn't get anything to appear, am I being stupid or is switch case not a good way to do it ?

I thought about creating the conditions list via switch case and then create functions which are called i.e.

switch ($posted) {
case "do":
posted_do();
break;
};

function posted_do() {
}
View user's profileFind all posts by jamiedean83Send private message


Joined: 13 May 2014
Posts: 11
Reply with quote
I ended up doing this a sneaky way which seems to work nicely.

Defined my classes in a seperate PHP file to keep things tidy and created a class for each type of API call - Do,POST,Get,Delete, etc etc

Then I defined a final class to create an object with each of the classes i.e.

in affect you end up with $intranet_api->DO->securityLogin();

which looks rather nice Wink

class api_do_functions {

function securityLogin() {
}
function securityLogout() {
}
}

class api_post_functions {
}

class api_functions {

function __construct() {
$this->DO = new api_do_functions();
$this->POST = new api_post_functions();

}

}
$intranet_api = new api_functions();
View user's profileFind all posts by jamiedean83Send private message
Code navigator - REST or API question
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic