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\Bundle\ContentTypesBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * @author Beau Simensen <[email protected]>
 */
class Configuration implements ConfigurationInterface
{
    /**
    * {@inheritdoc}
    */
    public function getConfigTreeBuilder(): TreeBuilder
    {
        $treeBuilder = new TreeBuilder('sculpin_content_types');

        $rootNode = $treeBuilder->getRootNode();

        $contentTypeNode = $rootNode
            ->useAttributeAsKey('name')
            ->prototype('array')
        ;

        $contentTypeNode
            ->children()
                ->scalarNode('type')->defaultValue('path')->end()
                ->scalarNode('singular_name')->end()
                ->booleanNode('enabled')->defaultTrue()->end()
                ->arrayNode('path')
                    ->beforeNormalization()
                        // Default case is we want the user to specify just one
                        // path but we can allow for multiple if they want to.
                        ->ifString()
                        ->then(function ($v) {
                            return [$v];
                        })
                    ->end()
                    ->prototype('scalar')->end()
                ->end()
                ->scalarNode('meta_key')->end()
                ->scalarNode('meta')->end()
                ->booleanNode('publish_drafts')->defaultNull()->end()
                ->scalarNode('permalink')->end()
                ->scalarNode('layout')->end()
                ->arrayNode('taxonomies')
                    ->beforeNormalization()
                        // Default case is we want the user to specify just one
                        // taxonomy but we can allow for multiple if they want to.
                        ->ifString()
                        ->then(function ($v) {
                            return [['name' => $v]];
                        })
                    ->end()
                    ->prototype('array')
                        ->beforeNormalization()
                            ->ifString()
                            ->then(function ($v) {
                                return ['name' => $v];
                            })
                        ->end()
                        ->children()
                            ->scalarNode('name')->end()
                            ->arrayNode('strategies')
                                ->prototype('scalar')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;

        return $treeBuilder;
    }
}
 ?>

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\Bundle\ContentTypesBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * @author Beau Simensen <[email protected]>
 */
class Configuration implements ConfigurationInterface
{
    /**
    * {@inheritdoc}
    */
    public function getConfigTreeBuilder(): TreeBuilder
    {
        $treeBuilder = new TreeBuilder('sculpin_content_types');

        $rootNode = $treeBuilder->getRootNode();

        $contentTypeNode = $rootNode
            ->useAttributeAsKey('name')
            ->prototype('array')
        ;

        $contentTypeNode
            ->children()
                ->scalarNode('type')->defaultValue('path')->end()
                ->scalarNode('singular_name')->end()
                ->booleanNode('enabled')->defaultTrue()->end()
                ->arrayNode('path')
                    ->beforeNormalization()
                        // Default case is we want the user to specify just one
                        // path but we can allow for multiple if they want to.
                        ->ifString()
                        ->then(function ($v) {
                            return [$v];
                        })
                    ->end()
                    ->prototype('scalar')->end()
                ->end()
                ->scalarNode('meta_key')->end()
                ->scalarNode('meta')->end()
                ->booleanNode('publish_drafts')->defaultNull()->end()
                ->scalarNode('permalink')->end()
                ->scalarNode('layout')->end()
                ->arrayNode('taxonomies')
                    ->beforeNormalization()
                        // Default case is we want the user to specify just one
                        // taxonomy but we can allow for multiple if they want to.
                        ->ifString()
                        ->then(function ($v) {
                            return [['name' => $v]];
                        })
                    ->end()
                    ->prototype('array')
                        ->beforeNormalization()
                            ->ifString()
                            ->then(function ($v) {
                                return ['name' => $v];
                            })
                        ->end()
                        ->children()
                            ->scalarNode('name')->end()
                            ->arrayNode('strategies')
                                ->prototype('scalar')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;

        return $treeBuilder;
    }
}

Function Calls

None

Variables

None

Stats

MD5 8c14c44e2b789d748cc236364837d1f9
Eval Count 0
Decode Time 104 ms