/** * @covers ::getID */ public function test_getID() { $this->Container['foo'] = 1; $this->Container['bar'] = 1; $this->Container['test'] = 'test'; $this->Container['element'] = new \DOMElement('span', 'test'); $this->Container['resource'] = stream_context_create(array('http' => array('method' => "GET", 'header' => "Accept-language: en\r\n" . "Cookie: foo=bar\r\n"))); $this->assertEquals('6067805dec5a61fab70ae6011c942cdb', strval($this->Container->getID()), 'IContainer::getID() returned an invalid value'); }
/** * Add inline attachment to message. * * @throws \BLW\Model\FileException If <code>$File</code> cannot be read. * * @param \BLW\Type\IFile $File * File to attatch. * @return string UniqueID of attachment. */ public function inlineAttachment(IFile $File) { // Is file readable? if (!$File->isReadable()) { // Try to open file try { $File->openFile(); } catch (FileException $e) { throw new FileException(strval($File), null, $e->getCode(), $e); } } // Generate unique id $File->UniqueID = uniqid(); // Add attachment $this->_InlineAttachments->append($File); // Done return "@{$File->UniqueID}"; }
/** * Add to email address. * * @param \BLW\Type\IEmailAddress $EmailAddress * Address to add. * @return integer Returns a <code>IDataMapper</code> status code. */ public function addBCC(IEmailAddress $EmailAddress) { // Is address valid? if ($EmailAddress->isValid()) { // Add email address $this->_BCC->append($EmailAddress); // Done return IDataMapper::UPDATED; } // Done return IDataMapper::INVALID; }
/** * Adds a page to history. * * <h4>Note</h4> * * <p>If history is full, oldest value is removed to make space * for new entry.</p> * * <hr> * * @param \BLW\Type\HTTP\Browser\IPage $Page * Page to add. * @return integer Returns a <code>DataMapper</code> status code. */ public function addHistory($Page) { // Is $Page a real page? if ($Page instanceof IPage) { // Reindex $History = iterator_to_array($this->_History); $Length = min($this->_MaxHistory - 1, $this->_Current + 1); // Begining or array up to Current position or (Maxlength - 1) $Start = max(0, $this->_Current + 2 - $this->_MaxHistory); // Current posistion stepped back (Maxlength - 1) spaces $History = array_slice($History, $Start, $Length, false); // Add to history $History[] = $Page; // Update $this->_History->exchangeArray($History); $this->_Current = count($this->_History) - 1; // Done return IDataMapper::UPDATED; // Invalid } else { return IDataMapper::INVALID; } }