Commit 409d915e authored by catch's avatar catch
Browse files

Issue #3115987 by jungle, kiamlaluno, quietone: Rename the $instanceIDs...

Issue #3115987 by jungle, kiamlaluno, quietone: Rename the $instanceIDs property used from plugin classes to $instanceIds

(cherry picked from commit da6f725f)
parent 0ae813d9
......@@ -21,7 +21,7 @@ abstract class LazyPluginCollection implements \IteratorAggregate, \Countable {
*
* @var array
*/
protected $instanceIDs = [];
protected $instanceIds = [];
/**
* Initializes and stores a plugin.
......@@ -66,7 +66,7 @@ public function clear() {
* TRUE if the plugin instance exists, FALSE otherwise.
*/
public function has($instance_id) {
return isset($this->pluginInstances[$instance_id]) || isset($this->instanceIDs[$instance_id]);
return isset($this->pluginInstances[$instance_id]) || isset($this->instanceIds[$instance_id]);
}
/**
......@@ -116,8 +116,8 @@ public function remove($instance_id) {
* (optional) The configuration used by this instance. Defaults to NULL.
*/
public function addInstanceId($id, $configuration = NULL) {
if (!isset($this->instanceIDs[$id])) {
$this->instanceIDs[$id] = $id;
if (!isset($this->instanceIds[$id])) {
$this->instanceIds[$id] = $id;
}
}
......@@ -128,7 +128,7 @@ public function addInstanceId($id, $configuration = NULL) {
* An array of all available instance IDs.
*/
public function getInstanceIds() {
return $this->instanceIDs;
return $this->instanceIds;
}
/**
......@@ -138,7 +138,7 @@ public function getInstanceIds() {
* The ID of the plugin instance to remove.
*/
public function removeInstanceId($instance_id) {
unset($this->instanceIDs[$instance_id]);
unset($this->instanceIds[$instance_id]);
$this->remove($instance_id);
}
......@@ -154,7 +154,7 @@ public function getIterator() {
* {@inheritdoc}
*/
public function count() {
return count($this->instanceIDs);
return count($this->instanceIds);
}
}
......@@ -64,9 +64,9 @@ public function __construct(PluginManagerInterface $manager, array $configuratio
if (!empty($configurations)) {
$instance_ids = array_keys($configurations);
$this->instanceIDs = array_combine($instance_ids, $instance_ids);
$this->instanceIds = array_combine($instance_ids, $instance_ids);
// Store the original order of the instance IDs for export.
$this->originalOrder = $this->instanceIDs;
$this->originalOrder = $this->instanceIds;
}
}
......@@ -87,7 +87,7 @@ protected function initializePlugin($instance_id) {
* @return $this
*/
public function sort() {
uasort($this->instanceIDs, [$this, 'sortHelper']);
uasort($this->instanceIds, [$this, 'sortHelper']);
return $this;
}
......@@ -106,10 +106,10 @@ public function sortHelper($aID, $bID) {
public function getConfiguration() {
$instances = [];
// Store the current order of the instances.
$current_order = $this->instanceIDs;
$current_order = $this->instanceIds;
// Reorder the instances to match the original order, adding new instances
// to the end.
$this->instanceIDs = $this->originalOrder + $current_order;
$this->instanceIds = $this->originalOrder + $current_order;
foreach ($this as $instance_id => $instance) {
if (PluginHelper::isConfigurable($instance)) {
......@@ -120,7 +120,7 @@ public function getConfiguration() {
}
}
// Restore the current order.
$this->instanceIDs = $current_order;
$this->instanceIds = $current_order;
return $instances;
}
......
......@@ -93,7 +93,7 @@ public function setConfiguration($configuration) {
public function addInstanceId($id, $configuration = NULL) {
$this->instanceId = $id;
// Reset the list of instance IDs since there can be only one.
$this->instanceIDs = [];
$this->instanceIds = [];
parent::addInstanceId($id, $configuration);
if ($configuration !== NULL) {
$this->setConfiguration($configuration);
......
......@@ -27,7 +27,7 @@ public function __construct(PluginManagerInterface $manager) {
$this->manager = $manager;
$instance_ids = array_keys($this->manager->getDefinitions());
$this->instanceIDs = array_combine($instance_ids, $instance_ids);
$this->instanceIds = array_combine($instance_ids, $instance_ids);
}
/**
......
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