Commit 093c5685 authored by heddn's avatar heddn Committed by heddn

Issue #3045039 by heddn: code standards

parent 870fc3d2
......@@ -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/
......
......@@ -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}
*/
......
......@@ -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.
*/
......
......@@ -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"
......
......@@ -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
......
......@@ -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"
* )
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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);
......
......@@ -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;
}
......
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