コード例 #1
0
 /**
  * process a single cell
  *
  * Generic processing of a table cell. Well, this function
  * just ignores cells.
  *
  * This method may be overwritten by a subclass (ColumnFixture)
  *
  * @param PHPFIT_Parse $cell
  */
 public function doCell($cell)
 {
     $adapter = null;
     if (isset($this->columnBindings[$cell->count])) {
         $adapter = $this->columnBindings[$cell->count];
     }
     try {
         $text = $cell->text();
         // skip the rest if there is no adapter
         if ($adapter == null) {
             $this->ignore($cell);
             return;
         }
         // a column can be a value
         if ($adapter->field != null) {
             $adapter->set($adapter->parse($text));
             return;
         }
         // or a column can be method
         if ($adapter->method != null) {
             $this->checkCell($cell, $adapter);
             return;
         }
     } catch (Exception $e) {
         $this->exception($cell, $e);
     }
 }
コード例 #2
0
 /**
  * @param PHPFIT_Parse $cell
  * @param string/int $value
  */
 public function check($cell, $value)
 {
     if ($cell->text() == strval($value)) {
         $this->right($cell);
     } else {
         $this->wrong($cell, $value);
     }
 }
コード例 #3
0
 /**
  * place an error text into a cell
  *
  * @param PHPFIT_Parse $cell
  * @param string $message
  */
 public function error($cell, $message)
 {
     $cell->body = $cell->text() . ': ' . self::escape($message);
     $cell->addToTag(self::getCssProperty('error'));
     $this->counts->exceptions++;
 }