source/AbstractPhysicalQuantity.php
protected static function unitNameOrAliasesAlreadyRegistered(UnitOfMeasureInterface $unit)
    {
        // If this class hasn't been initialized yet, do so now
        if (!is_array(static::$unitDefinitions)) {
            static::$unitDefinitions = [];
            static::initialize();
        }

        $currentUnitNamesAndAliases = [];
        foreach (static::$unitDefinitions as $unitOfMeasure) {
            $currentUnitNamesAndAliases[] = $unitOfMeasure->getName();
            $currentUnitNamesAndAliases = array_merge($currentUnitNamesAndAliases, $unitOfMeasure->getAliases());
        }

        $newUnitNamesAndAliases = array_merge([$unit->getName()], $unit->getAliases());

        return count(array_intersect($currentUnitNamesAndAliases, $newUnitNamesAndAliases)) > 0;
    }
protected static function unitNameOrAliasesAlreadyRegistered(UnitOfMeasureInterface $unit)
    {
        // If this class hasn't been initialized yet, do so now
        if (!is_array(static::$unitDefinitions)) {
            static::$unitDefinitions = [];
            static::initialize();
        }

        $currentUnitNamesAndAliases = [];
        foreach (static::$unitDefinitions as $unitOfMeasure) {
            $currentUnitNamesAndAliases[] = $unitOfMeasure->getName();
            $currentUnitNamesAndAliases = array_merge($currentUnitNamesAndAliases, $unitOfMeasure->getAliases());
        }

        $newUnitNamesAndAliases = array_merge([$unit->getName()], $unit->getAliases());

        return count(array_intersect($currentUnitNamesAndAliases, $newUnitNamesAndAliases)) > 0;
    }
protected static function unitNameOrAliasesAlreadyRegistered ( UnitOfMeasureInterface $ unit ) { // If this class hasn't been initialized yet, do so now if ( ! is_array ( static :: $ unitDefinitions ) ) { static :: $ unitDefinitions = [ ] ; static :: initialize ( ) ; } $ currentUnitNamesAndAliases = [ ] ; foreach ( static :: $ unitDefinitions as $ unitOfMeasure ) { $ currentUnitNamesAndAliases [ ] = $ unitOfMeasure -> getName ( ) ; $ currentUnitNamesAndAliases = array_merge ( $ currentUnitNamesAndAliases , $ unitOfMeasure -> getAliases ( ) ) ; } $ newUnitNamesAndAliases = array_merge ( [ $ unit -> getName ( ) ] , $ unit -> getAliases ( ) ) ; return count ( array_intersect ( $ currentUnitNamesAndAliases , $ newUnitNamesAndAliases ) ) > 0 ; }
Given a unit of measure, determine if its name or any of its aliases conflict
with the set of already-known unit names and aliases.

@param UnitOfMeasureInterface $unit The unit in question

@return boolean true if there is a conflict, false if there is not
Given a unit of measure determine if its name or any of its aliases conflict with the set of already - known unit names and aliases .