for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
/**
* @package s9e\TextFormatter
* @copyright Copyright (c) 2010-2020 The s9e authors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace s9e\TextFormatter\Configurator\Traits;
use s9e\TextFormatter\Configurator\Helpers\ContextSafeness;
trait AttributeMapSafeness
{
* Assess the safeness of this attribute filter based on given list of strings
*
* @param string[] $strings
* @return void
protected function assessSafeness(array $strings): void
$str = implode('', $strings);
foreach (['AsURL', 'InCSS', 'InJS'] as $context)
$callback = ContextSafeness::class . '::getDisallowedCharacters' . $context;
foreach ($callback() as $char)
if (strpos($str, $char) !== false)
continue 2;
}
$methodName = 'markAsSafe' . $context;
$this->$methodName();