Пример #1
0
 public function store(Row $row)
 {
     if (null === $row->getRowNumber()) {
         throw new \InvalidArgumentException("Can't cache rows without a number");
     }
     $this->checkSize();
     $this->cache[$row->getRowNumber()] = $row;
     return $this;
 }
Пример #2
0
 /**
  * Remove a row from the dataset
  * 
  * @param \ChartBlocks\DataSet\Row|int $numberOrRow
  * @return boolean
  */
 public function removeRow($numberOrRow)
 {
     if ($numberOrRow instanceof Row) {
         $id = $numberOrRow->getRowNumber();
     } elseif (Row::isValidNumber($numberOrRow)) {
         $id = $numberOrRow;
     } else {
         throw new \InvalidArgumentException('Invalid row identifier');
     }
     $putData = array('method' => 'shiftRow', 'index' => $id - 1, 'amount' => 1);
     $setId = $this->getDataSet()->id;
     $result = $this->getClient()->put('data/alter/' . $setId, $putData);
     return isset($result['success']) && $result['success'];
 }
Пример #3
0
 /**
  * 
  * @param int
  * @return \ChartBlocks\DataSet\Row
  */
 public function setRowNumber($row)
 {
     if ($row !== null && false === Row::isValidNumber($row)) {
         throw new \InvalidArgumentException('Invalid row number');
     }
     $this->rowNumber = $row === null ? null : (int) $row;
     return $this;
 }