| Conditions | 10 | 
| Paths | 11 | 
| Total Lines | 33 | 
| Code Lines | 22 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 1 | Features | 1 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 45 |     public function crawlUrls($eventObject) { | 
            ||
| 46 |         $helper = Mage::helper('turpentine/cron'); | 
            ||
| 47 |         if ($helper->getCrawlerEnabled()) { | 
            ||
| 48 | $maxRunTime = $helper->getAllowedRunTime();  | 
            ||
| 49 |             if ($maxRunTime === 0) { | 
            ||
| 50 | $maxRunTime = self::MAX_CRAWL_TIME;  | 
            ||
| 51 | }  | 
            ||
| 52 | |||
| 53 | $batchSize = $helper->getCrawlerBatchSize();  | 
            ||
| 54 | $timeout = $helper->getCrawlerWaitPeriod();  | 
            ||
| 55 | $crawlCount = 0;  | 
            ||
| 56 | |||
| 57 | // just in case we have a silly short max_execution_time  | 
            ||
| 58 | $maxRunTime = abs($maxRunTime - self::EXEC_TIME_BUFFER);  | 
            ||
| 59 | while (($helper->getRunTime() < $maxRunTime) &&  | 
            ||
| 60 |                     $url = $helper->getNextUrl()) { | 
            ||
| 61 |                 if ( ! $this->_crawlUrl($url)) { | 
            ||
| 62 |                     Mage::helper('turpentine/debug')->logWarn( | 
            ||
| 63 | 'Failed to crawl URL: %s', $url );  | 
            ||
| 64 | }  | 
            ||
| 65 | |||
| 66 | if ($crawlCount > 0  | 
            ||
| 67 | && $timeout > 0  | 
            ||
| 68 | && $batchSize > 0  | 
            ||
| 69 | && $crawlCount % $batchSize == 0  | 
            ||
| 70 |                 ) { | 
            ||
| 71 |                     Mage::helper('turpentine/debug')->logDebug('Crawled '.$crawlCount.' urls, sleeping for '.$timeout.' seconds'); | 
            ||
| 72 | sleep($timeout);  | 
            ||
| 73 | }  | 
            ||
| 74 | $crawlCount++;  | 
            ||
| 75 | }  | 
            ||
| 76 | }  | 
            ||
| 77 | }  | 
            ||
| 78 | |||
| 113 | 
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.