252ef2df309960f46fa50b4f1c656a53cf939b75
[yaffs-website] / web / modules / contrib / imagemagick / src / ImagemagickExecManagerInterface.php
1 <?php
2
3 namespace Drupal\imagemagick;
4
5 /**
6  * Provides an interface for ImageMagick execution managers.
7  */
8 interface ImagemagickExecManagerInterface {
9
10   /**
11    * Gets the binaries package in use.
12    *
13    * @param string $package
14    *   (optional) Force the graphics package.
15    *
16    * @return string
17    *   The default package ('imagemagick'|'graphicsmagick'), or the $package
18    *   argument.
19    */
20   public function getPackage($package = NULL);
21
22   /**
23    * Gets a translated label of the binaries package in use.
24    *
25    * @param string $package
26    *   (optional) Force the package.
27    *
28    * @return string
29    *   A translated label of the binaries package in use, or the $package
30    *   argument.
31    */
32   public function getPackageLabel($package = NULL);
33
34   /**
35    * Verifies file path of the executable binary by checking its version.
36    *
37    * @param string $path
38    *   The user-submitted file path to the convert binary.
39    * @param string $package
40    *   (optional) The graphics package to use.
41    *
42    * @return array
43    *   An associative array containing:
44    *   - output: The shell output of 'convert -version', if any.
45    *   - errors: A list of error messages indicating if the executable could
46    *     not be found or executed.
47    */
48   public function checkPath($path, $package = NULL);
49
50   /**
51    * Executes the convert executable as shell command.
52    *
53    * @param string $command
54    *   The executable to run.
55    * @param \Drupal\imagemagick\ImagemagickExecArguments $arguments
56    *   An ImageMagick execution arguments object.
57    * @param string &$output
58    *   (optional) A variable to assign the shell stdout to, passed by
59    *   reference.
60    * @param string &$error
61    *   (optional) A variable to assign the shell stderr to, passed by
62    *   reference.
63    * @param string $path
64    *   (optional) A custom file path to the executable binary.
65    *
66    * @return bool
67    *   TRUE if the command succeeded, FALSE otherwise. The error exit status
68    *   code integer returned by the executable is logged.
69    */
70   public function execute($command, ImagemagickExecArguments $arguments, &$output = NULL, &$error = NULL, $path = NULL);
71
72   /**
73    * Executes a command on the operating system.
74    *
75    * This differs from ::runOsCommand in the sense that here the command to be
76    * executed and its arguments are passed separately.
77    *
78    * @param string $command
79    *   The command to run.
80    * @param string $arguments
81    *   The arguments of the command to run.
82    * @param string $id
83    *   An identifier for the process to be spawned on the operating system.
84    * @param string &$output
85    *   (optional) A variable to assign the shell stdout to, passed by
86    *   reference.
87    * @param string &$error
88    *   (optional) A variable to assign the shell stderr to, passed by
89    *   reference.
90    *
91    * @return int|bool
92    *   The operating system returned code, or FALSE if it was not possible to
93    *   execute the command.
94    */
95   public function runOsShell($command, $arguments, $id, &$output = NULL, &$error = NULL);
96
97 }