protected function generatePhpClass($iconSet)
    {
        $phpClass     = file_get_contents($this->assetDir . '/class.Icon.tpl');
        $phpClassPath = $this->tmpDir . '/class.Icon.php';
        $constants    = '';
        $functions    = '';
        $patterns     = array('{CONSTANTS}', '{FUNCTIONS}', '{DATE}', '{DO_NOT_EDIT}');

        foreach ($iconSet as $iconProperties) {
            $icon = $iconProperties->properties->name;
            // constants
            $constName = 'CLASS_' . strtoupper(str_replace('-', '_', $icon));
            // functions
            $iconFn = strtolower(trim($icon));
            $iconFn = str_replace(' ', '', ucwords(preg_replace('~[\W_-]+~', ' ', $iconFn)));
            $functions .= '    public static function icon' . $iconFn . '($options=array()){' . "\n"
                . '        return self::buildIcon(self::' . $constName . ', $options);' . "\n" . '    }' . "\n\n";

            $constants .= '    const ' . $constName . ' = \'icon-' . $icon . '\';' . "\n";
        }

        $phpClass = str_replace(
            $patterns,
            array($constants, $functions, date('Y-m-d H:i:s'), $this->doNotEdit),
            $phpClass
        );

        file_put_contents($phpClassPath, $phpClass);

        ob_start();
        system('php -l ' . $phpClassPath);
        $parseResult = ob_get_clean();

        if (false === strpos($parseResult, 'No syntax errors detected')) {
            $parseResult = strtok($parseResult, PHP_EOL);
            return array('error' => $parseResult);
        }

        return $phpClassPath;
    }