2013-10-04 06:17:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Knp\Bundle\GaufretteBundle\DependencyInjection\Factory;
|
|
|
|
|
|
|
|
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
|
|
|
|
use Symfony\Component\DependencyInjection\Reference;
|
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
|
|
use Symfony\Component\DependencyInjection\DefinitionDecorator;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dropbox Adapter Factory
|
|
|
|
*/
|
|
|
|
class DropboxAdapterFactory implements AdapterFactoryInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
function create(ContainerBuilder $container, $id, array $config)
|
|
|
|
{
|
|
|
|
$container
|
|
|
|
->setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.dropbox'))
|
|
|
|
->addArgument(new Reference($config['api_id']))
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
function getKey()
|
|
|
|
{
|
|
|
|
return 'dropbox';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
function addConfiguration(NodeDefinition $builder)
|
|
|
|
{
|
|
|
|
$builder
|
|
|
|
->children()
|
2013-10-06 06:25:51 +00:00
|
|
|
->scalarNode('api_id')->cannotBeEmpty()->end()
|
2013-10-04 06:17:52 +00:00
|
|
|
->end()
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|