Skip to content

Commit

Permalink
Merge pull request #4 from mrzepinski/master
Browse files Browse the repository at this point in the history
Fixed unused lines, basic oauth and HV links
  • Loading branch information
rukbat committed Apr 24, 2013
2 parents 7a56c15 + 1372503 commit fdce15f
Show file tree
Hide file tree
Showing 6 changed files with 827 additions and 456 deletions.
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

0 comments on commit fdce15f

Please sign in to comment.