diff --git a/src/Css.php b/src/Css.php index 69d6353..9c8bf6c 100644 --- a/src/Css.php +++ b/src/Css.php @@ -108,17 +108,12 @@ public static function parseString($cssString) * Parse CSS from file * * @param string $cssFile - * @throws Exception * @return self */ public static function parseFile($cssFile) { - if (!file_exists($cssFile)) { - throw new Exception('Error: That file does not exist.'); - } - $css = new self(); - $css->parseCss(file_get_contents($cssFile)); + $css->parseCssFile($cssFile); return $css; } @@ -281,6 +276,21 @@ public function parseCss($cssString) return $this; } + /** + * Parse CSS string from file + * + * @param string $cssFile + * @throws Exception + * @return self + */ + public function parseCssFile($cssFile) + { + if (!file_exists($cssFile)) { + throw new Exception('Error: That file does not exist.'); + } + return $this->parseCss(file_get_contents($cssFile)); + } + /** * Method to render the selector CSS *