generate() public method

Generates the scripts to do the filtering specified in the rules.
public generate ( ) : array
return array The scripts.
Example #1
0
 /**
  * Generates the scripts to do the filtering specified in the rules.
  *
  * @return array  The scripts.
  */
 public function generate()
 {
     if (!$this->_generated) {
         $this->_generate();
         $this->_generated = true;
     }
     /* Build a list of required sieve extensions. */
     $requires = array();
     foreach ($this->_recipes as $item) {
         $rule = isset($this->_params['transport'][$item['rule']]) ? $item['rule'] : Ingo::RULE_ALL;
         if (!isset($requires[$rule])) {
             $requires[$rule] = array();
         }
         $requires[$rule] = array_merge($requires[$rule], $item['object']->requires());
     }
     foreach ($requires as $rule => $require) {
         $this->_insertItem($rule, new Ingo_Script_Sieve_Require(array_unique($require)), null, 1);
     }
     return parent::generate();
 }