<commit_before><?php

/**
 * This file is part of the Lean Mapper library (http://www.leanmapper.com)
 *
 * Copyright (c) 2013 <NAME> (aka Tharos)
 *
 * For the full copyright and license information, please view the file
 * license-mit.txt that was distributed with this source code.
 */

namespace LeanMapper\Reflection;

use LeanMapper\Exception\InvalidAnnotationException;
use ReflectionClass;

/**
 * Enumeration of property possible values
 *
 * @author <NAME>
 */
class PropertyValuesEnum
{

	/** @var string[] */
	private $values = array();


	/**
	 * @param string $definition
	 * @param EntityReflection $reflection
	 * @throws InvalidAnnotationException
	 */
	public function __construct($definition, EntityReflection $reflection)
	{
		$matches = array();
		preg_match('#^((?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+|self|static|parent)::((?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+)\*$#', $definition, $matches);
		if (empty($matches)) {
			throw new InvalidAnnotationException('Invalid enumeration definition given: ' . $definition);
		}
		$class = $matches[1];
		$prefix = substr($matches[2], 0, -1);

		if ($class === 'self' or $class === 'static') {
			$constants = $reflection->getConstants();
		} elseif ($class === 'parent') {
			$constants = $reflection->getParentClass()->getConstants();
		} else {
			$aliases = $reflection->getAliases();
			$reflectionClass = new ReflectionClass($aliases->translate($class));
			$constants = $reflectionClass->getConstants();
		}
		foreach ($constants as $name => $value) {
			if (substr($name, 0, strlen($prefix)) === $prefix) {
				$this->values[$value] = true;
			}
		}
	}
<commit_msg>Fixed regular pattern<commit_after><?php

/**
 * This file is part of the Lean Mapper library (http://www.leanmapper.com)
 *
 * Copyright (c) 2013 <NAME> (aka Tharos)
 *
 * For the full copyright and license information, please view the file
 * license-mit.txt that was distributed with this source code.
 */

namespace LeanMapper\Reflection;

use LeanMapper\Exception\InvalidAnnotationException;
use ReflectionClass;

/**
 * Enumeration of property possible values
 *
 * @author <NAME>
 */
class PropertyValuesEnum
{

	/** @var string[] */
	private $values = array();


	/**
	 * @param string $definition
	 * @param EntityReflection $reflection
	 * @throws InvalidAnnotationException
	 */
	public function __construct($definition, EntityReflection $reflection)
	{
		$matches = array();
		preg_match('#^((?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+|self|static|parent)::([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]+)\*$#', $definition, $matches);
		if (empty($matches)) {
			throw new InvalidAnnotationException('Invalid enumeration definition given: ' . $definition);
		}
		$class = $matches[1];
		$prefix = substr($matches[2], 0, -1);

		if ($class === 'self' or $class === 'static') {
			$constants = $reflection->getConstants();
		} elseif ($class === 'parent') {
			$constants = $reflection->getParentClass()->getConstants();
		} else {
			$aliases = $reflection->getAliases();
			$reflectionClass = new ReflectionClass($aliases->translate($class));
			$constants = $reflectionClass->getConstants();
		}
		foreach ($constants as $name => $value) {
			if (substr($name, 0, strlen($prefix)) === $prefix) {
				$this->values[$value] = true;
			}
		}
	}

{'fraction_non_alphanumeric': 0.18094089264173704, 'fraction_numerical': 0.010253317249698432, 'mean_word_length': 4.240126382306477, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6976765', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1062, 'n_words': 246}