<commit_before><?php

namespace ScssWatcher;

use \RecursiveDirectoryIterator;
use \RecursiveIteratorIterator;
use \RegexIterator;
use \SplFileInfo;

/**
 * Recursively monitors a directory for changed `.scss` files and generates `.css` versions
 * 
 * Usage (see `scripts/watch.php'):
 *      $watcher = new ScssWatcher($path);
 *      $watcher->run();
 * 
 * Defaults:
 *      style: `expanded` (can be changed via `$watcher->style`)
 *      flags: `--sourcemap` (can be changed via `$watcher->flags`)
 * 
 * @author <NAME>
 * @license http://opensource.org/licenses/MIT The MIT License (MIT)
 */
class ScssWatcher {
    
    /**
     * @var string The entry/root directory to monitor 
     */
    protected $entryPath = null;
    
    /**
     * @var int Modification timestamp of mixins or other system SCSS files with a leading `_`
     */
    protected $sysMod = 0;
    
    /**
     * @var int Oldest modification timestamp of all CSS files
     */
    protected $oldestMod = 0;
    
    /**
     * @var string Current error string returned by sass binary
     */
    protected $currentError = null;
    
    /**
     * @var int Interval in seconds for re-scanning the directory 
     */
    public $delay = 1;
    
    /**
     * @var string Path to sass binary 
     */
    public $sassBinary = '/usr/bin/sass';
    
    /**
     * @var string CSS formatting style
     */
    public $style = 'expanded';
    
    /**
     * @var string Additional sass binary flags 
     */
    public $flags = '--sourcemap';
    
    /**
     * Instantiates the class with a root/entry directory
     * @param string $entryPath Path to entry directory
     */
	public function __construct($entryPath) {
        $this->entryPath = $entryPath;
        $this->oldestMod = time();
        $this->sassBinary = $this->getBinPath() ?: $this->sassBinary;
	}
    
    /**
     * Returns the path to an installed sass binary
     * 
     * @return string Path to sass binary
     */
    protected function getBinPath()
    {
        return trim(shell_exec("which sass 2>&1"));
    }<commit_msg>Apply `realpath` to input path and provide basic information about watched directory<commit_after><?php

namespace ScssWatcher;

use \RecursiveDirectoryIterator;
use \RecursiveIteratorIterator;
use \RegexIterator;
use \SplFileInfo;

/**
 * Recursively monitors a directory for changed `.scss` files and generates `.css` versions
 * 
 * Usage (see `scripts/watch.php'):
 *      $watcher = new ScssWatcher($path);
 *      $watcher->run();
 * 
 * Defaults:
 *      style: `expanded` (can be changed via `$watcher->style`)
 *      flags: `--sourcemap` (can be changed via `$watcher->flags`)
 * 
 * @author <NAME>
 * @license http://opensource.org/licenses/MIT The MIT License (MIT)
 */
class ScssWatcher {
    
    /**
     * @var string The entry/root directory to monitor 
     */
    protected $entryPath = null;
    
    /**
     * @var int Modification timestamp of mixins or other system SCSS files with a leading `_`
     */
    protected $sysMod = 0;
    
    /**
     * @var int Oldest modification timestamp of all CSS files
     */
    protected $oldestMod = 0;
    
    /**
     * @var string Current error string returned by sass binary
     */
    protected $currentError = null;
    
    /**
     * @var int Interval in seconds for re-scanning the directory 
     */
    public $delay = 1;
    
    /**
     * @var string Path to sass binary 
     */
    public $sassBinary = '/usr/bin/sass';
    
    /**
     * @var string CSS formatting style
     */
    public $style = 'expanded';
    
    /**
     * @var string Additional sass binary flags 
     */
    public $flags = '--sourcemap';
    
    /**
     * Instantiates the class with a root/entry directory
     * @param string $entryPath Path to entry directory
     */
	public function __construct($entryPath) {
        $this->entryPath = realpath($entryPath);
        $this->oldestMod = time();
        $this->sassBinary = $this->getBinPath() ?: $this->sassBinary;
        echo "Watching '" . $this->entryPath . "' with subdirectories\n";
	}
    
    /**
     * Returns the path to an installed sass binary
     * 
     * @return string Path to sass binary
     */
    protected function getBinPath()
    {
        return trim(shell_exec("which sass 2>&1"));
    }
{'fraction_non_alphanumeric': 0.12085363024820227, 'fraction_numerical': 0.002319647413593134, 'mean_word_length': 2.314373558800922, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '795586', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1279, 'n_words': 394}