MessagePack\Packer::setTypeDetectionMode PHP Метод

setTypeDetectionMode() публичный Метод

public setTypeDetectionMode ( integer $mode )
$mode integer
    public function setTypeDetectionMode($mode)
    {
        if ($mode > 0b1010 || $mode < 0 || 0b11 === ($mode & 0b11)) {
            throw new \InvalidArgumentException('Invalid type detection mode.');
        }
        $this->strDetectionMode = $mode & 0b11;
        $this->arrDetectionMode = $mode & 0b1100;
    }

Usage Example

Пример #1
0
 /**
  * @dataProvider provideInvalidTypeDetectionModeData
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Invalid type detection mode.
  */
 public function testConstructorThrowsErrorOnInvalidTypeDetectionMode($mode)
 {
     $this->packer->setTypeDetectionMode($mode);
 }