forked from mirrors/easyappointments
Created base files for value types.
This commit is contained in:
parent
a1011a67eb
commit
1a651fc718
7 changed files with 137 additions and 0 deletions
18
src/engine/Types/Bool.php
Normal file
18
src/engine/Types/Bool.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Open Source Web Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) 2013 - 2016, Alex Tselegidis
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link http://easyappointments.org
|
||||||
|
* @since v1.2.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
namespace \EA\Engine\Types;
|
||||||
|
|
||||||
|
class Bool extends Type {
|
||||||
|
|
||||||
|
}
|
18
src/engine/Types/Double.php
Normal file
18
src/engine/Types/Double.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Open Source Web Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) 2013 - 2016, Alex Tselegidis
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link http://easyappointments.org
|
||||||
|
* @since v1.2.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
namespace \EA\Engine\Types;
|
||||||
|
|
||||||
|
class Double extends Type {
|
||||||
|
|
||||||
|
}
|
0
src/engine/Types/Email.php
Normal file
0
src/engine/Types/Email.php
Normal file
18
src/engine/Types/Int.php
Normal file
18
src/engine/Types/Int.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Open Source Web Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) 2013 - 2016, Alex Tselegidis
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link http://easyappointments.org
|
||||||
|
* @since v1.2.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
namespace \EA\Engine\Types;
|
||||||
|
|
||||||
|
class Int extends Type {
|
||||||
|
|
||||||
|
}
|
18
src/engine/Types/String.php
Normal file
18
src/engine/Types/String.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Open Source Web Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) 2013 - 2016, Alex Tselegidis
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link http://easyappointments.org
|
||||||
|
* @since v1.2.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
namespace \EA\Engine\Types;
|
||||||
|
|
||||||
|
class String extends Type {
|
||||||
|
|
||||||
|
}
|
47
src/engine/Types/Type.php
Normal file
47
src/engine/Types/Type.php
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Open Source Web Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) 2013 - 2016, Alex Tselegidis
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link http://easyappointments.org
|
||||||
|
* @since v1.2.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
namespace \EA\Engine\Types;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract Type Class
|
||||||
|
*
|
||||||
|
* This class needs to be extended by the type classes which must implement the validation logic.
|
||||||
|
*/
|
||||||
|
abstract class Type {
|
||||||
|
/**
|
||||||
|
* Class Constructor
|
||||||
|
*
|
||||||
|
* @param mixed $value The type value to be validated.
|
||||||
|
*/
|
||||||
|
public function __construct($value) {
|
||||||
|
$this->_validate($value);
|
||||||
|
$this->value = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type value.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get() {
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implement the validation logic in the children classes.
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException If the validation fails.
|
||||||
|
*/
|
||||||
|
abstract protected function _validate();
|
||||||
|
}
|
18
src/engine/Types/UnsignedInt.php
Normal file
18
src/engine/Types/UnsignedInt.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Open Source Web Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) 2013 - 2016, Alex Tselegidis
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link http://easyappointments.org
|
||||||
|
* @since v1.2.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
namespace \EA\Engine\Types;
|
||||||
|
|
||||||
|
class UnsignedInt extends Int {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue