Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unused lines, basic oauth and HV links #4

Merged
merged 3 commits into from
Apr 24, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/nbproject/*
41 changes: 15 additions & 26 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,29 @@
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
class Configuration implements ConfigurationInterface {

/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
public function getConfigTreeBuilder() {
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('rukbat_bitly');

// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
$rootNode->children()
->scalarNode('key')
// ->isRequired()
// ->cannotBeEmpty()
->end()
->scalarNode('login')
// ->isRequired()
// ->cannotBeEmpty()
->end()
->scalarNode('clientid')
->end()
->scalarNode('secret')
->end()
->end();
->scalarNode('key')
->end()
->scalarNode('login')
->end()
->scalarNode('password')
->end()
->scalarNode('clientid')
->end()
->scalarNode('secret')
->end()
->end();

return $treeBuilder;
}
}

}
19 changes: 6 additions & 13 deletions DependencyInjection/RukbatBitlyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,23 @@
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class RukbatBitlyExtension extends Extension
{
class RukbatBitlyExtension extends Extension {

/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
public function load(array $configs, ContainerBuilder $container) {
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);

$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');

foreach (array('key','login','clientid','secret') as $attribute) {
foreach (array('key', 'login', 'password', 'clientid', 'secret') as $attribute) {
if (isset($config[$attribute])) {
$container->setParameter('rukbat_bitly.' . $attribute, $config[$attribute]);
$container->setParameter('rukbat_bitly.'.$attribute, $config[$attribute]);
}
}

}
}

}
3 changes: 2 additions & 1 deletion Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<parameters>
<parameter key="rukbat_bitly.key">null</parameter>
<parameter key="rukbat_bitly.login">null</parameter>
<parameter key="rukbat_bitly.password">null</parameter>
<parameter key="rukbat_bitly.clientid">null</parameter>
<parameter key="rukbat_bitly.secret">null</parameter>
<parameter key="rukbat_bitly.rukbatbitly.service.class">Rukbat\BitlyBundle\Services\RukbatBitly</parameter>
Expand All @@ -16,10 +17,10 @@
<service id="RukbatBitly" class="%rukbat_bitly.rukbatbitly.service.class%">
<argument>%rukbat_bitly.key%</argument>
<argument>%rukbat_bitly.login%</argument>
<argument>%rukbat_bitly.password%</argument>
<argument>%rukbat_bitly.clientid%</argument>
<argument>%rukbat_bitly.secret%</argument>
</service>
</services>

</container>

1 change: 1 addition & 0 deletions Resources/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function registerBundles()
rukbat_bitly:
key: yourKey # Required
login: yourLogin # Required
password: null
clientid: null
secret: null
```
Expand Down
Loading