You are here

public function Package::setDependencies in Features 8.3

Same name and namespace in other branches
  1. 8.4 src/Package.php \Drupal\features\Package::setDependencies()

Sets the dependencies of a package.

Ensures that dependencies are unique and do not include the package itself.

Parameters

\string[] $dependencies:

Return value

$this

1 call to Package::setDependencies()
Package::appendDependency in src/Package.php

File

src/Package.php, line 497

Class

Package
Defines a value object for storing package related data.

Namespace

Drupal\features

Code

public function setDependencies(array $dependencies) {
  $dependencies = array_unique($dependencies);

  // Package shouldn't be dependent on itself.
  $full_name = $this
    ->getFullName();
  if (in_array($full_name, $dependencies)) {
    unset($dependencies[array_search($full_name, $dependencies)]);
  }
  sort($dependencies);
  $this->dependencies = $dependencies;
  return $this;
}