<commit_before><?php
/**
 * Created by Kunstmaan.
 * Date: 25/06/14
 * Time: 09:28
 */

namespace Kunstmaan\MediaBundle\Helper\File;

use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Type;

/**
 * SVGMimeTypeGuesser
 *
 * Simple Mime type guesser to detect SVG image files, it will test if the file is an XML file and return SVG mime type
 * if the XML contains a valid SVG namespace...
 *
 * @package Kunstmaan\MediaBundle\Helper\File
 */
class SVGMimeTypeGuesser implements MimeTypeGuesserInterface
{
    private $_MIMETYPE_NAMESPACES = array(
        'http://www.w3.org/2000/svg' => 'image/svg+xml'
    );

    /**
     * Returns whether this guesser is supported on the current OS
     *
     * @return bool
     */
    public static function isSupported()
    {
        return function_exists('DOMDocument') && class_exists('DOMXPath');
    }

    /**
     * {@inheritdoc}
     */
    public function guess($path)
    {
        if (!is_file($path)) {
            throw new FileNotFoundException($path);
        }<commit_msg>fix isSupported check<commit_after><?php
/**
 * Created by Kunstmaan.
 * Date: 25/06/14
 * Time: 09:28
 */

namespace Kunstmaan\MediaBundle\Helper\File;

use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Type;

/**
 * SVGMimeTypeGuesser
 *
 * Simple Mime type guesser to detect SVG image files, it will test if the file is an XML file and return SVG mime type
 * if the XML contains a valid SVG namespace...
 *
 * @package Kunstmaan\MediaBundle\Helper\File
 */
class SVGMimeTypeGuesser implements MimeTypeGuesserInterface
{
    private $_MIMETYPE_NAMESPACES = array(
        'http://www.w3.org/2000/svg' => 'image/svg+xml'
    );

    /**
     * Returns whether this guesser is supported on the current OS
     *
     * @return bool
     */
    public static function isSupported()
    {
        return class_exists('DOMDocument') && class_exists('DOMXPath');
    }

    /**
     * {@inheritdoc}
     */
    public function guess($path)
    {
        if (!is_file($path)) {
            throw new FileNotFoundException($path);
        }
{'fraction_non_alphanumeric': 0.10707456978967496, 'fraction_numerical': 0.011472275334608031, 'mean_word_length': 3.367278797996661, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3107268', 'n_tokens_mistral': 796, 'n_tokens_neox': 788, 'n_words': 186}