TrackManiaControl/core/Update/UpdateData.php

50 lines
1.2 KiB
PHP
Raw Normal View History

2014-02-10 22:54:49 +01:00
<?php
namespace ManiaControl\Update;
2014-02-10 22:54:49 +01:00
/**
* ManiaControl Update Data Model Class
2014-05-02 17:50:30 +02:00
*
* @author ManiaControl Team <mail@maniacontrol.com>
2019-01-05 21:02:24 +01:00
* @copyright 2014-2019 ManiaControl Team
2014-05-02 17:50:30 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
2014-02-10 22:54:49 +01:00
*/
class UpdateData {
/*
* Public properties
*/
public $version = null;
public $channel = null;
public $url = null;
public $releaseDate = null;
public $minDedicatedBuild = null;
/**
* Construct new update data instance
2014-05-02 17:50:30 +02:00
*
* @param object $updateData
*/
2014-02-10 22:54:49 +01:00
public function __construct($updateData) {
2014-05-02 17:50:30 +02:00
$this->version = $updateData->version;
$this->channel = $updateData->channel;
$this->url = $updateData->url;
$this->releaseDate = $updateData->release_date;
2014-04-14 14:38:00 +02:00
$this->minDedicatedBuild = $updateData->min_dedicated_build;
2014-02-10 22:54:49 +01:00
}
/**
* Check if the update data is newer than the given date
2014-05-02 17:50:30 +02:00
*
* @param string $compareDate
* @return bool
*/
public function isNewerThan($compareDate) {
if (!$compareDate) {
return true;
}
$compareTime = strtotime($compareDate);
$releaseTime = strtotime($this->releaseDate);
return ($releaseTime > $compareTime);
}
}