<commit_before><?php

namespace Layer\Data\Metadata\Query;

use Doctrine\Common\Annotations\Annotation;
use Doctrine\Common\Annotations\Reader;
use Doctrine\ORM\Mapping\ClassMetadata;
use Layer\Utility\InflectorInterface;

class GetPropertyLabelQuery extends PropertyAnnotationQuery {

	private $inflector;

	public function __construct(Reader $reader, InflectorInterface $inflector) {
		parent::__construct($reader);
		$this->inflector = $inflector;
	}

	public function getName() {
		return 'getPropertyLabel';
	}

	protected function getAnnotationClass() {
		return 'Layer\\Data\\Metadata\\Annotation\\PropertyLabel';
	}

	protected function getResultFromAnnotation(ClassMetadata $classMetadata, $annotation, array $options) {
		if(empty($annotation->value)) {
			return $this->getFallbackResult($classMetadata, $options);
		}
		return $annotation->value;
	}

	protected function getFallbackResult(ClassMetadata $classMetadata, array $options) {
		$reflProperty = $classMetadata->getReflectionClass()->getProperty($options['property']);
		return ucfirst($this->getInflector()->humanize($reflProperty->getName()));
	}

	protected function getInflector() {
		return $this->inflector;
	}

}<commit_msg>Need to underscore before humanizing<commit_after><?php

namespace Layer\Data\Metadata\Query;

use Doctrine\Common\Annotations\Annotation;
use Doctrine\Common\Annotations\Reader;
use Doctrine\ORM\Mapping\ClassMetadata;
use Layer\Utility\InflectorInterface;

class GetPropertyLabelQuery extends PropertyAnnotationQuery {

	private $inflector;

	public function __construct(Reader $reader, InflectorInterface $inflector) {
		parent::__construct($reader);
		$this->inflector = $inflector;
	}

	public function getName() {
		return 'getPropertyLabel';
	}

	protected function getAnnotationClass() {
		return 'Layer\\Data\\Metadata\\Annotation\\PropertyLabel';
	}

	protected function getResultFromAnnotation(ClassMetadata $classMetadata, $annotation, array $options) {
		if(empty($annotation->value)) {
			return $this->getFallbackResult($classMetadata, $options);
		}
		return $annotation->value;
	}

	protected function getFallbackResult(ClassMetadata $classMetadata, array $options) {
		$reflProperty = $classMetadata->getReflectionClass()->getProperty($options['property']);
		return ucfirst($this->getInflector()->humanize($this->getInflector()->underscore($reflProperty->getName())));
	}

	protected function getInflector() {
		return $this->inflector;
	}

}
{'fraction_non_alphanumeric': 0.12469536961819659, 'fraction_numerical': 0.0, 'mean_word_length': 6.532110091743119, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7385003', 'n_tokens_mistral': 718, 'n_tokens_neox': 698, 'n_words': 132}