Skip to content

Commit

Permalink
[Encapsulation] Move everything from protected to private (except for…
Browse files Browse the repository at this point in the history
… entry point)
  • Loading branch information
GeLoLabs committed Nov 8, 2014
1 parent b6c6b1d commit cc0a387
Show file tree
Hide file tree
Showing 21 changed files with 83 additions and 73 deletions.
7 changes: 7 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
inherit: true

filter:
excluded_paths:
- bin/*
- vendor/*
- Tests/*
14 changes: 7 additions & 7 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getConfigTreeBuilder()
*
* @return \Symfony\Component\Config\Definition\Builder\NodeDefinition The configs node.
*/
protected function createConfigsNode()
private function createConfigsNode()
{
return $this->createNode('configs')
->useAttributeAsKey('name')
Expand All @@ -66,7 +66,7 @@ protected function createConfigsNode()
*
* @return \Symfony\Component\Config\Definition\Builder\NodeDefinition The plugins node.
*/
protected function createPluginsNode()
private function createPluginsNode()
{
return $this->createNode('plugins')
->useAttributeAsKey('name')
Expand All @@ -83,7 +83,7 @@ protected function createPluginsNode()
*
* @return \Symfony\Component\Config\Definition\Builder\NodeDefinition The styles node.
*/
protected function createStylesNode()
private function createStylesNode()
{
return $this->createNode('styles')
->useAttributeAsKey('name')
Expand Down Expand Up @@ -114,7 +114,7 @@ protected function createStylesNode()
*
* @return \Symfony\Component\Config\Definition\Builder\NodeDefinition The templates node.
*/
protected function createTemplatesNode()
private function createTemplatesNode()
{
return $this->createNode('templates')
->useAttributeAsKey('name')
Expand All @@ -140,7 +140,7 @@ protected function createTemplatesNode()
*
* @return \Symfony\Component\Config\Definition\Builder\NodeDefinition The toolbars node.
*/
protected function createToolbarsNode()
private function createToolbarsNode()
{
return $this->createNode('toolbars')
->addDefaultsIfNotSet()
Expand All @@ -167,7 +167,7 @@ protected function createToolbarsNode()
*
* @return \Symfony\Component\Config\Definition\Builder\NodeDefinition The node.
*/
protected function createNode($name)
private function createNode($name)
{
return $this->createTreeBuilder()->root($name);
}
Expand All @@ -177,7 +177,7 @@ protected function createNode($name)
*
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder.
*/
protected function createTreeBuilder()
private function createTreeBuilder()
{
return new TreeBuilder();
}
Expand Down
30 changes: 15 additions & 15 deletions DependencyInjection/IvoryCKEditorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function loadInternal(array $config, ContainerBuilder $container)
*
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
*/
protected function registerResources(ContainerBuilder $container)
private function registerResources(ContainerBuilder $container)
{
$templatingEngines = $container->getParameter('templating.engines');

Expand Down Expand Up @@ -81,7 +81,7 @@ protected function registerResources(ContainerBuilder $container)
* @param array $config The CKEditor configuration
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
*/
protected function registerConfig(array $config, ContainerBuilder $container)
private function registerConfig(array $config, ContainerBuilder $container)
{
$formType = $container->getDefinition('ivory_ck_editor.form.type');

Expand Down Expand Up @@ -114,7 +114,7 @@ protected function registerConfig(array $config, ContainerBuilder $container)
*
* @throws \Ivory\CKEditorBundle\Exception\DependencyInjectionException If the default config does not exist.
*/
protected function registerConfigs(array $config, ContainerBuilder $container)
private function registerConfigs(array $config, ContainerBuilder $container)
{
if (empty($config['configs'])) {
return;
Expand Down Expand Up @@ -142,7 +142,7 @@ protected function registerConfigs(array $config, ContainerBuilder $container)
* @param array $config The CKEditor configuration.
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
*/
protected function registerPlugins(array $config, ContainerBuilder $container)
private function registerPlugins(array $config, ContainerBuilder $container)
{
if (empty($config['plugins'])) {
return;
Expand All @@ -161,7 +161,7 @@ protected function registerPlugins(array $config, ContainerBuilder $container)
* @param array $config The CKEditor configuration.
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
*/
protected function registerStylesSet(array $config, ContainerBuilder $container)
private function registerStylesSet(array $config, ContainerBuilder $container)
{
if (empty($config['styles'])) {
return;
Expand All @@ -180,7 +180,7 @@ protected function registerStylesSet(array $config, ContainerBuilder $container)
* @param array $config The CKEditor configuration.
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
*/
protected function registerTemplates(array $config, ContainerBuilder $container)
private function registerTemplates(array $config, ContainerBuilder $container)
{
if (empty($config['templates'])) {
return;
Expand All @@ -202,7 +202,7 @@ protected function registerTemplates(array $config, ContainerBuilder $container)
*
* @return array The CKEditor configuration with merged toolbars.
*/
protected function mergeToolbars(array $config)
private function mergeToolbars(array $config)
{
$resolvedToolbars = $this->resolveToolbars($config);
unset($config['toolbars']);
Expand All @@ -229,7 +229,7 @@ protected function mergeToolbars(array $config)
*
* @return array The resolved CKEditor toolbars.
*/
protected function resolveToolbars(array $config)
private function resolveToolbars(array $config)
{
$resolvedToolbars = array();

Expand All @@ -252,9 +252,9 @@ protected function resolveToolbars(array $config)
*
* @throws \Ivory\CKEditorBundle\Exception\DependencyInjectionException If the toolbar item does not exist.
*
* @return array The resolved CKEditor toolbar item.
* @return array|string The resolved CKEditor toolbar item.
*/
protected function resolveToolbarItem($item, array $items)
private function resolveToolbarItem($item, array $items)
{
if (is_string($item) && ($item[0] === '@')) {
$itemName = substr($item, 1);
Expand All @@ -276,7 +276,7 @@ protected function resolveToolbarItem($item, array $items)
*
* @return array The fixed CKEditor styles set.
*/
protected function fixStylesSet(array $stylesSet)
private function fixStylesSet(array $stylesSet)
{
foreach ($stylesSet as &$value) {
$value = array_filter($value);
Expand All @@ -290,7 +290,7 @@ protected function fixStylesSet(array $stylesSet)
*
* @return array The default CKEditor toolbars.
*/
protected function getDefaultToolbars()
private function getDefaultToolbars()
{
return array(
'full' => $this->getFullToolbar(),
Expand All @@ -304,7 +304,7 @@ protected function getDefaultToolbars()
*
* @return array The full CKEditor toolbar.
*/
protected function getFullToolbar()
private function getFullToolbar()
{
return array(
array('Source', '-', 'NewPage', 'Preview', 'Print', '-', 'Templates'),
Expand Down Expand Up @@ -334,7 +334,7 @@ protected function getFullToolbar()
*
* @return array The standard CKEditor toolbar.
*/
protected function getStandardToolbar()
private function getStandardToolbar()
{
return array(
array('Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'),
Expand All @@ -355,7 +355,7 @@ protected function getStandardToolbar()
*
* @return array The basic CKEditor toolbar.
*/
protected function getBasicToolbar()
private function getBasicToolbar()
{
return array(
array('Bold', 'Italic'),
Expand Down
20 changes: 10 additions & 10 deletions Form/Type/CKEditorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,31 @@
class CKEditorType extends AbstractType
{
/** @var boolean */
protected $enable = true;
private $enable = true;

/** @var boolean */
protected $autoload = true;
private $autoload = true;

/** @var boolean */
protected $inputSync = false;
private $inputSync = false;

/** @var string */
protected $basePath = 'bundles/ivoryckeditor/';
private $basePath = 'bundles/ivoryckeditor/';

/** @var string */
protected $jsPath = 'bundles/ivoryckeditor/ckeditor.js';
private $jsPath = 'bundles/ivoryckeditor/ckeditor.js';

/** @var \Ivory\CKEditorBundle\Model\ConfigManagerInterface */
protected $configManager;
private $configManager;

/** @var \Ivory\CKEditorBundle\Model\PluginManagerInterface */
protected $pluginManager;
private $pluginManager;

/** @var \Ivory\CKEditorBundle\Model\StylesSetManagerInterface */
protected $stylesSetManager;
private $stylesSetManager;

/** @var \Ivory\CKEditorBundle\Model\TemplateManager*/
protected $templateManager;
/** @var \Ivory\CKEditorBundle\Model\TemplateManagerInterface */
private $templateManager;

/**
* Creates a CKEditor type.
Expand Down
4 changes: 2 additions & 2 deletions Model/ConfigManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
class ConfigManager implements ConfigManagerInterface
{
/** @var string */
protected $defaultConfig;
private $defaultConfig;

/** @var array */
protected $configs = array();
private $configs = array();

/**
* Creates a CKEditor config manager.
Expand Down
2 changes: 1 addition & 1 deletion Model/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class PluginManager implements PluginManagerInterface
{
/** @var array */
protected $plugins = array();
private $plugins = array();

/**
* Creates a plugin manager.
Expand Down
2 changes: 1 addition & 1 deletion Model/StylesSetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class StylesSetManager implements StylesSetManagerInterface
{
/** @var array */
protected $stylesSets = array();
private $stylesSets = array();

/**
* Creates a styles set manager.
Expand Down
2 changes: 1 addition & 1 deletion Model/TemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class TemplateManager implements TemplateManagerInterface
{
/** @var array */
protected $templates = array();
private $templates = array();

/**
* Creates a plugin manager.
Expand Down
18 changes: 9 additions & 9 deletions Templating/CKEditorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
class CKEditorHelper extends Helper
{
/** @var \Ivory\JsonBuilder\JsonBuilder */
protected $jsonBuilder;
private $jsonBuilder;

/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
protected $container;
private $container;

/**
* Creates a CKEditor template helper.
Expand Down Expand Up @@ -206,7 +206,7 @@ protected function fixConfigLanguage(array $config)
*
* @return array The fixed config.
*/
protected function fixConfigContentsCss(array $config)
private function fixConfigContentsCss(array $config)
{
if (isset($config['contentsCss'])) {
$cssContents = (array) $config['contentsCss'];
Expand All @@ -227,7 +227,7 @@ protected function fixConfigContentsCss(array $config)
*
* @return array The fixed config.
*/
protected function fixConfigFilebrowsers(array $config)
private function fixConfigFilebrowsers(array $config)
{
$filebrowserKeys = array(
'Browse',
Expand Down Expand Up @@ -270,7 +270,7 @@ protected function fixConfigFilebrowsers(array $config)
*
* @param array $config The config.
*/
protected function fixConfigEscapedValues(array $config)
private function fixConfigEscapedValues(array $config)
{
if (isset($config['protectedSource'])) {
foreach ($config['protectedSource'] as $key => $value) {
Expand All @@ -297,7 +297,7 @@ protected function fixConfigEscapedValues(array $config)
*
* @return string The fixed config.
*/
protected function fixConfigConstants($json)
private function fixConfigConstants($json)
{
return preg_replace('/"(CKEDITOR\.[A-Z_]+)"/', '$1', $json);
}
Expand All @@ -309,7 +309,7 @@ protected function fixConfigConstants($json)
*
* @return string The fixed path.
*/
protected function fixPath($path)
private function fixPath($path)
{
if (($position = strpos($path, '?')) !== false) {
return substr($path, 0, $position);
Expand All @@ -323,7 +323,7 @@ protected function fixPath($path)
*
* @return \Symfony\Component\Templating\Helper\CoreAssetsHelper The assets helper.
*/
protected function getAssetsHelper()
private function getAssetsHelper()
{
return $this->container->get('templating.helper.assets');
}
Expand All @@ -333,7 +333,7 @@ protected function getAssetsHelper()
*
* @return \Symfony\Component\Routing\RouterInterface The router.
*/
protected function getRouter()
private function getRouter()
{
return $this->container->get('router');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
abstract class AbstractIvoryCKEditorExtensionTest extends \PHPUnit_Framework_TestCase
{
/** @var \Symfony\Component\DependencyInjection\ContainerBuilder */
protected $container;
private $container;

/** @var \Symfony\Component\Templating\Helper\CoreAssetsHelper|\PHPUnit_Framework_MockObject_MockObject */
protected $assetsHelperMock;
private $assetsHelperMock;

/** @var \Symfony\Component\Routing\RouterInterface|\PHPUnit_Framework_MockObject_MockObject */
protected $routerMock;
private $routerMock;

/**
* {@inheritdoc}
Expand Down

0 comments on commit cc0a387

Please sign in to comment.