Skip to content

Instantly share code, notes, and snippets.

@damiankloip
Last active February 18, 2016 13:56
Show Gist options
  • Save damiankloip/ac12f568924c69462279 to your computer and use it in GitHub Desktop.
Save damiankloip/ac12f568924c69462279 to your computer and use it in GitHub Desktop.
<?php
/**
* @file
* Contains \Drupal\Component\Discovery\YamlDirectoryIterator.
*/
namespace Drupal\Component\Discovery;
class YamlDirectoryIterator extends \FilterIterator {
/**
* YamlDirectoryIterator constructor.
*
* @param string $path
*/
public function __construct($path) {
$iterator = new \FileSystemIterator($path);
parent::__construct($iterator);
}
/**
* Implements \FilterIterator::accept().
*/
public function accept() {
/** @var \SplFileInfo $file_info */
$file_info = $this->getInnerIterator()->current();
return $file_info->isFile() && ($file_info->getExtension() === 'yml');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment