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

Esempio n. 1
0
 /**
  * @covers \JBZoo\Utils\Cli::isInteractive
  */
 public function testCanDetectIfFileDescriptorIsInteractive()
 {
     $this->assertInternalType('boolean', Cli::isInteractive(STDOUT));
 }