Validação para o tipo de cnab 400

@param  $content
@return bool
761958
public static function isCnab400($content)
    {
        $content = is_array($content) ? $content[0] : $content;
        return mb_strlen(rtrim($content, "\r\n")) == 400 ? true : false;
    }
1156807
public function parseLang($content) {
        $this->_content = $content;
        $this->_parseDebugStart();
        $this->_parsePath();
        $this->_parseGravatar();
        $this->_parseUrl();
        $this->_parsePhp();
        $this->_parseLang();
        $this->_parseForeach();
        $this->_parseFor();
        $this->_parseVar();
        $this->_parseVarFunc();
        $this->_parseCondition();
        $this->_parseFunction();
        $this->_parseException();
        $this->_parseDebugEnd();

        return $this->_content;
    }
116526
public function match($contents){
		// Extract
		if(!preg_match($this->_compile(),$contents,$pieces)){
			return false;
		}
		// Init values
		$values=$this->default_values;
		// Loop over potential arguments
		foreach($pieces as $name=>$value){
			// Drop integer keys
			if(is_int($name)){
				continue;
			}
			// Verify value format
			if($value && isset($this->validators[$name])){
				if(!preg_match('#^'.$this->validators[$name].'$#S',$value)){
					return false;
				}
			}
			// Save value
			if($value){
				$values[$name]=$value;
			}
		}
		// Return
		return $values;
	}
1242458
private function parsePhp(&$content)
    {
        // 短标签的情况要将<?标签用echo方式输出 否则无法正常输出xml标识
        $content = preg_replace('/(<\?(?!php|=|$))/i', '<?php echo \'\\1\'; ?>' . "\n", $content);

        // PHP语法检查
        if ($this->config['tpl_deny_php'] && false !== strpos($content, '<?php')) {
            throw new Exception('not allow php tag', 11600);
        }

        return;
    }
148396
private function isSelectable(Content $content): bool
    {
        if (!$this->config->hasParameter('allowed_content_types')) {
            return true;
        }

        if ($this->allowedContentTypeIds === null) {
            $this->allowedContentTypeIds = [];

            $allowedContentTypes = $this->config->getParameter('allowed_content_types');
            if (is_string($allowedContentTypes) && $allowedContentTypes !== '') {
                $allowedContentTypes = array_map('trim', explode(',', $allowedContentTypes));
                $this->allowedContentTypeIds = $this->getContentTypeIds($allowedContentTypes);
            }
        }

        if (count($this->allowedContentTypeIds) === 0) {
            return true;
        }

        return in_array($content->contentInfo->contentTypeId, $this->allowedContentTypeIds, true);
    }
1145374
protected function _validate($value)
    {
        $value = trim($value);
        $pattern = '/^[a-f0-9]{32}$/';
        return (is_string($value) && preg_match($pattern, $value) == 1);
    }
123457
public function isValid($value)
    {
        $query = (new \Cms\Orm\CmsFileQuery)
            ->byObject($this->_getObjectName(), $this->getObjectId());
        if ($this->getClass()) {
            $query->andFieldClass()->equals($this->getClass());
        }
        if ($this->getActive() !== null) {
            $query->andFieldActive()->equals($this->getActive());
        }
        if (!$query->count()) {
            $this->_error(self::INVALID);
            return false;
        }
        return true;
    }
954953
public function setContent( $content )
	{
		if( $this->content === (string) $content )
			return FALSE;
		$this->content = (string) $content;
		return TRUE;
	}
896214
protected function isValidFormat()
    {
        //    Reading 2048 bytes should be enough to validate that the format is HTML
        $data = fread($this->fileHandle, 2048);
        if ((strpos($data, '<') !== false) &&
                (strlen($data) !== strlen(strip_tags($data)))) {
            return true;
        }

        return false;
    }
145395
private function isContentTypeExcluded(Content $content)
    {
        $contentType = $this->repository->sudo(function () use ($content) {
            $contentType = $this->contentTypeService->loadContentType($content->contentInfo->contentTypeId);

            return $contentType;
        });

        return !in_array($contentType->identifier, $this->options['included-content-types']);
    }
884029
public static function validate($cif)
    {
        $cifCodes = 'JABCDEFGHI';

        if (9 !== strlen($cif)) {
            return false;
        }
        $cif = strtoupper(trim($cif));
        $sum = (string) Nif::getCifSum($cif);

        $n = (10 - substr($sum, -1)) % 10;

        if (preg_match('/^[ABCDEFGHJKNPQRSUVW]{1}/', $cif)) {
            if (in_array($cif[0], array('A', 'B', 'E', 'H'))) {
                // Numerico
                return $cif[8] == $n;
            } elseif (in_array($cif[0], array('K', 'P', 'Q', 'S'))) {
                // Letras
                return $cif[8] == $cifCodes[$n];
            } else {
                // Alfanumérico
                if (is_numeric($cif[8])) {
                    return $cif[8] == $n;
                } else {
                    return $cif[8] == $cifCodes[$n];
                }
            }
        }

        return false;
    }
886534
public static function isCnab240($content)
    {
        $content = is_array($content) ? $content[0] : $content;
        return mb_strlen(rtrim($content, "\r\n")) == 240 ? true : false;
    }
278833
protected function assertIsValid(string $content): bool
    {
        json_decode($content);

        if (json_last_error() !== JSON_ERROR_NONE) {
            $error = json_last_error_msg();

            throw new ResponseContextException($error);
        }

        return true;
    }
239975
protected function sanitizeContent($content) {
    $regex = '/^\n' . preg_quote($this->blockStart, '/') . ".*?" . preg_quote($this->blockEnd, '/') . '\n/sm';
    return preg_replace($regex, '', $content);
  }
551431
public function parseContent($content)
    {
        $cto = $this->getContentTypeObject();
        if (!empty($cto)) {
            return $cto->parseContent($content);
        } else {
            return $content;
        }
    }
1277786
protected function correct($content)
    {
        $corrections = $this->corrections;
        if (!empty($corrections)) {
            foreach ($corrections as $pattern => $replacement) {
                $reg_count = 0;

                /**
                 * @var $content
                 * reassign $content to corrected $content as long as corrections
                 * rules array loop
                 */
                $content = preg_replace('/' .
                    $pattern .
                    '/us', $replacement, $content, -1, $reg_count);
            }
        }
        return $content;
    }
1211887
private function validate($content, $file)
    {
        if (null === $content) {
            return $content;
        }

        if (!is_array($content)) {
            throw new \InvalidArgumentException(sprintf('The service file "%s" is not valid.', $file));
        }

        foreach (array_keys($content) as $namespace) {
            if (in_array($namespace, ['imports', 'parameters'])) {
                continue;
            }
        }

        return $content;
    }