icingaweb2/modules/doc/library/Doc/MarkdownFileIterator.php
Eric Lippmann af33599e19 Add doc module (WIP)
refs #4820
2014-02-11 15:09:03 +01:00

28 lines
689 B
PHP

<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}
namespace Icinga\Module\Doc;
use \RecursiveFilterIterator;
class MarkdownFileIterator extends RecursiveFilterIterator
{
/**
* Accept files with .md suffix
*
* @return bool Whether the current element of the iterator is acceptable
* through this filter
*/
public function accept()
{
$current = $this->getInnerIterator()->current();
if (!$current->isFile()) {
return false;
}
$filename = $current->getFilename();
$sfx = substr($filename, -3);
return $sfx === false ? false : strtolower($sfx) === '.md';
}
}