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\Source;

/**
 * @author Beau Simensen <[email protected]>
 */
class CompositeDataSource implements DataSourceInterface
{
    /**
     * @var DataSourceInterface[]
     */
    private $dataSources = [];

    /**
     * @param DataSourceInterface[] $dataSources
     */
    public function __construct(array $dataSources = [])
    {
        foreach ($dataSources as $dataSource) {
            $this->dataSources[$dataSource->dataSourceId()] = $dataSource;
        }
    }

    public function addDataSource(DataSourceInterface $dataSource): void
    {
        $this->dataSources[$dataSource->dataSourceId()] = $dataSource;
    }

    /**
     * Get the data sources that this source is composed of.
     *
     * @return DataSourceInterface[]
     */
    public function dataSources(): array
    {
        return $this->dataSources;
    }

    /**
     * {@inheritdoc}
     */
    public function dataSourceId(): string
    {
        return 'CompositeDataSource('.implode(',', array_map(function (DataSourceInterface $dataSource) {
            return $dataSource->dataSourceId();
        }, $this->dataSources));
    }

    /**
     * {@inheritdoc}
     */
    public function refresh(SourceSet $sourceSet): void
    {
        foreach ($this->dataSources as $dataSource) {
            $dataSource->refresh($sourceSet);
        }
    }
}
 ?>

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\Source;

/**
 * @author Beau Simensen <[email protected]>
 */
class CompositeDataSource implements DataSourceInterface
{
    /**
     * @var DataSourceInterface[]
     */
    private $dataSources = [];

    /**
     * @param DataSourceInterface[] $dataSources
     */
    public function __construct(array $dataSources = [])
    {
        foreach ($dataSources as $dataSource) {
            $this->dataSources[$dataSource->dataSourceId()] = $dataSource;
        }
    }

    public function addDataSource(DataSourceInterface $dataSource): void
    {
        $this->dataSources[$dataSource->dataSourceId()] = $dataSource;
    }

    /**
     * Get the data sources that this source is composed of.
     *
     * @return DataSourceInterface[]
     */
    public function dataSources(): array
    {
        return $this->dataSources;
    }

    /**
     * {@inheritdoc}
     */
    public function dataSourceId(): string
    {
        return 'CompositeDataSource('.implode(',', array_map(function (DataSourceInterface $dataSource) {
            return $dataSource->dataSourceId();
        }, $this->dataSources));
    }

    /**
     * {@inheritdoc}
     */
    public function refresh(SourceSet $sourceSet): void
    {
        foreach ($this->dataSources as $dataSource) {
            $dataSource->refresh($sourceSet);
        }
    }
}

Function Calls

None

Variables

None

Stats

MD5 93bdd94b2fb0861edea2c1b771375dea
Eval Count 0
Decode Time 98 ms