2014-02-10 22:54:49 +01:00
|
|
|
<?php
|
2014-04-12 12:14:37 +02:00
|
|
|
|
|
|
|
namespace ManiaControl\Update;
|
|
|
|
|
2014-02-10 22:54:49 +01:00
|
|
|
/**
|
2014-07-25 16:28:47 +02:00
|
|
|
* ManiaControl Update Data Model Class
|
2014-05-02 17:50:30 +02:00
|
|
|
*
|
|
|
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
2015-01-19 11:06:20 +01:00
|
|
|
* @copyright 2014-2015 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 {
|
2014-04-12 12:14:37 +02:00
|
|
|
/*
|
2014-07-25 16:28:47 +02:00
|
|
|
* Public properties
|
2014-04-12 12:14:37 +02:00
|
|
|
*/
|
2014-05-02 04:03:33 +02:00
|
|
|
public $version = null;
|
|
|
|
public $channel = null;
|
|
|
|
public $url = null;
|
|
|
|
public $releaseDate = null;
|
|
|
|
public $minDedicatedBuild = null;
|
|
|
|
|
2014-04-12 12:14:37 +02:00
|
|
|
/**
|
2014-07-25 16:28:47 +02:00
|
|
|
* Construct new update data instance
|
2014-05-02 17:50:30 +02:00
|
|
|
*
|
2014-05-02 04:03:33 +02:00
|
|
|
* @param object $updateData
|
2014-04-12 12:14:37 +02:00
|
|
|
*/
|
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
|
|
|
}
|
2014-05-02 04:03:33 +02:00
|
|
|
|
|
|
|
/**
|
2014-07-25 16:28:47 +02:00
|
|
|
* Check if the update data is newer than the given date
|
2014-05-02 17:50:30 +02:00
|
|
|
*
|
2014-05-02 04:03:33 +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);
|
|
|
|
}
|
2014-04-12 12:14:37 +02:00
|
|
|
}
|