Skip to content

Commit 617a5df

Browse files
committed
Use new HttpStatus utility class in exceptions and TransportMock
1 parent 97ff846 commit 617a5df

33 files changed

+67
-83
lines changed

src/Exception/Http/Status304.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 304 Not Modified responses
@@ -27,5 +28,5 @@ final class Status304 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Not Modified';
31+
protected $reason = HttpStatus::TEXT_304;
3132
}

src/Exception/Http/Status305.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 305 Use Proxy responses
@@ -27,5 +28,5 @@ final class Status305 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Use Proxy';
31+
protected $reason = HttpStatus::TEXT_305;
3132
}

src/Exception/Http/Status306.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 306 Switch Proxy responses
@@ -27,5 +28,5 @@ final class Status306 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Switch Proxy';
31+
protected $reason = HttpStatus::TEXT_306;
3132
}

src/Exception/Http/Status400.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 400 Bad Request responses
@@ -27,5 +28,5 @@ final class Status400 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Bad Request';
31+
protected $reason = HttpStatus::TEXT_400;
3132
}

src/Exception/Http/Status401.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 401 Unauthorized responses
@@ -27,5 +28,5 @@ final class Status401 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Unauthorized';
31+
protected $reason = HttpStatus::TEXT_401;
3132
}

src/Exception/Http/Status402.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 402 Payment Required responses
@@ -27,5 +28,5 @@ final class Status402 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Payment Required';
31+
protected $reason = HttpStatus::TEXT_402;
3132
}

src/Exception/Http/Status403.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 403 Forbidden responses
@@ -27,5 +28,5 @@ final class Status403 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Forbidden';
31+
protected $reason = HttpStatus::TEXT_403;
3132
}

src/Exception/Http/Status404.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 404 Not Found responses
@@ -27,5 +28,5 @@ final class Status404 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Not Found';
31+
protected $reason = HttpStatus::TEXT_404;
3132
}

src/Exception/Http/Status405.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 405 Method Not Allowed responses
@@ -27,5 +28,5 @@ final class Status405 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Method Not Allowed';
31+
protected $reason = HttpStatus::TEXT_405;
3132
}

src/Exception/Http/Status406.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WpOrg\Requests\Exception\Http;
99

1010
use WpOrg\Requests\Exception\Http;
11+
use WpOrg\Requests\Utility\HttpStatus;
1112

1213
/**
1314
* Exception for 406 Not Acceptable responses
@@ -27,5 +28,5 @@ final class Status406 extends Http {
2728
*
2829
* @var string
2930
*/
30-
protected $reason = 'Not Acceptable';
31+
protected $reason = HttpStatus::TEXT_406;
3132
}

0 commit comments

Comments
 (0)