Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelcom committed Jan 31, 2021
2 parents 129a018 + bfcdd1b commit dd7f616
Show file tree
Hide file tree
Showing 122 changed files with 185,270 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM splitbrain/phpfarm:jessie

RUN apt-get update && apt-get install -y git zip

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY . /var/www/

WORKDIR /var/www/
46 changes: 46 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
32 changes: 32 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

We accept contributions via pull requests on [Github].
Please make all pull requests to the `develop` branch, not the `master` branch.

## Before posting an issue

- If a command is failing, post the full output you get when running the command, with the `--verbose` argument

## Pull Requests

- **Create an issue** - Explain as detailed as possible the issue you encountered so we can understand the context of your pull request
- **[Symfony Coding Standard]** - The easiest way to apply the conventions is to run `composer lint`
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **Create feature branches** - Don't ask us to pull from your master branch.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.

## Running Tests

``` bash
$ composer test
```

**Happy coding**!

[Github]: https://github.com/wsdltophp/domhandler
[Symfony Coding Standard]: http://symfony.com/doc/current/contributing/code/standards.html
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vendor
composer.lock
phpunit.xml
.phpunit.result.cache
coverage
17 changes: 17 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__);

return PhpCsFixer\Config::create()
->setUsingCache(false)
->setRules(array(
'@PSR2' => true,
'binary_operator_spaces' => true,
'no_whitespace_in_blank_line' => true,
'ternary_operator_spaces' => true,
'cast_spaces' => true,
'trailing_comma_in_multiline_array' => true
))
->setFinder($finder);
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
language: php

jobs:
include:
- name: 'Tests under PHP 7.4'
php: '7.4'
dist: bionic
- name: 'Tests under PHP 8.0'
php: '8.0'
dist: bionic
- name: 'Tests under PHP nightly'
php: 'nightly'
dist: bionic

fast_finish: true
allow_failures:
- php: 'nightly'

cache:
directories:
- $HOME/.composer/cache

install:
- composer install

script:
- php -dmemory_limit=-1 -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php -dmemory_limit=-1 ocular.phar code-coverage:upload --format=php-clover coverage.clover

