Skip to content

Commit

Permalink
Add instance method for parseCssFile
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksagona committed Nov 15, 2017
1 parent 9af7a70 commit 53cd2a4
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/Css.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit 53cd2a4

Please sign in to comment.