Commit dc8b4d0d authored by Ludwig Ruderstaller's avatar Ludwig Ruderstaller
Browse files

CS Fix

parent aba14eb8
Pipeline #17706 failed
......@@ -22,7 +22,7 @@ variables:
#- vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs
# - php -d zend.enable_gc=0 bin/phpunit -c ./phpunit.xml.dist --coverage-html=build/coverage --coverage-xml=build/logs/coverage --log-junit=build/logs/phpunit.xml --coverage-text --colors=never
#- bin/behat --format=progress --verbose --stop-on-failure
- vendor/bin/phpunit
- vendor/bin/phpunit --coverage-html build/coverage
stage: test
cache:
key: "${CI_PROJECT_PATH_SLUG}-cache"
......@@ -33,13 +33,13 @@ variables:
test:php7.1:
<<: *php_definition
image: dockerhub.cwd.at/docker/php/cli-xdebug:7.1
# artifacts:
# name: coverage
# paths:
# - build/coverage
artifacts:
name: coverage
paths:
- build/coverage
# - build/logs
# when: on_success
# expire_in: 2 days
when: on_success
expire_in: 2 days
tags:
- autoscale
......
......@@ -25,15 +25,14 @@ class ZonesEndpoint extends AbstractEndpoint
*/
public function delete($zoneId)
{
if ($zoneId instanceOf Zone) {
if ($zoneId instanceof Zone) {
$zoneId = $zoneId->getId();
}
$this->getClient()->call(null, sprintf(self::ENDPOINT_ELEMENT, $this->defaultServerId, $zoneId), null, false, 'DELETE');
}
public function create(Zone $zone, $rrsets = true, $hydrationClass = Zone::Class): Zone
public function create(Zone $zone, $rrsets = true, $hydrationClass = Zone::class): Zone
{
$rrsets = ($rrsets) ? 'true' : 'false';
......@@ -46,12 +45,14 @@ class ZonesEndpoint extends AbstractEndpoint
/**
* @param string|Zone $zoneId
*
* @return Zone
*
* @throws \Http\Client\Exception
*/
public function get($zoneId, $hydrationClass = Zone::Class): Zone
public function get($zoneId, $hydrationClass = Zone::class): Zone
{
if ($zoneId instanceOf Zone) {
if ($zoneId instanceof Zone) {
$zoneId = $zoneId->getId();
}
......@@ -63,14 +64,13 @@ class ZonesEndpoint extends AbstractEndpoint
*
* @throws \Http\Client\Exception
*/
public function all($zoneName = null, $hydrationClass = Zone::Class): array
public function all($zoneName = null, $hydrationClass = Zone::class): array
{
$queryParams = [];
if ($zoneName !== null) {
if (null !== $zoneName) {
$queryParams['zone'] = $zoneName;
}
return $this->getClient()->call(null, sprintf(self::ENDPOINT_LIST, $this->defaultServerId), $hydrationClass, true, 'GET', $queryParams);
}
}
......@@ -88,11 +88,13 @@ class Zone
/**
* @param null|string $id
*
* @return Zone
*/
public function setId(?string $id): Zone
{
$this->id = $id;
return $this;
}
......@@ -106,11 +108,13 @@ class Zone
/**
* @param string $name
*
* @return Zone
*/
public function setName(string $name): Zone
{
$this->name = $name;
return $this;
}
......@@ -124,11 +128,13 @@ class Zone
/**
* @param string $type
*
* @return Zone
*/
public function setType(string $type): Zone
{
$this->type = $type;
return $this;
}
......@@ -142,11 +148,13 @@ class Zone
/**
* @param null|string $url
*
* @return Zone
*/
public function setUrl(?string $url): Zone
{
$this->url = $url;
return $this;
}
......@@ -160,11 +168,13 @@ class Zone
/**
* @param null|string $kind
*
* @return Zone
*/
public function setKind(?string $kind): Zone
{
$this->kind = $kind;
return $this;
}
......@@ -178,11 +188,13 @@ class Zone
/**
* @param RRSet[] $rrsets
*
* @return Zone
*/
public function setRrsets(array $rrsets): Zone
{
$this->rrsets = $rrsets;
return $this;
}
......@@ -196,11 +208,13 @@ class Zone
/**
* @param int|null $serial
*
* @return Zone
*/
public function setSerial(?int $serial): Zone
{
$this->serial = $serial;
return $this;
}
......@@ -214,11 +228,13 @@ class Zone
/**
* @param int|null $notifiedSerial
*
* @return Zone
*/
public function setNotifiedSerial(?int $notifiedSerial): Zone
{
$this->notifiedSerial = $notifiedSerial;
return $this;
}
......@@ -232,11 +248,13 @@ class Zone
/**
* @param string[] $masters
*
* @return Zone
*/
public function setMasters(array $masters): Zone
{
$this->masters = $masters;
return $this;
}
......@@ -250,11 +268,13 @@ class Zone
/**
* @param bool $dnssec
*
* @return Zone
*/
public function setDnssec(bool $dnssec): Zone
{
$this->dnssec = $dnssec;
return $this;
}
......@@ -268,11 +288,13 @@ class Zone
/**
* @param null|string $nsec3param
*
* @return Zone
*/
public function setNsec3param(?string $nsec3param): Zone
{
$this->nsec3param = $nsec3param;
return $this;
}
......@@ -286,11 +308,13 @@ class Zone
/**
* @param bool $nsec3narrow
*
* @return Zone
*/
public function setNsec3narrow(bool $nsec3narrow): Zone
{
$this->nsec3narrow = $nsec3narrow;
return $this;
}
......@@ -304,11 +328,13 @@ class Zone
/**
* @param bool $predisgned
*
* @return Zone
*/
public function setPredisgned(bool $predisgned): Zone
{
$this->predisgned = $predisgned;
return $this;
}
......@@ -322,11 +348,13 @@ class Zone
/**
* @param null|string $soaEdit
*
* @return Zone
*/
public function setSoaEdit(?string $soaEdit): Zone
{
$this->soaEdit = $soaEdit;
return $this;
}
......@@ -340,11 +368,13 @@ class Zone
/**
* @param null|string $soaEditApi
*
* @return Zone
*/
public function setSoaEditApi(?string $soaEditApi): Zone
{
$this->soaEditApi = $soaEditApi;
return $this;
}
......@@ -358,11 +388,13 @@ class Zone
/**
* @param bool $apiRectify
*
* @return Zone
*/
public function setApiRectify(bool $apiRectify): Zone
{
$this->apiRectify = $apiRectify;
return $this;
}
......@@ -376,11 +408,13 @@ class Zone
/**
* @param null|string $zone
*
* @return Zone
*/
public function setZone(?string $zone): Zone
{
$this->zone = $zone;
return $this;
}
......@@ -394,11 +428,13 @@ class Zone
/**
* @param null|string $account
*
* @return Zone
*/
public function setAccount(?string $account): Zone
{
$this->account = $account;
return $this;
}
......@@ -412,11 +448,13 @@ class Zone
/**
* @param string[] $nameservers
*
* @return Zone
*/
public function setNameservers(array $nameservers): Zone
{
$this->nameservers = $nameservers;
return $this;
}
}
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cwd\PowerDNSClient\Validator\Constraints;
declare(strict_types=1);
namespace Cwd\PowerDNSClient\Validator\Constraints;
use Cwd\PowerDNSClient\Validator\ZoneNameValidator;
use Symfony\Component\Validator\Constraint;
......@@ -18,4 +27,4 @@ class HasDotPostfix extends Constraint
{
return ZoneNameValidator::class;
}
}
\ No newline at end of file
}
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cwd\PowerDNSClient\Validator;
declare(strict_types=1);
namespace Cwd\PowerDNSClient\Validator;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\ConstraintViolationListInterface;
......@@ -22,4 +31,4 @@ class ValidationException extends \DomainException
{
return $this->violations;
}
}
\ No newline at end of file
}
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Cwd\PowerDNSClient\Validator;
......@@ -14,10 +24,10 @@ class ZoneNameValidator extends ConstraintValidator
return;
}
if (substr($value,-1) !== '.') {
if ('.' !== substr($value, -1)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ string }}', $value)
->addViolation();
}
}
}
\ No newline at end of file
}
......@@ -20,7 +20,7 @@ use Webmozart\Assert\Assert;
class ZonesEndpointTest extends AbstractTest
{
/**
* This makes sure with have a clean startingpoint
* This makes sure with have a clean startingpoint.
*/
public function testCleanup()
{
......@@ -54,7 +54,7 @@ class ZonesEndpointTest extends AbstractTest
try {
$this->getClient()->zones()->create($zone, true);
$this->fail('No validation exception was thrown');
}catch (ValidationException $e) {
} catch (ValidationException $e) {
foreach ($e->getViolations() as $violation) {
$this->assertTrue(!empty($violation->getMessage()));
}
......@@ -93,6 +93,7 @@ class ZonesEndpointTest extends AbstractTest
$zone = $this->getClient()->zones()->create($zone, true);
$this->assertNotEmpty($zone->getId());
return $zone;
}
......@@ -131,7 +132,6 @@ class ZonesEndpointTest extends AbstractTest
$this->getClient()->zones()->get($zone, 'NotExisting');
}
/**
* @depends testCreate
*/
......@@ -152,7 +152,6 @@ class ZonesEndpointTest extends AbstractTest
$this->assertInstanceOf(Zone::class, $newZone);
$this->assertEquals($zone, $newZone);
}
/**
......@@ -195,7 +194,6 @@ class ZonesEndpointTest extends AbstractTest
Assert::allIsInstanceOf($zones, Zone::class);
}
/**
* @depends testCreateSlave
*/
......@@ -209,7 +207,6 @@ class ZonesEndpointTest extends AbstractTest
$this->getClient()->zones()->get($zone->getId());
}
/**
* @depends testCreate
*/
......
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
/*
* This file is part of the CwdPowerDNS Client
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment