Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / migrate / src / Annotation / MigrateSource.php
1 <?php
2
3 namespace Drupal\migrate\Annotation;
4
5 use Drupal\Component\Annotation\Plugin;
6
7 /**
8  * Defines a migration source plugin annotation object.
9  *
10  * Plugin Namespace: Plugin\migrate\source
11  *
12  * For a working example, check
13  * \Drupal\migrate\Plugin\migrate\source\EmptySource
14  * \Drupal\migrate_drupal\Plugin\migrate\source\UrlAlias
15  *
16  * @see \Drupal\migrate\Plugin\MigratePluginManager
17  * @see \Drupal\migrate\Plugin\MigrateSourceInterface
18  * @see \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
19  * @see \Drupal\migrate\Annotation\MigrateProcessPlugin
20  * @see \Drupal\migrate\Annotation\MigrateDestination
21  * @see plugin_api
22  *
23  * @ingroup migration
24  *
25  * @Annotation
26  */
27 class MigrateSource extends Plugin implements MultipleProviderAnnotationInterface {
28
29   /**
30    * A unique identifier for the process plugin.
31    *
32    * @var string
33    */
34   public $id;
35
36   /**
37    * Whether requirements are met.
38    *
39    * @var bool
40    */
41   public $requirements_met = TRUE;
42
43   /**
44    * Identifies the system providing the data the source plugin will read.
45    *
46    * The source plugin itself determines how the value is used. For example,
47    * Migrate Drupal's source plugins expect source_module to be the name of a
48    * module that must be installed and enabled in the source database.
49    *
50    * @see \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase::checkRequirements
51    *
52    * @var string
53    */
54   public $source_module;
55
56   /**
57    * Specifies the minimum version of the source provider.
58    *
59    * This can be any type, and the source plugin itself determines how it is
60    * used. For example, Migrate Drupal's source plugins expect this to be an
61    * integer representing the minimum installed database schema version of the
62    * module specified by source_module.
63    *
64    * @var mixed
65    */
66   public $minimum_version;
67
68   /**
69    * {@inheritdoc}
70    */
71   public function getProvider() {
72     if (isset($this->definition['provider'])) {
73       return is_array($this->definition['provider']) ? reset($this->definition['provider']) : $this->definition['provider'];
74     }
75     return FALSE;
76   }
77
78   /**
79    * {@inheritdoc}
80    */
81   public function getProviders() {
82     if (isset($this->definition['provider'])) {
83       // Ensure that we return an array even if
84       // \Drupal\Component\Annotation\AnnotationInterface::setProvider() has
85       // been called.
86       return (array) $this->definition['provider'];
87     }
88     return [];
89   }
90
91   /**
92    * {@inheritdoc}
93    */
94   public function setProviders(array $providers) {
95     $this->definition['provider'] = $providers;
96   }
97
98 }