From 093c56851a4197ebfc81f065e4665a1b0da2e589 Mon Sep 17 00:00:00 2001 From: lucashedding <lucashedding@1463982.no-reply.drupal.org> Date: Tue, 2 Apr 2019 10:16:18 -0500 Subject: [PATCH] Issue #3045039 by heddn: code standards --- migrate_example_advanced/README.txt | 6 +++--- src/DataFetcherPluginBase.php | 7 ------- src/Event/MigratePrepareRowEvent.php | 2 -- src/Plugin/migrate/process/Dom.php | 13 +++++++------ src/Plugin/migrate/process/EntityLookup.php | 7 +++++-- src/Plugin/migrate/process/FileBlob.php | 13 +++++++------ src/Plugin/migrate/process/SkipOnValue.php | 6 ++++-- src/Plugin/migrate/process/StrReplace.php | 8 ++++---- src/Plugin/migrate_plus/authentication/OAuth2.php | 7 ++++++- src/Plugin/migrate_plus/data_parser/Soap.php | 3 +++ 10 files changed, 39 insertions(+), 33 deletions(-) diff --git a/migrate_example_advanced/README.txt b/migrate_example_advanced/README.txt index 8d5a25d8..58ee806f 100644 --- a/migrate_example_advanced/README.txt +++ b/migrate_example_advanced/README.txt @@ -7,9 +7,9 @@ migrations with a wine theme. SETUP ----- To demonstrate XML migrations as realistically as possible, the setup module -provides the source data as REST services. So the migrations' references to these -services can be set up accurately, if you install migrate_example_advanced via -drush be sure to use the --uri parameter, e.g. +provides the source data as REST services. So the migrations' references to +these services can be set up accurately, if you install migrate_example_advanced +via drush be sure to use the --uri parameter, e.g. drush en -y migrate_example_advanced --uri=http://d8.local:8083/ diff --git a/src/DataFetcherPluginBase.php b/src/DataFetcherPluginBase.php index 9e413fe1..eb21f301 100644 --- a/src/DataFetcherPluginBase.php +++ b/src/DataFetcherPluginBase.php @@ -15,13 +15,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ abstract class DataFetcherPluginBase extends PluginBase implements DataFetcherPluginInterface { - /** - * {@inheritdoc} - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - } - /** * {@inheritdoc} */ diff --git a/src/Event/MigratePrepareRowEvent.php b/src/Event/MigratePrepareRowEvent.php index 4727f3ee..ad348e19 100644 --- a/src/Event/MigratePrepareRowEvent.php +++ b/src/Event/MigratePrepareRowEvent.php @@ -38,10 +38,8 @@ class MigratePrepareRowEvent extends Event { * * @param \Drupal\migrate\Row $row * Row of source data to be analyzed/manipulated. - * * @param \Drupal\migrate\Plugin\MigrateSourceInterface $source * Source plugin that is the source of the event. - * * @param \Drupal\migrate\Plugin\MigrationInterface $migration * Migration entity. */ diff --git a/src/Plugin/migrate/process/Dom.php b/src/Plugin/migrate/process/Dom.php index f67479f9..324e2291 100644 --- a/src/Plugin/migrate/process/Dom.php +++ b/src/Plugin/migrate/process/Dom.php @@ -29,8 +29,9 @@ use Drupal\migrate\Row; * - encoding: (optional) The encoding of the document as part of the XML * declaration. Defaults to 'UTF-8'. * - * Examples: + * @codingStandardsIgnoreStart * + * Examples: * @code * process: * 'body/value': @@ -42,9 +43,8 @@ use Drupal\migrate\Row; * plugin: dom * method: export * @endcode - * - * This will convert the input string to a DOMDocument object and back, with no - * explicit processing. It should have few noticeable effects. + * This example above will convert the input string to a DOMDocument object and + * back, with no explicit processing. It should have few noticeable effects. * * @code * process: @@ -62,9 +62,10 @@ use Drupal\migrate\Row; * method: export * non_root: true * @endcode + * This example above will have the same effect as the previous example, since + * it specifies the default values for all the optional parameters. * - * This will have the same effect as the previous example, since it specifies - * the default values for all the optional parameters. + * @codingStandardsIgnoreEnd * * @MigrateProcessPlugin( * id = "dom" diff --git a/src/Plugin/migrate/process/EntityLookup.php b/src/Plugin/migrate/process/EntityLookup.php index ec11a28d..00c034a0 100644 --- a/src/Plugin/migrate/process/EntityLookup.php +++ b/src/Plugin/migrate/process/EntityLookup.php @@ -24,6 +24,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * - access_check: (optional) Indicates if access to the entity for this user * will be checked. Default is true. * + * @codingStandardsIgnoreStart + * * Example usage with minimal configuration: * @code * destination: @@ -37,8 +39,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * access_check: false * source: tags * @endcode - * - * In this example the access check is disabled. + * In this example above, the access check is disabled. * * Example usage with full configuration: * @code @@ -52,6 +53,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * ignore_case: true * @endcode * + * @codingStandardsIgnoreEnd + * * @MigrateProcessPlugin( * id = "entity_lookup", * handle_multiples = TRUE diff --git a/src/Plugin/migrate/process/FileBlob.php b/src/Plugin/migrate/process/FileBlob.php index b04be892..e2f0e431 100644 --- a/src/Plugin/migrate/process/FileBlob.php +++ b/src/Plugin/migrate/process/FileBlob.php @@ -20,8 +20,9 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * Available configuration keys: * - reuse: true * - * Examples: + * @codingStandardsIgnoreStart * + * Examples: * @code * uri: * plugin: file_blob @@ -29,8 +30,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * - 'public://example.txt' * - blob * @endcode - * - * A basic configuration. + * Above, a basic configuration. * * @code * source: @@ -57,9 +57,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * - @destination_path * - @destination_blob * @endcode - * - * In some instances, it may be necessary to manipulate values before they can - * be processed by this plugin. This is because this plugin takes a binary blob + In the example above, it is necessary to manipulate the values before they + * are processed by this plugin. This is because this plugin takes a binary blob * and saves it as a file. In many cases, as in this example, the data is base64 * encoded and should be decoded first. In destination_blob, the incoming data * is decoded from base64 to binary. The destination_path element is @@ -67,6 +66,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * constants to create the final path. The resulting values are then referenced * as the source of the file_blob plugin. * + * @codingStandardsIgnoreEnd + * * @MigrateProcessPlugin( * id = "file_blob" * ) diff --git a/src/Plugin/migrate/process/SkipOnValue.php b/src/Plugin/migrate/process/SkipOnValue.php index af18a734..bf1632fe 100644 --- a/src/Plugin/migrate/process/SkipOnValue.php +++ b/src/Plugin/migrate/process/SkipOnValue.php @@ -25,6 +25,8 @@ use Drupal\migrate\Row; * - row: Skips the entire row. * - process: Prevents further processing of the input property * + * @codingStandardsIgnoreStart + * * Examples: * * Example usage with minimal configuration: @@ -35,7 +37,6 @@ use Drupal\migrate\Row; * method: process * value: blog * @endcode - * * The above example will skip further processing of the input property if * the content_type source field equals "blog". * @@ -50,9 +51,10 @@ use Drupal\migrate\Row; * - article * - testimonial * @endcode - * * The above example will skip processing any row for which the source row's * content type field is not "article" or "testimonial". + * + * @codingStandardsIgnoreEnd */ class SkipOnValue extends ProcessPluginBase { diff --git a/src/Plugin/migrate/process/StrReplace.php b/src/Plugin/migrate/process/StrReplace.php index dcff096b..70374e28 100644 --- a/src/Plugin/migrate/process/StrReplace.php +++ b/src/Plugin/migrate/process/StrReplace.php @@ -14,8 +14,9 @@ use Drupal\migrate\Row; * id = "str_replace" * ) * - * To do a simple hardcoded string replace use the following: + * @codingStandardsIgnoreStart * + * To do a simple hardcoded string replace, use the following: * @code * field_text: * plugin: str_replace @@ -23,7 +24,6 @@ use Drupal\migrate\Row; * search: foo * replace: bar * @endcode - * * If the value of text is "vero eos et accusam et justo vero" in source, foo is * "et" in search and bar is "that" in replace, field_text will be "vero eos * that accusam that justo vero". @@ -37,7 +37,6 @@ use Drupal\migrate\Row; * search: foo * replace: bar * @endcode - * * If the value of text is "VERO eos et accusam et justo vero" in source, foo is * "vero" in search and bar is "that" in replace, field_text will be "that eos * et accusam et justo that". @@ -51,7 +50,6 @@ use Drupal\migrate\Row; * search: foo * replace: bar * @endcode - * * If the value of text is "vero eos et 123 accusam et justo 123 duo" in source, * foo is "/[0-9]{3}/" in search and bar is "the" in replace, field_text will be * "vero eos et the accusam et justo the duo". @@ -68,6 +66,8 @@ use Drupal\migrate\Row; * search: ["AT", "CH", "DK"] * replace: ["Austria", "Switzerland", "Denmark"] * @endcode + * + * @codingStandardsIgnoreEnd */ class StrReplace extends ProcessPluginBase { diff --git a/src/Plugin/migrate_plus/authentication/OAuth2.php b/src/Plugin/migrate_plus/authentication/OAuth2.php index 116314d6..0be3f081 100755 --- a/src/Plugin/migrate_plus/authentication/OAuth2.php +++ b/src/Plugin/migrate_plus/authentication/OAuth2.php @@ -41,21 +41,26 @@ class OAuth2 extends AuthenticationPluginBase implements ContainerFactoryPluginI case 'authorization_code': $grant_type = new AuthorizationCode($client, $this->configuration); break; + case 'client_credentials': $grant_type = new ClientCredentials($client, $this->configuration); break; + case 'urn:ietf:params:oauth:grant-type:jwt-bearer': $grant_type = new JwtBearer($client, $this->configuration); break; + case 'password': $grant_type = new PasswordCredentials($client, $this->configuration); break; + case 'refresh_token': $grant_type = new RefreshToken($client, $this->configuration); break; + default: throw new MigrateException("Unrecognized grant_type {$this->configuration['grant_type']}."); - break; + } $middleware = new OAuthMiddleware($client, $grant_type); diff --git a/src/Plugin/migrate_plus/data_parser/Soap.php b/src/Plugin/migrate_plus/data_parser/Soap.php index 7f8c694e..3f8a7542 100755 --- a/src/Plugin/migrate_plus/data_parser/Soap.php +++ b/src/Plugin/migrate_plus/data_parser/Soap.php @@ -104,12 +104,15 @@ class Soap extends DataParserPluginBase implements ContainerFactoryPluginInterfa $xml = simplexml_load_string($response_value); $this->iterator = new \ArrayIterator($xml->xpath($this->itemSelector)); break; + case 'object': $this->iterator = new \ArrayIterator($response_value->{$this->itemSelector}); break; + case 'array': $this->iterator = new \ArrayIterator($response_value[$this->itemSelector]); break; + } return TRUE; } -- GitLab