@php $requestExampleLangs = [ (object)[ 'label' => 'JavaScript', 'lang' => 'JavaScript', ], ]; $includeCurl = true; // COMENTAR ESTA LÍNEA EN PRODUCCIÓN! if(isset($includeCurl) && $includeCurl === true) { $unshift = (object)[ 'label' => 'Curl (verbose)', 'lang' => 'Curl', ]; array_unshift($requestExampleLangs, $unshift); $unshift = (object)[ 'label' => 'Curl (shorthand)', 'lang' => 'Curl-Shorthand', ]; array_unshift($requestExampleLangs, $unshift); } // if(!isset($requestJSONBody) || $requestJSONBody === '') // array_unshift($requestExampleLangs, 'URL'); $codeTabWidth = round(100 / (count($requestExampleLangs)), 8); $exampleCodeParams = array( 'requestURL' => $requestURL, ); if(isset($requestJSONBody) && !empty($requestJSONBody)) $exampleCodeParams['requestJSONBody'] = $requestJSONBody; if(isset($userToken) && !empty($userToken)) $exampleCodeParams['userToken'] = $userToken; if(isset($httpMethod) && !empty($httpMethod)) $exampleCodeParams['httpMethod'] = $httpMethod; $issetExample = $example ?? true; $requestHtmlHeading = $issetExample ? 'Example request' : 'Request'; $responseHtmlHeading = $issetExample ? 'Example response' : 'Response'; // dd($codeTabWidth); @endphp
@include('components.functions.example-'.strtolower($exampleLang->lang), $exampleCodeParams)
{{ json_decode(json_encode($functionExampleResponse)) ?? '(Empty response)' }}