<commit_before><?php

/*
 * This file is part of Zippy.
 *
 * (c) Alchemy <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Alchemy\Zippy\Resource\Teleporter;

use Alchemy\Zippy\Resource\Resource;
use Alchemy\Zippy\Exception\IOException;
use Alchemy\Zippy\Exception\InvalidArgumentException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOException as SfIOException;

/**
 * This class transport an object using the local filesystem
 */
class LocalTeleporter extends AbstractTeleporter
{
    private $filesystem;

    public function __construct(Filesystem $filesystem)
    {
        $this->filesystem = $filesystem;
    }

    /**
     * {@inheritdoc}
     */
    public function teleport(Resource $resource, $context)
    {
        $target = $this->getTarget($context, $resource);

        try {
            if (is_file($resource->getOriginal())) {
                $this->filesytem->copy($resource->getOriginal(), $target);
            } elseif (is_dir($resource->getOriginal())) {
                $this->filesytem->mirror($resource->getOriginal(), $target, true);
            } else {
                throw new InvalidArgumentException('Resource must be a file or a directory');
            }
        } catch (SfIOException $e) {
            throw new IOException(sprintf('Could not write %s', $target), $e->getCode(), $e);<commit_msg>Fix typo<commit_after><?php

/*
 * This file is part of Zippy.
 *
 * (c) Alchemy <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Alchemy\Zippy\Resource\Teleporter;

use Alchemy\Zippy\Resource\Resource;
use Alchemy\Zippy\Exception\IOException;
use Alchemy\Zippy\Exception\InvalidArgumentException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOException as SfIOException;

/**
 * This class transport an object using the local filesystem
 */
class LocalTeleporter extends AbstractTeleporter
{
    private $filesystem;

    public function __construct(Filesystem $filesystem)
    {
        $this->filesystem = $filesystem;
    }

    /**
     * {@inheritdoc}
     */
    public function teleport(Resource $resource, $context)
    {
        $target = $this->getTarget($context, $resource);

        try {
            if (is_file($resource->getOriginal())) {
                $this->filesystem->copy($resource->getOriginal(), $target);
            } elseif (is_dir($resource->getOriginal())) {
                $this->filesystem->mirror($resource->getOriginal(), $target);
            } else {
                throw new InvalidArgumentException('Resource must be a file or a directory');
            }
        } catch (SfIOException $e) {
            throw new IOException(sprintf('Could not write %s', $target), $e->getCode(), $e);
{'fraction_non_alphanumeric': 0.12048599392507593, 'fraction_numerical': 0.0, 'mean_word_length': 3.043656207366985, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 29, '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': '5009238', 'n_tokens_mistral': 825, 'n_tokens_neox': 792, 'n_words': 211}