<commit_before><?php

/**
 * (c) FSi sp. z o.o. <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace FSi\DoctrineExtensions\Uploadable\FileHandler;

use FSi\DoctrineExtensions\Uploadable\Exception\RuntimeException;

class SplFileInfoHandler extends AbstractHandler
{
    /**
     * @var string
     */
    private $tempFilename;

    /**
     * @param string $tempFilename
     */
    public function __construct($tempFilename = 'temp')
    {
        $this->tempFilename = $tempFilename;
    }

    /**
     * {@inheritdoc}
     */
    public function getContent($file)
    {
        if (!$this->supports($file)) {
            throw $this->generateNotSupportedException($file);
        }

        $level = error_reporting(0);
        if ($file instanceof \SplFileObject) {
            $fileObject = $file;
            $filePosition = $this->tryTellFile($fileObject);
        } else {
            $fileObject = $this->tryOpenFile($file);
        }
        $this->trySeekFile($fileObject, 0, SEEK_END);
        $fileSize = $this->tryTellFile($fileObject);
        $this->trySeekFile($fileObject, 0);<commit_msg>Prevent warning in SplFileInfoHandler regarding nonexistant variable<commit_after><?php

/**
 * (c) FSi sp. z o.o. <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace FSi\DoctrineExtensions\Uploadable\FileHandler;

use FSi\DoctrineExtensions\Uploadable\Exception\RuntimeException;

class SplFileInfoHandler extends AbstractHandler
{
    /**
     * @var string
     */
    private $tempFilename;

    /**
     * @param string $tempFilename
     */
    public function __construct($tempFilename = 'temp')
    {
        $this->tempFilename = $tempFilename;
    }

    /**
     * {@inheritdoc}
     */
    public function getContent($file)
    {
        if (!$this->supports($file)) {
            throw $this->generateNotSupportedException($file);
        }

        $level = error_reporting(0);
        $filePosition = null;
        if ($file instanceof \SplFileObject) {
            $fileObject = $file;
            $filePosition = $this->tryTellFile($fileObject);
        } else {
            $fileObject = $this->tryOpenFile($file);
        }
        $this->trySeekFile($fileObject, 0, SEEK_END);
        $fileSize = $this->tryTellFile($fileObject);
        $this->trySeekFile($fileObject, 0);
{'fraction_non_alphanumeric': 0.1272437175907459, 'fraction_numerical': 0.0023932987634623054, 'mean_word_length': 2.5931232091690544, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3142097', 'n_tokens_mistral': 730, 'n_tokens_neox': 713, 'n_words': 157}