1 <?php
2
3 /* --------------------------------------------------------------
4 NonEmptyStringType.inc.php 2015-11-19
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2015 Gambio GmbH
8 Released under the GNU General Public License (Version 2)
9 [http://www.gnu.org/licenses/gpl-2.0.html]
10 --------------------------------------------------------------
11 */
12
13 /**
14 * Class NonEmptyStringType
15 *
16 * Shared string type class. Use the "asString" method for getting the plain value.
17 *
18 * Notice: The constructor value must not be empty!
19 *
20 * @category System
21 * @package Shared
22 * @subpackage Types
23 */
24 class NonEmptyStringType extends StringType
25 {
26 /**
27 * Class Constructor
28 *
29 * @param string $p_value Must not be empty.
30 *
31 * @throws InvalidArgumentException
32 */
33 public function __construct($p_value)
34 {
35 parent::__construct($p_value);
36
37 if(empty($p_value))
38 {
39 throw new InvalidArgumentException('NonEmptyStringType: Invalid argument value given (expected non-empty '
40 . ' string got ' . gettype($p_value) . '): ' . $p_value);
41 }
42 }
43 }