Run PHP-CS-FIXER to make sure

code is consisted with PSR-1 + PSR-2
This commit is contained in:
eldadfux committed 2019-09-06 20:04:26 +03:00
1 parent c9d3448571
commit 35680bbae9
37 files changed
+928 -753

No files matched your search

+3 -3
View File
@@ -6,18 +6,18 @@ use Utopia\Validator;
class File extends Validator
{
public function getDescription()
{
return 'File is not valid';
}
/**
* NOT MUCH RIGHT NOW
* NOT MUCH RIGHT NOW.
*
* TODO think what to do here, currently only used for parameter to be present in SDKs
*
* @param string $name
* @param string $name
*
* @return bool
*/
public function isValid($name)
+5 -5
View File
@@ -6,25 +6,25 @@ use Utopia\Validator;
class FileName extends Validator
{
public function getDescription()
{
return 'Filename is not valid';
}
/**
* The file name can only contain "a-z", "A-Z", "0-9" and "-" and not empty
* The file name can only contain "a-z", "A-Z", "0-9" and "-" and not empty.
*
* @param string $name
*
* @param string $name
* @return bool
*/
public function isValid($name)
{
if(empty($name)) {
if (empty($name)) {
return false;
}
if(!preg_match('/^[a-zA-Z0-9.]+$/', $name)) {
if (!preg_match('/^[a-zA-Z0-9.]+$/', $name)) {
return false;
}
+4 -3
View File
@@ -21,13 +21,14 @@ class FileSize extends Validator
public function getDescription()
{
return 'File size can\'t be bigger than ' . $this->max;
return 'File size can\'t be bigger than '.$this->max;
}
/**
* Finds whether a file size is smaller than required limit
* Finds whether a file size is smaller than required limit.
*
* @param int $fileSize
*
* @param int $fileSize
* @return bool
*/
public function isValid($fileSize)
+14 -11
View File
@@ -8,21 +8,21 @@ use Utopia\Validator;
class FileType extends Validator
{
/**
* File Types Constants
* File Types Constants.
*/
const FILE_TYPE_JPEG = 'jpeg';
const FILE_TYPE_GIF = 'gif';
const FILE_TYPE_PNG = 'png';
const FILE_TYPE_JPEG = 'jpeg';
const FILE_TYPE_GIF = 'gif';
const FILE_TYPE_PNG = 'png';
/**
* File Type Binaries
* File Type Binaries.
*
* @var array
*/
protected $types = array(
self::FILE_TYPE_JPEG => "\xFF\xD8\xFF",
self::FILE_TYPE_GIF => 'GIF',
self::FILE_TYPE_PNG => "\x89\x50\x4e\x47\x0d\x0a",
self::FILE_TYPE_JPEG => "\xFF\xD8\xFF",
self::FILE_TYPE_GIF => 'GIF',
self::FILE_TYPE_PNG => "\x89\x50\x4e\x47\x0d\x0a",
);
/**
@@ -31,7 +31,8 @@ class FileType extends Validator
protected $whiteList;
/**
* @param array $whiteList
* @param array $whiteList
*
* @throws Exception
*/
public function __construct(array $whiteList)
@@ -51,12 +52,14 @@ class FileType extends Validator
}
/**
* Is Valid
* Is Valid.
*
* Binary check to finds whether a file is of valid type
*
* @see http://stackoverflow.com/a/3313196
* @param string $path
*
* @param string $path
*
* @return bool
*/
public function isValid($path)