public function getBinary()
    {
        /** @noinspection IsEmptyFunctionUsageInspection */
        if (empty($this->getData('binary'))) {
            
            $attachmentBinary = file_get_contents(
                $this->getFilePath()
            );            

            $this->setData(
                'binary',
                $attachmentBinary
            );
        }

        return $this->getData('binary');
    }
public function getBinary()
    {
        /** @noinspection IsEmptyFunctionUsageInspection */
        if (empty($this->getData('binary'))) {
            
            $attachmentBinary = file_get_contents(
                $this->getFilePath()
            );            

            $this->setData(
                'binary',
                $attachmentBinary
            );
        }

        return $this->getData('binary');
    }
public function getBinary ( ) { /** @noinspection IsEmptyFunctionUsageInspection */ if ( empty ( $ this -> getData ( 'binary' ) ) ) { $ attachmentBinary = file_get_contents ( $ this -> getFilePath ( ) ) ; $ this -> setData ( 'binary' , $ attachmentBinary ) ; } return $ this -> getData ( 'binary' ) ; }
Returns binary data of a single attachment file

@return string binary data of attachment file
@throws \Magento\Framework\Exception\MailException
Returns binary data of a single attachment file