Serializes the parameter as php code
@param mixed $param
@return string Returns the php code representation of the parameter
@throws \InvalidArgumentException Raises an error if the parameter is neither a primitive type nor a writable class
494894
private function GetParamString($param)
    {
        if ($param === null)
            return "null";
        if (is_string($param))
            return "'" .  addcslashes($param, "'") . "'";
        
        else if (is_bool($param))
            return $param ? "true" : "false";
        
        else if (is_int($param) || is_float($param))
            return (string)$param;
        
        else if ($param instanceof WritableClass)
            return $param->GetNewStatement();
        
        else if (is_array($param))
        {
            $resultArr = array();
            foreach ($param as $key=>$val)
            {
                $resultArr[] = $this->GetParamString($key) . '=>' . $this->GetParamString($val);
            }
            return 'array(' . join (', ' , $resultArr) .')';
        }
        else if ($param instanceof \Phine\Framework\System\Enum)
        {
            $value = $param->Value();
            $class = get_class($param);
            return "\\$class::ByValue('$value')";
        }
        throw new \InvalidArgumentException('A writable class must have primitive types, Enums, arrays and PhpWritable classes as construct params only.');
    }
351316
public static function setParams(&$param)
    {
        $arr_req = array();
        foreach($param as $key=>$value){
            if(is_array($value)) {
                $arr_req[] = "${key}=".implode("&",$value);
            } else {
                if ($value == '') {
                    continue;
                }
                $arr_req[] = "${key}=${value}";
            }
        }
        $str = implode("&",$arr_req);

        return $str;
    }
817541
public static function castToArray($param)
    {
        if ($param instanceof \stdClass) {
            $param = (array) $param;

            return $param;
        }

        if ($param instanceof Arrayable) {
            return $param->toArray();
        }

        return $param;
    }
1129894
public static function input($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }

        $o = '<input ';
        $o .= (isset($params['type'])) ? " type='{$params['type']}'" : 'type="text"';
        $o .= (isset($params['id'])) ? " id='{$params['id']}'" : '';
        $o .= (isset($params['name'])) ? " name='{$params['name']}'" : '';
        $o .= (isset($params['class'])) ? " class='form-input text {$params['class']}'" : '';
        $o .= (isset($params['onclick'])) ? " onclick='{$params['onclick']}'" : '';
        $o .= (isset($params['onkeypress'])) ? " onkeypress='{$params['onkeypress']}'" : '';
        $o .= (isset($params['value'])) ? ' value="' . $params['value'] . '"' : '';
        $o .= (isset($params['length'])) ? " maxlength='{$params['length']}'" : '';
        $o .= (isset($params['width'])) ? " style='width:{$params['width']}px;'" : '';
        $o .= (isset($params['disabled'])) ? " disabled='{$params['disabled']}'" : '';
        $o .= (isset($params['placeholder'])) ? " placeholder='{$params['placeholder']}'" : '';
        $o .= (isset($params['accept'])) ? " accept='{$params['accept']}'" : '';
        $o .= (isset($params['maxlength'])) ? " maxlength='{$params['maxlength']}'" : '';
        $o .= (isset($params['minlength'])) ? " minlength='{$params['minlength']}'" : '';
        $o .= (isset($params['style'])) ? " style='{$params['style']}'" : '';
        $o .= (isset($params['required'])) ? " required='required'" : '';
        $o .= (isset($params['autocomplete'])) ? " autocomplete='{$params['autocomplete']}'" : '';
        $o .= (isset($params['autofocus'])) ? " autofocus" : '';
        $o .= " />\n";
        return $o;
    }
160066
protected function serializeParams(array $params)
    {
        $serialized = array();
        foreach ($params as $param) {
            $serialized[] = $this->serializer->serialize($param);
        }

        return $serialized;
    }
331326
public function prepareParam(array $param = null)
    {
        if (!$param) {
            return [];
        }
        $ret = [];

        foreach ($param as $key => $value) {
            if (is_array($value)) {
                $keyString = md5($key);
                foreach ($value as $subKey => $subValue) {
                    $ret[] =[':' . $keyString.$subKey , $subValue];
                }
            } else {
                $ret[] = [':' . md5($key), $value];
            }

        }

        return $ret;
    }
365455
public static function submit($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }

        $o = '<input type="submit"';
        $o .= (isset($params['id'])) ? " id='{$params['id']}'" : '';
        $o .= (isset($params['name'])) ? " name='{$params['name']}'" : '';
        $o .= (isset($params['class'])) ? " class='{$params['class']}'" : '';
        $o .= (isset($params['onclick'])) ? " onclick='{$params['onclick']}'" : '';
        $o .= (isset($params['value'])) ? " value='{$params['value']}'" : '';
        $o .= (isset($params['disabled'])) ? " disabled='{$params['disabled']}'" : '';
        $o .= (isset($params['style'])) ? " style='{$params['style']}'" : '';
        $o .= " />\n";
        return $o;
    }
1226412
public static function hidden($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }

        $o = '<input type="hidden"';
        $o .= (isset($params['id'])) ? " id='{$params['id']}'" : '';
        $o .= (isset($params['name'])) ? " name='{$params['name']}'" : '';
        $o .= (isset($params['class'])) ? " class='{$params['class']}'" : '';
        $o .= (isset($params['value'])) ? " value='{$params['value']}'" : '';
        $o .= " />\n";
        return $o;
    }
