3 namespace Drupal\drupalmoduleupgrader;
8 * Represents a Drupal 7 module being run through the DMU.
10 interface TargetInterface {
13 * Returns the machine name of the target module.
20 * Returns the base path of the target module.
24 public function getBasePath();
27 * Returns the path to a particular file, relative to the CWD.
30 * The file, relative to the module root. If $file begins with a period,
31 * it will be prefixed with the module name (.module --> MODULE.module)
35 public function getPath($file);
38 * Returns a fully configured Finder which can iterate over the target
39 * module's code files. Any file type which doesn't contain PHP code
42 * @return \Symfony\Component\Finder\Finder
44 public function getFinder();
47 * Returns an indexer for this target.
49 * @param string $which
50 * The type of indexer to get. Should be the ID of an indexer plugin.
52 * @return IndexerInterface
54 public function getIndexer($which);
57 * Returns services defined by the target module.
59 * @return \Doctrine\Common\Collections\ArrayCollection
61 public function getServices();
64 * Returns if the target module implements a particular hook.
67 * The hook to look for, without the hook_ prefix.
71 public function implementsHook($hook);
74 * Executes a hook implementation and returns the result.
77 * The hook to execute, without the hook_ prefix.
78 * @param array $arguments
79 * Additional parameters to pass to the hook implementation.
84 * \InvalidArgumentException if the module doesn't implement the hook.
85 * \LogicException if the hook contains non-executable logic.
87 public function executeHook($hook, array $arguments = []);
90 * Parses a file into a syntax tree, keeping a reference to it, and
94 * The path of the file to open, relative to the CWD.
96 * @return \Pharborist\RootNode|NULL
98 public function open($file);
101 * Saves the file in which a particular node appears.
103 * @param \Pharborist\Node|NULL $node
104 * The node to save. This can be positioned anywhere in the
105 * syntax tree. If NULL, all open files will be saved.
107 * @throws \Drupal\drupalmoduleupgrader\IOException
109 public function save(Node $node = NULL);
112 * Creates a new, empty document.
114 * @param string $file
115 * The path of the file to create, relative to the CWD.
117 * @return \Pharborist\RootNode
119 public function create($file);
122 * Clears internal references to all open documents, discarding changes.
124 public function flush();