Skip to content

Instantly share code, notes, and snippets.

@mcjwsk
Last active April 26, 2016 13:54
Show Gist options
  • Save mcjwsk/ce4d6336c27136828d7c to your computer and use it in GitHub Desktop.
Save mcjwsk/ce4d6336c27136828d7c to your computer and use it in GitHub Desktop.
<?php
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__));
$invalidFiles = array();
foreach ($files as $file) {
if ($file->isLink() || $file->isDir()) {
continue;
}
$fileName = $file->getFilename();
if ($fileName == 'config.xml') {
if (strpos($file->getPathname(), DIRECTORY_SEPARATOR . '.idea' . DIRECTORY_SEPARATOR) !== false) {
continue;
}
$filePath = str_replace(__DIR__, '.', $file->getPathname());
$xml = simplexml_load_file($filePath);
foreach ($xml->xpath('//events') as $areaEvents) {
foreach ($areaEvents->children() as $event) {
$eventName = $event->getName();
if ($eventName != strtolower($eventName)) {
$invalidFiles[$filePath][] = $eventName;
}
}
}
}
}
echo '<pre>';
var_export($invalidFiles);
echo '</pre>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment