summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php')
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php30
1 files changed, 12 insertions, 18 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php
index 4612a8613..e4d08b527 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php
@@ -6,25 +6,22 @@ use DateTime;
use DateTimeZone;
/**
- * Date Parser
+ * Date Parser.
*
* @author Frederic Guillot
- * @package Parser
*/
class DateParser
{
/**
- * Timezone used to parse feed dates
+ * Timezone used to parse feed dates.
*
- * @access public
* @var string
*/
public $timezone = 'UTC';
/**
- * Supported formats [ 'format' => length ]
+ * Supported formats [ 'format' => length ].
*
- * @access public
* @var array
*/
public $formats = array(
@@ -56,10 +53,10 @@ class DateParser
);
/**
- * Try to parse all date format for broken feeds
+ * Try to parse all date format for broken feeds.
+ *
+ * @param string $value Original date format
*
- * @access public
- * @param string $value Original date format
* @return DateTime
*/
public function getDateTime($value)
@@ -67,7 +64,6 @@ class DateParser
$value = trim($value);
foreach ($this->formats as $format => $length) {
-
$truncated_value = $value;
if ($length !== null) {
$truncated_value = substr($truncated_value, 0, $length);
@@ -83,19 +79,18 @@ class DateParser
}
/**
- * Get a valid date from a given format
+ * Get a valid date from a given format.
*
- * @access public
- * @param string $format Date format
- * @param string $value Original date value
- * @return DateTime|boolean
+ * @param string $format Date format
+ * @param string $value Original date value
+ *
+ * @return DateTime|bool
*/
public function getValidDate($format, $value)
{
$date = DateTime::createFromFormat($format, $value, new DateTimeZone($this->timezone));
if ($date !== false) {
-
$errors = DateTime::getLastErrors();
if ($errors['error_count'] === 0 && $errors['warning_count'] === 0) {
@@ -107,9 +102,8 @@ class DateParser
}
/**
- * Get the current datetime
+ * Get the current datetime.
*
- * @access public
* @return DateTime
*/
public function getCurrentDateTime()