From a422ccc311116564d15f0a4fe99c3ef67c7f1267 Mon Sep 17 00:00:00 2001 From: Sullivan SENECHAL Date: Thu, 12 May 2016 05:07:51 -0400 Subject: [PATCH] Applied fixes from StyleCI --- .../BaseBreadcrumbMenuBlockService.php | 28 +++++----- .../Social/TwitterEmbedTweetBlockService.php | 20 +++---- DependencyInjection/SonataSeoExtension.php | 26 +++++----- Seo/SeoPage.php | 28 +++++----- .../DependencyInjection/ConfigurationTest.php | 52 +++++++++---------- 5 files changed, 77 insertions(+), 77 deletions(-) diff --git a/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php b/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php index 70137a13..752e4150 100644 --- a/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php +++ b/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php @@ -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 */ @@ -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. * diff --git a/Block/Social/TwitterEmbedTweetBlockService.php b/Block/Social/TwitterEmbedTweetBlockService.php index 58fa4ef9..19e9a5a8 100644 --- a/Block/Social/TwitterEmbedTweetBlockService.php +++ b/Block/Social/TwitterEmbedTweetBlockService.php @@ -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. * @@ -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', - )); - } } diff --git a/DependencyInjection/SonataSeoExtension.php b/DependencyInjection/SonataSeoExtension.php index c0102dbb..8864348a 100644 --- a/DependencyInjection/SonataSeoExtension.php +++ b/DependencyInjection/SonataSeoExtension.php @@ -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. * @@ -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', - )); - } } diff --git a/Seo/SeoPage.php b/Seo/SeoPage.php index 8739ca4f..4d9c7875 100644 --- a/Seo/SeoPage.php +++ b/Seo/SeoPage.php @@ -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} */ @@ -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; + } } diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index d0faeb39..44727b8e 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -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())); @@ -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); + } }