for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AlgoWeb\xsdTypes\Facets;
trait WhiteSpaceTrait
{
/**
* @Exclude
* @var string specifies how whitespace (line feeds, tabs, spaces, and carriage returns) is handled
*/
private $whiteSpace = 'preserve';
* Changes the input value in accordance with the defined white space handler.
* @param string $val
* @return string
string|null
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
protected function fixWhitespace($val)
switch ($this->whiteSpace) {
case 'preserve':
return $val;
case 'replace':
$val = str_replace("\r\n", "\n", $val);
$val
return preg_replace('/\s/', ' ', $val);
case 'collapse':
return trim(preg_replace('/\s+/', ' ', $val));
}
* @param string $value
protected function setWhiteSpaceFacet($value)
if (!in_array($value, ['preserve', 'replace', 'collapse'])) {
throw new \InvalidArgumentException('Invalid whitespace handling method ' . get_class($this));
$this->whiteSpace = $value;
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.