Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare(strict_types=1); /* * This file is a part of Sculpin. * * (c) Dragonfly..

Decoded Output download

<?php

declare(strict_types=1);

/*
 * This file is a part of Sculpin.
 *
 * (c) Dragonfly Development Inc.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sculpin\Core\SiteConfiguration;

use Dflydev\DotAccessConfiguration\Configuration;
use Dflydev\DotAccessConfiguration\ConfigurationInterface;
use Dflydev\DotAccessConfiguration\YamlFileConfigurationBuilder;

/**
 * @author Beau Simensen <[email protected]>
 */
final class SiteConfigurationFactory
{
    /**
     * @var string
     */
    private $projectDir;

    /**
     * @var string
     */
    private $environment;

    public function __construct(string $projectDir, string $environment)
    {
        $this->projectDir = $projectDir;
        $this->environment = $environment;
    }

    /**
     * Get an instance of the Configuration() class from the given file.
     *
     * @param  string $configFile
     *
     * @return ConfigurationInterface
     */
    private function getConfigFile(string $configFile): ConfigurationInterface
    {
        $builder = new YamlFileConfigurationBuilder([$configFile]);

        return $builder->build();
    }

    /**
     * Create Site Configuration
     *
     * @return ConfigurationInterface
     */
    public function create(): ConfigurationInterface
    {
        $config = $this->detectConfig();
        $config->set('env', $this->environment);

        return $config;
    }
    /**
     * Detect configuration file and create Site Configuration from it
     *
     * @return Configuration
     */
    public function detectConfig(): ConfigurationInterface
    {
        if (file_exists($file = $this->projectDir.'/app/config/sculpin_site_'.$this->environment.'.yml')) {
            return $this->getConfigFile($file);
        }

        if (file_exists($file = $this->projectDir.'/app/config/sculpin_site.yml')) {
            return $this->getConfigFile($file);
        }

        return new Configuration();
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

/*
 * This file is a part of Sculpin.
 *
 * (c) Dragonfly Development Inc.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sculpin\Core\SiteConfiguration;

use Dflydev\DotAccessConfiguration\Configuration;
use Dflydev\DotAccessConfiguration\ConfigurationInterface;
use Dflydev\DotAccessConfiguration\YamlFileConfigurationBuilder;

/**
 * @author Beau Simensen <[email protected]>
 */
final class SiteConfigurationFactory
{
    /**
     * @var string
     */
    private $projectDir;

    /**
     * @var string
     */
    private $environment;

    public function __construct(string $projectDir, string $environment)
    {
        $this->projectDir = $projectDir;
        $this->environment = $environment;
    }

    /**
     * Get an instance of the Configuration() class from the given file.
     *
     * @param  string $configFile
     *
     * @return ConfigurationInterface
     */
    private function getConfigFile(string $configFile): ConfigurationInterface
    {
        $builder = new YamlFileConfigurationBuilder([$configFile]);

        return $builder->build();
    }

    /**
     * Create Site Configuration
     *
     * @return ConfigurationInterface
     */
    public function create(): ConfigurationInterface
    {
        $config = $this->detectConfig();
        $config->set('env', $this->environment);

        return $config;
    }
    /**
     * Detect configuration file and create Site Configuration from it
     *
     * @return Configuration
     */
    public function detectConfig(): ConfigurationInterface
    {
        if (file_exists($file = $this->projectDir.'/app/config/sculpin_site_'.$this->environment.'.yml')) {
            return $this->getConfigFile($file);
        }

        if (file_exists($file = $this->projectDir.'/app/config/sculpin_site.yml')) {
            return $this->getConfigFile($file);
        }

        return new Configuration();
    }
}

Function Calls

None

Variables

None

Stats

MD5 d0859b13a6ad82525d099f00c84e2827
Eval Count 0
Decode Time 111 ms