Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Develop (#21)
Browse files Browse the repository at this point in the history
* rename function

* update readme

* rename function (#11) (#15)

* rename function

* update readme

* fixes #14 | added missing MisdirectedRequestException for error code 421 (#17)

* fixes #14, fixes #13  and added missing MisdirectedRequestException for error code 421

* Issue 16 (#20)

fixes #16
  • Loading branch information
prisis authored Feb 20, 2017
1 parent d7e86ed commit 0d519a2
Show file tree
Hide file tree
Showing 52 changed files with 790 additions and 450 deletions.
1 change: 0 additions & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ $config->getFinder()
->in(__DIR__)
->exclude('build')
->exclude('vendor')
->exclude('tests')
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
Expand Down
104 changes: 0 additions & 104 deletions .scrutinizer.yml

This file was deleted.

84 changes: 34 additions & 50 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,44 @@
preset: psr2
preset: recommended

risky: false
risky: true

linting: true

finder:
exclude:
- vendor
- build

enabled:
- align_equals
- combine_consecutive_unsets
- concat_with_spaces
- function_typehint_space
- newline_after_open_tag
- declare_strict_types
- dir_constant
- ereg_to_preg
- mb_str_functions
- modernize_types_casting
- no_blank_lines_after_return
- no_blank_lines_before_namespace
- ordered_use
- phpdoc_order
- short_array_syntax
- alias_functions
- array_element_no_space_before_comma
- array_element_white_space_after_comma
- double_arrow_multiline_whitespaces
- duplicate_semicolon
- empty_return
- extra_empty_lines
- include
- list_commas
- method_separation
- multiline_array_trailing_comma
- namespace_no_leading_whitespace
- new_with_braces
- no_blank_lines_after_class_opening
- no_empty_lines_after_phpdocs
- object_operator
- operators_spaces
- phpdoc_align
- phpdoc_indent
- phpdoc_inline_tag
- phpdoc_no_access
- phpdoc_no_empty_return
- phpdoc_no_package
- phpdoc_scalar
- phpdoc_separation
- phpdoc_to_comment
- phpdoc_trim
- phpdoc_types
- phpdoc_type_to_var
- phpdoc_var_without_name
- remove_leading_slash_use
- return
- short_bool_cast
- single_array_no_trailing_comma
- single_quote
- spaces_after_semicolon
- spaces_before_semicolon
- spaces_cast
- standardize_not_equal
- ternary_spaces
- trim_array_spaces
- unneeded_control_parentheses
- whitespacy_lines
- no_empty_comment
- no_useless_else
- ordered_class_elements
- php_unit_construct
- php_unit_dedicate_assert
- phpdoc_add_missing_param_annotation
- pow_to_exponentiation
- protected_to_private
- random_api_migration
- return_type_declaration
- not_operator_with_successor_space

disabled:
- blank_line_after_opening_tag
- unalign_equals
- self_accessor
- concat_without_spaces
- single_blank_line_before_namespace
- simplified_null_return

finder:
exclude:
Expand Down
11 changes: 1 addition & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@ language: php
sudo: false

php:
- 5.6
- 7.0
- 7.1

matrix:
include:
# Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version
- php: hhvm
sudo: required
dist: trusty
group: edge
allow_failures:
- php: hhvm
fast_finish: true

cache:
Expand All @@ -23,7 +15,6 @@ cache:
- $HOME/.php-cs-fixer

before_install:
- composer self-update
- composer validate

install:
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Changelog

All Notable changes to `http-status` will be documented in this file
## NEXT - 2017-02-20

### Added
- MisdirectedRequestException, the error code 421 and the status message.
- Support for [http-message-util](//github.com/php-fig/http-message-util)
- Tests against iana.org

### Deprecated
- Nothing

### Fixed
- Nothing

### Removed
- Support for php 5.6 and hhvm

### Security
- Nothing

## NEXT - 2016-06-22

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2016 Narrowspark
Copyright (c) 2015-2017 Narrowspark

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,29 @@ $ composer require narrowspark/http-status
## Usage

``` php

use Narrowspark\HttpStatus\HttpStatus;

// get status message from code
echo HttpStatus::getReasonMessage(301); // This and all future requests should be directed to the given URI.

// get status name from code
echo HttpStatus::getReasonPhrase(301); // Moved Permanently

try {
HttpStatus::getReasonException(301):
} catch(/Exception $e) {
echo $e->getMessage(); // 301 Moved Permanently
echo $e->getCode(); // 301
}
```

### Now we have support for ([http-message-util](//github.com/php-fig/http-message-util)) so you can do something like this:

``` php
use Narrowspark\HttpStatus\HttpStatus;

// get status name from code
echo HttpStatus::getReasonPhrase(HttpStatus::STATUS_MOVED_PERMANENTLY); // Moved Permanently
```

## HTTP status code classes ([from RFC7231](https://tools.ietf.org/html/rfc7231#section-6))
## HTTP status code classes ([from RFC7231](//tools.ietf.org/html/rfc7231#section-6))
The first digit of the status-code defines the class of response.
The last two digits do not have any categorization role. There are five values for the first digit:

Expand Down Expand Up @@ -111,7 +115,9 @@ Code | Message | RFC
429 | Too Many Requests | [RFC6585]
430 | *Unassigned* |
431 | Request Header Fields Too Large | [RFC6585]
432-499 | *Unassigned* |
432-450 | *Unassigned* |
451 | Unavailable For Legal | [RFC7725]
452-499 | *Unassigned* |
500 | Internal Server Error | [RFC7231, Section 6.6.1]
501 | Not Implemented | [RFC7231, Section 6.6.2]
502 | Bad Gateway | [RFC7231, Section 6.6.3]
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
}
],
"require": {
"php" : "^5.6 || ^7.0"
"php" : "^7.0",
"fig/http-message-util" : "^1.1"
},
"require-dev": {
"narrowspark/php-cs-fixer-config" : "^1.4",
"phpunit/phpunit" : "^4.8 || ^5.1"
"narrowspark/php-cs-fixer-config" : "^2.2",
"phpunit/phpunit" : "^6.0"
},
"provide": {
"psr/http-message-implementation" : "^1.0"
Expand All @@ -41,7 +42,7 @@
},
"extra": {
"branch-alias": {
"dev-master" : "2.0-dev"
"dev-master" : "3.0-dev"
}
},
"suggest": {
Expand Down
Loading

0 comments on commit 0d519a2

Please sign in to comment.