<?php
/**
*+-----------------------------------------------------------------------+
*| CliParser v0.1 - 19 Jul 2006 |
*+-----------------------------------------------------------------------+
*| Diego do Nascimento Feitosa |
*| hide@address.com |
*| www.dnfeitosa.com |
*| São Paulo/SP - Brasil |
*| The latest version can be found at www.dnfeitosa.com |
*+-----------------------------------------------------------------------+
*| CliParser is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published by |
*| the Free Software Foundation; either version 2 of the License, or |
*| (at your option) any later version. |
*| |
*| CliParser is distributed in the hope that it will be useful, but |
*| WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
*| General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with CliParser; if not, write to the Free Software |
*| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
*| 02111-1307 USA |
*+-----------------------------------------------------------------------+
**/
require_once("CliToken.inc");
/**
* This is an example script of how to extend the abstract
* class Token and implement a customized token type.
* The condition to this token be valid, is return an array with 2
* itens
**/
class CliTokenExample extends CliToken {
protected $value = array();
function setTokenValue($value) { // Override this method to make value capable of receive more than 1 value;
$this->value[] = $value;
}
function assignCondition($value) {
return is_string($value) || is_dir($value); // This makes the token capable of receive a normal string or a path as argument
}
function isAssigned() { // True when the array store 2 arguments
if (count($this->value) == 2) {
$this->assigned = true;
} else {
$this->assigned = false;
}
return $this->assigned;
}
}
?>