Skip to content

Commit

Permalink
Merge pull request #65 from rvdbogerd/rvdbogerd/fix-some-issues-with-…
Browse files Browse the repository at this point in the history
…outdated-libraries

Fix some issues with outdated libraries
  • Loading branch information
goetas authored Jan 4, 2023
2 parents 4b2984b + 1818da2 commit 04cb405
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
12 changes: 10 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
"goetas-webservices/xsd2php-runtime": "^0.2.11",
"goetas-webservices/soap-common": "^0.2.2",
"goetas-webservices/soap-reader": "^0.3.3",
"goetas-webservices/xsd2php": "^0.4.7"
"goetas-webservices/xsd2php": "^0.4.7",
"laminas/laminas-code": "^4.8",
"laminas/laminas-zendframework-bridge": "^1.7",
"doctrine/inflector": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0|^8.0",
Expand Down Expand Up @@ -55,5 +58,10 @@
},
"bin": [
"bin/soap-client"
]
],
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false
}
}
}
12 changes: 9 additions & 3 deletions src/StubGeneration/ClientStubGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

namespace GoetasWebservices\SoapServices\SoapClient\StubGeneration;

use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use GoetasWebservices\SoapServices\Metadata\Headers\Header;
use GoetasWebservices\SoapServices\SoapClient\StubGeneration\Tag\MethodTag;
use GoetasWebservices\SoapServices\SoapClient\StubGeneration\Tag\ParamTag;
Expand All @@ -30,12 +31,17 @@ class ClientStubGenerator
* @var bool
*/
private $unwrapReturn = false;
/**
* @var Inflector
*/
private $inflector;

public function __construct(PhpConverter $phpConverter, NamingStrategy $namingStrategy, bool $unwrapReturn = false, array $baseNs = [])
{
$this->namingStrategy = $namingStrategy;
$this->phpConverter = $phpConverter;
$this->unwrapReturn = $unwrapReturn;
$this->inflector = InflectorFactory::create()->build();
}

public function setUnwrap(bool $mode = true): void
Expand Down Expand Up @@ -73,7 +79,7 @@ private function visitPortType(ClassGenerator $class, PortType $portType): ?bool

$namespaces = $this->phpConverter->getNamespaces();
$class->setNamespaceName($namespaces[$portType->getDefinition()->getTargetNamespace()] . '\\SoapStubs');
$class->setName(Inflector::classify($portType->getName()));
$class->setName($this->inflector->classify($portType->getName()));
$class->setDocblock($docBlock);

foreach ($portType->getOperations() as $operation) {
Expand All @@ -88,7 +94,7 @@ private function visitOperation(PortType\Operation $operation): MethodTag
{
$types = $this->getOperationReturnTypes($operation);
$operationTag = new MethodTag(
Inflector::camelize($operation->getName()),
$this->inflector->camelize($operation->getName()),
$types,
preg_replace("/[\n\r]+/", ' ', $operation->getDocumentation())
);
Expand Down

0 comments on commit 04cb405

Please sign in to comment.