Formats the container options.

@param string $type
@param bool   $maxIfNull

@return string
506183
public function formatContainerOptions(string $type = 'css', bool $maxIfNull = false)
    {
        $options = '';
        $height = ($maxIfNull && !$this->height) ? '100%' : $this->height;
        $width = ($maxIfNull && !$this->width) ? '100%' : $this->width;

        switch ($type) {
            case 'css':
                $options .= " style='";
                (!$height) ?: $options .= "height: {$height}px !important;";
                (!$width) ?: $options .= "width: {$width}px !important;";
                $options .= "' ";
                break;
            case 'js':
                if ($height) {
                    if (is_int($height)) {
                        $options .= "height: {$height}, ";
                    } else {
                        $options .= "height: '{$height}', ";
                    }
                }
                if ($width) {
                    if (is_int($width)) {
                        $options .= "width: {$width}, ";
                    } else {
                        $options .= "width: '{$width}', ";
                    }
                }
                break;
            default:
                (!$height) ?: $options .= " height='{$this->height}' ";
                (!$this->width) ?: $options .= " width='{$this->width}' ";
        }

        return $options;
    }
335538
public function display($type = null) : string
    {
        if (is_null($type)) {
            $type = self::DISPLAY_SHORT;
        }

        if ($type == self::DISPLAY_DURATION) {
            $format = [];

            if ($this->hour) {
                $format[] = Unit::format($this->hour, 'duration/hour');
            }

            if ($this->minute) {
                $format[] = Unit::format($this->minute, 'duration/minute');
            }

            if ($this->second) {
                $format[] = Unit::format($this->second, 'duration/second');
            }

            return Misc::joinUnits($format, 'narrow');
        }

        return Calendar::formatTime($this->toMutable(), $type);
    }
929515
public function type($type=null)
    {
        if (isset($type)) {
            $this->data['type'] = $type;
            return $this;
        }
        
        return isset($this->data['type']) ? $this->data['type'] : 'select';
    }
713983
public function getStatement($type = null)
    {
        
        // $this->buffer = array();
        // $this->next = false;

        $sql = "SELECT * FROM [{$this->collection->getName()}]";

        $wheres = array();
        $data = array();

        foreach ($this->criteria as $key => $value) {
            $wheres[] = $a= $this->connection->getDialect()->grammarExpression(
                $key,
                $value,
                $this->collection,
                $data
            );
        }

        if (!empty($wheres)) {
            $sql .= ' WHERE '.implode(' AND ', $wheres);
        }

        if (isset($this->sorts)) {
            $sorts = array();

            foreach ($this->sorts as $key => $value) {
                if ($value == 1) {
                    $op = ' ASC';
                } else {
                    $op = ' DESC';
                }

                $sorts[] = $key.$op;
            }

            if (!empty($sorts)) {
                $sql .= ' ORDER BY '.implode(',', $sorts);
            }
        }else{
            $sql .= ' ORDER BY ID';

        }

        if (isset($this->limit) || isset($this->skip)) {
            $sql .= ' OFFSET '.($this->skip ?: 0).' ROWS FETCH NEXT '. ($this->limit ?: -1) .' ROWS ONLY';
            // $sql .= ' LIMIT '.($this->limit ?: -1).' OFFSET '.($this->skip ?: 0);
        }

        $query = $this->connection->prepare($sql,$data);
        
        $statement = mssql_query($query);    

        $this->rows = array();

        while ($row  = mssql_fetch_assoc($statement)) {
            $this->rows[] = $row;
        }
        

        mssql_free_result($statement);
        
        $this->index = -1;

        
    }
524837
private function mapFormat($type)
    {
        switch ($type) {
            case IMAGETYPE_BMP:
                return 'BMP';
            case IMAGETYPE_COUNT:
                return 'COUNT';
            case IMAGETYPE_GIF:
                return 'GIF';
            case IMAGETYPE_ICO:
                return 'ICO';
            case IMAGETYPE_IFF:
                return 'IFF';
            case IMAGETYPE_JB2:
                return 'JB2';
            case IMAGETYPE_JP2:
                return 'JP2';
            case IMAGETYPE_JPC:
                return 'JPC';
            case IMAGETYPE_JPEG:
                return 'JPEG';
            case IMAGETYPE_JPEG2000:
                return 'JPEG2000';
            case IMAGETYPE_JPX:
                return 'JPX';
            case IMAGETYPE_PNG:
                return 'PNG';
            case IMAGETYPE_PSD:
                return 'PSD';
            case IMAGETYPE_SWC:
                return 'SWC';
            case IMAGETYPE_SWF:
                return 'SWF';
            case IMAGETYPE_TIFF_II:
                return 'TIFF_II';
            case IMAGETYPE_TIFF_MM:
                return 'TIFF_MM';
            case IMAGETYPE_WBMP:
                return 'WBMP';
            case IMAGETYPE_XBM:
                return 'XBM';
            case IMAGETYPE_UNKNOWN:
            default:
                return 'UNKNOWN';
        }
    }
