Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Console / Prompt / AbstractPrompt.php
blob7ccb28ce0f48037408c88e45dc776bb063968d36
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Console\Prompt;
12 use ReflectionClass;
13 use Zend\Console\Adapter\AdapterInterface as ConsoleAdapter;
14 use Zend\Console\Console;
15 use Zend\Console\Exception;
17 abstract class AbstractPrompt implements PromptInterface
19 /**
20 * @var ConsoleAdapter
22 protected $console;
24 /**
25 * @var mixed
27 protected $lastResponse;
29 /**
30 * Return last answer to this prompt.
32 * @return mixed
34 public function getLastResponse()
36 return $this->lastResponse;
39 /**
40 * Return console adapter to use when showing prompt.
42 * @return ConsoleAdapter
44 public function getConsole()
46 if (!$this->console) {
47 $this->console = Console::getInstance();
50 return $this->console;
53 /**
54 * Set console adapter to use when showing prompt.
56 * @param ConsoleAdapter $adapter
58 public function setConsole(ConsoleAdapter $adapter)
60 $this->console = $adapter;
63 /**
64 * Create an instance of this prompt, show it and return response.
66 * This is a convenience method for creating statically creating prompts, i.e.:
68 * $name = Zend\Console\Prompt\Line::prompt("Enter your name: ");
70 * @return mixed
71 * @throws Exception\BadMethodCallException
73 public static function prompt()
75 if (get_called_class() === __CLASS__) {
76 throw new Exception\BadMethodCallException(
77 'Cannot call prompt() on AbstractPrompt class. Use one of the Zend\Console\Prompt\ subclasses.'
81 $refl = new ReflectionClass(get_called_class());
82 $instance = $refl->newInstanceArgs(func_get_args());
83 return $instance->show();