public function testSetGetIncrement() { $le = new LogEntry('page'); $this->assertSame(1, $le->getIncrement()); $le->setIncrement(22.33); $this->assertSame(22.33, $le->getIncrement()); }
/** * Add a log to the buffer. * Note: the data is not saved until you call the save method. * * @param string $entity Entity name. * @param int $ref * @param int $increment * * @return LogEntry * @throws AnalyticsDbException */ public function log($entity, $ref = 0, $increment = 1) { if (!preg_match('/^([A-z0-9\\/\\-\\_]+)$/', $entity)) { throw new AnalyticsDbException('Entity name can only contain ([A-z0-9\\/\\-]).'); } if (!preg_match('/^([A-z0-9\\/\\-\\_]+)$/', $ref)) { throw new AnalyticsDbException('Entity referrer can only contain ([A-z0-9\\/\\-]).'); } $entry = new LogEntry($entity); $entry->setRef($ref); $entry->setIncrement($increment); $this->logBuffer->addEntry($entry); return $entry; }