@@ -61,7 +61,7 @@ discard block  | 
                                                    ||
| 61 | 61 | */  | 
                                                        
| 62 | 62 | private function setUp()  | 
                                                        
| 63 | 63 |      { | 
                                                        
| 64 | -        if (!$this->config->has('purifier')) { | 
                                                        |
| 64 | +        if ( ! $this->config->has('purifier')) { | 
                                                        |
| 65 | 65 |              throw new Exception('Configuration parameters not loaded!'); | 
                                                        
| 66 | 66 | }  | 
                                                        
| 67 | 67 | |
@@ -85,30 +85,30 @@ discard block  | 
                                                    ||
| 85 | 85 | */  | 
                                                        
| 86 | 86 | private function addCustomDefinition(array $definitionConfig, HTMLPurifier_Config $configObject = null)  | 
                                                        
| 87 | 87 |      { | 
                                                        
| 88 | -        if (!$configObject) { | 
                                                        |
| 88 | +        if ( ! $configObject) { | 
                                                        |
| 89 | 89 | $configObject = HTMLPurifier_Config::createDefault();  | 
                                                        
| 90 | 90 | $configObject->loadArray($this->getConfig());  | 
                                                        
| 91 | 91 | }  | 
                                                        
| 92 | 92 | |
| 93 | 93 | // Setup the custom definition  | 
                                                        
| 94 | -        $configObject->set('HTML.DefinitionID', $definitionConfig['id']); | 
                                                        |
| 95 | -        $configObject->set('HTML.DefinitionRev', $definitionConfig['rev']); | 
                                                        |
| 94 | +        $configObject->set('HTML.DefinitionID', $definitionConfig[ 'id' ]); | 
                                                        |
| 95 | +        $configObject->set('HTML.DefinitionRev', $definitionConfig[ 'rev' ]); | 
                                                        |
| 96 | 96 | |
| 97 | 97 | // Enable debug mode  | 
                                                        
| 98 | -        if (!isset($definitionConfig['debug']) || $definitionConfig['debug']) { | 
                                                        |
| 98 | +        if ( ! isset($definitionConfig[ 'debug' ]) || $definitionConfig[ 'debug' ]) { | 
                                                        |
| 99 | 99 |              $configObject->set('Cache.DefinitionImpl', null); | 
                                                        
| 100 | 100 | }  | 
                                                        
| 101 | 101 | |
| 102 | 102 | // Start configuring the definition  | 
                                                        
| 103 | 103 |          if ($def = $configObject->maybeGetRawHTMLDefinition()) { | 
                                                        
| 104 | 104 | // Create the definition attributes  | 
                                                        
| 105 | -            if (!empty($definitionConfig['attributes'])) { | 
                                                        |
| 106 | - $this->addCustomAttributes($definitionConfig['attributes'], $def);  | 
                                                        |
| 105 | +            if ( ! empty($definitionConfig[ 'attributes' ])) { | 
                                                        |
| 106 | + $this->addCustomAttributes($definitionConfig[ 'attributes' ], $def);  | 
                                                        |
| 107 | 107 | }  | 
                                                        
| 108 | 108 | |
| 109 | 109 | // Create the definition elements  | 
                                                        
| 110 | -            if (!empty($definitionConfig['elements'])) { | 
                                                        |
| 111 | - $this->addCustomElements($definitionConfig['elements'], $def);  | 
                                                        |
| 110 | +            if ( ! empty($definitionConfig[ 'elements' ])) { | 
                                                        |
| 111 | + $this->addCustomElements($definitionConfig[ 'elements' ], $def);  | 
                                                        |
| 112 | 112 | }  | 
                                                        
| 113 | 113 | }  | 
                                                        
| 114 | 114 | |
@@ -127,10 +127,10 @@ discard block  | 
                                                    ||
| 127 | 127 |      { | 
                                                        
| 128 | 128 |          foreach ($attributes as $attribute) { | 
                                                        
| 129 | 129 | // Get configuration of attribute  | 
                                                        
| 130 | - $required = !empty($attribute[3]) ? true : false;  | 
                                                        |
| 131 | - $onElement = $attribute[0];  | 
                                                        |
| 132 | - $attrName = $required ? $attribute[1] . '*' : $attribute[1];  | 
                                                        |
| 133 | - $validValues = $attribute[2];  | 
                                                        |
| 130 | + $required = ! empty($attribute[ 3 ]) ? true : false;  | 
                                                        |
| 131 | + $onElement = $attribute[ 0 ];  | 
                                                        |
| 132 | + $attrName = $required ? $attribute[ 1 ].'*' : $attribute[ 1 ];  | 
                                                        |
| 133 | + $validValues = $attribute[ 2 ];  | 
                                                        |
| 134 | 134 | |
| 135 | 135 |              if ($onElement === '*') { | 
                                                        
| 136 | 136 | $def = $validValues;  | 
                                                        
@@ -139,7 +139,7 @@ discard block  | 
                                                    ||
| 139 | 139 | }  | 
                                                        
| 140 | 140 | |
| 141 | 141 |                  if ($def instanceof \HTMLPurifier_AttrDef) { | 
                                                        
| 142 | - $definition->info_global_attr[$attrName] = $def;  | 
                                                        |
| 142 | + $definition->info_global_attr[ $attrName ] = $def;  | 
                                                        |
| 143 | 143 | }  | 
                                                        
| 144 | 144 | |
| 145 | 145 | continue;  | 
                                                        
@@ -167,13 +167,13 @@ discard block  | 
                                                    ||
| 167 | 167 |      { | 
                                                        
| 168 | 168 |          foreach ($elements as $element) { | 
                                                        
| 169 | 169 | // Get configuration of element  | 
                                                        
| 170 | - $name = $element[0];  | 
                                                        |
| 171 | - $contentSet = $element[1];  | 
                                                        |
| 172 | - $allowedChildren = $element[2];  | 
                                                        |
| 173 | - $attributeCollection = $element[3];  | 
                                                        |
| 174 | - $attributes = isset($element[4]) ? $element[4] : null;  | 
                                                        |
| 170 | + $name = $element[ 0 ];  | 
                                                        |
| 171 | + $contentSet = $element[ 1 ];  | 
                                                        |
| 172 | + $allowedChildren = $element[ 2 ];  | 
                                                        |
| 173 | + $attributeCollection = $element[ 3 ];  | 
                                                        |
| 174 | + $attributes = isset($element[ 4 ]) ? $element[ 4 ] : null;  | 
                                                        |
| 175 | 175 | |
| 176 | -            if (!empty($attributes)) { | 
                                                        |
| 176 | +            if ( ! empty($attributes)) { | 
                                                        |
| 177 | 177 | $definition->addElement($name, $contentSet, $allowedChildren, $attributeCollection, $attributes);  | 
                                                        
| 178 | 178 |              } else { | 
                                                        
| 179 | 179 | $definition->addElement($name, $contentSet, $allowedChildren, $attributeCollection);  | 
                                                        
@@ -209,24 +209,24 @@ discard block  | 
                                                    ||
| 209 | 209 | $configObject = HTMLPurifier_Config::createDefault();  | 
                                                        
| 210 | 210 | |
| 211 | 211 | // Allow configuration to be modified  | 
                                                        
| 212 | -        if (! $this->config->get('purifier.finalize')) { | 
                                                        |
| 212 | +        if ( ! $this->config->get('purifier.finalize')) { | 
                                                        |
| 213 | 213 | $configObject->autoFinalize = false;  | 
                                                        
| 214 | 214 | }  | 
                                                        
| 215 | 215 | |
| 216 | 216 | // Set default config  | 
                                                        
| 217 | - $defaultConfig = [];  | 
                                                        |
| 218 | -        $defaultConfig['Core.Encoding'] = $this->config->get('purifier.encoding'); | 
                                                        |
| 219 | -        $defaultConfig['Cache.SerializerPath'] = $this->config->get('purifier.cachePath'); | 
                                                        |
| 220 | -        $defaultConfig['Cache.SerializerPermissions'] = $this->config->get('purifier.cacheFileMode', 0755); | 
                                                        |
| 217 | + $defaultConfig = [ ];  | 
                                                        |
| 218 | +        $defaultConfig[ 'Core.Encoding' ] = $this->config->get('purifier.encoding'); | 
                                                        |
| 219 | +        $defaultConfig[ 'Cache.SerializerPath' ] = $this->config->get('purifier.cachePath'); | 
                                                        |
| 220 | +        $defaultConfig[ 'Cache.SerializerPermissions' ] = $this->config->get('purifier.cacheFileMode', 0755); | 
                                                        |
| 221 | 221 | |
| 222 | -        if (! $config) { | 
                                                        |
| 222 | +        if ( ! $config) { | 
                                                        |
| 223 | 223 |              $config = $this->config->get('purifier.settings.default'); | 
                                                        
| 224 | 224 |          } elseif (is_string($config)) { | 
                                                        
| 225 | -            $config = $this->config->get('purifier.settings.' . $config); | 
                                                        |
| 225 | +            $config = $this->config->get('purifier.settings.'.$config); | 
                                                        |
| 226 | 226 | }  | 
                                                        
| 227 | 227 | |
| 228 | -        if (! is_array($config)) { | 
                                                        |
| 229 | - $config = [];  | 
                                                        |
| 228 | +        if ( ! is_array($config)) { | 
                                                        |
| 229 | + $config = [ ];  | 
                                                        |
| 230 | 230 | }  | 
                                                        
| 231 | 231 | |
| 232 | 232 | // Merge configurations  | 
                                                        
@@ -266,7 +266,7 @@ discard block  | 
                                                    ||
| 266 | 266 | public function clean($dirty, $config = null, \Closure $postCreateConfigHook = null)  | 
                                                        
| 267 | 267 |      { | 
                                                        
| 268 | 268 |          if (is_array($dirty)) { | 
                                                        
| 269 | -            return array_map(function ($item) use ($config) { | 
                                                        |
| 269 | +            return array_map(function($item) use ($config) { | 
                                                        |
| 270 | 270 | return $this->clean($item, $config);  | 
                                                        
| 271 | 271 | }, $dirty);  | 
                                                        
| 272 | 272 | }  | 
                                                        
@@ -283,7 +283,7 @@ discard block  | 
                                                    ||
| 283 | 283 | //If $dirty is not an explicit string, bypass purification assuming configuration allows this  | 
                                                        
| 284 | 284 |          $ignoreNonStrings = $this->config->get('purifier.ignoreNonStrings', false); | 
                                                        
| 285 | 285 | $stringTest = is_string($dirty);  | 
                                                        
| 286 | -        if($stringTest === false && $ignoreNonStrings === true) { | 
                                                        |
| 286 | +        if ($stringTest === false && $ignoreNonStrings === true) { | 
                                                        |
| 287 | 287 | return $dirty;  | 
                                                        
| 288 | 288 | }  | 
                                                        
| 289 | 289 | |