diff --git a/src/engine/Types/Bool.php b/src/engine/Types/Bool.php new file mode 100644 index 00000000..baa628b3 --- /dev/null +++ b/src/engine/Types/Bool.php @@ -0,0 +1,18 @@ + + * @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 { + +} diff --git a/src/engine/Types/Double.php b/src/engine/Types/Double.php new file mode 100644 index 00000000..30d29ebc --- /dev/null +++ b/src/engine/Types/Double.php @@ -0,0 +1,18 @@ + + * @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 { + +} diff --git a/src/engine/Types/Email.php b/src/engine/Types/Email.php new file mode 100644 index 00000000..e69de29b diff --git a/src/engine/Types/Int.php b/src/engine/Types/Int.php new file mode 100644 index 00000000..b3bf8557 --- /dev/null +++ b/src/engine/Types/Int.php @@ -0,0 +1,18 @@ + + * @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 { + +} diff --git a/src/engine/Types/String.php b/src/engine/Types/String.php new file mode 100644 index 00000000..7fddb205 --- /dev/null +++ b/src/engine/Types/String.php @@ -0,0 +1,18 @@ + + * @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 { + +} diff --git a/src/engine/Types/Type.php b/src/engine/Types/Type.php new file mode 100644 index 00000000..343857ca --- /dev/null +++ b/src/engine/Types/Type.php @@ -0,0 +1,47 @@ + + * @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(); +} diff --git a/src/engine/Types/UnsignedInt.php b/src/engine/Types/UnsignedInt.php new file mode 100644 index 00000000..e55b3fea --- /dev/null +++ b/src/engine/Types/UnsignedInt.php @@ -0,0 +1,18 @@ + + * @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 { + +}