1 <?php
  2 
  3 /**
  4  * Interface for packages.
  5  *
  6  * @author gharlan
  7  *
  8  * @package redaxo\core\packages
  9  */
 10 interface rex_package_interface
 11 {
 12     /**
 13      * Returns the name of the package.
 14      *
 15      * @return string Name
 16      */
 17     public function getName();
 18 
 19     /**
 20      * Returns the related Addon.
 21      *
 22      * @return rex_addon
 23      */
 24     public function getAddon();
 25 
 26     /**
 27      * Returns the package ID.
 28      *
 29      * @return string
 30      */
 31     public function getPackageId();
 32 
 33     /**
 34      * Returns the package type as string.
 35      *
 36      * @return string
 37      */
 38     public function getType();
 39 
 40     /**
 41      * Returns the base path.
 42      *
 43      * @param string $file File
 44      */
 45     public function getPath($file = '');
 46 
 47     /**
 48      * Returns the assets path.
 49      *
 50      * @param string $file File
 51      */
 52     public function getAssetsPath($file = '');
 53 
 54     /**
 55      * Returns the assets url.
 56      *
 57      * @param string $file File
 58      */
 59     public function getAssetsUrl($file = '');
 60 
 61     /**
 62      * Returns the data path.
 63      *
 64      * @param string $file File
 65      */
 66     public function getDataPath($file = '');
 67 
 68     /**
 69      * Returns the cache path.
 70      *
 71      * @param string $file File
 72      */
 73     public function getCachePath($file = '');
 74 
 75     /**
 76      * @see rex_config::set()
 77      */
 78     public function setConfig($key, $value = null);
 79 
 80     /**
 81      * @see rex_config::get()
 82      */
 83     public function getConfig($key = null, $default = null);
 84 
 85     /**
 86      * @see rex_config::has()
 87      */
 88     public function hasConfig($key = null);
 89 
 90     /**
 91      * @see rex_config::remove()
 92      */
 93     public function removeConfig($key);
 94 
 95     /**
 96      * Sets a property.
 97      *
 98      * @param string $key   Key of the property
 99      * @param mixed  $value New value for the property
100      */
101     public function setProperty($key, $value);
102 
103     /**
104      * Returns a property.
105      *
106      * @param string $key     Key of the property
107      * @param mixed  $default Default value, will be returned if the property isn't set
108      *
109      * @return mixed
110      */
111     public function getProperty($key, $default = null);
112 
113     /**
114      * Returns if a property is set.
115      *
116      * @param string $key Key of the property
117      *
118      * @return bool
119      */
120     public function hasProperty($key);
121 
122     /**
123      * Removes a property.
124      *
125      * @param string $key Key of the property
126      */
127     public function removeProperty($key);
128 
129     /**
130      * Returns if the package is available (activated and installed).
131      *
132      * @return bool
133      */
134     public function isAvailable();
135 
136     /**
137      * Returns if the package is installed.
138      *
139      * @return bool
140      */
141     public function isInstalled();
142 
143     /**
144      * Returns if it is a system package.
145      *
146      * @return bool
147      */
148     public function isSystemPackage();
149 
150     /**
151      * Returns the author.
152      *
153      * @param mixed $default Default value, will be returned if the property isn't set
154      *
155      * @return mixed
156      */
157     public function getAuthor($default = null);
158 
159     /**
160      * Returns the version.
161      *
162      * @param string $format See {@link rex_formatter::version()}
163      *
164      * @return mixed
165      */
166     public function getVersion($format = null);
167 
168     /**
169      * Returns the supportpage.
170      *
171      * @param mixed $default Default value, will be returned if the property isn't set
172      *
173      * @return mixed
174      */
175     public function getSupportPage($default = null);
176 
177     /**
178      * Includes a file in the package context.
179      *
180      * @param string $file Filename
181      */
182     public function includeFile($file);
183 
184     /**
185      * Adds the package prefix to the given key and returns the translation for it.
186      *
187      * @param string $key Key
188      *
189      * @return string Translation for the key
190      */
191     public function i18n($key);
192 }
193