JBZoo\Utils\Cli::isInteractive PHP Method

isInteractive() public static method

Returns if the file descriptor is an interactive terminal or not.
public static isInteractive ( integer | resource $fileDescriptor = self::STDOUT ) : boolean
$fileDescriptor integer | resource
return boolean
    public static function isInteractive($fileDescriptor = self::STDOUT)
    {
        return function_exists('posix_isatty') && @posix_isatty($fileDescriptor);
    }

Usage Example

コード例 #1
0
ファイル: CliTest.php プロジェクト: jbzoo/utils
 /**
  * @covers \JBZoo\Utils\Cli::isInteractive
  */
 public function testCanDetectIfFileDescriptorIsInteractive()
 {
     $this->assertInternalType('boolean', Cli::isInteractive(STDOUT));
 }