コード例 #1
0
ファイル: RowTest.php プロジェクト: Vci/Libs
 /**
  * Complete
  */
 public function testIsValidLength()
 {
     // check for offset
     $this->assertTrue($this->object->isValidLength());
     // check for false offset
     $this->assertFalse($this->object1->isValidLength());
 }
コード例 #2
0
ファイル: Table.php プロジェクト: Vci/Libs
 /**
  * Implementation of ArrayAccess from the PHP SPL.
  *
  * @return (mixed) Whatever is at the offset. The return type is determined
  *  by the Vci_Dom_Table_Row::returnType attribute, and can be either a 
  *  DOMNode, or the text content of the DOMNode at the offset.
  * @author "David Hazel" <*****@*****.**>
  **/
 public function offsetGet($offset)
 {
     // check the offset
     if (!$this->offsetExists($offset)) {
         return NULL;
     }
     // determine the internal offset
     $offset = $this->getInternalOffset($offset);
     // generate the result
     $row = new Vci_Dom_Table_Row($this->rowNodeList->item($offset), $this->headers);
     // set the result type
     if ($this->returnType === Vci_Dom_Table_Row::RETURN_DOM) {
         $row->setReturnType(Vci_Dom_Table_Row::RETURN_DOM);
     } else {
         if ($this->returnType === Vci_Dom_Table_Row::RETURN_TEXT) {
             $row->setReturnType(Vci_Dom_Table_Row::RETURN_TEXT);
         } else {
             throw new Exception('Invalid return type! The value could not be returned.');
         }
     }
     // return the result
     return $row;
 }