bench.php 616 B

12345678910111213141516171819202122232425
  1. <?php
  2. class Controller_Bench extends Controller
  3. {
  4. public function action_json()
  5. {
  6. return new Response(json_encode(array('message' => 'Hello World!')), 200, array(
  7. 'Content-Type' => 'application/json'
  8. ));
  9. }
  10. public function action_db()
  11. {
  12. $queries = Input::get('queries', 1);
  13. $worlds = array();
  14. for($i = 0; $i < $queries; ++$i) {
  15. $worlds[] = Model_World::find(mt_rand(1, 10000))->toJson();
  16. }
  17. return new Response(json_encode($worlds), 200, array(
  18. 'Content-Type' => 'application/json'
  19. ));
  20. }
  21. }