Location: PHPKode > scripts > XCS Parser > xcs-parser/examples/inherit.php
<?php
/**
 * Inheritance test/demo file for XcsParser class.
 */

error_reporting(E_ALL | E_STRICT);
include '../lib/XcsParser_class.php';

/**
 * XcsParser utillity class.
 * Class extends XcsParser base class and pre-sets some
 * settings. It also adds a convenience method, `process()`
 * in order to skip in-script method chaining.
 */
final class MyXcsParser extends XcsParser {
	/**
	 * Pre-set protected property.
	 */
	protected $commentsAreImportant = false;

	/**
	 * Pre-set protected property.
	 */
	protected $compressionLevel = XcsParser::COMPRESS_ALL;

	/**
	 * A convenience method.
	 */
	final public function process () {
		$this->parse();
		$this->compress();
		return $this->getCss();
	}
}

$css = file_get_contents('../etc/style.css');
$sp = new MyXcsParser($css);

echo $sp->process();
?>
Return current item: XCS Parser