/** * @param SecretTextInterface $secretText */ public function __construct(SecretTextInterface $secretText) { $this->data = $secretText->getBinaryData(); $this->itemSize = $secretText->getBinaryItemSize(); $this->maxIndex = strlen($this->data) - 1; }
/** * Decode stegoText * * @param ImageInterface $stegoText * @param SecretTextInterface $secretText * @return string */ public function decode(ImageInterface $stegoText, SecretTextInterface $secretText) { $secretText->setBinaryItemSize($this->channelsSize); $iterator = $this->getImageIterator($stegoText); $result = ''; do { // get lasts bits value of pixel accordingly confugurated channel $result .= $this->decodeItem($iterator, $stegoText); // move to next pixel $iterator->next(); } while ($secretText->getEndMarkPos($result) === false); return $secretText->getFromBinaryData($result); }