Created base files for value types.

This commit is contained in:
Alex Tselegidis 2016-07-09 10:05:33 +02:00
parent a1011a67eb
commit 1a651fc718
7 changed files with 137 additions and 0 deletions

18
src/engine/Types/Bool.php Normal file
View 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 {
}

View 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 {
}

View file

18
src/engine/Types/Int.php Normal file
View 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 {
}

View 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
View 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();
}

View 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 {
}