src/Callbacks/OptionValueAndSwatchHandler.php
public function createOptionValueIfNecessary($attributeCode, $storeId, $value)
    {

        // try to load the attribute option value and add the option ID
        if ($this->loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId = $this->getEntityTypeId(), $attributeCode, $storeId, $value)) {
            return;
        }

        // initialize the option ID
        $optionId = $this->createOptionByValueIfNecessary($entityTypeId, $attributeCode, $storeId, $value);

        // create the value for the option
        $this->persistAttributeOptionValue($this->prepareAttributeOptionValue($optionId, $storeId, $value));

        // log a message that the value has successfully been created
        $this->getSystemLogger()->info(sprintf('Successfully created option value for attribute with code "%s", store ID "%d" and value "%s"', $attributeCode, $storeId, $value));
    }
public function createOptionValueIfNecessary($attributeCode, $storeId, $value)
    {

        // try to load the attribute option value and add the option ID
        if ($this->loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId = $this->getEntityTypeId(), $attributeCode, $storeId, $value)) {
            return;
        }

        // initialize the option ID
        $optionId = $this->createOptionByValueIfNecessary($entityTypeId, $attributeCode, $storeId, $value);

        // create the value for the option
        $this->persistAttributeOptionValue($this->prepareAttributeOptionValue($optionId, $storeId, $value));

        // log a message that the value has successfully been created
        $this->getSystemLogger()->info(sprintf('Successfully created option value for attribute with code "%s", store ID "%d" and value "%s"', $attributeCode, $storeId, $value));
    }
Queries whether or not an option as well as its value for the attribute with the given code
already exists. If not the option and/or the value will be created dynamically.

@param string  $attributeCode The attribute code to create the option as well as the value for
@param integer $storeId       The store ID
@param mixed   $value         The store specific option swatch/value

@return void