mirror of
https://github.com/openvk/chandler.git
synced 2025-03-31 21:43:59 +03:00
Reformatting the Event class.
This commit is contained in:
parent
11e11add72
commit
f8cb0c50a4
2 changed files with 63 additions and 26 deletions
|
@ -1,37 +1,74 @@
|
|||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace Chandler\Eventing\Events;
|
||||
|
||||
/**
|
||||
* @package Chandler\Eventing\Events
|
||||
*/
|
||||
class Event
|
||||
{
|
||||
protected $data;
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $code;
|
||||
protected $time;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $pristine = true;
|
||||
|
||||
function __construct($data = "", float $code = 0)
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $time;
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getCode(): float
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getData(): string
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTime(): int
|
||||
{
|
||||
return $this->time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isTainted(): bool
|
||||
{
|
||||
return !$this->pristine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @param float $code
|
||||
*/
|
||||
public function __construct(string $data = "", float $code = 0.0)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->code = $code;
|
||||
$this->time = time();
|
||||
}
|
||||
|
||||
function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function getCode()
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
function getTime()
|
||||
{
|
||||
return $this->time;
|
||||
}
|
||||
|
||||
function isTainted()
|
||||
{
|
||||
return !$this->pristine;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<phpunit bootstrap="vendor/autoload.php" cacheResultFile="tests/cache/result.txt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd">
|
||||
<phpunit bootstrap="vendor/autoload.php" cacheResultFile="tests/cache/result.json" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd">
|
||||
<coverage cacheDirectory="tests/cache" processUncoveredFiles="true">
|
||||
<include>
|
||||
<file>chandler/Eventing/Events/Event.php</file>
|
||||
|
|
Loading…
Reference in a new issue