mirror of
https://github.com/clitor-is-protocol/kevacoin-php.git
synced 2025-02-10 22:14:17 +00:00
fix fileSize method, update protocol validation
This commit is contained in:
parent
80d4dc22e4
commit
17c7dbd014
@ -6,8 +6,10 @@ namespace ClitorIsProtocol\Kevacoin;
|
|||||||
|
|
||||||
class Reader
|
class Reader
|
||||||
{
|
{
|
||||||
private array $_errors = [];
|
private int $_protocol = 1;
|
||||||
private array $_meta = [];
|
|
||||||
|
private array $_errors = [];
|
||||||
|
private array $_meta = [];
|
||||||
|
|
||||||
public function __construct(string $value)
|
public function __construct(string $value)
|
||||||
{
|
{
|
||||||
@ -19,7 +21,7 @@ class Reader
|
|||||||
if // version valid
|
if // version valid
|
||||||
(!
|
(!
|
||||||
(
|
(
|
||||||
isset($meta['version']) && preg_match('/[\d]{2}\.[\d]{2}\.[\d]{2}/', $meta['version'])
|
isset($meta['version']) && preg_match(sprintf('/^%s\./', $this->_protocol), $meta['version'])
|
||||||
)
|
)
|
||||||
) $this->_errors[] = _('[_CLITOR_IS_] version not compatible');
|
) $this->_errors[] = _('[_CLITOR_IS_] version not compatible');
|
||||||
|
|
||||||
@ -127,10 +129,10 @@ class Reader
|
|||||||
return !empty($this->_meta['file']['mime']) ? $this->_meta['file']['mime'] : null;
|
return !empty($this->_meta['file']['mime']) ? $this->_meta['file']['mime'] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get File Length
|
// Get File Size
|
||||||
public function fileLength(): ?string
|
public function fileSize(): ?int
|
||||||
{
|
{
|
||||||
return !empty($this->_meta['file']['length']) ? $this->_meta['file']['length'] : null;
|
return !empty($this->_meta['file']['size']) ? $this->_meta['file']['size'] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get File Name
|
// Get File Name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user