Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.59 KB | None | 0 0
  1. #########################################CONTROLLER###################################################
  2. <?php
  3.  
  4. namespace App\Http\Controllers;
  5.  
  6. use App\helpModel;
  7.  
  8. class HelpController extends Controller
  9. {
  10. function Help(){
  11. $manualContent = helpModel::GetManualContent();
  12. $manual = helpModel::ProcessManualContent($manualContent);
  13. return $manual;
  14. }
  15. }
  16. #########################################Model###############################################################
  17. <?php
  18.  
  19. namespace App;
  20.  
  21. use Illuminate\Database\Eloquent\Model;
  22.  
  23. class helpModel extends Model
  24. {
  25. static function GetManualContent(){
  26. $manualContent = array(
  27. "version 1.0" => array(
  28. "/api/v1/GET/beacon/..." => array(
  29. "content" => array(
  30. "/api/v1/GET/beacon" => array(
  31. "input" => 'N/A',
  32. "output" => 'all beacons',
  33. ),
  34. "/api/v1/GET/beacon/{beaconId}" => array(
  35. "input" => 'beaconId (integer)',
  36. "output" => 'a specific beacon',
  37. ),
  38. "/api/v1/GET/beacon/{beaconId}/staticData" => array(
  39. "input" => 'beaconId (integer)',
  40. "output" => 'all static data for a specific beacon',
  41. ),
  42. "/api/v1/GET/beacon/{beaconId}/staticData/{dataId}" => array(
  43. "input" => 'beaconId (integer) <b>+</b> dataId (integer)',
  44. "output" => 'specific static data for a specific beacon',
  45. ),
  46. "/api/v1/GET/beacon/{beaconId}/route" => array(
  47. "input" => 'beaconId (integer)',
  48. "output" => 'all routes for a specific beacon',
  49. ),
  50. "/api/v1/GET/beacon/{beaconId}/route/{routeId}" => array(
  51. "input" => 'beaconId (integer) <b>+</b> routeId (integer)',
  52. "output" => 'a specific route for a specific beacon',
  53. ),
  54. "/api/v1/GET/beacon/{beaconId}/route/{routeId}/dynamicData" => array(
  55. "input" => 'beaconId (integer) <b>+</b> routeId (integer)',
  56. "output" => 'all dynamic data for a specific beacon and route combination',
  57. ),
  58. "/api/v1/GET/beacon/{beaconId}/route/{routeId}/dynamicData/{dataId}" => array(
  59. "input" => 'beaconId (integer) <b>+</b> routeId (integer) <b>+</b> dataId (integer)',
  60. "output" => 'specific dynamic data for a specific beacon and route combination',
  61. ),
  62. ),
  63. ),
  64. ),
  65. );
  66. return $manualContent;
  67. }
  68.  
  69. static function ProcessManualContent($manualContent)
  70. {
  71. $processedManualContent = '';
  72. foreach ($manualContent as $apiVersion => $apiRouteSummary) {
  73. $processedManualContent .= '<h1>'.$apiVersion.'</h1> <ul style="list-style-type:none">';
  74.  
  75. foreach ($apiRouteSummary as $apiRouteSummaryName => $apiVersionFunctions){
  76. $processedManualContent .= '<li> <h3>'.$apiRouteSummaryName.'</h3> </li> <ul style="list-style-type:disc">';
  77.  
  78. foreach ($apiVersionFunctions['content'] as $apiFunction => $apiFunctions){
  79. $processedManualContent .= '<li> <p> <b>'.$apiFunction.'</b> </p> </li> <ul style="list-style-type:none">';
  80.  
  81. foreach ($apiFunctions as $valueName => $value) {
  82. $processedManualContent .= '<li> <p> <i>'.$valueName.':</i> '.$value.'</p> </li>';
  83. }
  84. $processedManualContent .= '</ul>';
  85. }
  86. $processedManualContent .= '</ul>';
  87. }
  88. $processedManualContent .= '</ul>';
  89. }
  90. return $processedManualContent;
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement