/** * @override * parses the pattern into a bind array. * @param Event $event the event to parse. * @return array the bind array for a database query. */ public function parse(Event $event) { //filter the events properties. $e = clone $event; $this->filterParams($e); $params = explode($this->delimiter, parent::parse($e)); $bind = array(); for ($i = 0; $i < count($params); $i++) { //replace the escaped_delimiter with the delimiter. $value = str_replace(self::ESCAPED_DELIMITER, $this->delimiter, $params[$i]); $bind[':' . $this->keys[$i]] = $value; } return $bind; }
/** * @override * attempts to parse the given event into a useable filename. This is obviously dependant * on the provided pattern on how useful this is. * @param Event $event the event that needs parsing. * @return string the event parsed into a useable filename. * @version 1.1 - now utilizes the new functionality of the 2.0 pattern parser. */ public function parse(Event $event) { if (!is_string($this->fileLocation) || strlen($this->fileLocation) == 0) { return ''; } //add additional information into the event. $e = clone $event; $info = pathinfo($this->fileLocation); if (!isset($info['extension'])) { return ''; } foreach ($info as $k => $v) { $e->{$k} = $v; } $e->{'format'} = $this->dateFormat; $value = parent::parse($e); return $this->sanitizeFileName($value); }