Swat/SwatUI.php
private function parseValue(
        $name,
        $value,
        $type,
        $translatable,
        SwatUIObject $object
    ) {
        switch ($type) {
            case 'string':
                return $this->translateValue($value, $translatable, $object);
            case 'boolean':
                return $value == 'true' ? true : false;
            case 'integer':
                return intval($value);
            case 'float':
                return floatval($value);
            case 'constant':
                return $this->parseConstantExpression($value, $object);
            case 'data':
                return $this->parseMapping($name, $value, $object);
            case 'date':
                return new SwatDate($value);
            case 'implicit-string':
                if ($value == 'false' || $value == 'true') {
                    trigger_error(
                        __CLASS__ .
                            ': Possible missing type="boolean" ' .
                            'attribute on property element',
                        E_USER_NOTICE
                    );
                }

                if (is_numeric($value)) {
                    trigger_error(
                        __CLASS__ .
                            ': Possible missing type="integer" ' .
                            ' or type="float" attribute on property element',
                        E_USER_NOTICE
                    );
                }

                return $this->translateValue($value, $translatable, $object);
            default:
                throw new SwatInvalidPropertyTypeException(
                    "Property type '{$type}' is not a recognized type " .
                        'but is used in SwatML.',
                    0,
                    $object,
                    $type
                );
        }
    }
private function parseValue(
        $name,
        $value,
        $type,
        $translatable,
        SwatUIObject $object
    ) {
        switch ($type) {
            case 'string':
                return $this->translateValue($value, $translatable, $object);
            case 'boolean':
                return $value == 'true' ? true : false;
            case 'integer':
                return intval($value);
            case 'float':
                return floatval($value);
            case 'constant':
                return $this->parseConstantExpression($value, $object);
            case 'data':
                return $this->parseMapping($name, $value, $object);
            case 'date':
                return new SwatDate($value);
            case 'implicit-string':
                if ($value == 'false' || $value == 'true') {
                    trigger_error(
                        __CLASS__ .
                            ': Possible missing type="boolean" ' .
                            'attribute on property element',
                        E_USER_NOTICE
                    );
                }

                if (is_numeric($value)) {
                    trigger_error(
                        __CLASS__ .
                            ': Possible missing type="integer" ' .
                            ' or type="float" attribute on property element',
                        E_USER_NOTICE
                    );
                }

                return $this->translateValue($value, $translatable, $object);
            default:
                throw new SwatInvalidPropertyTypeException(
                    "Property type '{$type}' is not a recognized type " .
                        'but is used in SwatML.',
                    0,
                    $object,
                    $type
                );
        }
    }
private function parseValue ( $ name , $ value , $ type , $ translatable , SwatUIObject $ object ) { switch ( $ type ) { case 'string' : return $ this -> translateValue ( $ value , $ translatable , $ object ) ; case 'boolean' : return $ value == 'true' ? true : false ; case 'integer' : return intval ( $ value ) ; case 'float' : return floatval ( $ value ) ; case 'constant' : return $ this -> parseConstantExpression ( $ value , $ object ) ; case 'data' : return $ this -> parseMapping ( $ name , $ value , $ object ) ; case 'date' : return new SwatDate ( $ value ) ; case 'implicit-string' : if ( $ value == 'false' || $ value == 'true' ) { trigger_error ( __CLASS__ . ': Possible missing type="boolean" ' . 'attribute on property element' , E_USER_NOTICE ) ; } if ( is_numeric ( $ value ) ) { trigger_error ( __CLASS__ . ': Possible missing type="integer" ' . ' or type="float" attribute on property element' , E_USER_NOTICE ) ; } return $ this -> translateValue ( $ value , $ translatable , $ object ) ; default : throw new SwatInvalidPropertyTypeException ( "Property type '{$type}' is not a recognized type " . 'but is used in SwatML.' , 0 , $ object , $ type ) ; } }
Parses the value of a property

Also does error notification in the event of a missing or unknown type
attribute.

@param string $name the name of the property.
@param string $value the value of the property.
@param string $type the type of the value.
@param boolean translatable whether the property is translatable.
@param SwatUIObject $object the object the property applies to.

@return mixed the value of the property as an appropriate PHP datatype.

@throws SwatInvalidPropertyTypeException,
SwatInvalidConstantExpressionException,
SwatUndefinedConstantException
Parses the value of a property