Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 *  $Id: InputRequest.php 123 2006-09-14 20:19:08Z mrook $
5
 *
6
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
12
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
13
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
16
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
 *
18
 * This software consists of voluntary contributions made by many individuals
19
 * and is licensed under the LGPL. For more information please see
20
 * <http://phing.info>.
21
 */
22
 
23
/**
24
 * Encapsulates an input request.
25
 *
26
 * @author Hans Lellelid <hans@xmpl.org> (Phing)
27
 * @author Stefan Bodewig <stefan.bodewig@epost.de> (Ant)
28
 * @version $Revision: 1.4 $
29
 * @package phing.input
30
 */
31
class InputRequest {
32
 
33
    protected $prompt;
34
    protected $input;
35
    protected $defaultValue;
36
    protected $promptChar;
37
 
38
    /**
39
     * @param string $prompt The prompt to show to the user.  Must not be null.
40
     */
41
    public function __construct($prompt) {
42
        if ($prompt === null) {
43
            throw new BuildException("prompt must not be null");
44
        }
45
        $this->prompt = $prompt;
46
    }
47
 
48
    /**
49
     * Retrieves the prompt text.
50
     */
51
    public function getPrompt() {
52
        return $this->prompt;
53
    }
54
 
55
    /**
56
     * Sets the user provided input.
57
     */
58
    public function setInput($input) {
59
        $this->input = $input;
60
    }
61
 
62
    /**
63
     * Is the user input valid?
64
     */
65
    public function isInputValid() {
66
        return true;
67
    }
68
 
69
    /**
70
     * Retrieves the user input.
71
     */
72
    public function getInput() {
73
        return $this->input;
74
    }
75
 
76
    /**
77
     * Set the default value to use.
78
     * @param mixed $v
79
     */
80
    public function setDefaultValue($v) {
81
        $this->defaultValue = $v;
82
    }
83
 
84
    /**
85
     * Return the default value to use.
86
     * @return mixed
87
     */
88
    public function getDefaultValue() {
89
        return $this->defaultValue;
90
    }
91
 
92
    /**
93
     * Set the default value to use.
94
     * @param string $c
95
     */
96
    public function setPromptChar($c) {
97
        $this->promptChar = $c;
98
    }
99
 
100
    /**
101
     * Return the default value to use.
102
     * @return string
103
     */
104
    public function getPromptChar() {
105
        return $this->promptChar;
106
    }
107
}