Example #1
0
    }, 'getvar' => function () {
        return PheryResponse::factory()->dump_vars('colorbox entry point', PheryResponse::factory()->access(array('$', 'colorbox')));
    }, 'pubsub' => function () {
        $r = new PheryResponse();
        switch (rand(1, 4)) {
            case 1:
                $r->publish('test', array(PheryResponse::factory()->this))->dump_vars(1);
                break;
            case 2:
                $r->publish('test2')->dump_vars(2);
                break;
            case 3:
                $r->publish('test2', array('hooray'))->dump_vars(3);
                break;
            case 4:
                $r->phery_broadcast('test', array('hooray'))->dump_vars(4);
                break;
        }
        return $r;
    }, 'objcall' => function () {
        $r = new PheryResponse();
        return $r->objinstance->blob('param');
    }))->process();
} catch (PheryException $exc) {
    /**
     * will trigger for "nonexistant" call
     * This will only be reached if 'exceptions' is set to TRUE
     * Otherwise it will fail silently, and return an empty
     * JSON response object {}
     */
    Phery::respond(PheryResponse::factory()->merge('my name is')->renew_csrf($phery)->exception($exc->getMessage()));