public function insert($value) { $_value = $value; if (($len = strlen($this->_prefix)) > 0) { if (strpos($_value, $this->_prefix) !== 0) { throw new Tinebase_Exception_UnexpectedValue('prefix missing'); } $_value = substr($_value, $len); } $_value = ltrim($_value, '0'); $orgLen = strlen($_value); $trimLen = strlen($_value); if ($orgLen !== $trimLen) { if ($trimLen >= $this->_zerofill || $orgLen > $this->_zerofill) { throw new Tinebase_Exception_UnexpectedValue('improper format: to many leading zeros "' . $value . '"'); } if ($orgLen < $this->_zerofill) { throw new Tinebase_Exception_UnexpectedValue('improper format: not enough leading zeros "' . $value . '"'); } if (0 === $trimLen) { $_value = '0'; } } $intValue = intval($_value); if ($_value !== '' . $intValue) { throw new Tinebase_Exception_UnexpectedValue('improper format: wrong prefix or non digit found where none should be "' . $value . '"'); } return parent::insert($intValue); }