556051
public function toPhpSupportedScalar(string $type): string
    {
        if ($this->isPhpScalarType($type)) {
            return $type;
        }

        if ($type === 'short') {
            return 'float';
        }
        if ($type === 'double') {
            return 'float';
        }
        if ($type === 'boolean') {
            return 'bool';
        }

        return $type;
    }
1052063
public function formatOptions(bool $strict = false, bool $noBraces = false)
    {
        if (!$strict && count($this->options) === 0) {
            return '';
        }

        $options = Encoder::encode($this->options);

        return $noBraces ? substr($options, 1, -1) : $options;
    }
409713
public static function normalize($type)
    {
        if (preg_match('/^\[?([\\\\\w]*)!?\]?!?$/', $type, $matches)) {
            $type = $matches[1];
        }

        switch ($type) {
            case 'bool':
            case 'boolean':
                $type = Types::BOOLEAN;
                break;
            case 'decimal':
            case 'float':
                $type = Types::FLOAT;
                break;
            case 'int':
            case 'integer':
                $type = Types::INT;
                break;
            case 'string':
                $type = Types::STRING;
                break;
            case 'id':
                $type = Types::ID;
                break;
            case 'datetime':
            case 'date_time':
                $type = Types::DATETIME;
                break;
            case 'date':
                $type = Types::DATE;
                break;
            case 'time':
                $type = Types::TIME;
                break;
            case 'any':
                $type = Types::ANY;
                break;
            case 'dynamic':
            case 'dynamicObject':
            case 'dynamic_object':
                $type = Types::DYNAMIC_OBJECT;
                break;
        }

        return Inflector::classify($type);
    }
224464
public static function typeBytes($type, $type_len)
    {
        $optional_int = "";

        if ($type_len < 15) {
            $type .= sprintf("%x", $type_len);
        } else {
            $type .= "f";
            $optional_int = self::intBytes($type_len);
        }

        return pack("H*", $type).$optional_int;
    }
154988
protected function _format($type) {
        $response = array(
            'success' => $this->_success,
            'data' => $this->_data
        );

        if ($this->_code) {
            $response['code'] = $this->_code;
        }

        switch (strtolower($type)) {
            case 'json':
                $format = TypeConverter::toJson($response);
            break;
            case 'xml':
                $format = TypeConverter::toXml($response);
            break;
            case 'html';
            case 'text':
            default:
                $format = (string) $this->_data;
            break;
        }

        return $format;
    }
654757
protected function generateURI(string $type, array $options): string
    {
        $label = $this->getLabel();
        Assertion::string($label, 'The label is not set.');
        Assertion::false($this->hasColon($label), 'Label must not contain a colon.');
        $options = array_merge($options, $this->getParameters());
        $this->filterOptions($options);
        $params = str_replace(['+', '%7E'], ['%20', '~'], http_build_query($options));

        return sprintf('otpauth://%s/%s?%s', $type, rawurlencode((null !== $this->getIssuer() ? $this->getIssuer().':' : '').$label), $params);
    }
236194
public static function formatFileType($data, $type=true, $separator=',') 
	{
		if($type == true) {
			$result = array_map("trim", explode($separator, $data));
		} else {
			$result = implode($separator.' ', $data);
		}
		return $result;	
	}
1091384
public function buildField($type, $label, $field, $injects)
    {
        $format = $this->orderFormat['default'];
        if (isset($this->orderFormat[$type])) {
            $format = $this->orderFormat[$type];
        }

        $output = '';

        foreach ($format as $item) {
            if ($item == 'label') {
                $output .= $label;
            } elseif ($item == 'field') {
                $output .= $field;
            } elseif (isset($injects[$item])) {
                $output .= $injects[$item];
            }
        }

        return $output;
    }
30791
public function setType($type)
    {
        if ($this->type() === $type) {
            return $type;
        }

        // Catch any API Request Exceptions here
        // so we can replace exception message
        // with more informative one.

        try {
            $this->setMeta(['Type' => $type]);
        } catch (ApiRequestFailedException $e) {
            throw new ApiRequestFailedException('Unable to set container type to "'.$type.'".', $e->getCode());
        }

        return $this->data['type'] = $type;
    }
528391
public function export( $data = null, $type = null, $delimiter = null ) {

		if ( ! empty( $data ) ) {
			$this->set_data( $data );
		}

		if ( ! empty( $type ) && in_array( $type, $this->types, true ) ) {
			$this->type = $type;
		}

		if ( ! empty( $delimiter ) ) {
			$this->delimiter = $delimiter;
		}

		if ( method_exists( $this, "build_{$this->type}" ) ) {
			call_user_func( array( $this, 'build_' . $this->type ) );
		}

		return $this->built;
	}
1005192
private function append($type, Minifier $minifier)
    {
        switch ($type) {
            case 'js':
                $this->jsMinifiers[] = $minifier;
                break;

            case 'css':
                $this->cssMinifiers[] = $minifier;
                break;
        }
    }
1359496
public function getDefaultTypeSize($type)
    {
        $sizes = $this->getDefaultTypeSizes();

        return isset($sizes[strtolower($type)]) ? $sizes[strtolower($type)] : null;
    }