542053
public static function maker( $param, $param2 = null )
	{
		if ( !is_null( $param2 ) )
		{
			return static::create( $param, $param2 );
		}
		
		$param = explode( ' ', $param );
		
		$element = array_shift( $param );
		
		return static::create( $element, implode( ' ', $param ) );
	}
683337
public static function text($param = array())
    {

        $defParam = array(
            'amount' => 128,
            'what' => 'bytes',
            'start' => 'yes',
            'lang' => 'en'
        );

        if (is_integer($param)) {
            $param = array('amount' => $param);
        }

        $param = array_merge($defParam, $param);

        $json = Utils::getJSON('http://json-lipsum.appspot.com/?' . http_build_query($param));

        if (isset($json->lipsum) && strpos('--', $json->lipsum)) {
            return implode(' -- ', $json->lipsum);
        } elseif (isset($json->lipsum)) {
            return $json->lipsum;
        } else {
            return 'Error Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
        }

    }
315214
public static function getQueryString( &$param ){
        
        // Geocoding components parameter
        if( isset($param['components']) && is_array($param['components'])){
           $param['components'] = self::joinParam( $param['components'], ':', '|');
        }   
        ///
        
        // Direction parameters
        if( isset($param['origin']) && is_array($param['origin'])){
           $param['origin'] = self::joinParam( $param['origin'], '', ':', false );
        }   
        
        if( isset($param['destination']) && is_array($param['destination'])){
           $param['destination'] = self::joinParam( $param['destination'], '', ':', false );
        }      
        
        if( isset($param['waypoints']) && is_array($param['waypoints'])){
           $param['waypoints'] = self::joinParam( $param['waypoints'], '', '|', false );
        } 
        
        if( isset($param['avoid']) && is_array($param['avoid'])){
           $param['avoid'] = self::joinParam( $param['avoid'], '', '|', false );
        }     
        ///
        
        // Distance Matrix parameters
        if( isset($param['origins']) && is_array($param['origins'])){
           $param['origins'] = self::joinParam( $param['origins'], '', '|', false );
        }   
        
        if( isset($param['destinations']) && is_array($param['destinations'])){
           $param['destinations'] = self::joinParam( $param['destinations'], '', '|', false );
        }   
        
        if( isset($param['transit_mode']) && is_array($param['transit_mode'])){
           $param['transit_mode'] = self::joinParam( $param['transit_mode'], '', '|', false );
        } 
        ///
        
        // Elevation & Road parameters
        if( isset($param['locations']) && is_array($param['locations'])){
           $param['locations'] = self::joinParam( $param['locations'], '', '|', false );
        }   
        if( isset($param['path']) && is_array($param['path'])){
           $param['path'] = self::joinParam( $param['path'], '', '|', false );
        } 
        ///
        
        // Places & Time Zone parameters
        if( isset($param['location']) && is_array($param['location'])){
           $param['location'] = self::joinParam( $param['location'], '', ',', false );
        } 
        
        /**
        * Place Search
        * Deprecation notices: Premium data (Zagat), types parameter, id and reference fields
        * Restricts the results to places matching the specified type. 
        * Only one type may be specified (if more than one type is provided, all types following the first entry are ignored).
        */
        if( isset($param['types']) && is_array($param['types'])){
           #$param['types'] = self::joinParam( $param['types'], '', '|', false );
           $param['type'] = !empty( $param['types'][0] ) ? $param['types'][0] : "";
        }     
                     
        ///
                
        // reset to empty array 
        self::$urlParam = [];
        
        return  self::joinParam( $param );

    }
791939
public static function encode($num)
    {
        $str = '';
        while ($num > 0) {
            $str = self::ALPHABET[($num % self::BASE)] . $str;
            $num = (int)($num / self::BASE);
        }
        return $str;
    }
721530
public String getValue(String param) throws PHPException {
		PHPMethodDescriptor m = getMethod("parse"); 
		if (m != null) {
			LOGGER.debug("Use parse method for class " + this);
			return getClassName() + "::parse('" + param + "')";
		}
		String staticVar = staticVarList.get(param.toLowerCase());
		if (staticVar != null) {
			LOGGER.debug("Using static var : " + staticVar);
			return getClassName() + "::" + staticVar;
		}
		LOGGER.error(this + " : no method parse and no static var " + param);
		throw new NoConverterFoundException(this + " : no method parse and no static var " + param);
	}
819397
private static function formatParameters(array $params)
    {
        return '[' . implode(', ', array_map(static function ($param) {
            if (is_resource($param)) {
                return (string) $param;
            }

            $json = @json_encode($param);

            if (! is_string($json) || $json === 'null' && is_string($param)) {
                // JSON encoding failed, this is not a UTF-8 string.
                return sprintf('"%s"', preg_replace('/.{2}/', '\\x$0', bin2hex($param)));
            }

            return $json;
        }, $params)) . ']';
    }
1129567
public function getParam(string $param)
    {
        if (! empty($this->match['params'][$param])) {
            return $this->match['params'][$param];
        }
    }
817608
static public function encode($data)
	{
		if (is_array($data) || (is_object($data) && !method_exists($data, '_toString')))
		{
			throw new \InvalidArgumentException(__CLASS__ . ' can not handle an array or non-stringable object.');
		}

		return $data;
	}
1065496
private function paramVarsAlign($param, $previousParam)
	{
		$paramStringLength         = strlen($param['type']) + $param['type_space'];
		$previousParamStringLength = strlen($previousParam['type']) + $previousParam['type_space'];

		return $paramStringLength === $previousParamStringLength;
	}