Redaxscript\Head\Script::render PHP Method

render() public method

render the script
Since: 3.0.0
public render ( ) : string
return string
    public function render()
    {
        $output = null;
        /* html elements */
        $scriptElement = new Html\Element();
        $scriptElement->init('script');
        $collectionArray = self::$_collectionArray[self::$_namespace];
        $collectionKeys = array_keys($collectionArray);
        $lastKey = end($collectionKeys);
        /* process collection */
        foreach ($collectionArray as $key => $value) {
            $output .= $scriptElement->copy()->attr($value);
            if ($key !== $lastKey || self::$_inline) {
                $output .= PHP_EOL;
            }
        }
        /* collect inline */
        if (self::$_inline) {
            $output .= $scriptElement->copy()->text(self::$_inline);
        }
        $this->clear();
        return $output;
    }