mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
3303a2cda1
Conflicts: lib/Cake/Console/Templates/skel/Config/Schema/db_acl.php lib/Cake/Console/Templates/skel/Config/Schema/i18n.php lib/Cake/Console/Templates/skel/Config/Schema/sessions.php lib/Cake/Console/Templates/skel/Config/acl.ini.php lib/Cake/Console/Templates/skel/Config/acl.php lib/Cake/Console/Templates/skel/Config/bootstrap.php lib/Cake/Console/Templates/skel/Config/core.php lib/Cake/Console/Templates/skel/Config/database.php.default lib/Cake/Console/Templates/skel/Config/email.php.default lib/Cake/Console/Templates/skel/Config/routes.php lib/Cake/Console/Templates/skel/Console/Command/AppShell.php lib/Cake/Console/Templates/skel/Console/cake.bat lib/Cake/Console/Templates/skel/Console/cake.php lib/Cake/Console/Templates/skel/Controller/AppController.php lib/Cake/Console/Templates/skel/Controller/PagesController.php lib/Cake/Console/Templates/skel/Model/AppModel.php lib/Cake/Console/Templates/skel/View/Errors/error400.ctp lib/Cake/Console/Templates/skel/View/Errors/error500.ctp lib/Cake/Console/Templates/skel/View/Helper/AppHelper.php lib/Cake/Console/Templates/skel/View/Layouts/Emails/html/default.ctp lib/Cake/Console/Templates/skel/View/Layouts/ajax.ctp lib/Cake/Console/Templates/skel/View/Layouts/default.ctp lib/Cake/Console/Templates/skel/View/Layouts/error.ctp lib/Cake/Console/Templates/skel/View/Layouts/flash.ctp lib/Cake/Console/Templates/skel/View/Pages/home.ctp lib/Cake/Console/Templates/skel/index.php lib/Cake/Console/Templates/skel/webroot/index.php lib/Cake/Console/Templates/skel/webroot/test.php
65 lines
1.5 KiB
PHP
65 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* ConsoleInput file.
|
|
*
|
|
* PHP 5
|
|
*
|
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
*
|
|
* Licensed under The MIT License
|
|
* For full copyright and license information, please see the LICENSE.txt
|
|
* Redistributions of files must retain the above copyright notice.
|
|
*
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
* @link http://cakephp.org CakePHP(tm) Project
|
|
* @package Cake.Console
|
|
* @since CakePHP(tm) v 2.0
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
|
*/
|
|
|
|
/**
|
|
* Object wrapper for interacting with stdin
|
|
*
|
|
* @package Cake.Console
|
|
*/
|
|
class ConsoleInput {
|
|
|
|
/**
|
|
* Input value.
|
|
*
|
|
* @var resource
|
|
*/
|
|
protected $_input;
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param string $handle The location of the stream to use as input.
|
|
*/
|
|
public function __construct($handle = 'php://stdin') {
|
|
$this->_input = fopen($handle, 'r');
|
|
}
|
|
|
|
/**
|
|
* Read a value from the stream
|
|
*
|
|
* @return mixed The value of the stream
|
|
*/
|
|
public function read() {
|
|
return fgets($this->_input);
|
|
}
|
|
|
|
/**
|
|
* Checks if data is available on the stream
|
|
*
|
|
* @param integer $timeout An optional time to wait for data
|
|
* @return bool True for data available, false otherwise
|
|
*/
|
|
public function dataAvailable($timeout = 0) {
|
|
$readFds = array($this->_input);
|
|
$readyFds = stream_select($readFds, $writeFds, $errorFds, $timeout);
|
|
return ($readyFds > 0);
|
|
}
|
|
|
|
}
|