Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #70

Merged
merged 5 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/workflows/php70.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/php71.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/php72.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/php73.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/php74.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/php80.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ jobs:
extensions: mysqli, mbstring, sqlsrv
tools: phpunit:8.5.13

- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop

- name: Install Dependencies
run: composer install --prefer-source --no-interaction --no-dev

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/php82.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ jobs:
extensions: mysqli, mbstring, sqlsrv
tools: phpunit:9.5.20, composer

- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop

- name: Install Dependencies
run: composer install --prefer-source --no-interaction --no-dev
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/php83.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ jobs:
php-version: ${{ matrix.php }}
extensions: mysqli, mbstring, sqlsrv
tools: phpunit:9.5.20, composer

- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop

- name: Install Dependencies
run: composer install --prefer-source --no-interaction --no-dev
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/php84.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master ]
branches: [ master, dev ]

jobs:
test:
Expand All @@ -28,9 +28,6 @@ jobs:
php-version: ${{ matrix.php }}
extensions: mysqli, mbstring, sqlsrv
tools: phpunit:9.5.20, composer

- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop

- name: Install Dependencies
run: composer install --prefer-source --no-interaction --no-dev
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ It includes inputs feltering and data validation in addion to creating user-defi
## Supported PHP Versions
| Build Status |
|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| <a target="_blank" href="https://github.com/WebFiori/http/actions/workflows/php70.yml"><img src="https://github.com/WebFiori/http/actions/workflows/php70.yml/badge.svg?branch=master"></a> |
| <a target="_blank" href="https://github.com/WebFiori/http/actions/workflows/php71.yml"><img src="https://github.com/WebFiori/http/actions/workflows/php71.yml/badge.svg?branch=master"></a> |
| <a target="_blank" href="https://github.com/WebFiori/http/actions/workflows/php72.yml"><img src="https://github.com/WebFiori/http/actions/workflows/php72.yml/badge.svg?branch=master"></a> |
| <a target="_blank" href="https://github.com/WebFiori/http/actions/workflows/php73.yml"><img src="https://github.com/WebFiori/http/actions/workflows/php73.yml/badge.svg?branch=master"></a> |
| <a target="_blank" href="https://github.com/WebFiori/http/actions/workflows/php74.yml"><img src="https://github.com/WebFiori/http/actions/workflows/php74.yml/badge.svg?branch=master"></a> |
| <a target="_blank" href="https://github.com/WebFiori/http/actions/workflows/php80.yml"><img src="https://github.com/WebFiori/http/actions/workflows/php80.yml/badge.svg?branch=master"></a> |
| <a target="_blank" href="https://github.com/WebFiori/http/actions/workflows/php81.yml"><img src="https://github.com/WebFiori/http/actions/workflows/php81.yml/badge.svg?branch=master"></a> |
| <a target="_blank" href="https://github.com/WebFiori/http/actions/workflows/php82.yml"><img src="https://github.com/WebFiori/http/actions/workflows/php82.yml/badge.svg?branch=master"></a> |
Expand Down
8 changes: 4 additions & 4 deletions tests/webfiori/tests/http/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ResponseTest extends TestCase {
* @test
*/
public function testAddHeader00() {
$this->assertFalse(Response::hasHeader('content-type'));
$this->assertFalse(Response::hasHeader('content-type', null));
$this->assertTrue(Response::addHeader('content-type', 'application/json'));
$this->assertTrue(Response::hasHeader('content-type', 'application/json'));
$this->assertFalse(Response::hasHeader('content-type', 'text/js'));
Expand All @@ -27,9 +27,9 @@ public function testAddHeader00() {
* @test
*/
public function testAddHeader01() {
$this->assertFalse(Response::hasHeader('Set-Cookie'));
$this->assertFalse(Response::hasHeader('Set-Cookie', null));
$this->assertTrue(Response::addHeader('Set-Cookie', 'name=ok'));
$this->assertTrue(Response::hasHeader('Set-Cookie'));
$this->assertTrue(Response::hasHeader('Set-Cookie', null));
$this->assertTrue(Response::hasHeader('Set-Cookie','name=ok'));

$this->assertTrue(Response::addHeader('Set-Cookie', 'name=good'));
Expand Down Expand Up @@ -122,7 +122,7 @@ public function testSetResponseCode() {
* @test
*/
public function testBeforeSend00() {
$this->assertFalse(Response::hasHeader('super'));
$this->assertFalse(Response::hasHeader('super', null));
Response::beforeSend(function () {
Response::addHeader('super', 'yes');
});
Expand Down
8 changes: 3 additions & 5 deletions webfiori/http/AbstractWebService.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ abstract class AbstractWebService implements JsonI {
* @param WebServicesManager|null $owner The manager which is used to
* manage the web service.
*/
public function __construct(string $name, WebServicesManager $owner = null) {
public function __construct(string $name) {
if (!$this->setName($name)) {
$this->setName('new-service');
}
Expand All @@ -135,8 +135,6 @@ public function __construct(string $name, WebServicesManager $owner = null) {
$this->requireAuth = true;
$this->sinceVersion = '1.0.0';
$this->serviceDesc = '';

$this->setManager($owner);
}
/**
* Returns an array that contains all possible requests methods at which the
Expand Down Expand Up @@ -726,7 +724,7 @@ public function send(string $contentType, $data, int $code = 200) {
*
* @since 1.0.1
*/
public function sendResponse(string $message, string $type = '', int $code = 200, $otherInfo = null) {
public function sendResponse(string $message, string $type = '', int $code = 200, mixed $otherInfo = '') {
$manager = $this->getManager();

if ($manager !== null) {
Expand Down Expand Up @@ -770,7 +768,7 @@ public function setIsAuthRequired(bool $bool) {
* the service was associated with a manager.
*
*/
public function setManager(WebServicesManager $manager = null) {
public function setManager(?WebServicesManager $manager) {
if ($manager === null) {
$this->owner = null;
} else {
Expand Down
Loading
Loading