/** * Asserts the stream is writable * * @throws Magento_Filesystem_Exception */ protected function _assertWritable() { $this->_assertOpened(); if (false === $this->_mode->isWriteAllowed()) { throw new Magento_Filesystem_Exception('The stream does not allow write.'); } }
/** * @param string $mode */ public function __construct($mode) { $searchPattern = '/(r|w|a|x|c)(b)?(\\+)?(\\d*)(f|h)?/'; preg_match($searchPattern, $mode, $ratios); if (count($ratios) > 4 && $ratios[4]) { $this->_ratio = (int) $ratios[4]; } if (count($ratios) == 6) { $this->_strategy = $ratios[5]; } $mode = preg_replace($searchPattern, '\\1\\2\\3', $mode); parent::__construct($mode); }
/** * @dataProvider onlyBModesDataProvider * @param string $mode */ public function testIsBinary($mode) { $streamMode = new Magento_Filesystem_Stream_Mode($mode); $this->assertTrue($streamMode->isBinary()); }