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