This repository has been archived by the owner on Jul 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3c9ddcb
Showing
19 changed files
with
513 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
tests/var/cache/* | ||
!tests/var/cache/.gitkeep | ||
tests/var/logs/* | ||
!tests/var/logs/.gitkeep | ||
vendor/ | ||
|
||
.php_cs.cache | ||
composer.lock | ||
php-cs-fixer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
->exclude('tests/var/') | ||
->exclude('vendor') | ||
->files() | ||
->name('*.php') | ||
; | ||
|
||
$config = PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setFinder($finder) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'align_multiline_comment' => ['comment_type' => 'all_multiline'], | ||
'array_indentation' => true, | ||
'array_syntax' => true, | ||
'blank_line_before_return' => true, | ||
'class_keyword_remove' => false, | ||
'combine_consecutive_issets' => true, | ||
'combine_consecutive_unsets' => true, | ||
'comment_to_phpdoc' => true, | ||
'compact_nullable_typehint' => true, | ||
'date_time_immutable' => true, | ||
'escape_implicit_backslashes' => [ | ||
'double_quoted' => false, | ||
'heredoc_syntax' => true, | ||
'single_quoted' => true, | ||
], | ||
'explicit_indirect_variable' => true, | ||
'explicit_string_variable' => true, | ||
'final_internal_class' => true, | ||
'fully_qualified_strict_types' => true, | ||
'heredoc_to_nowdoc' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'list_syntax' => true, | ||
'mb_str_functions' => true, | ||
'method_chaining_indentation' => true, | ||
'multiline_comment_opening_closing' => true, | ||
'multiline_whitespace_before_semicolons' => true, | ||
'native_function_invocation' => true, | ||
'no_alternative_syntax' => true, | ||
'no_blank_lines_before_namespace' => false, | ||
'no_null_property_initialization' => true, | ||
'no_php4_constructor' => true, | ||
'no_short_echo_tag' => true, | ||
'no_superfluous_elseif' => true, | ||
'no_unreachable_default_argument_value' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'not_operator_with_space' => true, | ||
'not_operator_with_successor_space' => true, | ||
'ordered_class_elements' => true, | ||
'ordered_imports' => true, | ||
'php_unit_dedicate_assert' => [ | ||
'target' => 'newest', | ||
], | ||
'php_unit_expectation' => true, | ||
'php_unit_mock' => true, | ||
'php_unit_namespaced' => true, | ||
'php_unit_no_expectation_annotation' => true, | ||
'php_unit_ordered_covers' => true, | ||
'php_unit_strict' => true, | ||
'php_unit_test_annotation' => true, | ||
'php_unit_test_class_requires_covers' => true, | ||
'phpdoc_add_missing_param_annotation' => [ | ||
'only_untyped' => false, | ||
], | ||
'phpdoc_order' => true, | ||
'phpdoc_types_order' => true, | ||
'psr0' => true, | ||
'simplified_null_return' => true, | ||
'strict_comparison' => true, | ||
'strict_param' => true, | ||
'string_line_ending' => true, | ||
]) | ||
; | ||
|
||
return $config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
language: php | ||
sudo: false | ||
|
||
env: | ||
global: | ||
- secure: p1AHe7WuwIKb/kzGisKsAFCBeiBQFF71p01TWfhvhawo1OF+ytfuAWQ9OUVFbBlANdiX2VbF8LkK1Pnkj0NLAHSry1kdyhLyEw54gTaOB66O1hf/1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WOW6aQijNVySHO15ND5R9VLmpYpgBbWZRBGAfnBV1U3BA7XtvR/shIzDeBJHIrygvQPIw3SV8stICIDsQANHHQxlggTbiJSfeDwMHToN/dFhuwN2Pp4xS9zok666Oniga+KuhROo4VyGFy6YV2fx1GQIAWxLW/MfC5KlPcenVi0hj8h1CXW4= | ||
|
||
matrix: | ||
fast_finish: true | ||
include: | ||
- php: 5.6 | ||
env: SYMFONY_VERSION=2.7.* | ||
- php: 5.6 | ||
env: SYMFONY_VERSION=2.8.* | ||
- php: 5.6 | ||
env: SYMFONY_VERSION=3.4.* | ||
- php: 7.0 | ||
env: SYMFONY_VERSION=2.7.* | ||
- php: 7.0 | ||
env: SYMFONY_VERSION=2.8.* | ||
- php: 7.0 | ||
env: SYMFONY_VERSION=3.4.* | ||
- php: 7.1 | ||
env: SYMFONY_VERSION=2.7.* | ||
- php: 7.1 | ||
env: SYMFONY_VERSION=2.8.* | ||
- php: 7.1 | ||
env: SYMFONY_VERSION=3.4.* | ||
- php: 7.1 | ||
env: SYMFONY_VERSION=4.0.* | ||
- php: 7.2 | ||
env: SYMFONY_VERSION=2.7.* | ||
- php: 7.2 | ||
env: SYMFONY_VERSION=2.8.* | ||
- php: 7.2 | ||
env: SYMFONY_VERSION=3.4.* | ||
- php: 7.2 | ||
env: SYMFONY_VERSION=4.0.* | ||
|
||
before_install: | ||
- phpenv config-rm xdebug.ini || echo "xdebug not available"; | ||
- echo "memory_limit=1G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; | ||
|
||
install: | ||
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --dev --no-update "symfony/framework-bundle:${SYMFONY_VERSION}"; fi; | ||
- composer install --no-interaction | ||
|
||
before_script: | ||
- wget http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -O php-cs-fixer && chmod +x php-cs-fixer | ||
|
||
script: | ||
- "./vendor/bin/phpunit -c phpunit.dist.xml" | ||
- "./php-cs-fixer fix --config .phpcs.php --diff --dry-run --no-interaction -v" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog | ||
## v0.1.0 | ||
* Initial Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2018 Sebastian Sellmeier | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# INWX Service Provider for Symfony | ||
|
||
[![Build Status](https://travis-ci.org/SebTM/inwx-api-bundle.svg?branch=master)](https://travis-ci.org/SebTM/inwx-api-bundle) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/SebTM/inwx-api-bundle.svg)](https://packagist.org/packages/SebTM/inwx-api-bundle) | ||
[![GitHub license](https://img.shields.io/github/license/SebTM/inwx-api-bundle.svg)](https://github.com/SebTM/inwx-api-bundle/blob/master/LICENSE.md) | ||
|
||
A Symfony bundle for including the [INWX PHP-Client](https://github.com/inwx/php-client). | ||
|
||
## Installation | ||
|
||
The INWX bundle can be installed via [Composer](http://getcomposer.org) by | ||
requiring the `sebtm/inwx-api-bundle` package in your project's `composer.json`: | ||
|
||
```json | ||
{ | ||
"require": { | ||
"sebtm/inwx-api-bundle": "~0.1" | ||
} | ||
} | ||
``` | ||
|
||
and adding an instance of `SebTM\INWX\InwxApiBundle` to your application's kernel: | ||
|
||
```php | ||
class AppKernel extends Kernel | ||
{ | ||
public function registerBundles() | ||
{ | ||
return [ | ||
... | ||
new \SebTM\INWX\InwxApiBundle(), | ||
]; | ||
} | ||
... | ||
} | ||
``` | ||
(This is NOT needed for Symfony-Flex while using recipes!) | ||
|
||
## Configuration | ||
### Sample YML Configuration | ||
|
||
The sample configuration which can be placed in `app/config/config.yml` file. | ||
|
||
```yaml | ||
inwx_api: | ||
environment: "production" | ||
username: "username" | ||
password: "password" | ||
language: "en" | ||
debug: false | ||
``` | ||
Supported environments: "production", "test" | ||
Supported languages: see documentation of INWX PHP-Client | ||
## Usage | ||
This bundle exposes an instance of the `SebTM\INWX\Domrobot` object: | ||
|
||
``` | ||
Service | Instance Of | ||
--- | --- | ||
inwx_api | SebTM\INWX\Domrobot | ||
``` | ||
## Links | ||
* [INWX PHP-Client on Github](https://github.com/inwx/php-client) | ||
* [INWX PHP-Client Documentation](https://www.inwx.de/en/help/apidoc) | ||
* [License](https://opensource.org/licenses/MIT) | ||
* [Symfony website](http://symfony.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "sebtm/inwx-api-bundle", | ||
"description": "A Symfony bundle for using \"inwx/php-client\".", | ||
"keywords": [ "inwx", "php", "client", "api", "symfony"], | ||
"type": "symfony-bundle", | ||
"minimum-stability": "stable", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Sebastian Sellmeier", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.6", | ||
"inwx/domrobot": "^2.4" | ||
}, | ||
"require-dev": { | ||
"symfony/framework-bundle": "^2.7|^2.8|^3.4|^4.0", | ||
"symfony/yaml": "^2.7|^2.8|^3.4|^4.0", | ||
"phpunit/phpunit": "^5.7|^6.5|^7.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"SebTM\\INWX\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"SebTM\\INWX\\Tests\\": "tests/" | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/7.0/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
> | ||
<php> | ||
<ini name="error_reporting" value="-1" /> | ||
<ini name="display_errors" value="On" /> | ||
<ini name="display_startup_errors" value="On" /> | ||
<ini name="date.timezone" value="Europe/Berlin" /> | ||
<env name="APP_ENV" value="test" /> | ||
<env name="APP_DEBUG" value="1" /> | ||
</php> | ||
|
||
<testsuites> | ||
<testsuite name="INWX-Api-Bundle tests"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace SebTM\INWX\DependencyInjection; | ||
|
||
use SebTM\INWX\Exception\InvalidConfigurationException; | ||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | ||
|
||
class InwxApiExtension extends Extension | ||
{ | ||
/** | ||
* @param array $configs | ||
* @param ContainerBuilder $container | ||
* | ||
* @throws \Exception Error occurred while parsing "services.yml" | ||
* @throws InvalidConfigurationException Missing environment-variable to construct a client-instance | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config/')); | ||
$loader->load('services.yml'); | ||
|
||
$config = array( | ||
'environment' => \getenv('INWX_API_ENVIRONMENT'), | ||
'username' => \getenv('INWX_API_USERNAME'), | ||
'password' => \getenv('INWX_API_PASSWORD'), | ||
'language' => \getenv('INWX_API_LANGUAGE'), | ||
'debug' => \filter_var(\getenv('INWX_API_DEBUG'), FILTER_VALIDATE_BOOLEAN), | ||
); | ||
|
||
$validate = \array_search(false, $config, true); | ||
if (false !== $validate && 'debug' !== $validate) { | ||
throw new InvalidConfigurationException(); | ||
} | ||
|
||
$definition = $container->getDefinition('inwx_api'); | ||
$definition->replaceArgument(0, $config['environment']); | ||
$definition->replaceArgument(1, $config['username']); | ||
$definition->replaceArgument(2, $config['password']); | ||
$definition->replaceArgument(3, $config['language']); | ||
$definition->replaceArgument(4, $config['debug']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace SebTM\INWX; | ||
|
||
use INWX\Domrobot as BaseDomrobot; | ||
|
||
class Domrobot extends BaseDomrobot | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $environment; | ||
|
||
/** | ||
* @param string $environment | ||
* @param string $username | ||
* @param string $password | ||
* @param string $language | ||
* @param bool $debug | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function __construct($environment, $username, $password, $language = 'en', $debug = false) | ||
{ | ||
$this->environment = $environment; | ||
parent::__construct($this->getAddress($environment)); | ||
|
||
$this->setLanguage($language); | ||
$this->setDebug($debug); | ||
$this->login($username, $password); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getEnvironment() | ||
{ | ||
return $this->environment; | ||
} | ||
|
||
/** | ||
* @param string $environment | ||
* | ||
* @throws \Exception Unsupported environment | ||
* | ||
* @return string | ||
*/ | ||
protected function getAddress($environment) | ||
{ | ||
switch ($environment) { | ||
case 'production': | ||
return ' https://api.domrobot.com/xmlrpc/'; | ||
|
||
case 'test': | ||
return 'https://api.ote.domrobot.com/xmlrpc/'; | ||
|
||
default: | ||
throw new \Exception('Unsupported environment!'); | ||
} | ||
} | ||
} |
Oops, something went wrong.