@param string $attributePath

@throws \Sidus\EAVModelBundle\Exception\MissingFamilyException
@throws \Sidus\EAVModelBundle\Exception\MissingAttributeException

@return AttributeInterface
178537
protected function getAttribute($attributePath)
    {
        list($familyCode, $attributeCode) = explode('.', $attributePath);
        $family = $this->familyRegistry->getFamily($familyCode);

        return $family->getAttribute($attributeCode);
    }
863323
public function getRelativeAsset (string $relativePath) : ?self
    {
        $filePath = new FilePath();

        return new self(
            $this->getNamespace(),
            $filePath->resolvePath($this->getFilePath(), $relativePath)
        );
    }
967292
public function nodePathAvailableForNode($nodePath, NodeInterface $node)
    {
        /** @var NodeData $existingNodeData */
        $existingNodeDataObjects = $this->nodeDataRepository->findByPathWithoutReduce($nodePath, $node->getWorkspace(), true);
        foreach ($existingNodeDataObjects as $existingNodeData) {
            if ($existingNodeData->getMovedTo() !== null && $existingNodeData->getMovedTo() === $node->getNodeData()) {
                return true;
            }
        }
        return !$this->nodePathExistsInAnyContext($nodePath);
    }
157837
public function createValue(AttributeInterface $attribute, array $context = null)
    {
        $this->checkAttribute($attribute);

        return $this->getFamily()->createValue($this, $attribute, $context);
    }
1108658
private function getRelativePathForResourceIcon($absolutePath)
    {
        if (empty($absolutePath)) {
            return null;
        }
        $pathInfo = pathinfo($absolutePath);

        return $this->fs->makePathRelative($pathInfo['dirname'], $this->webDir).$pathInfo['basename'];
    }
655818
protected function addAttribute(AttributeInterface $attribute)
    {
        if (\in_array($attribute->getCode(), static::$reservedCodes, true)) {
            throw new AttributeConfigurationException("Attribute code '{$attribute->getCode()}' is a reserved code");
        }
        $this->attributes[$attribute->getCode()] = $attribute;
    }
596394
protected function getGroupIcon(AttributeInterface $attribute, array $groupPath, $level)
    {
        $fieldsetPath = $this->getFieldsetPath($groupPath, $level);
        $family = $attribute->getFamily();

        $transKeys = [
            "eav.family.{$family->getCode()}.group.{$fieldsetPath}.icon",
            "eav.group.{$fieldsetPath}.icon",
        ];

        return $this->tryTranslate($transKeys, []);
    }
227057
public function addAttachment($filePath) {
        if (!$file = fopen($filePath, 'r')) {
            throw new Exception('Cannot open file "' . $filePath . '"');
        }

        $this->attachments[$filePath] = chunk_split(base64_encode(fread($file, filesize($filePath))));
        return $this;
    }
1124880
private function getValue(AttributePath $path, array $attributes): string
    {
        $name = $path->getName();

        if (!array_key_exists($name, $attributes)) {
            throw InvalidAttribute::missing($name);
        }

        return (string)$attributes[$name];
    }
49871
protected function getValuesByAttribute(AttributeInterface $attribute)
    {
        if (null === $this->valuesByAttributes) {
            $this->valuesByAttributes = [];
        }

        if (!array_key_exists($attribute->getCode(), $this->valuesByAttributes)) {
            $this->valuesByAttributes[$attribute->getCode()] = [];
            foreach ($this->values as $value) {
                if ($value->getAttributeCode() === $attribute->getCode()) {
                    $this->addValueByAttribute($value);
                }
            }
        }

        return $this->valuesByAttributes[$attribute->getCode()];
    }
1119709
public static function createByFilePath($filepath) : Repository
    {
        $filename = basename($filepath);
        list($domain, $language, $extension) = explode('.', $filename, 3);

        $yamlParser = new YamlParser();
        $data = $yamlParser->parse(file_get_contents($filepath));

        $emptyArray = [];
        $translations = [];
        self::createPlainRepresentationByArray(
            $translations,
            $language,
            ($data) ?: [],
            $emptyArray,
            ''
        );

        $translationCollection = TranslationCollection::create($translations);

        return new self(
            $translationCollection,
            $filepath,
            $language,
            $domain
        );
    }
37681
public function getParentDirectory(): ?FilePathInterface
    {
        if ($this->myParentDirectory($aboveBaseLevel, $directoryParts)) {
            return new self($this->myIsAbsolute, $aboveBaseLevel, $this->myDrive, $directoryParts, null);
        }

        return null;
    }
585753
public function getDirectory(): FilePathInterface
    {
        return new self($this->myIsAbsolute, $this->myAboveBaseLevel, $this->myDrive, $this->myDirectoryParts, null);
    }
376778
public function enterAttribute(AttributePath $path): void
    {
        if ($this->done) {
            return;
        }

        $name = $path->getName();
        $value = $this->getValue($path, $this->attributes);
        $pattern = $path->getTypePattern();

        $this->validateValue($name, $value, $pattern);

        $this->uri .= $value;
    }
1357176
private function realPath($absolutePath): string
    {
        $finalParts = [];
        $currentIndex = -1;

        $absolutePath = $this->normalizeSlashes($absolutePath);
        foreach (explode('/', $absolutePath) as $pathPart) {
            if ('..' === $pathPart) {
                // we need to remove the previous entry
                if (-1 === $currentIndex) {
                    throw new \Exception(sprintf('Problem making path relative - is the path "%s" absolute?', $absolutePath));
                }

                unset($finalParts[$currentIndex]);
                --$currentIndex;

                continue;
            }

            $finalParts[] = $pathPart;
            ++$currentIndex;
        }

        $finalPath = implode('/', $finalParts);
        // Normalize: // => /
        // Normalize: /./ => /
        $finalPath = str_replace(['//', '/./'], '/', $finalPath);

        return $finalPath;
    }
1198204
private function initField(AttributeInterface $attribute)
    {
        $fieldName = $attribute->getAttributeCode();
        $fieldConfig = $this->attributeHelper->getMappingFieldOptions($attribute);

        if ($attribute->usesSource()) {
            $optionFieldName = $this->attributeHelper->getOptionTextFieldName($fieldName);
            $fieldType = FieldInterface::FIELD_TYPE_TEXT;
            $fieldOptions = ['name' => $optionFieldName, 'type' => $fieldType, 'fieldConfig' => $fieldConfig];
            $this->fields[$optionFieldName] = $this->fieldFactory->create($fieldOptions);

            // Reset parent field values : only the option text field should be used for spellcheck and autocomplete.
            $fieldConfig['is_used_in_spellcheck'] = false;
            $fieldConfig['is_searchable'] = false;
        }

        $fieldType    = $this->attributeHelper->getFieldType($attribute);
        $fieldOptions = ['name' => $fieldName, 'type' => $fieldType, 'fieldConfig' => $fieldConfig];

        $this->fields[$fieldName] = $this->fieldFactory->create($fieldOptions);

        return $this;
    }
183596
public function addAttributeValue(AttributeValueInterface $attributeValue)
    {
        if (!$this->attributeValues->contains($attributeValue)) {
            $attributeValue->setSubject($this);
            $this->attributeValues->add($attributeValue);
        }

        return $this;
    }