1 | <?php |
||
26 | abstract class Plugin |
||
27 | { |
||
28 | /** |
||
29 | * The dwoo instance that runs this plugin. |
||
30 | * |
||
31 | * @var Core |
||
32 | */ |
||
33 | protected $core; |
||
34 | |||
35 | /** |
||
36 | * Constructor, if you override it, call parent::__construct($core); or assign |
||
37 | * the dwoo instance yourself if you need it. |
||
38 | * |
||
39 | * @param Core $core the dwoo instance that runs this plugin |
||
40 | */ |
||
41 | public function __construct(Core $core) |
||
45 | |||
46 | // plugins should always implement : |
||
47 | // public function process($arg, $arg, ...) |
||
|
|||
48 | // or for block plugins : |
||
49 | // public function init($arg, $arg, ...) |
||
50 | |||
51 | // this could be enforced with : |
||
52 | // abstract public function process(...); |
||
53 | // if my feature request gets enough interest one day |
||
54 | // see => http://bugs.php.net/bug.php?id=44043 |
||
55 | |||
56 | /** |
||
57 | * Utility function that converts an array of compiled parameters (or rest array) to a string of xml/html tag |
||
58 | * attributes. this is to be used in preProcessing or postProcessing functions, example : |
||
59 | * $p = $compiler->getCompiledParams($params); |
||
60 | * // get only the rest array as attributes |
||
61 | * $attributes = Plugin::paramsToAttributes($p['*']); |
||
62 | * // get all the parameters as attributes (if there is a rest array, it will be included) |
||
63 | * $attributes = Plugin::paramsToAttributes($p); |
||
64 | * |
||
65 | * @param array $params an array of attributeName=>value items that will be compiled to be ready for inclusion in a php string |
||
66 | * inclusion in a php string |
||
67 | * @param string $delim the string delimiter you want to use (defaults to ') |
||
68 | * @param Compiler $compiler the compiler instance (optional for BC, but recommended to pass it for proper escaping behavior) |
||
69 | * escaping behavior) |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | public static function paramsToAttributes(array $params, $delim = '\'', Compiler $compiler = null) |
||
105 | } |
||
106 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.