<?php

declare(strict_types=1);

namespace TYPO3\ClassAliasLoader\IncludeFile;

/*
 * This file is part of the class alias loader package.
 *
 * (c) Helmut Hummel <info@helhum.io>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

use Composer\Config;
use Composer\IO\IOInterface;

class PrependToken implements TokenInterface
{
    /**
     * @var string
     */
    private $name = 'prepend';

    /**
     * @var Config
     */
    private $config;

    /**
     * BaseDirToken constructor.
     *
     * @param IOInterface $io
     * @param Config $config
     */
    public function __construct(Config $config)
    {
        $this->config = $config;
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function getContent(string $includeFilePath): string
    {
        return $this->config->get('prepend-autoloader') === false ? 'false' : 'true';
    }
}
