protected static function scanForListener($pathPackage,$remove = false) {
		
		// get listener list path
		$pathList = Config::getOption("configDir")."/listeners.json";
		
		// make sure listeners.json exists. if not create it
		if (!file_exists($pathList)) {
			file_put_contents($pathList, "{ \"listeners\": [ ] }");
		}
		
		// load listener list
		$listenerList = json_decode(file_get_contents($pathList),true);
		
		// set-up a finder to find the listener
		$finder = new Finder();
		$finder->files()->name('PatternLabListener.php')->in($pathPackage);
		
		// iterate over the returned objects
		foreach ($finder as $file) {
			
			// create the name
			$classes      = self::findClasses($file->getPathname());
			$listenerName = "\\".$classes[0];
			
			// check to see what we should do with the listener info
			if (!$remove && !in_array($listenerName,$listenerList["listeners"])) {
				$listenerList["listeners"][] = $listenerName;
			} else if ($remove && in_array($listenerName,$listenerList["listeners"])) {
				$key = array_search($listenerName, $listenerList["listeners"]);
				unset($listenerList["listeners"][$key]);
			}
			
			// write out the listener list
			file_put_contents($pathList,json_encode($listenerList));
			
		}
		
	}
protected static function scanForListener($pathPackage,$remove = false) {
		
		// get listener list path
		$pathList = Config::getOption("configDir")."/listeners.json";
		
		// make sure listeners.json exists. if not create it
		if (!file_exists($pathList)) {
			file_put_contents($pathList, "{ \"listeners\": [ ] }");
		}
		
		// load listener list
		$listenerList = json_decode(file_get_contents($pathList),true);
		
		// set-up a finder to find the listener
		$finder = new Finder();
		$finder->files()->name('PatternLabListener.php')->in($pathPackage);
		
		// iterate over the returned objects
		foreach ($finder as $file) {
			
			// create the name
			$classes      = self::findClasses($file->getPathname());
			$listenerName = "\\".$classes[0];
			
			// check to see what we should do with the listener info
			if (!$remove && !in_array($listenerName,$listenerList["listeners"])) {
				$listenerList["listeners"][] = $listenerName;
			} else if ($remove && in_array($listenerName,$listenerList["listeners"])) {
				$key = array_search($listenerName, $listenerList["listeners"]);
				unset($listenerList["listeners"][$key]);
			}
			
			// write out the listener list
			file_put_contents($pathList,json_encode($listenerList));
			
		}
		
	}
protected static function scanForListener ( $ pathPackage , $ remove = false ) { // get listener list path $ pathList = Config :: getOption ( "configDir" ) . "/listeners.json" ; // make sure listeners.json exists. if not create it if ( ! file_exists ( $ pathList ) ) { file_put_contents ( $ pathList , "{ \"listeners\": [ ] }" ) ; } // load listener list $ listenerList = json_decode ( file_get_contents ( $ pathList ) , true ) ; // set-up a finder to find the listener $ finder = new Finder ( ) ; $ finder -> files ( ) -> name ( 'PatternLabListener.php' ) -> in ( $ pathPackage ) ; // iterate over the returned objects foreach ( $ finder as $ file ) { // create the name $ classes = self :: findClasses ( $ file -> getPathname ( ) ) ; $ listenerName = "\\" . $ classes [ 0 ] ; // check to see what we should do with the listener info if ( ! $ remove && ! in_array ( $ listenerName , $ listenerList [ "listeners" ] ) ) { $ listenerList [ "listeners" ] [ ] = $ listenerName ; } else if ( $ remove && in_array ( $ listenerName , $ listenerList [ "listeners" ] ) ) { $ key = array_search ( $ listenerName , $ listenerList [ "listeners" ] ) ; unset ( $ listenerList [ "listeners" ] [ $ key ] ) ; } // write out the listener list file_put_contents ( $ pathList , json_encode ( $ listenerList ) ) ; } }
Scan the package for a listener
@param  {String}     the path for the package
Scan the package for a listener