after_success:
- bash <(curl -s https://codecov.io/bash)
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# CHANGELOG

## 1.0.0 - 2021/01/31
- Initial release after exporting source code from the [PackageGenerator](https://github.com/WsdlToPhp/PackageGenerator) project
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2021 Mikaël DELSOL

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# WSDL Handler

> WSDL Handler provides handful methods to manipulate/browse a WSDL and its schemas.
[![License](https://poser.pugx.org/wsdltophp/wsdlhandler/license)](https://packagist.org/packages/wsdltophp/wsdlhandler)
[![Latest Stable Version](https://poser.pugx.org/wsdltophp/wsdlhandler/version.png)](https://packagist.org/packages/wsdltophp/wsdlhandler)
[![Build Status](https://travis-ci.com/WsdlToPhp/WsdlHandler.svg)](https://travis-ci.com/github/WsdlToPhp/WsdlHandler)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/WsdlToPhp/WsdlHandler/badges/quality-score.png)](https://scrutinizer-ci.com/g/WsdlToPhp/WsdlHandler/)
[![Code Coverage](https://scrutinizer-ci.com/g/WsdlToPhp/WsdlHandler/badges/coverage.png)](https://scrutinizer-ci.com/g/WsdlToPhp/WsdlHandler/)
[![Total Downloads](https://poser.pugx.org/wsdltophp/wsdlhandler/downloads)](https://packagist.org/packages/wsdltophp/wsdlhandler)
[![StyleCI](https://styleci.io/repos/87977980/shield)](https://styleci.io/repos/87977980)
[![SymfonyInsight](https://insight.symfony.com/projects/3dd23426-0808-4715-9a11-e51dc84cb0b4/mini.svg)](https://insight.symfony.com/projects/3dd23426-0808-4715-9a11-e51dc84cb0b4)

WsdlHandler uses the [decorator design pattern](https://en.wikipedia.org/wiki/Decorator_pattern) upon [DomHandler](https://github.com/WsdlToPhp/DomHandler).

The source code has been originally created into the [PackageGenerator](https://github.com/WsdlToPhp/PackageGenerator) project but it felt that it had the possibility to live by itself and to evolve independtly from the PackageGenerator project if necessary.

## Testing using [Docker](https://www.docker.com/)
Thanks to the [Docker image](https://hub.docker.com/r/splitbrain/phpfarm) of [phpfarm](https://github.com/fpoirotte/phpfarm), tests can be run locally under *any* PHP version using the cli:
- php-7.4

First of all, you need to create your container which you can do using [docker-compose](https://docs.docker.com/compose/) by running the below command line from the root directory of the project:
```bash
$ docker-compose up -d --build
```

You then have a container named `wsdl_handler` in which you can run `composer` commands and `php cli` commands such as:
```bash
# install deps in container (using update ensure it does use the composer.lock file if there is any)
$ docker exec -it wsdl_handler php-7.4 /usr/bin/composer update
# run tests in container
$ docker exec -it wsdl_handler php-7.4 -dmemory_limit=-1 vendor/bin/phpunit
```

## Contributing

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## FAQ

Feel free to [create an issue](https://github.com/WsdlToPhp/WsdlHandler/issues/new).

## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.

52 changes: 52 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "wsdltophp/wsdlhandler",
"type": "library",
"description": "Decorative design pattern to ease WSDL handling",
"keywords": [
"xml",
"dom",
"xpath",
"php",
"wsdl",
"xsd"
],
"homepage": "https://github.com/WsdlToPhp/WsdlHandler",
"license": "MIT",
"authors": [
{
"name": "Mikaël DELSOL",
"email": "[email protected]",
"homepage": "https://www.wsdltophp.com",
"role": "Owner"
}
],
"require": {
"php": ">=7.4",
"ext-dom": "*",
"wsdltophp/domhandler": "~2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.0",
"phpunit/phpunit": "^9"
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"WsdlToPhp\\WsdlHandler\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"WsdlToPhp\\WsdlHandler\\Tests\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/php-cs-fixer fix --ansi --diff --verbose"
},
"support": {
"email": "[email protected]"
}
}
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.4'

services:
php:
build:
context: .
dockerfile: .docker/Dockerfile
volumes:
- .:/var/www:rw
container_name: wsdl_handler
20 changes: 20 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php">
<coverage>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
</php>
<testsuites>
<testsuite name="full">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
81 changes: 81 additions & 0 deletions src/AbstractDocument.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

declare(strict_types=1);

namespace WsdlToPhp\WsdlHandler;

use DOMElement;
use WsdlToPhp\DomHandler\ElementHandler;
use WsdlToPhp\DomHandler\DomDocumentHandler;
use WsdlToPhp\DomHandler\AbstractDomDocumentHandler;
use WsdlToPhp\WsdlHandler\Tag\Tag;

abstract class AbstractDocument extends DomDocumentHandler
{
const TAG_ADDRESS = 'address';
const TAG_ALL = 'all';
const TAG_ANNOTATION = 'annotation';
const TAG_ANY = 'any';
const TAG_ANY_ATTRIBUTE = 'anyAttribute';
const TAG_APPINFO = 'appinfo';
const TAG_ATTRIBUTE = 'attribute';
const TAG_ATTRIBUTE_GROUP = 'attributeGroup';
const TAG_BINDING = 'binding';
const TAG_BODY = 'body';
const TAG_CHOICE = 'choice';
const TAG_COMPLEX_CONTENT = 'complexContent';
const TAG_COMPLEX_TYPE = 'complexType';
const TAG_DEFINITIONS = 'definitions';
const TAG_DOCUMENTATION = 'documentation';
const TAG_ELEMENT = 'element';
const TAG_ENUMERATION = 'enumeration';
const TAG_EXTENSION = 'extension';
const TAG_FIELD = 'field';
const TAG_GROUP = 'group';
const TAG_HEADER = 'header';
const TAG_IMPORT = 'import';
const TAG_INCLUDE = 'include';
const TAG_INPUT = 'input';
const TAG_KEY = 'key';
const TAG_KEYREF = 'keyref';
const TAG_LIST = 'list';
const TAG_MEMBER_TYPES = 'memberTypes';
const TAG_MESSAGE = 'message';
const TAG_NOTATION = 'notation';
const TAG_OPERATION = 'operation';
const TAG_OUTPUT = 'output';
const TAG_PART = 'part';
const TAG_PORT = 'port';
const TAG_PORT_TYPE = 'portType';
const TAG_REDEFINE = 'redefine';
const TAG_RESTRICTION = 'restriction';
const TAG_SELECTOR = 'selector';
const TAG_SEQUENCE = 'sequence';
const TAG_SCHEMA = 'schema';
const TAG_SIMPLE_CONTENT = 'simpleContent';
const TAG_SIMPLE_TYPE = 'simpleType';
const TAG_TYPES = 'types';
const TAG_UNION = 'union';
const TAG_UNIQUE = 'unique';

protected function getElementHandler(DOMElement $element, AbstractDomDocumentHandler $domDocument, int $index = -1): ElementHandler
{
$handlerName = Tag::class;
if (class_exists($elementNameClass = sprintf('%s\Tag\Tag%s', __NAMESPACE__, ucfirst(implode('', array_slice(explode(':', $element->nodeName), -1, 1)))))) {
$handlerName = $elementNameClass;
}

return new $handlerName($element, $domDocument, $index);
}

public function getNamespaceUri(string $namespace): string
{
$rootElement = $this->getRootElement();
$uri = '';
if ($rootElement instanceof ElementHandler && $rootElement->hasAttribute(sprintf('xmlns:%s', $namespace))) {
$uri = $rootElement->getAttribute(sprintf('xmlns:%s', $namespace))->getValue();
}

return $uri;
}
}
9 changes: 9 additions & 0 deletions src/Schema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace WsdlToPhp\WsdlHandler;

class Schema extends AbstractDocument
{
}
Loading

0 comments on commit dd7f616

Please sign in to comment.