* given crawler instance.
*
* @param $stateName Name of the state
- * @param $crawlerInstance A Crawler class instance
* @return $stateInstance A Stateable class instance
*/
- public static final function createCrawlerStateInstanceByName ($stateName, Crawler $crawlerInstance) {
+ public static final function createCrawlerStateInstanceByName ($stateName) {
// Then construct the class' configuraton entry
$className = 'crawler_' . $stateName . '_state_class';
// Get a class from that configuration entry
- $stateInstance = self::createObjectByConfiguredName($className, array($crawlerInstance));
+ $stateInstance = self::createObjectByConfiguredName($className);
+
+ // Get crawler instance
+ $crawlerInstance = Registry::getRegistry()->getInstance('crawler');
// Debug message
self::createDebugInstance(__CLASS__)->debugOutput('CRAWLER-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Crawler state has changed from ' . $crawlerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');