Browse Source

fix fileSize method, update protocol validation

main 1.0.2
ghost 9 months ago
parent
commit
17c7dbd014
  1. 10
      src/Reader.php

10
src/Reader.php

@ -6,6 +6,8 @@ namespace ClitorIsProtocol\Kevacoin;
class Reader class Reader
{ {
private int $_protocol = 1;
private array $_errors = []; private array $_errors = [];
private array $_meta = []; private array $_meta = [];
@ -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…
Cancel
Save