| @@ 28-74 (lines=47) @@ | ||
| 25 | *  | 
                                |
| 26 | * @package AlgoWeb\xsdTypes  | 
                                |
| 27 | */  | 
                                |
| 28 | class xsLanguage extends xsToken  | 
                                |
| 29 | { | 
                                |
| 30 | /**  | 
                                |
| 31 | * Construct.  | 
                                |
| 32 | *  | 
                                |
| 33 | * @param string $value  | 
                                |
| 34 | */  | 
                                |
| 35 | public function __construct($value)  | 
                                |
| 36 |     { | 
                                |
| 37 | parent::__construct($value);  | 
                                |
| 38 | /*  | 
                                |
| 39 |          * Match a single character present in the list below [a-zA-Z]{1,8} | 
                                |
| 40 |          *     {1,8} Quantifier — Matches between 1 and 8 times, as many times as possible, giving back as needed | 
                                |
| 41 | * a-z a single character in the range between a (index 97) and z (index 122) (case sensitive)  | 
                                |
| 42 | * A-Z a single character in the range between A (index 65) and Z (index 90) (case sensitive)  | 
                                |
| 43 |          * 1st Capturing Group (-[a-zA-Z0-9]{1,8})* | 
                                |
| 44 | * Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed  | 
                                |
| 45 | * A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated  | 
                                |
| 46 | * group to capture all iterations or use a non-capturing group instead if you're not interested in the data  | 
                                |
| 47 | * - matches the character - literally (case sensitive)  | 
                                |
| 48 |          *      Match a single character present in the list below [a-zA-Z0-9]{1,8} | 
                                |
| 49 |          *      {1,8} Quantifier — Matches between 1 and 8 times, as many times as possible, giving back as needed | 
                                |
| 50 | * a-z a single character in the range between a (index 97) and z (index 122) (case sensitive)  | 
                                |
| 51 | * A-Z a single character in the range between A (index 65) and Z (index 90) (case sensitive)  | 
                                |
| 52 | * 0-9 a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)  | 
                                |
| 53 | */  | 
                                |
| 54 |         $this->setPatternFacet('[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*'); | 
                                |
| 55 |         $this->setWhiteSpaceFacet('collapse'); | 
                                |
| 56 | }  | 
                                |
| 57 | ||
| 58 | protected function fixValue()  | 
                                |
| 59 |     { | 
                                |
| 60 | parent::fixValue();  | 
                                |
| 61 | ||
| 62 | $this->value = trim($this->value);  | 
                                |
| 63 | }  | 
                                |
| 64 | ||
| 65 | protected function isOK()  | 
                                |
| 66 |     { | 
                                |
| 67 | parent::isOK();  | 
                                |
| 68 |         if (empty(trim($this->value))) { | 
                                |
| 69 | throw new \InvalidArgumentException(  | 
                                |
| 70 | 'The provided value for ' . __CLASS__ . ' must not be a blank string.'  | 
                                |
| 71 | );  | 
                                |
| 72 | }  | 
                                |
| 73 | }  | 
                                |
| 74 | }  | 
                                |
| 75 | ||
| @@ 30-59 (lines=30) @@ | ||
| 27 | *  | 
                                |
| 28 | * @package AlgoWeb\xsdTypes  | 
                                |
| 29 | */  | 
                                |
| 30 | class xsString extends xsAnySimpleType  | 
                                |
| 31 | { | 
                                |
| 32 | use LengthTrait;  | 
                                |
| 33 | ||
| 34 | /**  | 
                                |
| 35 | * Construct.  | 
                                |
| 36 | *  | 
                                |
| 37 | * @param string $value  | 
                                |
| 38 | */  | 
                                |
| 39 | public function __construct($value)  | 
                                |
| 40 |     { | 
                                |
| 41 | parent::__construct($value);  | 
                                |
| 42 |         $this->setWhiteSpaceFacet('preserve'); | 
                                |
| 43 | }  | 
                                |
| 44 | ||
| 45 | protected function fixValue()  | 
                                |
| 46 |     { | 
                                |
| 47 | parent::fixValue();  | 
                                |
| 48 | }  | 
                                |
| 49 | ||
| 50 | protected function isOK()  | 
                                |
| 51 |     { | 
                                |
| 52 | $this->checkLength($this->value);  | 
                                |
| 53 |         if (is_array($this->value) || is_object($this->value)) { | 
                                |
| 54 | throw new \InvalidArgumentException(  | 
                                |
| 55 | 'The provided value for ' . __CLASS__ . ' must not be an array or an object.'  | 
                                |
| 56 | );  | 
                                |
| 57 | }  | 
                                |
| 58 | }  | 
                                |
| 59 | }  | 
                                |
| 60 | ||