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

#2913690: PHPCS and refactor cleanup #62

Merged
merged 2 commits into from
Feb 8, 2018
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
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: php
sudo: false

php:
- 5.6
- 7.0
- 7.1

Expand Down Expand Up @@ -57,4 +56,4 @@ install:

script:
- ./run-tests.sh
- composer phpcs
- composer phpcs
6 changes: 6 additions & 0 deletions config/install/cloudflare.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
client_ip_restore_enabled: false
bypass_host: ''
valid_credentials: false
zone_id: ''
apikey: ''
email: ''
2 changes: 1 addition & 1 deletion config/schema/cloudflare.settings.schema.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Schema for the configuration files of the CloudFlare module.
# Schema for the configuration files of the CloudFlare module.
cloudflare.settings:
type: config_object
label: 'CloudFlare Config'
Expand Down
12 changes: 6 additions & 6 deletions modules/cloudflare_form_tester/src/Mocks/ZoneMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ class ZoneMock implements CloudFlareZoneInterface {
/**
* {@inheritdoc}
*/
public static function create(ConfigFactoryInterface $config, LoggerInterface $logger, CloudFlareStateInterface $state, CloudFlareComposerDependenciesCheckInterface $check_interface) {
public static function create(ConfigFactoryInterface $config_factory, LoggerInterface $logger, CloudFlareStateInterface $state, CloudFlareComposerDependenciesCheckInterface $check_interface) {

return new static(
$config,
$config_factory,
$logger,
$state,
$check_interface
Expand All @@ -84,17 +84,17 @@ public static function create(ConfigFactoryInterface $config, LoggerInterface $l
/**
* Zone constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config
* CloudFlare config object.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Psr\Log\LoggerInterface $logger
* A logger instance.
* @param \Drupal\cloudflare\CloudFlareStateInterface $state
* Tracks rate limits associated with CloudFlare Api.
* @param \Drupal\cloudflare\CloudFlareComposerDependenciesCheckInterface $check_interface
* Checks that composer dependencies are met.
*/
public function __construct(ConfigFactoryInterface $config, LoggerInterface $logger, CloudFlareStateInterface $state, CloudFlareComposerDependenciesCheckInterface $check_interface) {
$this->config = $config->get('cloudflare.settings');
public function __construct(ConfigFactoryInterface $config_factory, LoggerInterface $logger, CloudFlareStateInterface $state, CloudFlareComposerDependenciesCheckInterface $check_interface) {
$this->config = $config_factory->get('cloudflare.settings');
$this->logger = $logger;
$this->state = $state;
$this->zone = $this->config->get('zone');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class CredentialCheck extends DiagnosticCheckBase implements DiagnosticCheckInte
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->config = $config->get('cloudflare.settings');
$this->config = $config_factory->get('cloudflare.settings');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static function create(ContainerInterface $container, array $configuratio
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param \Drupal\cloudflare\CloudFlareStateInterface $state
* Tracks limits associated with CloudFlare Api.
Expand All @@ -105,10 +105,10 @@ public static function create(ContainerInterface $container, array $configuratio
* @throws \LogicException
* Thrown if $configuration['id'] is missing, see Purger\Service::createId.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config, CloudFlareStateInterface $state, LoggerInterface $logger, CloudFlareComposerDependenciesCheckInterface $checker) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, CloudFlareStateInterface $state, LoggerInterface $logger, CloudFlareComposerDependenciesCheckInterface $checker) {
parent::__construct($configuration, $plugin_id, $plugin_definition);

$this->config = $config->get('cloudflare.settings');
$this->config = $config_factory->get('cloudflare.settings');
$this->state = $state;
$this->logger = $logger;
$this->areCloudflareComposerDepenciesMet = $checker->check();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Drupal\cloudflarepurger\Tests\DiagnosticCheck;

use DateTime;
use Drupal\purge\Plugin\Purge\DiagnosticCheck\DiagnosticCheckInterface;
use Drupal\cloudflare\State;
use Drupal\cloudflarepurger\Plugin\Purge\DiagnosticCheck\ApiRateLimitCheck;
Expand All @@ -29,7 +28,7 @@ class ApiRateLimitCheckTest extends DiagnosticCheckTestBase {
*/
public function testApiRateLimitCheck($api_rate, $expected_severity) {
$this->drupalState->set(State::API_RATE_COUNT, $api_rate);
$this->drupalState->set(State::API_RATE_COUNT_START, new DateTime());
$this->drupalState->set(State::API_RATE_COUNT_START, new \DateTime());

$api_rate_limit_check = new ApiRateLimitCheck([], '23123', 'this is a definition', $this->cloudflareState, $this->composerDependencyStub);
$actual_severity = $api_rate_limit_check->run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Drupal\cloudflarepurger\Tests\DiagnosticCheck;

use DateTime;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\purge\Plugin\Purge\DiagnosticCheck\DiagnosticCheckInterface;
use Drupal\cloudflare\State;
Expand Down Expand Up @@ -39,7 +38,7 @@ public function setUp() {
*/
public function testDailyTagPurgeLimitCheck($api_rate, $expected_severity) {
$this->drupalState->set(State::TAG_PURGE_DAILY_COUNT, $api_rate);
$this->drupalState->set(State::TAG_PURGE_DAILY_COUNT_START, new DateTime());
$this->drupalState->set(State::TAG_PURGE_DAILY_COUNT_START, new \DateTime());

$api_rate_limit_check = new DailyTagPurgeLimitCheck([], '23123', 'this is a definition', $this->cloudflareState, $this->composerDependencyStub);
$actual_severity = $api_rate_limit_check->run();
Expand Down
6 changes: 3 additions & 3 deletions src/EventSubscriber/ClientIpRestore.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ClientIpRestore implements EventSubscriberInterface {
/**
* Constructs a ClientIpRestore.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache
* Cache backend.
Expand All @@ -76,10 +76,10 @@ class ClientIpRestore implements EventSubscriberInterface {
* @param \Psr\Log\LoggerInterface $logger
* A logger instance.
*/
public function __construct(ConfigFactoryInterface $config, CacheBackendInterface $cache, ClientInterface $http_client, LoggerInterface $logger) {
public function __construct(ConfigFactoryInterface $config_factory, CacheBackendInterface $cache, ClientInterface $http_client, LoggerInterface $logger) {
$this->httpClient = $http_client;
$this->cache = $cache;
$this->config = $config->get('cloudflare.settings');
$this->config = $config_factory->get('cloudflare.settings');
$this->logger = $logger;
$this->isClientIpRestoreEnabled = $this->config->get(SELF::CLOUDFLARE_CLIENT_IP_RESTORE_ENABLED);
$this->bypassHost = $this->config->get(SELF::CLOUDFLARE_BYPASS_HOST);
Expand Down
Loading