function compliant()
{
    if ($condition) {
        firstActionInBlock();
        secondActionInBlock();
    }
    if ($condition) {
        action();
    }
    $outerAction;
    if ($condition) {
        firstActionInBlock();
        secondAction();
    } else {
        if ($condition) {
        } else {
            other();
        }
    }
    thirdAction();
    $str = null;
    for ($i = 0; $i < count($array); $i++) {
        $str = $array[$i];
        doTheThing($str);
    }
    if ($condition) {
        action();
    }
    $outerAction();
}
Esempio n. 2
0
<?
set_time_limit (0);

require_once dirname(dirname(dirname(__FILE__)))."/inc.php";

$code =
$body = false;

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

    $postdata = file_get_contents("php://input"); 
    $token = getToken ($postdata);
    list($requestId, $err, $code) = doTheThing($postdata);

    if (!empty($err)) {
        $body = json_encode([
            "token" => $token,
            "error" => $err,
        ], true);

    } else {
        $body = json_encode([
            "requestId" => $requestId
        ], true);
    }

} else {
    $requestId = extractRequestId ($_SERVER["REQUEST_URI"]);
    $body = doTheOtherThing($requestId);
    $code = 200;