Ingo_Script_Maildrop_Recipe::generate PHP Метод

generate() публичный Метод

Generates maildrop code to represent the recipe.
public generate ( ) : string
Результат string maildrop code to represent the recipe.
    public function generate()
    {
        $text = array();
        if (!$this->_valid) {
            return '';
        }
        if (count($this->_conditions) > 0) {
            $text[] = "if( \\";
            $nest = false;
            foreach ($this->_conditions as $condition) {
                $cond = $nest ? $this->_combine : '   ';
                $text[] = $cond . $condition['condition'] . $condition['flags'] . $condition['extra'] . " \\";
                $nest = true;
            }
            $text[] = ')';
        }
        foreach ($this->_action as $val) {
            $text[] = $val;
        }
        if ($this->_disable) {
            $code = '';
            foreach ($text as $val) {
                $comment = new Ingo_Script_Maildrop_Comment($val);
                $code .= $comment->generate() . "\n";
            }
            return $code;
        }
        return implode("\n", $text);
    }