tapestry-cloud/tapestry

View on GitHub
src/Plates/Extensions/Environment.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace Tapestry\Plates\Extensions;

use League\Plates\Engine;
use Tapestry\Entities\Project;
use League\Plates\Extension\ExtensionInterface;

class Environment implements ExtensionInterface
{
    /**
     * @var string
     */
    private $environment = '';

    /**
     * Environment constructor.
     * @param Project $project
     */
    public function __construct(Project $project)
    {
        $this->environment = $project->environment;
    }

    public function register(Engine $engine)
    {
        $engine->registerFunction('getEnvironment', [$this, 'getEnvironment']);
    }

    public function getEnvironment()
    {
        return $this->environment;
    }
}