<commit_before><?php

/**********************************************************************
*        Huco 617.B2 (Winter 2014)
*        WeatherManager is an managerial class that builds a series
*        of web scrapers, instructs them to collect weather forecast 
*        data and inserts it all into a database.
**********************************************************************/

class Weather_WeatherManager {

	protected $scrapers = array();		//  collection of scrapers
	protected $path_to_scrapers;

	public function __construct() {
		$this->path_to_scrapers = $this->get_URL_up_a_directory() . 'Scraper';
		Utility_Logger::log('Starting run; loading scrapers from ' . $this->path_to_scrapers );
		$this->loadScraperFiles();
		$this->instantiateScrapers();
	}
        
	public function addScraper(Weather_WeatherScraper $scraper) {
		$this->scrapers[] = $scraper;
	}
	
	function get_URL_up_a_directory($url = __DIR__) {
		//	if URL ends in a slash, remove it to move up properly
		if ( substr( $url, strlen($url) - 1 ) ==  '/' ) $url = substr( $url, 0, strlen($url) - 1 );
		$last_slash = strripos( $url, '/' );
		$up = substr( $url, 0, $last_slash + 1 );
		$down = substr( $url, $last_slash + 1 );
		return $up;
	}
	
	public function instantiateScrapers() {
		$classes = array_filter( get_declared_classes(), array('Weather_WeatherManager', 'is_scraper') );
		foreach ($classes as $scraper) $this->scrapers[] = new $scraper($this);
	}
	
	//	Used as a callback function in instantiateScrapers()
	protected function is_scraper( $string ) {
		return (strpos($string, 'Scraper_') !== false);
	}
        
	public function loadScraperFiles() {<commit_msg>Removing path-to-scrapers from being written to logfile.<commit_after><?php

/**********************************************************************
*        Huco 617.B2 (Winter 2014)
*        WeatherManager is an managerial class that builds a series
*        of web scrapers, instructs them to collect weather forecast 
*        data and inserts it all into a database.
**********************************************************************/

class Weather_WeatherManager {

	protected $scrapers = array();		//  collection of scrapers
	protected $path_to_scrapers;

	public function __construct() {
		$this->path_to_scrapers = $this->get_URL_up_a_directory() . 'Scraper';
		Utility_Logger::log('Starting run.' );
		$this->loadScraperFiles();
		$this->instantiateScrapers();
	}
        
	public function addScraper(Weather_WeatherScraper $scraper) {
		$this->scrapers[] = $scraper;
	}
	
	function get_URL_up_a_directory($url = __DIR__) {
		//	if URL ends in a slash, remove it to move up properly
		if ( substr( $url, strlen($url) - 1 ) ==  '/' ) $url = substr( $url, 0, strlen($url) - 1 );
		$last_slash = strripos( $url, '/' );
		$up = substr( $url, 0, $last_slash + 1 );
		$down = substr( $url, $last_slash + 1 );
		return $up;
	}
	
	public function instantiateScrapers() {
		$classes = array_filter( get_declared_classes(), array('Weather_WeatherManager', 'is_scraper') );
		foreach ($classes as $scraper) $this->scrapers[] = new $scraper($this);
	}
	
	//	Used as a callback function in instantiateScrapers()
	protected function is_scraper( $string ) {
		return (strpos($string, 'Scraper_') !== false);
	}
        
	public function loadScraperFiles() {
{'fraction_non_alphanumeric': 0.2075301204819277, 'fraction_numerical': 0.008433734939759036, 'mean_word_length': 4.29665071770335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '2069388', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1050, 'n_words': 274}