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

Applied fixes from StyleCI #134

Merged
merged 1 commit into from
May 12, 2016
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
28 changes: 14 additions & 14 deletions Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ public function getName()
return sprintf('Breadcrumb %s', $this->context);
}

/**
* {@inheritdoc}
*/
public function configureSettings(OptionsResolver $resolver)
{
parent::configureSettings($resolver);

$resolver->setDefaults(array(
'menu_template' => 'SonataSeoBundle:Block:breadcrumb.html.twig',
'include_homepage_link' => true,
'context' => false,
));
}

/**
* @return FactoryInterface
*/
Expand All @@ -87,20 +101,6 @@ protected function getContext()
return $this->context;
}

/**
* {@inheritdoc}
*/
public function configureSettings(OptionsResolver $resolver)
{
parent::configureSettings($resolver);

$resolver->setDefaults(array(
'menu_template' => 'SonataSeoBundle:Block:breadcrumb.html.twig',
'include_homepage_link' => true,
'context' => false,
));
}

/**
* Initialize breadcrumb menu.
*
Expand Down
20 changes: 10 additions & 10 deletions Block/Social/TwitterEmbedTweetBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ public function buildEditForm(FormMapper $form, BlockInterface $block)
));
}

/**
* {@inheritdoc}
*/
public function getBlockMetadata($code = null)
{
return new Metadata($this->getName(), (!is_null($code) ? $code : $this->getName()), false, 'SonataSeoBundle', array(
'class' => 'fa fa-twitter',
));
}

/**
* Returns supported API parameters from settings.
*
Expand Down Expand Up @@ -194,14 +204,4 @@ protected function buildUri($uriMatched, array $settings)

return sprintf('%s?%s', self::TWITTER_OEMBED_URI, implode('&', $parameters));
}

/**
* {@inheritdoc}
*/
public function getBlockMetadata($code = null)
{
return new Metadata($this->getName(), (!is_null($code) ? $code : $this->getName()), false, 'SonataSeoBundle', array(
'class' => 'fa fa-twitter',
));
}
}
26 changes: 13 additions & 13 deletions DependencyInjection/SonataSeoExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ public function load(array $configs, ContainerBuilder $container)
->replaceArgument(1, $config['encoding']);
}

/**
* Add class to compile.
*/
public function configureClassesToCompile()
{
$this->addClassesToCompile(array(
'Sonata\\SeoBundle\\Seo\\SeoPage',
'Sonata\\SeoBundle\\Seo\\SeoPageInterface',
'Sonata\\SeoBundle\\Sitemap\\SourceManager',
'Sonata\\SeoBundle\\Twig\\Extension\\SeoExtension',
));
}

/**
* Configure the default seo page.
*
Expand Down Expand Up @@ -174,17 +187,4 @@ protected function fixConfiguration(array $config)

return $config;
}

/**
* Add class to compile.
*/
public function configureClassesToCompile()
{
$this->addClassesToCompile(array(
'Sonata\\SeoBundle\\Seo\\SeoPage',
'Sonata\\SeoBundle\\Seo\\SeoPageInterface',
'Sonata\\SeoBundle\\Sitemap\\SourceManager',
'Sonata\\SeoBundle\\Twig\\Extension\\SeoExtension',
));
}
}
28 changes: 14 additions & 14 deletions Seo/SeoPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,6 @@ public function setMetas(array $metadatas)
return $this;
}

/**
* @param mixed $meta
*
* @return array
*/
private function normalize($meta)
{
if (is_string($meta)) {
return array($meta, array());
}

return $meta;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -398,4 +384,18 @@ public function getOEmbedLinks()
{
return $this->oembedLinks;
}

/**
* @param mixed $meta
*
* @return array
*/
private function normalize($meta)
{
if (is_string($meta)) {
return array($meta, array());
}

return $meta;
}
}
52 changes: 26 additions & 26 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,6 @@

class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
private function getDefaultConfiguration()
{
return array(
'encoding' => 'UTF-8',
'page' => array(
'default' => 'sonata.seo.page.default',
'head' => array(),
'metas' => array(),
'separator' => ' - ',
'title' => 'Sonata Project',
),
'sitemap' => array(
'doctrine_orm' => array(),
'services' => array(),
),
);
}

private function processConfiguration(array $configs)
{
$configuration = new Configuration();
$processor = new Processor();

return $processor->processConfiguration($configuration, $configs);
}

public function testDefaultConfiguration()
{
$config = $this->processConfiguration(array(array()));
Expand Down Expand Up @@ -90,4 +64,30 @@ public function testWithYamlConfig()

$this->assertEquals('website', $config['page']['metas']['property']['og:type']);
}

private function getDefaultConfiguration()
{
return array(
'encoding' => 'UTF-8',
'page' => array(
'default' => 'sonata.seo.page.default',
'head' => array(),
'metas' => array(),
'separator' => ' - ',
'title' => 'Sonata Project',
),
'sitemap' => array(
'doctrine_orm' => array(),
'services' => array(),
),
);
}

private function processConfiguration(array $configs)
{
$configuration = new Configuration();
$processor = new Processor();

return $processor->processConfiguration($configuration, $configs);
}
}