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

Laravel 11 #21

Merged
merged 6 commits into from
Jul 29, 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
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
time: "04:00"
timezone: "America/New_York"
51 changes: 8 additions & 43 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,16 @@
name: main
on:
pull_request:
push:
jobs:
tests-80:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.0.2]
laravel: [8.0, 9.0]
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: dom, curl, libxml, mbstring, zip, pcntl, gd, soap
coverage: none

- name: Install dependencies
run: composer require "illuminate/support:^${{ matrix.laravel }}" --prefer-stable --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit --verbose

tests-81:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.1]
laravel: [8.0, 9.0, 10.0]
php: [8.2, 8.3]
laravel: [11.0]
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
steps:
- name: Checkout code
Expand Down Expand Up @@ -74,7 +39,7 @@ jobs:
run: composer require "illuminate/support:^${{ matrix.laravel }}" --prefer-stable --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit --verbose
run: vendor/bin/phpunit

code_styles:
runs-on: ubuntu-latest
Expand All @@ -97,7 +62,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
tools: composer:v2
extensions: dom, curl, libxml, mbstring, zip, pcntl, gd, soap
coverage: none
Expand All @@ -107,4 +72,4 @@ jobs:

- name: Run style check
id: style_check
run: vendor/bin/phpcs
run: vendor/bin/pint --test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SOAP is old, but still used. Soapy is modern, but feature limited to fit our use
Heavily inspired by [artisaninweb/laravel-soap](https://github.com/artisaninweb/laravel-soap).

### Install
This package is currently supporting Laravel 8.x, 9.x, and 10.x.
This package is currently supporting Laravel 11.x.

```shell
composer require sourcetoad/soapy
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
}
],
"require": {
"php": "^8.0.2",
"php": "^8.2",
"ext-simplexml": "*",
"ext-soap": "*",
"illuminate/support": "^8.0|^9.0|^10.0"
"illuminate/support": "^11"
},
"require-dev": {
"orchestra/testbench": "^6.24|^7.0|^8.0",
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "^3.5"
"orchestra/testbench": "^9.2",
"phpunit/phpunit": "^11.2",
"laravel/pint": "^1.17"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 0 additions & 9 deletions phpcs.xml

This file was deleted.

17 changes: 5 additions & 12 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
forceCoversAnnotation="false"
failOnRisky="true"
failOnWarning="true"
verbose="true">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd" bootstrap="vendor/autoload.php"
executionOrder="depends,defects" failOnRisky="true" failOnWarning="true" cacheDirectory=".phpunit.cache"
requireCoverageMetadata="false">
<testsuites>
<testsuite name="default">
<directory>./tests/Unit</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</source>
</phpunit>
3 changes: 2 additions & 1 deletion src/Exceptions/ClientClassNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
declare(strict_types = 1);

declare(strict_types=1);

namespace Sourcetoad\Soapy\Exceptions;

Expand Down
3 changes: 2 additions & 1 deletion src/Exceptions/CurtainNotSetupException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
declare(strict_types = 1);

declare(strict_types=1);

namespace Sourcetoad\Soapy\Exceptions;

Expand Down
3 changes: 2 additions & 1 deletion src/Exceptions/CurtainRequiresWsdlException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
declare(strict_types = 1);

declare(strict_types=1);

namespace Sourcetoad\Soapy\Exceptions;

Expand Down
3 changes: 2 additions & 1 deletion src/SoapyBaseClient.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
declare(strict_types = 1);

declare(strict_types=1);

namespace Sourcetoad\Soapy;

Expand Down
3 changes: 2 additions & 1 deletion src/SoapyClient.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
declare(strict_types = 1);

declare(strict_types=1);

namespace Sourcetoad\Soapy;

Expand Down
66 changes: 34 additions & 32 deletions src/SoapyCurtain.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
<?php
declare(strict_types = 1);

declare(strict_types=1);

namespace Sourcetoad\Soapy;

class SoapyCurtain
{
/** @var string|null */
protected $wsdl = null;
protected ?string $wsdl = null;

/** @var bool */
protected $trace = false;
protected bool $trace = false;

/** @var int */
protected $cache = WSDL_CACHE_NONE;
protected int $cache = WSDL_CACHE_NONE;

/** @var string|null */
protected $location = null;
protected ?string $location = null;

/** @var string|null */
protected $uri = null;
protected ?string $uri = null;

/** @var string */
protected $certificate;
protected ?string $certificate = null;

/** @var array */
protected $options = [];
protected array $options = [];

/** @var array */
protected $classMap;
protected array $classMap = [];

/** @var array */
protected $typeMap;
protected array $typeMap = [];

#region getters
//region getters

public function getWsdl(): ?string
{
Expand Down Expand Up @@ -67,7 +59,7 @@ public function getUri(): ?string
public function getOptions(): array
{
$baseOptions = [
'trace' => $this->getTrace(),
'trace' => $this->getTrace(),
'cache_wsdl' => $this->getCache(),
];

Expand Down Expand Up @@ -104,19 +96,21 @@ public function getTypemap(): ?array
return $this->typeMap;
}

#endregion
//endregion

#region setters
//region setters

public function setWsdl(string $wsdl): self
{
$this->wsdl = $wsdl;

return $this;
}

public function setTrace(bool $flag): self
{
$this->trace = $flag;

return $this;
}

Expand All @@ -125,10 +119,11 @@ public function setCache(int $cache): self
$allowed = [WSDL_CACHE_NONE, WSDL_CACHE_DISK, WSDL_CACHE_MEMORY, WSDL_CACHE_BOTH];

if (! in_array($cache, $allowed)) {
throw new \InvalidArgumentException('Cache value passed (' . $allowed . ') is not valid.');
throw new \InvalidArgumentException('Cache value passed ('.$cache.') is not valid.');
}

$this->cache = $cache;

return $this;
}

Expand All @@ -143,67 +138,74 @@ public function setClassMap(array $classmap): self
}

$this->classMap = $classes;

return $this;
}

public function setOptions(array $options): self
{
$this->options = $options;

return $this;
}

public function setCertificate(string $certificate): self
{
$this->certificate = $certificate;

return $this;
}

public function setLocation(string $location): self
{
$this->location = $location;

return $this;
}

public function setUri(string $uri): self
{
$this->uri = $uri;

return $this;
}

public function addTypeMapViaClassName(string $namespace, string $item, string $itemClass)
public function addTypeMapViaClassName(string $namespace, string $item, string $itemClass): self
{
$function = function (string $xml) use ($itemClass) {
$object = simplexml_load_string($xml);

return new $itemClass($object);
};

return $this->addTypeMap($namespace, $item, $function);
}

public function addTypeMap(string $namespace, string $item, \Closure $fromXml)
public function addTypeMap(string $namespace, string $item, \Closure $fromXml): self
{
$typeMap = [
'type_ns' => $namespace,
'type_ns' => $namespace,
'type_name' => $item,
'from_xml' => $fromXml,
'from_xml' => $fromXml,
];

$this->typeMap[] = $typeMap;

return $this;
}

#endregion
//endregion

#region functions
//region functions

public function isReady(): bool
{
if (! empty($this->getLocation()) && ! empty($this->getUri())) {
return true;
}

return !empty($this->getWsdl());
return ! empty($this->getWsdl());
}

#endregion
//endregion
}
Loading
Loading