Refactor format actions
This commit is contained in:
		@@ -4,21 +4,14 @@ declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace Homepage\HtmlPrettierBundle;
 | 
			
		||||
 | 
			
		||||
use Generator;
 | 
			
		||||
use Sculpin\Core\Event\SourceSetEvent;
 | 
			
		||||
use Sculpin\Core\Sculpin;
 | 
			
		||||
use Sculpin\Core\Source\SourceInterface;
 | 
			
		||||
use Sculpin\Core\Source\SourceSet;
 | 
			
		||||
 | 
			
		||||
use function strlen;
 | 
			
		||||
 | 
			
		||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 | 
			
		||||
 | 
			
		||||
class HtmlPrettier implements EventSubscriberInterface
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public static function getSubscribedEvents(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
@@ -47,7 +40,7 @@ class HtmlPrettier implements EventSubscriberInterface
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function filterSource(SourceSet $sourceSet): Generator
 | 
			
		||||
    private function filterSource(SourceSet $sourceSet): \Generator
 | 
			
		||||
    {
 | 
			
		||||
        /** @var SourceInterface $source */
 | 
			
		||||
        foreach ($sourceSet->allSources() as $source) {
 | 
			
		||||
@@ -65,7 +58,7 @@ class HtmlPrettier implements EventSubscriberInterface
 | 
			
		||||
 | 
			
		||||
    private function endsWith($haystack, $needle): bool
 | 
			
		||||
    {
 | 
			
		||||
        $length = strlen($needle);
 | 
			
		||||
        $length = \strlen($needle);
 | 
			
		||||
 | 
			
		||||
        return $length === 0 || (substr($haystack, -$length) === $needle);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user