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

        // queryh whether or not we've a swatch attribute
        if ($type = $this->getSwatchTypeLoader()->loadSwatchType($this->getEntityTypeId(), $attributeCode)) {
            $this->createOptionSwatchIfNecessary($attributeCode, $storeId, $value, $type);
        } else {
            $this->createOptionValueIfNecessary($attributeCode, $storeId, $value);
        }
    }
public function createOptionValueOrSwatchIfNecessary($attributeCode, $storeId, $value)
    {

        // queryh whether or not we've a swatch attribute
        if ($type = $this->getSwatchTypeLoader()->loadSwatchType($this->getEntityTypeId(), $attributeCode)) {
            $this->createOptionSwatchIfNecessary($attributeCode, $storeId, $value, $type);
        } else {
            $this->createOptionValueIfNecessary($attributeCode, $storeId, $value);
        }
    }
Queries whether or not an option as well as its swatch/value for the attribute with the given code
already exists. If not the option and/or the swatch/value will be created dynamically.

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

@return void