#!/usr/bin/env php
<?php
require __DIR__.'/../vendor/autoload.php';

use wapmorgan\FileTypeDetector\Detector;

$class = new ReflectionClass('wapmorgan\FileTypeDetector\Detector');
$properties = $class->getDefaultProperties();

$all_formats = $properties['extensions'];
$all_types = $properties['types'];

// check for type relation
$formats_with_type = array();
foreach ($all_types as $type_formats)
	$formats_with_type = array_merge($formats_with_type, $type_formats);

$formats_without_type = array_diff($all_formats, $formats_with_type);
if (!empty($formats_without_type)) {
	echo '! There are formats without type:'.PHP_EOL.
	'- '.implode(PHP_EOL.'- ', $formats_without_type).PHP_EOL;
}

$formats_without_mimetype = array_diff($all_formats, array_keys($properties['mimeTypes']));
if (!empty($formats_without_mimetype)) {
	echo '! There are formats without mimetype:'.PHP_EOL.
	'- '.implode(PHP_EOL.'- ', $formats_without_mimetype).PHP_EOL;
}

$formats_without_signature = array_diff($all_formats, array_keys($properties['signatures']));
if (!empty($formats_without_signature)) {
	echo '! There are formats without signature:'.PHP_EOL.
	'- '.implode(PHP_EOL.'- ', $formats_without_signature).PHP_EOL;
}
