PAGI\Client\ChannelStatus::toString PHP Method

toString() public static method

This will return the human readable description for the given channel status. See class constants. (False if the status is invalid).
public static toString ( integer $status ) : string
$status integer Channel status.
return string
    public static function toString($status)
    {
        switch ($status) {
            case self::DOWN_AVAILABLE:
                return 'Channel is down and available';
            case self::DOWN_RESERVED:
                return 'Channel is down, but reserved';
            case self::OFF_HOOK:
                return 'Channel is off hook';
            case self::DIGITS_DIALED:
                return 'Digits (or equivalent) have been dialed';
            case self::LINE_RINGING:
                return 'Line is ringing';
            case self::REMOTE_RINGING:
                return 'Remote end is ringing';
            case self::LINE_UP:
                return 'Line is up';
            case self::LINE_BUSY:
                return 'Line is busy';
            default:
                return false;
        }
    }

Usage Example

Example #1
0
 /**
  * @test
  */
 public function can_correct_status()
 {
     $this->assertEquals(ChannelStatus::toString(ChannelStatus::DOWN_AVAILABLE), 'Channel is down and available');
     $this->assertEquals(ChannelStatus::toString(ChannelStatus::DOWN_RESERVED), 'Channel is down, but reserved');
     $this->assertEquals(ChannelStatus::toString(ChannelStatus::OFF_HOOK), 'Channel is off hook');
     $this->assertEquals(ChannelStatus::toString(ChannelStatus::DIGITS_DIALED), 'Digits (or equivalent) have been dialed');
     $this->assertEquals(ChannelStatus::toString(ChannelStatus::LINE_RINGING), 'Line is ringing');
     $this->assertEquals(ChannelStatus::toString(ChannelStatus::REMOTE_RINGING), 'Remote end is ringing');
     $this->assertEquals(ChannelStatus::toString(ChannelStatus::LINE_UP), 'Line is up');
     $this->assertEquals(ChannelStatus::toString(ChannelStatus::LINE_BUSY), 'Line is busy');
     $this->assertFalse(ChannelStatus::toString(123123));
 }
All Usage Examples Of PAGI\Client\ChannelStatus::toString
ChannelStatus