Skip to content

Commit ed77b5d

Browse files
committed
Out: Add HTTP keywords
Issue #40
1 parent 97d726d commit ed77b5d

File tree

6 files changed

+95
-58
lines changed

6 files changed

+95
-58
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "smillerdev/phpdraft",
33
"description": "This is a parser for API Blueprint files in PHP.",
4-
"minimum-stability": "stable",
4+
"minimum-stability": "dev",
55
"license": "GPL-3.0",
66
"authors": [
77
{
@@ -18,7 +18,8 @@
1818
"require": {
1919
"php": "5.6.* || 7.*",
2020
"ql/uri-template": "1.*",
21-
"michelf/php-markdown": "1.*"
21+
"michelf/php-markdown": "1.*",
22+
"lukasoppermann/http-status": "^1.0@dev"
2223
},
2324
"require-dev": {
2425
"phpunit/phpunit": "5.7.*",

src/PHPDraft/Out/HTML/default.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ use PHPDraft\Out\Minifier;
230230
data-toggle="collapse"
231231
data-target="#request-coll--<?= $transition->get_href() . '-' . $response->statuscode; ?>">
232232
Response <var
233-
class="<?= $this->get_response_status($response->statuscode) ?>"><?= $response->statuscode; ?></var>
233+
class="<?= $this->get_response_status($response->statuscode) ?>"><?= $response->statuscode." ".$this->http_status->getReasonPhrase($response->statuscode)?></var>
234234
<span
235235
class="glyphicon
236236
indicator

src/PHPDraft/Out/HTML/material.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ use PHPDraft\Out\Minifier;
9696
<?php if (!empty($transition->responses)): ?>
9797
<?php foreach ($transition->responses as $key => $response): ?>
9898
<a href="#<?= $transition->get_href() . '-' . $response->statuscode; ?>-panel"
99-
class="mdl-tabs__tab <?= $this->get_response_status($response->statuscode) ?>"><?= $response->statuscode; ?></a>
99+
class="mdl-tabs__tab <?= $this->get_response_status($response->statuscode) ?>"
100+
title="<?= $response->statuscode." ".$this->http_status->getReasonPhrase($response->statuscode)?>"><?= $response->statuscode; ?></a>
100101
<?php endforeach;?>
101102
<?php endif;?>
102103
</div>

src/PHPDraft/Out/TemplateGenerator.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace PHPDraft\Out;
1010

11+
use Lukasoppermann\Httpstatus\Httpstatus;
1112
use Michelf\MarkdownExtra;
1213
use PHPDraft\Model\Category;
1314
use PHPDraft\Model\Elements\ObjectStructureElement;
@@ -56,6 +57,12 @@ class TemplateGenerator
5657
* @var
5758
*/
5859
protected $base_data;
60+
/**
61+
* The Http Status resolver
62+
*
63+
* @var Httpstatus
64+
*/
65+
protected $http_status;
5966
/**
6067
* Structures used in all data
6168
*
@@ -73,6 +80,7 @@ public function __construct($template, $image)
7380
{
7481
$this->template = $template;
7582
$this->image = $image;
83+
$this->http_status = new Httpstatus();
7684
}
7785

7886
/**

0 commit comments

Comments
 (0)